Commit Graph

136 Commits

Author SHA1 Message Date
Anhad Singh d82ba37de8 feat(mapper/remap_with_full): conditional remap
This commit modifies the transform function (`f`) argument of
`remap_with_full` to return an `Option`. This allows the caller to skip
remaps based on the previous frame and page flags. It can alternatively
be done by first translating the address and then remapping based on
that but that would mean we have to walk the page tables twice :|

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-19 19:50:00 +11:00
Anhad Singh f299c885e6 feat(lib): implement Debug for PhysicalAddress
Make it consistent with the debug output for `VirtualAddress`

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-19 19:32:10 +11:00
Jeremy Soller d33fc3b5b0 Merge branch 'mmu_flags' into 'master'
Set RISCV MMU marker flags by default

See merge request redox-os/rmm!18
2025-12-09 06:28:44 -07:00
aarch 5b149b7fe4 Set RISCV MMU marker flags by default 2025-12-09 06:28:44 -07:00
Jeremy Soller 409a1c02f5 Derive Hash for PhysicalAddress 2025-11-12 07:36:54 -07:00
Jeremy Soller 7e14945bc5 Merge branch 'stable' into 'master'
Remove all nighly feature gates

See merge request redox-os/rmm!17
2025-10-26 09:18:30 -06:00
bjorn3 075d52f153 Fix example binary 2025-10-26 11:58:43 +01:00
bjorn3 e6d42dda19 Fix compilation of EmulateArch 2025-10-26 11:55:42 +01:00
bjorn3 5b5bbe5643 Remove VirtualAddress::is_canonical
This way the last remaining feature gate can be removed. It also matches
how other architectures handle this functionality.
2025-10-25 20:02:55 +02:00
bjorn3 e371f47f51 Remove let_chain feature gate
It is now stable.
2025-10-25 20:01:32 +02:00
Jeremy Soller 5f983a02fe Merge branch 'edition_2024' into 'master'
Update to the 2024 edition

See merge request redox-os/rmm!16
2025-09-10 08:40:36 -06:00
bjorn3 08c00a434d Update to the 2024 edition
On newer rustc versions let_chain is only allowed with the 2024 edition.
2025-09-10 15:37:19 +02:00
Jeremy Soller 63669069f4 Merge branch 'bump_fix' into 'master'
Fix a bump allocator error

See merge request redox-os/rmm!15
2024-10-22 21:26:17 +00:00
Andrey Turkin 91ccf4e6aa Fix a bump allocator error 2024-10-22 22:14:39 +03:00
Jeremy Soller edb3a87578 Merge branch 'riscv' into 'master'
Fixes and changes to make RISC-V paging work

See merge request redox-os/rmm!14
2024-09-24 12:51:39 +00:00
Andrey Turkin ed8bcfca1f Add write combining page flags where applicable 2024-09-24 08:26:02 +03:00
Andrey Turkin 192dd8283f RISC-V: implement TLB flush 2024-09-24 08:26:01 +03:00
Andrey Turkin f51cd00f00 Remove read/write flags from common PDE flags.
RISC-V convention marks PDE with no read/write/execute, so we can't have none of this flags set there. Remove their setting from PDE handling code and instead set them as appropriate in arch-specific defaults.

Also enable both readonly and readwrite flags to be non-zero (as long as their intersection completely masks both of them), as required for RISC-V PTE handling.
2024-09-24 08:24:18 +03:00
Andrey Turkin a96ea6f5f3 Allow physical address bits be anywhere in PTE entry
Before this commit, RMM assumed base physical address was presented in PTE as is, i.e. physical page address was shifted exactly to PAGE_SHIFT, so physical address can be extracted from PTE by simply masking off some bits and can be placed in PTE by simple addition/OR.

This is not the case for RISC-V which has 4Kb base page so 12 bits PAGE_SHIFT, yet physical page address is only shifted 10 bits in PTE.

This commit removes this assumption.

 NOTE: This commit changes meaning of constants:
 * ENTRY_ADDRESS_SIZE from "total physical size in bytes" to "total physical size in PAGES"
 * ENTRY_ADDRESS_MASK from "mask of physical bits in PTE" to "mask of physical bits starting at bit 0"
2024-09-23 08:47:27 +03:00
Andrey Turkin b7d3acf606 Separate leaf page and directory pages USER flag
This is required for RISC-V. Privileged spec says:

> For non-leaf PTEs, the D, A, and U bits are reserved for future standard use.
> Until their use is defined by a standard extension, they must be cleared by software
> for forward compatibility.

QEMU fails address translation if it sees any of these flags set on non-leaf page entry.
2024-09-23 08:47:23 +03:00
Jeremy Soller bb27f57228 Merge branch 'fix_bump' into 'master'
Fix bump allocator initialization

See merge request redox-os/rmm!13
2024-09-22 13:20:33 +00:00
4lDO2 d95ea6598f Fix bump allocator. 2024-09-22 10:27:06 +02:00
4lDO2 5f9a587968 Convert repr(packed) to repr(C, packed). 2024-09-08 20:48:05 +02:00
Jeremy Soller ea4cfb2cbf Merge branch 'fix' into 'master'
Revived tests

See merge request redox-os/rmm!12
2024-09-02 21:16:38 +00:00
Andrey Turkin 7c0995ee24 Revived tests
Also fixed debug build failure on i686, and reformatted the code
2024-07-12 21:10:37 +03:00
4lDO2 99fcfc5fae Skip insufficiently large bump alloc regions. 2024-04-11 22:02:44 +02:00
4lDO2 5e75df56c5 More BumpAllocator APIs. 2023-12-18 11:16:15 +01:00
4lDO2 ed455915ca Allow arbitrary bump allocation size. 2023-12-18 11:16:11 +01:00
Jeremy Soller d7d824552b Merge branch 'derive_hash_virtual_address' into 'master'
Derive Hash for VirtualAddress

See merge request redox-os/rmm!11
2023-12-13 00:10:02 +00:00
bjorn3 aad492f805 Derive Hash for VirtualAddress 2023-12-12 22:21:22 +01:00
Jeremy Soller a992ae89ed Merge branch 'mmu' into 'master'
Demand paging related improvements

See merge request redox-os/rmm!10
2023-08-01 13:51:37 +00:00
4lDO2 86aba2dbe5 Better VirtualAddress Debug impl. 2023-07-28 13:39:32 +02:00
4lDO2 b5937b7b91 Set aarch64 "not global" flag by default. 2023-07-28 13:38:39 +02:00
4lDO2 8e22e69c94 Add remap_with{,_full}. 2023-07-17 13:31:51 +02:00
4lDO2 0aa7fea250 Fix remap bug: require present before remapping. 2023-07-17 13:31:46 +02:00
Jeremy Soller eaab222011 Merge branch 'fix_is_global' into 'master'
Fix is_global.

See merge request redox-os/rmm!9
2023-07-16 16:36:55 +00:00
4lDO2 339984e49b Fix is_global. 2023-07-16 18:32:34 +02:00
Jeremy Soller e24e8485ba Merge branch 'aarch64-stuff' into 'master'
Add GLOBAL flag and prettify some stuff

See merge request redox-os/rmm!8
2023-06-12 12:12:09 +00:00
uuuvn d89e6008e8 Add GLOBAL flag and prettify some stuff 2023-06-12 10:23:40 +00:00
Jeremy Soller 7aeb9f0ac8 Remove rust-toolchain 2023-02-11 14:50:26 -07:00
Jeremy Soller 81b03cc693 Improve aarch64 tlb flushing 2022-08-28 09:19:07 -06:00
Jeremy Soller 27bb8e44dd Do not allow phys_to_virt overflow 2022-08-26 11:07:21 -06:00
Jeremy Soller 61ba2e6c8e Fix unmap_parents 2022-08-22 18:49:32 -06:00
Jeremy Soller 0d4ff5d4f3 Add functions for accessing mapper allocator 2022-08-21 13:20:44 -06:00
Jeremy Soller df733ed571 Use TableKind for most table operations 2022-08-20 13:00:48 -06:00
Jeremy Soller c5eb435d79 Match PHYS_OFFSET accross archs 2022-08-19 20:53:15 -06:00
Jeremy Soller e05868e1dc Improve aarch64 paging instructions 2022-08-19 19:52:00 -06:00
Jeremy Soller e9950ee6da Fix more warnings 2022-07-29 18:53:12 -06:00
Jeremy Soller 23d4995e50 Fix warnings 2022-07-29 18:37:37 -06:00
4lDO2 5700899e9a Merge branch 'migrate_kernel_to_rmm' into 'master'
Add necessary functionality for migrating kernel paging code to RMM

See merge request redox-os/rmm!6
2022-07-27 15:10:52 +00:00