page enable problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Combuster
Member
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: page enable problem

Post by Combuster »

writing CR0 is not the bug

The manifestation is caused by writing PE, having broken tables, executing a page full of zeroes, which are equivalent to 00 00 = add [eax], al (also in bochs log, just read it :wink:), which causes a pagefault on the same eax you used to write CR0. Which makes the exact bug way too easy to spot.

@OP: Get bochs debugger, and tell it to info tab after the mov cr0, eax instruction. Then compare that with what you had intended it to be.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Brutus
Posts: 8
Joined: Fri May 29, 2009 1:04 am

Re: page enable problem

Post by Brutus »

Combuster wrote:writing CR0 is not the bug

The manifestation is caused by writing PE, having broken tables, executing a page full of zeroes, which are equivalent to 00 00 = add [eax], al (also in bochs log, just read it :wink:), which causes a pagefault on the same eax you used to write CR0. Which makes the exact bug way too easy to spot.

@OP: Get bochs debugger, and tell it to info tab after the mov cr0, eax instruction. Then compare that with what you had intended it to be.
And how can I fix this execution of page full of zeros? :/
User avatar
Combuster
Member
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: page enable problem

Post by Combuster »

*fetches crystal ball*

I see... fog... very thick fog...</sarcasm>



Ask smart questions, will you.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Brutus
Posts: 8
Joined: Fri May 29, 2009 1:04 am

Re: page enable problem

Post by Brutus »

Combuster wrote:*fetches crystal ball*

I see... fog... very thick fog...</sarcasm>



Ask smart questions, will you.
* gets his 8-ball, asks "will I be able to ask smart question", receives the answers "Not in this life, mate" *

;) OK, smart questions are not my strong point, but let's try. Which part of my PE writing creates broken tables? :)
User avatar
Combuster
Member
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: page enable problem

Post by Combuster »

hmm

I suggest you look at
pageableMemoryStart = MEMORY_MAP + 0x100000; // high bogosity levels.

and the rest of the thread you hijacked.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Brutus
Posts: 8
Joined: Fri May 29, 2009 1:04 am

Re: page enable problem

Post by Brutus »

Combuster wrote:hmm

I suggest you look at
pageableMemoryStart = MEMORY_MAP + 0x100000; // high bogosity levels.

and the rest of the thread you hijacked.
Don't know what is wrong with this line, but I've re-aligned it to 4096 (it was already aligned, but just to be on a safe side) and changed MEMORY_MAP with KERNEL_END, which I get from linker, and still no result :/... Maybe I don't get the reason of this high bogosity level.

EDIT: The address, that is held in pageableMemoryStart is 0x100000 (GRUB thing) + 32MB KERNEL + 4MB of my PMM structure.
Post Reply