diff --git a/Makefile b/Makefile index 672027d..5bde355 100644 --- a/Makefile +++ b/Makefile @@ -199,15 +199,17 @@ BIOS_CFLAGS += -mregparm=3 bios.o: bios/bios.bin bios/bios-rom.h -bios/bios.bin.elf: bios/bios.S bios/e820.c bios/int10.c bios/rom.ld.S +bios/bios.bin.elf: bios/bios.S bios/e820.c bios/int10.c bios/int15.c bios/rom.ld.S $(E) " CC bios/e820.o" $(Q) $(CC) -include code16gcc.h $(CFLAGS) $(BIOS_CFLAGS) -c -s bios/e820.c -o bios/e820.o $(E) " CC bios/int10.o" $(Q) $(CC) -include code16gcc.h $(CFLAGS) $(BIOS_CFLAGS) -c -s bios/int10.c -o bios/int10.o + $(E) " CC bios/int15.o" + $(Q) $(CC) -include code16gcc.h $(CFLAGS) $(BIOS_CFLAGS) -c -s bios/int15.c -o bios/int15.o $(E) " CC bios/bios.o" $(Q) $(CC) $(CFLAGS) $(BIOS_CFLAGS) -c -s bios/bios.S -o bios/bios.o $(E) " LD " $@ - $(Q) ld -T bios/rom.ld.S -o bios/bios.bin.elf bios/bios.o bios/e820.o bios/int10.o + $(Q) ld -T bios/rom.ld.S -o bios/bios.bin.elf bios/bios.o bios/e820.o bios/int10.o bios/int15.o bios/bios.bin: bios/bios.bin.elf $(E) " OBJCOPY " $@ diff --git a/bios/bios.S b/bios/bios.S index fe2d97b..2ee21a9 100644 --- a/bios/bios.S +++ b/bios/bios.S @@ -73,16 +73,13 @@ ENTRY(bios_int10) ENTRY_END(bios_int10) ENTRY(bios_int15) - cmp $0xE820, %eax - jne 1f - SAVE_BIOSREGS - movl %esp, %eax # it's bioscall case - call e820_query_map + movl %esp, %eax + call int15_handler RESTORE_BIOSREGS -1: + IRET ENTRY_END(bios_int15) diff --git a/bios/int15.c b/bios/int15.c new file mode 100644 index 0000000..e1a1ce4 --- /dev/null +++ b/bios/int15.c @@ -0,0 +1,12 @@ +#include "kvm/bios.h" + +#include "kvm/e820.h" + +bioscall void int15_handler(struct biosregs *regs) +{ + switch (regs->eax) { + case 0xe820: + e820_query_map(regs); + break; + } +} diff --git a/include/kvm/bios.h b/include/kvm/bios.h index 69a5654..469576e 100644 --- a/include/kvm/bios.h +++ b/include/kvm/bios.h @@ -58,6 +58,8 @@ #ifndef __ASSEMBLER__ +#include + struct biosregs { u32 eax; u32 ebx; @@ -73,6 +75,9 @@ struct biosregs { u32 eflags; }; +void int10_handler(struct biosregs *regs); +void int15_handler(struct biosregs *regs); + #endif #endif /* BIOS_H_ */ diff --git a/include/kvm/vesa.h b/include/kvm/vesa.h index 7b9a5ce..ac041d9 100644 --- a/include/kvm/vesa.h +++ b/include/kvm/vesa.h @@ -14,6 +14,5 @@ struct kvm; struct biosregs; struct framebuffer *vesa__init(struct kvm *self); -void int10_handler(struct biosregs *args); #endif