x86_64 icon indicating copy to clipboard operation
x86_64 copied to clipboard

`PageTableEntry::frame` misleadingly returns 4KiB frames for >4KiB frames

Open ChocolateLoverRaj opened this issue 7 months ago • 7 comments

Before #529 , it used to return an error (FrameError::HugeFrame). Now it just returns a PhysFrame<Size4KiB>. This is misleading because while the address mapping for those 4KiB is valid, the entry does not really point to a 4KiB frame if it's huge. It should be a 2MiB or 1GiB frame.

I ran into this when my code here stopped working after I switched from 0.15.2 to f01a291ecb0c1c8e8a5f5d58c29fbd9588a1486c.

I understand that because PhysFrame is generic and the frame size is only phantom data, and because PageTableEntry does not know what level it is, the frame method can't know what the actual frame size is. But imo this function's behavior needs to change.

ChocolateLoverRaj avatar Mar 15 '25 05:03 ChocolateLoverRaj