Page MenuHomeFreeBSD

RISC-V: Add definition for pmap_get_tables()
ClosedPublic

Authored by mhorne063_gmail.com on Nov 24 2018, 12:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 30, 1:18 PM
Unknown Object (File)
Thu, Mar 28, 11:25 AM
Unknown Object (File)
Mar 13 2024, 5:56 AM
Unknown Object (File)
Feb 8 2024, 2:43 PM
Unknown Object (File)
Dec 26 2023, 9:35 PM
Unknown Object (File)
Dec 14 2023, 8:14 AM
Unknown Object (File)
Dec 12 2023, 11:44 PM
Unknown Object (File)
Nov 18 2023, 6:13 AM
Subscribers

Details

Summary

pmap_get_tables() can be used to obtain the l1 through l3 page table entries for a given virtual address and mapping.
It is required for minidump support.

The function is already declared in riscv/include/pmap.h.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/riscv/riscv/pmap.c
3431 ↗(On Diff #51032)

Can't you assume that the L1 table is initialized?

3448 ↗(On Diff #51032)

We should check for a superpage at level 1 too.

mhorne063_gmail.com added inline comments.
sys/riscv/riscv/pmap.c
3431 ↗(On Diff #51032)

Certainly we can for kernel_pmap. I can't speak confidently about other mappings but I doubt this function ever be used on those.

I could turn it into an assert or just remove it. Any preference?

3448 ↗(On Diff #51032)

I didn't find any references to L1 superpages, but seeing as they aren't disallowed I agree it's a good check to have.

Side question: any idea why we use PTE_RX? The spec says PTE_RWX should all be zero for page tables but most of the checks omit the W bit. Is this intentional?

sys/riscv/riscv/pmap.c
3431 ↗(On Diff #51032)

pmap_pinit() allocates the L1 page as part of pmap initialization.

I think it might as well be removed. In general I find it a bit weird to assert that a pointer is non-NULL immediately before dereferencing it.

3448 ↗(On Diff #51032)

They are permitted in SV39; see section 4.4.1 in the privileged architecture reference.

I believe it's done that way because the spec currently disallows setting W without R (while it does allow X without R), so checking just R and X is sufficient. @br could confirm.

This looks ok to me. I'll go through the minidump review before committing it, though.

sys/riscv/riscv/pmap.c
3431 ↗(On Diff #51093)

Style: comments should end with a period.

This revision is now accepted and ready to land.Nov 26 2018, 1:48 PM
This revision now requires review to proceed.Nov 26 2018, 4:09 PM
sys/riscv/riscv/pmap.c
3457 ↗(On Diff #51123)

Hmm, re-reading this, why do we not check for PTE_V in the L3 entry?

markj added inline comments.
sys/riscv/riscv/pmap.c
3457 ↗(On Diff #51123)

Never mind, I should have read the minidump code before asking.

This revision is now accepted and ready to land.Feb 28 2019, 6:34 PM
This revision was automatically updated to reflect the committed changes.