diff --git a/kernel/hal/x86/blk/BlockDevice.cpp b/kernel/hal/x86/blk/BlockDevice.cpp index 303891e..44a5d5e 100644 --- a/kernel/hal/x86/blk/BlockDevice.cpp +++ b/kernel/hal/x86/blk/BlockDevice.cpp @@ -54,7 +54,7 @@ namespace MTGosHAL { auto BlockDevice::getDriveCnt() -> uint8_t {return numDevices;} auto BlockDevice::getDriveNumByName(const char * name) -> uint8_t { if(strlen(name)!=5) - return -1; //Format is ATA[0-3][sl] (regex) + return -1; //Format is ATA[0-3][sm] (regex) if((name[0]!=name[2])||(name[2]!='A')) return -1; if(name[1]!='T') @@ -62,7 +62,7 @@ namespace MTGosHAL { uint8_t drivenum=name[3]-0x30; if(drivenum>3) return -1; - if((name[4]!='s')&&(name[4]!='l')) + if((name[4]!='s')&&(name[4]!='m')) return -1; drivenum<<=1; drivenum+=(name[4]=='s')?1:0; @@ -84,6 +84,9 @@ namespace MTGosHAL { outb(ataports[drv>>1]+LBAmid, (uint8_t)(sectorNum>>8)); outb(ataports[drv>>1]+LBAhi, (uint8_t)(sectorNum>>16)); outb(ataports[drv>>1]+CMD, 0x24); + inb(ataports[drv>>1]+CMD); + inb(ataports[drv>>1]+CMD); + inb(ataports[drv>>1]+CMD); while(inb(ataports[drv>>1]+CMD)&0x80); uint16_t *bufw=(uint16_t *)buf; for(int i=0;i<256;i++) diff --git a/kernel/hal/x86/init/init.cpp b/kernel/hal/x86/init/init.cpp index b8e20e3..886a3ad 100644 --- a/kernel/hal/x86/init/init.cpp +++ b/kernel/hal/x86/init/init.cpp @@ -40,7 +40,11 @@ namespace MTGosHAL { idt.setEntry(48, (void *)((uint32_t)&intr_stub_0+768), SEG_KERNEL, IDT_TRAP_GATE | IDT_SEG_32_BIT | IDT_RING_0 | IDT_USED); idt.setEntry(8, (void *)((uint32_t)&intr_stub_0+128), SEG_DBL_FAULT, IDT_TASK_GATE | IDT_SEG_32_BIT | IDT_RING_0 | IDT_USED); idt.apply(); - sti(); + char sec[513]; + sec[512]='\0'; + disk.readSector(disk.getDriveNumByName("ATA0m"),1,(uint8_t *)sec); + out << sec; + //sti(); ::main(); for(;;); }