I want to switch on the A20 gate and have the following code:
Code: Select all
uint32t enableA20Gate() {
struct x86Regs_t regs= { 0x2401, 0, 0, 0, 0, 0, 0, 0 };
uint32t flags, tmp;
uint16t *test1= (uint16t *)0x500, *test2= (uint16t *)0x100500;
*test1= 0;
*test2= 1;
if(*test1 != *test2)
return 1;
flags= callBIOS(0x15,®s);
if(flags & FLAG_CF) {
tmp= inb(0x92);
tmp|= 2;
outb(0x92,tmp);
}
*test2= 1;
if(*test1 != *test2)
return 1;
waitKbd();
outb(0x64,0xad);
waitKbd();
outb(0x64,0xd0);
waitKbdData();
tmp= inb(0x60);
waitKbd();
outb(0x64,0xd1);
waitKbd();
outb(0x60,tmp | 2);
waitKbd();
outb(0x64,0xae);
waitKbd();
*test2= 1;
if(*test1 != *test2)
return 1;
return 0;
}