Can you tell me the problem?
Code: Select all
STRING Read_Disk_Sector()
{
STRING buffer;
__asm__ __volatile__ ("movl 0x1f0, %edx; movb 0xa0, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f2, %edx; movb 1, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f3, %edx; movb 2, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f4, %edx; movb 0, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f5, %edx; movb 0, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f7, %edx; movb 0x20, %al; outb %al, %dx;");
__asm__ __volatile__ ("_continue: inb %dx, %al; testb %al, 8; jz _continue;");
__asm__ __volatile__ ("movl $512/2, %eax; xorw %bx, %bx; movw $1, %bx; mulw %bx; movl %eax, %ecx;");
__asm__ __volatile__ ("movl 0x1f0, %edx; rep insw");
__asm__ __volatile__ ("movl %%edi, %0" :"=r" (buffer) );
return buffer;
}
void Write_Disk_Sector(STRING buffer)
{
__asm__ __volatile__ ("movl 0x1f0, %edx; movb 0xa0, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f2, %edx; movb 1, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f3, %edx; movb 2, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f4, %edx; movb 0, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f5, %edx; movb 0, %al; outb %al, %dx;");
__asm__ __volatile__ ("movl 0x1f7, %edx; movb 0x30, %al; outb %al, %dx;");
__asm__ __volatile__ ("_cont: inb %dx, %al; testb %al, 8; jz _cont;");
__asm__ __volatile__ ("movl $512/2, %eax; xorw %bx, %bx; movw $1, %bx; mulw %bx; movl %eax, %ecx;");
__asm__ __volatile__ ("movl %0, %%esi;" : : "r"(buffer));
__asm__ __volatile__ ("movl 0x1f0, %edx; rep outsw");
}