55 lines
1.2 KiB
C
55 lines
1.2 KiB
C
#include <sys.h>
|
|
#include <stdlib.h>
|
|
#include "bootinfo.h"
|
|
#include "drivers/ata.h"
|
|
#include "drivers/keycodes.h"
|
|
#include "drivers/ps2ctrl.h"
|
|
#include "drivers/ps2kb.h"
|
|
#include "drivers/pci.h"
|
|
#include "fs/fat.h"
|
|
#include "fs/mbr.h"
|
|
#include "panic.h"
|
|
#include "term.h"
|
|
#include "interrupt/pic.h"
|
|
#include "interrupt/idt.h"
|
|
|
|
extern void kmain(void* boot_info) {
|
|
term_clear();
|
|
term_setcol(0x0f);
|
|
bootinfo_load(boot_info);
|
|
printf("cmdline: %s\n", bootinfo_get_cmdline());
|
|
idt_init();
|
|
pic_remap(PIC_REMAP_OFFSET);
|
|
ps2ctrl_init();
|
|
ps2kb_init();
|
|
pci_init();
|
|
|
|
struct PciDevice pcidev;
|
|
if(!pci_findby_class(&pcidev, 0x01, 0x01, NULL)) {
|
|
panic("Could not find IDE device");
|
|
}
|
|
|
|
struct AtaDevice atadev;
|
|
ata_init(&atadev, pcidev);
|
|
struct MbrPartition part0;
|
|
mbr_get_partition(&part0, atadev, 0);
|
|
struct FatInfo fat;
|
|
fat_init(&fat, atadev, part0);
|
|
fat_test(&fat);
|
|
|
|
|
|
while(1) {
|
|
int_wait();
|
|
struct Keycode code = ps2kb_get();
|
|
if(code.key != KEY_NONE) {
|
|
if(code.flags & KC_FLAG_ERROR) {
|
|
printf("error: %X\n", code.key);
|
|
} else if(code.flags & KC_FLAG_KEY_DOWN) {
|
|
printf("pressed: %X\n", code.key);
|
|
} else {
|
|
printf("released: %X\n", code.key);
|
|
}
|
|
}
|
|
}
|
|
}
|