diff --git a/.gitignore b/.gitignore index 8d5a1b4..d218281 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.o +*.swp /boot.bin /boot.elf /serve diff --git a/src/bios.S b/src/bios.S index 1d35336..091b9bb 100644 --- a/src/bios.S +++ b/src/bios.S @@ -31,8 +31,7 @@ bios_write: push %ebp PROT32 pop %ebx - mov %ebp, %esp - pop %ebp + leave ret .global bios_getmap @@ -68,8 +67,7 @@ _gmdone: add $24, %di pop %edi pop %ebx - mov %ebp, %esp - pop %ebp + leave ret .global bios_func @@ -80,39 +78,38 @@ bios_func: push %ebp push %edi push %esi - mov 8+0(%ebp), %eax - mov 8+4(%ebp), %edi - // The interrupt number is given as an immediate value to INT. // To support any interrupt number, we use self-modifying code. + mov 8+0(%ebp), %eax mov %al, _bf_int+1 PROT16 REAL - mov 0(%edi), %eax - mov 4(%edi), %ecx - mov 8(%edi), %edx - mov 12(%edi), %ebx - mov 16(%edi), %ebp - mov 20(%edi), %esi - mov 24(%edi), %edi + mov 8+4(%ebp), %edi + mov 0(%edi), %ax + mov 2(%edi), %cx + mov 4(%edi), %dx + mov 6(%edi), %bx + mov 8(%edi), %bp + mov 10(%edi), %si + mov 12(%edi), %di // This instruction will get written at runtime _bf_int: .byte 0xCD, 0 // INT imm8 push $0 pushf - push %edi + push %di mov 8+4(%ebp), %edi - mov %eax, 0(%edi) - mov %ecx, 4(%edi) - mov %edx, 8(%edi) - mov %ebx, 12(%edi) - mov %ebp, 16(%edi) - mov %esi, 20(%edi) - pop %eax - mov %eax, 24(%edi) + mov %ax, 0(%edi) + mov %cx, 2(%edi) + mov %dx, 4(%edi) + mov %bx, 6(%edi) + mov %bp, 8(%edi) + mov %si, 10(%edi) + pop %ax + mov %ax, 12(%edi) PROT PROT32 @@ -123,6 +120,5 @@ _bf_int: .byte 0xCD, 0 // INT imm8 pop %edi pop %ebp pop %ebx - mov %ebp, %esp - pop %ebp + leave ret diff --git a/src/main.c b/src/main.c index 6adb5ed..576f4d4 100644 --- a/src/main.c +++ b/src/main.c @@ -49,7 +49,7 @@ struct vesa_info { uint8_t reserved[492]; }; -extern uint16_t bios_func(uint8_t inum, uint32_t reg[]); +extern uint16_t bios_func(uint8_t inum, uint16_t reg[]); #define PG_PRESENT 0x001 #define PG_WRITE 0x002 @@ -123,7 +123,7 @@ main() bios_write(buf); #endif - uint32_t reg[7]; + uint16_t reg[7]; reg[0] = (0x0E << 8) + 'J'; reg[1] = 0; reg[2] = 0;