#include "tty.h" #ifndef _HD_H #define _HD_H static inline void insw(unsigned short port, unsigned char *addr, unsigned long count) { __asm__ __volatile__("rep; ins" "w":"=D"(addr), "=c"(count):"d"(port), "0"(addr), "1"(count)); } void hd_init(void) { unsigned char *p, c[512], *e; e = c; while ((inb(0x1f7) & 0x80) == 0x80) ; printf("HERE 1\n"); outb(0x1f2, 0x04); outb(0x1f3, 0x07); outb(0x1f4, 0xa7); outb(0x1f5, 0x00); outb(0x1f6, 0xa3); outb(0x1f7, 0x20); printf("%x", inb(0x1f7)); while ((inb(0x1f7) & 0x80) == 0x80 || (inb(0x1f7) & 0x08) != 0x08) ; // Doesn't break out of this loop. Something wrong here. But as per the hardware spec this is what is expected.Corrections to be made in this loop. printf("HERE 2\n"); insw(0x1f0, e, 256); printf("%x %x #####\n", c[0], e[0]); p = 0xc0000; printf("$$$$$$$$$$%x %x$$$$$$$$$$$\n", *p, *(p + 1)); } #endif