History log of /haiku/src/system/kernel/arch/arm/paging/32bit/ARMVMTranslationMap32Bit.cpp
Revision Date Author Comments
# b799d160 15-Jun-2023 David Karoly <karolyd577@gmail.com>

kernel/arm/paging: implement Modified Flag

* Introduce SWDBM flag similarly to the arm64 port
* Reuse TEX[2] for SWDBM flag which should be availble
to be used by the operating system if TEX remap
is enabled.
* Introduce SetAndClearPageTableEntryFlags for updating
accessed and modified flags atomically
* Startup sequence is handled similarly to accessed flag, i.e.
set Modified flag in initially mapped pages in bootloader and early map.
* Once the kernel initialization has progressed enough,
pages are mapped as read-only and modified flag handling is done
in the page fault handler.

Change-Id: I8f761e2c6325d1b91481abd569d5e8befded0761
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6518
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# d38dcdde 17-May-2023 David Karoly <karolyd577@gmail.com>

kernel/arm/paging: implement Accessed flag querying

Change-Id: I519235124bbc93d41eec4be3e773576758a575a7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6445
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# cce0386a 10-May-2023 David Karoly <karolyd577@gmail.com>

kernel/arm/paging: implement Accessed Flag handling

Change-Id: Ida5f8faa538df9244e44ef30a73b61b2ffb693af
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6444
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 772df0f6 12-Mar-2023 David Karoly <karolyd577@gmail.com>

kernel/arm/paging: assume nothing is dirty

This is a workaround to allow early bootup to progress further.

Eventually accessed and modified page flags will need to be implemented
but for now this patch allows to proceed with bringup attempts
for the ARM port.

Change-Id: Icad415a5d484213a76a90ca79bb76463140a8bdf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6197
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>


# 3d79cd33 01-Sep-2022 David Karoly <karolyd577@gmail.com>

kernel/arm: set PXN for user memory

* set PXN for all page tables below KERNEL_BASE
* also set PXN for physical page mapper

PXN, Privileged execute-never

When the PXN bit is 1, a Permission fault is generated if the processor
is executing at PL1 and attempts to execute an instruction fetched from
the corresponding memory region.

Change-Id: I3056cbed151004ac9edfbc81ebeada328aeb603c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5607
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# fe3405c0 01-Jul-2022 David Karoly <karolyd577@gmail.com>

kernel/arm: ensure page dir is correctly aligned

Page directory physical address must be aligned on 16K and
it must be mapped to a contiguous physical region.

Change-Id: I6723023c9deaa1c4a1081cf5a984a1766241a532
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5423
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 745a40d7 23-Apr-2022 David Karoly <karolyd577@gmail.com>

kernel/arm: implement memory attributes

Set AP[2:0] and XN flags based on page attributes.
PXN is not implemented as it seems to be available only
in L1 descriptors on ARMv7.

Set TEX, B, C flags based on memoryType:
* B_MTR_UC is mapped to Strongly Ordered (TEX=0, B=0, C=0)
* B_MTR_WC is mapped to Shareable Device Memory (TEX=0, B=1, C=0)
* B_MTR_WT is mapped to Outer and Inner Write-Through, no Write-Allocate (TEX=0, B=0, C=1)
* B_MTR_WB is mapped to Outer and Inner Write-Back, no Write-Allocate (TEx=0, B=1, C=1)
* B_MTR_WP has no direct equivalent on the ARM so it's mapped as B_MTR_WB
* default is Write-Back

Implement ARMPagingMethod32Bit::AttributesToPageTableEntryFlags()
for mapping from page attributes to AP[2:0] and XN flags.

Implement ARMPagingMethod32Bit::PageTableEntryFlagsToAttributes()
for the reverse mapping used in Query() and QueryInterrupt()
i.e. recover page attributes from AP[2:0] and XN flags.

Implement ARMPagingMethod32Bit::MemoryTypeToPageTableEntryFlags()
fr mapping from memoryType to TEX, B, C flags.

Implement ARMVMTranslationMap32Bit::Protect() which used to be commented out.

Accessed and modified flags are not implemented yet, so no such
flags are returned from Query() and QueryInterrupt().

Also because of this, we just invalidate TLB on any call to Protect()
without checking whether the page has been accessed.

Change-Id: I027af5c02bd6218d9f92a58044aeb26373e1956b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5236
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 2ab17547 28-Oct-2021 David Karoly <karolyd577@gmail.com>

kernel/arch/arm/paging: set size and alignment for page directory

Change-Id: Ie3aa80c134c8b519005f7e52c51c7696f26bd49d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4672
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# c8e72ef9 28-Oct-2021 David Karoly <karolyd577@gmail.com>

kernel/arch/arm/paging: ARMVMTranslationMap32Bit::QueryInterrupt shall return page start address

Change-Id: I8949518c563b367b8b84f3728ae1e923e49044ba
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4666
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 286a9c99 23-Oct-2021 David Karoly <karolyd577@gmail.com>

kernel/arch/arm/paging: ARMVMTranslationMap32Bit::Query shall return page start address

Change-Id: Ibe95f8808bc052c31765f055bef1daf0aa1eac6d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4652
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 057fe191 01-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Break thread-related AutoLockers into a separate header.

Including thread.h brings a massive array of things with it from
the kernel thread arch headers, team and thread definitions,
hash tables, linked lists, Referenceable, etc. that the vast majority
of AutoLock.h consumers neither want nor need.

So, put these in a separate header, and adjust all consumers of these
lockers to include the new file.

This change exposes the fact that a lot of files were inadvertently
making use of headers included indirectly through thread.h. Those
will be fixed in the next commit.


# 1819aa71 07-Sep-2014 Ithamar R. Adema <ithamar@upgrade-android.com>

ARM: sync up VM code with x86

No big functional reason for this, but rather keep it in sync now
then have to do lots of work later on, when there are major changes.
Once I have it fully fleshed out for ARM, I might take a look if
we can generalise it a little more, as there's lots of code
_exactly_ the same for both platforms (and other platforms in
progress using the same code).


# f0422c6f 03-Dec-2012 Michael Lotz <mmlr@mlotz.ch>

Only set the physical address if the entry is mapped.

Otherwise, even when the address was 0, we would possibly set the
physical address to != 0 as we always applied the page offset.


# 926d1024 03-Dec-2012 Michael Lotz <mmlr@mlotz.ch>

Fix wrong address mask (page directory vs. page table).


# fed8bb7d 30-Nov-2012 Michael Lotz <mmlr@mlotz.ch>

Fix index range for ARM MMU coarse page tables.

As there are only 8 bits for the index in the coarse page table entries
the maximum index is 256. This makes us correctly move to the next page
directory once we've run through all entries. Fixes missing unmap of
pages that crossed that boundary and consequent panic "page still has
mappings" when the page was removed from a cache.


# f86b5828 06-Nov-2012 Ithamar R. Adema <ithamar@upgrade-android.com>

ARM: Cleanup of port support code.

This also implements the fault handler correctly now, and cleans up the
exception handling. Seems a lot more stable now, no unexpected panics or
faults happening anymore.


# d09e7b5b 04-Nov-2012 Ithamar R. Adema <ithamar@upgrade-android.com>

ARM: mark pages found in query as present


# 5707f251 13-Mar-2011 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* Quiet down VM debug output, so we can easily find errors ;)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40927 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3091264b 31-Oct-2010 François Revol <revol@free.fr>

s/Copyirght/Copyright/ unless it's a neologism from Ithamar :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39235 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c917cd62 30-Oct-2010 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* ARM: Major VM work
- This is mostly a copy of the x86 32bit paging method and infrastructure, this was copied for two reasons:
1) It is the most complete VM arch
2) The first ARM PAE patches have landed on alkml, so we will have to deal with it in the future as well,
and this infrastructure has proven to be ready ;)
- No protection features, or dirty/accessed tracking yet
- Lots of #if 0

but....

It boots all the way up to init_modules() now, and then dies because of a lack of (ARM) ELF relocation implementation!

Since at this point the VM can be fully initialised, I'm going to focus on CPU exceptions next, so we can get KDL to trigger
when it happens, and I can actually debug from there ;)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39206 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1819aa71eeea86d951569eaa05bbe9eedfbf222e 07-Sep-2014 Ithamar R. Adema <ithamar@upgrade-android.com>

ARM: sync up VM code with x86

No big functional reason for this, but rather keep it in sync now
then have to do lots of work later on, when there are major changes.
Once I have it fully fleshed out for ARM, I might take a look if
we can generalise it a little more, as there's lots of code
_exactly_ the same for both platforms (and other platforms in
progress using the same code).


# f0422c6f9f78f51b4400d63b6d0e5d1453b38583 03-Dec-2012 Michael Lotz <mmlr@mlotz.ch>

Only set the physical address if the entry is mapped.

Otherwise, even when the address was 0, we would possibly set the
physical address to != 0 as we always applied the page offset.


# 926d1024d0c75ee88107646f1c0ed819ff9fd6a9 03-Dec-2012 Michael Lotz <mmlr@mlotz.ch>

Fix wrong address mask (page directory vs. page table).


# fed8bb7dff054cc37c266f9ce78244cdc04c28fc 30-Nov-2012 Michael Lotz <mmlr@mlotz.ch>

Fix index range for ARM MMU coarse page tables.

As there are only 8 bits for the index in the coarse page table entries
the maximum index is 256. This makes us correctly move to the next page
directory once we've run through all entries. Fixes missing unmap of
pages that crossed that boundary and consequent panic "page still has
mappings" when the page was removed from a cache.


# f86b5828486b661145eb15952ec14648c9bb8d9b 06-Nov-2012 Ithamar R. Adema <ithamar@upgrade-android.com>

ARM: Cleanup of port support code.

This also implements the fault handler correctly now, and cleans up the
exception handling. Seems a lot more stable now, no unexpected panics or
faults happening anymore.


# d09e7b5b90b86793a6f44d90e5ccc86c1bcbfffe 04-Nov-2012 Ithamar R. Adema <ithamar@upgrade-android.com>

ARM: mark pages found in query as present


# 5707f2519cc1b258b0baca9625f9763f43cf5de8 13-Mar-2011 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* Quiet down VM debug output, so we can easily find errors ;)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40927 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d80c86e19e2610e7444a4fcefe3e0f8e6 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3091264bb53e84341c9ac5a246d44363d8292353 31-Oct-2010 François Revol <revol@free.fr>

s/Copyirght/Copyright/ unless it's a neologism from Ithamar :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39235 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c917cd62618c2bfd683dba8bf34f96fb7bd37203 30-Oct-2010 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* ARM: Major VM work
- This is mostly a copy of the x86 32bit paging method and infrastructure, this was copied for two reasons:
1) It is the most complete VM arch
2) The first ARM PAE patches have landed on alkml, so we will have to deal with it in the future as well,
and this infrastructure has proven to be ready ;)
- No protection features, or dirty/accessed tracking yet
- Lots of #if 0

but....

It boots all the way up to init_modules() now, and then dies because of a lack of (ARM) ELF relocation implementation!

Since at this point the VM can be fully initialised, I'm going to focus on CPU exceptions next, so we can get KDL to trigger
when it happens, and I can actually debug from there ;)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39206 a95241bf-73f2-0310-859d-f6bbb57e9c96