Page 1 of 1
idt and paging
Posted: Tue Jul 29, 2003 11:44 am
by northfuse2005
hi
i just enabled paging, but my idt doesn't work now. with bochs, it returns the following message: (when i try to invoke the divide by zero error)
i can't figure it out. my idt was working fine before i enabled paging. any help would be appreciated. thanks
Re:idt and paging
Posted: Tue Jul 29, 2003 12:04 pm
by Tim
The first thing I would check would be the limit on the code segment.
Re:idt and paging
Posted: Tue Jul 29, 2003 12:31 pm
by Pype.Clicker
maybe you could try to locate the message in BOCHS sources and then run bochs in a debugger , setting a breakpoint where the error is reported and inspect the virtual CPU's state (like IDT descriptor content, RIP value, CS limit, etc).
Re:idt and paging
Posted: Tue Jul 29, 2003 1:12 pm
by Tim
Or just read bochsout.txt, and look at the EIP register and the CS segment descriptor.
Re:idt and paging
Posted: Thu Jul 31, 2003 1:01 pm
by northfuse2005
hey- thanks for the help.
another question- i've setup the page directories and tables, but how do i map physical addresses to virtual addresses, and how do i know it works when i do?
Re:idt and paging
Posted: Thu Jul 31, 2003 3:51 pm
by Tim
Re:idt and paging
Posted: Fri Aug 01, 2003 11:20 am
by northfuse2005
virtual memory makes since, but i can't get it to work. i enable pagin, map a physical address to a virtual address, but the only way to access the data at the address is through the virtual address. it doesn't make sense.
Re:idt and paging
Posted: Fri Aug 01, 2003 11:44 am
by bkilgore
sure it does...that's the way paging works. Once you enable paging, the memory unit interprets every address you try to access as a virtual address. So if you try to access memory at it's physical address, the memory unit will try to interpret that physical address as a virtual address, which won't work well at all, or at least won't do what you are expecting it to do.
The only ways to access that memory at its physical address is to a) disable paging, or b) identity-map that address, or tell the memory unit that the virtual address maps to the same physical address.
In other words, if the physical address of the memory is 0x20000, you have to map that virtual address to the same physical address. Then you wil be able to address that memory using either 0x20000, or the other virtual address you assigned it when allocating.
But there's no real point to doing this as you only need to reference it through it's virtual address, and if you add two references to the same physical address, you're just wasting virtual address space.
Re:idt and paging
Posted: Sat Aug 02, 2003 3:16 am
by Pype.Clicker
northfuse2005 wrote:
virtual memory makes since, but i can't get it to work. i enable pagin, map a physical address to a virtual address, but the only way to access the data at the address is through the virtual address. it doesn't make sense.
of course, you must make sure to have the page directory itself mapped somewhere or you'll be unable to change the memory mapping once paging will be enabled.
Re:idt and paging
Posted: Mon Aug 04, 2003 7:54 pm
by northfuse2005
sorry- i messed up when typing my post. i mean't to say that even after enabling paging, the only way to access the memory is through the physical address, even if that page table (and directory) aren't mapped to the physical address.