Activating paging corrupts stack
Re: Activating paging corrupts stack
show a register dump right before it fails, and right after it fails. Something to note though is, since I do not know how you coded the paging routine, does it fail immediatley after cr0 is loaded, or does it fail at the ret instruction? If it does not fail after cr0 is loaded, then paging should be working right and its probably a stack issue. show a register dump, gdt, and segment and control registers
-
- Member
- Posts: 76
- Joined: Sun Dec 14, 2008 1:53 pm
Re: Activating paging corrupts stack
Code: Select all
Control registers before failure:
CR0: 0x60000011
CR1: Reserved
CR2: can't retrieve
CR3: 0x0
CR4: 0x0
GDT before failure:
Index: 0, Selector: 0x0000, Base address: 0x0, Size: 0x0, DPL: 0x0
Index: 1, Selector: 0x0008, Base address: 0x0, Size: 0xFFFFFFFF, DPL: 0
Index: 2, Selector: 0x0010, Base address: 0x0, Size: 0xFFFFFFFF, DPL: 0
Index: 3, Selector: 0x0018, Base address: 0x0, Size: 0xFFFFFFFF, DPL: 3
Index: 4, Selector: 0x0020, Base address: 0x0, Size: 0xFFFFFFFF, DPL: 3
Index: 5, Selector: 0x0028, Base address: 0x10B020, Size: 0x2F, DPL: 0
Segment registers before failure:
CS: 0x0008
DS: 0x0010
ES: 0x0010
SS: 0x0010
FS: 0x0010
GS: 0x0010
Control registers after failure:
CR0: 0xE0000011
CR1: Reserved
CR2: can't retrieve
CR3: 0x110000
CR4: 0x0
GDT after failure:
Same as before failure
Segment registers after failure
Same as before failure
- Attachments
-
- Link.ld
- Linker script
- (581 Bytes) Downloaded 21 times
-
- Paging.cpp
- Paging code
- (7.28 KiB) Downloaded 28 times
Re: Activating paging corrupts stack
what about a dump of the regular registers before and after the failure? what is esp before you enter that routine, and what is it right before the ret instruction?
-
- Member
- Posts: 76
- Joined: Sun Dec 14, 2008 1:53 pm
Re: Activating paging corrupts stack
Code: Select all
Registers before failure:
EAX: 0xE0000011
EBX: 0x0
ECX: 0x11244C
EDX: 0x0
ESI: 0x2CEEE
EDI: 0x2CEEF
EBP: 0x10AFC0
ESP: 0x10AFA8
EIP: 0x00104DAD
EFlags: 0x6
Registers after failure:
EAX: 0x0
EBX: 0x2CD80
ECX: 0x11244C
EDX: 0x0
ESI: 0x2CEEE
EDI: 0x2CEEF
EBP: 0x10AFF0
ESP: 0x10AFB0
EIP: 0xC
EFlags: 0x10046
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Activating paging corrupts stack
tried "info tab" anywhere? Where is your code jumping and what bit of physical memory should be there and what bit is actually there ?
-
- Member
- Posts: 76
- Joined: Sun Dec 14, 2008 1:53 pm
Re: Activating paging corrupts stack
Sorry for the late reply, I've had quite a lot of non-OSDev related stuff to do. Anyway; my debugging has gone a little awry. My error actually occurs immediately after the leave, but before the ret of the InitialisePaging method, before I return to Main. My page tables stay the same throughout (identity mapping from 0x0 to 0x00113FFF)
Another thing I've noticed is that if I set the stack size to 0x10000 bytes, the opcode exception becomes a page fault exception in Bochs and VPC. The amount of memory allocated becomes 0x7000, and the faulting address becomes 0xA0000011
Another thing I've noticed is that if I set the stack size to 0x10000 bytes, the opcode exception becomes a page fault exception in Bochs and VPC. The amount of memory allocated becomes 0x7000, and the faulting address becomes 0xA0000011