Page 1 of 1

Return to real mode

Posted: Fri Aug 10, 2007 8:11 am
by lukem95
Could any body give me a hand moving from PMODE to real mode?

I want to create a function to execute BIOS interupts but can't find anything simple enough for me to understand (i have tried many sources and articles but cant find anything that has it in detail)

Thankyou, Luke

EDIT: Well since writing this i've found some more information and from what i can tell i have to disable interupts, disable A20 and then put 0 in the PM bit.

To do this i tried:

__asm__ __volatile__ ("cli");
outportb(0x60,0xdf);

__asm__ __volatile__ ("mov %%eax, %%cr0\n"
"dec %%al" /* Decrease the Pmode bit */
"mov %%cr0, %%eax\n"
"db 0eah");

I know the inline ASM fails but thats not a problem, as i can just put it into my start.asm

Posted: Sat Aug 11, 2007 10:01 am
by lode
If you use paging you should also deactivate it before disabling protected mode.

Also the contents of the bios data areas and real mode interrupt vectors should be preserved during your adventures in pmode. The easiest way to do this is not to touch the first megabyte of physical memory at all.