diff mbox

[7/8] kvm tools, bios: Convert int15 code to C

Message ID 1313147226-12400-7-git-send-email-penberg@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Pekka Enberg Aug. 12, 2011, 11:07 a.m. UTC
This patch convert the int15 interrupt handler code into C.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 tools/kvm/Makefile           |    6 ++++--
 tools/kvm/bios/bios.S        |    9 +++------
 tools/kvm/bios/int15.c       |   12 ++++++++++++
 tools/kvm/include/kvm/bios.h |    5 +++++
 tools/kvm/include/kvm/vesa.h |    1 -
 5 files changed, 24 insertions(+), 9 deletions(-)
 create mode 100644 tools/kvm/bios/int15.c
diff mbox

Patch

diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile
index 672027d..5bde355 100644
--- a/tools/kvm/Makefile
+++ b/tools/kvm/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/tools/kvm/bios/bios.S b/tools/kvm/bios/bios.S
index fe2d97b..2ee21a9 100644
--- a/tools/kvm/bios/bios.S
+++ b/tools/kvm/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/tools/kvm/bios/int15.c b/tools/kvm/bios/int15.c
new file mode 100644
index 0000000..e1a1ce4
--- /dev/null
+++ b/tools/kvm/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/tools/kvm/include/kvm/bios.h b/tools/kvm/include/kvm/bios.h
index 69a5654..469576e 100644
--- a/tools/kvm/include/kvm/bios.h
+++ b/tools/kvm/include/kvm/bios.h
@@ -58,6 +58,8 @@ 
 
 #ifndef __ASSEMBLER__
 
+#include <linux/types.h>
+
 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/tools/kvm/include/kvm/vesa.h b/tools/kvm/include/kvm/vesa.h
index 7b9a5ce..ac041d9 100644
--- a/tools/kvm/include/kvm/vesa.h
+++ b/tools/kvm/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