Setting the Scan Code set
Posted: Sun Dec 03, 2017 10:16 am
I'm using the following code to try and set the Scan Code set ( 2 ).
However,when I try to boot my OS in QEMU or VirtualBox they both reset.
Bochs doesn't.
What am I doing wrong here?
Here is my init function:
Code: Select all
outb(0x60,0xF0);
outb(0x64,0x02);
Bochs doesn't.
What am I doing wrong here?
Here is my init function:
Code: Select all
void ps2_keyboard_install()
{
while(inb(PS2_KB_CMD) & 0x1)
inb(PS2_KB_DATA);
// Test the PS/2 controller
outb(PS2_KB_CMD,0xAA);
if(inb(PS2_KB_DATA) != 0x55)
{
// PS/2 Controller test failed
// Kernel Panic
asm volatile("int $19");
}
// Test the first port
outb(PS2_KB_CMD,0xAB);
if(inb(PS2_KB_DATA) != 0x00)
{
// First port didn't pass the test
// Kernel Panic
asm volatile("int $19");
}
// Enable the first port
outb(PS2_KB_CMD,0xAE);
// Set SCS
outb(PS2_KB_CMD,0xF0);
outb(PS2_KB_DATA,0x02);
// Get config
outb(PS2_KB_CMD,0x20);
uint8_t cfg = (inb(PS2_KB_DATA) | 1) & ~0x10;
// Set config
outb(PS2_KB_CMD,0x60);
outb(PS2_KB_DATA,cfg);
// Set scan code set
// Install our handler
irq_install_handler(1, ps2_keyboard_handler);
}