Cleaned up the bios call code somewhat
This commit is contained in:
parent
c1737c30b7
commit
37f53699ff
3 changed files with 24 additions and 27 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
*.o
|
*.o
|
||||||
|
*.swp
|
||||||
/boot.bin
|
/boot.bin
|
||||||
/boot.elf
|
/boot.elf
|
||||||
/serve
|
/serve
|
||||||
|
|
|
||||||
46
src/bios.S
46
src/bios.S
|
|
@ -31,8 +31,7 @@ bios_write: push %ebp
|
||||||
PROT32
|
PROT32
|
||||||
|
|
||||||
pop %ebx
|
pop %ebx
|
||||||
mov %ebp, %esp
|
leave
|
||||||
pop %ebp
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.global bios_getmap
|
.global bios_getmap
|
||||||
|
|
@ -68,8 +67,7 @@ _gmdone: add $24, %di
|
||||||
|
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %ebx
|
pop %ebx
|
||||||
mov %ebp, %esp
|
leave
|
||||||
pop %ebp
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.global bios_func
|
.global bios_func
|
||||||
|
|
@ -80,39 +78,38 @@ bios_func: push %ebp
|
||||||
push %edi
|
push %edi
|
||||||
push %esi
|
push %esi
|
||||||
|
|
||||||
mov 8+0(%ebp), %eax
|
|
||||||
mov 8+4(%ebp), %edi
|
|
||||||
|
|
||||||
// The interrupt number is given as an immediate value to INT.
|
// The interrupt number is given as an immediate value to INT.
|
||||||
// To support any interrupt number, we use self-modifying code.
|
// To support any interrupt number, we use self-modifying code.
|
||||||
|
mov 8+0(%ebp), %eax
|
||||||
mov %al, _bf_int+1
|
mov %al, _bf_int+1
|
||||||
|
|
||||||
PROT16
|
PROT16
|
||||||
REAL
|
REAL
|
||||||
|
|
||||||
mov 0(%edi), %eax
|
mov 8+4(%ebp), %edi
|
||||||
mov 4(%edi), %ecx
|
mov 0(%edi), %ax
|
||||||
mov 8(%edi), %edx
|
mov 2(%edi), %cx
|
||||||
mov 12(%edi), %ebx
|
mov 4(%edi), %dx
|
||||||
mov 16(%edi), %ebp
|
mov 6(%edi), %bx
|
||||||
mov 20(%edi), %esi
|
mov 8(%edi), %bp
|
||||||
mov 24(%edi), %edi
|
mov 10(%edi), %si
|
||||||
|
mov 12(%edi), %di
|
||||||
|
|
||||||
// This instruction will get written at runtime
|
// This instruction will get written at runtime
|
||||||
_bf_int: .byte 0xCD, 0 // INT imm8
|
_bf_int: .byte 0xCD, 0 // INT imm8
|
||||||
push $0
|
push $0
|
||||||
pushf
|
pushf
|
||||||
|
|
||||||
push %edi
|
push %di
|
||||||
mov 8+4(%ebp), %edi
|
mov 8+4(%ebp), %edi
|
||||||
mov %eax, 0(%edi)
|
mov %ax, 0(%edi)
|
||||||
mov %ecx, 4(%edi)
|
mov %cx, 2(%edi)
|
||||||
mov %edx, 8(%edi)
|
mov %dx, 4(%edi)
|
||||||
mov %ebx, 12(%edi)
|
mov %bx, 6(%edi)
|
||||||
mov %ebp, 16(%edi)
|
mov %bp, 8(%edi)
|
||||||
mov %esi, 20(%edi)
|
mov %si, 10(%edi)
|
||||||
pop %eax
|
pop %ax
|
||||||
mov %eax, 24(%edi)
|
mov %ax, 12(%edi)
|
||||||
|
|
||||||
PROT
|
PROT
|
||||||
PROT32
|
PROT32
|
||||||
|
|
@ -123,6 +120,5 @@ _bf_int: .byte 0xCD, 0 // INT imm8
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %ebp
|
pop %ebp
|
||||||
pop %ebx
|
pop %ebx
|
||||||
mov %ebp, %esp
|
leave
|
||||||
pop %ebp
|
|
||||||
ret
|
ret
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ struct vesa_info {
|
||||||
uint8_t reserved[492];
|
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_PRESENT 0x001
|
||||||
#define PG_WRITE 0x002
|
#define PG_WRITE 0x002
|
||||||
|
|
@ -123,7 +123,7 @@ main()
|
||||||
bios_write(buf);
|
bios_write(buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t reg[7];
|
uint16_t reg[7];
|
||||||
reg[0] = (0x0E << 8) + 'J';
|
reg[0] = (0x0E << 8) + 'J';
|
||||||
reg[1] = 0;
|
reg[1] = 0;
|
||||||
reg[2] = 0;
|
reg[2] = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue