]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Reform bios make rules
authorCyrill Gorcunov <gorcunov@gmail.com>
Tue, 7 Jun 2011 19:41:16 +0000 (23:41 +0400)
committerPekka Enberg <penberg@kernel.org>
Wed, 8 Jun 2011 14:15:30 +0000 (17:15 +0300)
Put bios code into bios.s and adjust makefile
rules accordingly. It's more natural than bios-rom.S
(which is now simply a container over real bios code).

Also improve bios deps in Makefile.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/Makefile
tools/kvm/bios/bios-rom.S
tools/kvm/bios/bios.S
tools/kvm/bios/gen-offsets.sh

index 6dca3c5fe412b1ee644a27a62455b2460823ecdc..c8d3cc022cda1c9fb403fd7fa5570edd36e56527 100644 (file)
@@ -82,7 +82,7 @@ DEPS  := $(patsubst %.o,%.d,$(OBJS))
 
 # Exclude BIOS object files from header dependencies.
 OBJS   += bios.o
-OBJS   += bios/bios.o
+OBJS   += bios/bios-rom.o
 
 LIBS   += -lrt
 LIBS   += -lpthread
@@ -165,20 +165,27 @@ BIOS_CFLAGS += -m32
 BIOS_CFLAGS += -march=i386
 BIOS_CFLAGS += -mregparm=3
 
-bios.o: bios/bios-rom.bin
-bios/bios.o: bios/bios.S bios/bios-rom.bin
-       $(E) "  CC      " $@
-       $(Q) $(CC) -c $(CFLAGS) bios/bios.S -o bios/bios.o
-       
-bios/bios-rom.bin: bios/bios-rom.S bios/e820.c
-       $(E) "  CC      " $@
+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
+       $(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
-       $(Q) $(CC) $(CFLAGS) $(BIOS_CFLAGS) -c -s bios/bios-rom.S -o bios/bios-rom.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-rom.bin.elf bios/bios-rom.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/bios.bin: bios/bios.bin.elf
        $(E) "  OBJCOPY " $@
-       $(Q) objcopy -O binary -j .text bios/bios-rom.bin.elf bios/bios-rom.bin
+       $(Q) objcopy -O binary -j .text bios/bios.bin.elf bios/bios.bin
+
+bios/bios-rom.o: bios/bios-rom.S bios/bios.bin bios/bios-rom.h
+       $(E) "  CC      " $@
+       $(Q) $(CC) -c $(CFLAGS) bios/bios-rom.S -o bios/bios-rom.o
+
+bios/bios-rom.h: bios/bios.bin.elf
        $(E) "  NM      " $@
        $(Q) cd bios && sh gen-offsets.sh > bios-rom.h && cd ..
 
index 1ddc461d791aac732b387f43f96ecb42230aba17..dc52b1e61bc8d8f339980af3df007bca68cd3dc8 100644 (file)
@@ -1,89 +1,12 @@
-/*
- * Our pretty trivial BIOS emulation
- */
-
-#include <kvm/bios.h>
 #include <kvm/assembly.h>
 
        .org 0
-       .code16gcc
-
-#include "macro.S"
-
-/*
- * fake interrupt handler, nothing can be faster ever
- */
-ENTRY(bios_intfake)
-       IRET
-ENTRY_END(bios_intfake)
-
-/*
- * int 10 - video - service
- */
-ENTRY(bios_int10)
-       pushw   %fs
-       pushl   %es
-       pushl   %edi
-       pushl   %esi
-       pushl   %ebp
-       pushl   %esp
-       pushl   %edx
-       pushl   %ecx
-       pushl   %ebx
-       pushl   %eax
-
-       movl            %esp, %eax
-       /* this is way easier than doing it in assembly */
-       /* just push all the regs and jump to a C handler */
-       call    int10_handler
-
-       popl    %eax
-       popl    %ebx
-       popl    %ecx
-       popl    %edx
-       popl    %esp
-       popl    %ebp
-       popl    %esi
-       popl    %edi
-       popl    %es
-       popw    %fs
-
-       IRET
-ENTRY_END(bios_int10)
-
-#define EFLAGS_CF      (1 << 0)
-
-ENTRY(bios_int15)
-       cmp $0xE820, %eax
-       jne 1f
-
-       pushw   %fs
-
-       pushl   %edx
-       pushl   %ecx
-       pushl   %edi
-       pushl   %ebx
-       pushl   %eax
-
-       movl    %esp, %eax      # it's bioscall case
-       call    e820_query_map
-
-       popl    %eax
-       popl    %ebx
-       popl    %edi
-       popl    %ecx
-       popl    %edx
-
-       popw    %fs
-
-       /* Clear CF */
-       andl    $~EFLAGS_CF, 0x4(%esp)
-1:
-       IRET
-ENTRY_END(bios_int15)
-
-GLOBAL(__locals)
-
-#include "local.S"
-
-END(__locals)
+#ifdef CONFIG_X86_64
+       .code64
+#else
+       .code32
+#endif
+
+GLOBAL(bios_rom)
+       .incbin "bios/bios.bin"
+END(bios_rom)
index e840dde133a0e3bde9f9a71246e47ac33413a006..1ddc461d791aac732b387f43f96ecb42230aba17 100644 (file)
@@ -1,12 +1,89 @@
+/*
+ * Our pretty trivial BIOS emulation
+ */
+
+#include <kvm/bios.h>
 #include <kvm/assembly.h>
 
        .org 0
-#ifdef CONFIG_X86_64
-       .code64
-#else
-       .code32
-#endif
-
-GLOBAL(bios_rom)
-       .incbin "bios/bios-rom.bin"
-END(bios_rom)
+       .code16gcc
+
+#include "macro.S"
+
+/*
+ * fake interrupt handler, nothing can be faster ever
+ */
+ENTRY(bios_intfake)
+       IRET
+ENTRY_END(bios_intfake)
+
+/*
+ * int 10 - video - service
+ */
+ENTRY(bios_int10)
+       pushw   %fs
+       pushl   %es
+       pushl   %edi
+       pushl   %esi
+       pushl   %ebp
+       pushl   %esp
+       pushl   %edx
+       pushl   %ecx
+       pushl   %ebx
+       pushl   %eax
+
+       movl            %esp, %eax
+       /* this is way easier than doing it in assembly */
+       /* just push all the regs and jump to a C handler */
+       call    int10_handler
+
+       popl    %eax
+       popl    %ebx
+       popl    %ecx
+       popl    %edx
+       popl    %esp
+       popl    %ebp
+       popl    %esi
+       popl    %edi
+       popl    %es
+       popw    %fs
+
+       IRET
+ENTRY_END(bios_int10)
+
+#define EFLAGS_CF      (1 << 0)
+
+ENTRY(bios_int15)
+       cmp $0xE820, %eax
+       jne 1f
+
+       pushw   %fs
+
+       pushl   %edx
+       pushl   %ecx
+       pushl   %edi
+       pushl   %ebx
+       pushl   %eax
+
+       movl    %esp, %eax      # it's bioscall case
+       call    e820_query_map
+
+       popl    %eax
+       popl    %ebx
+       popl    %edi
+       popl    %ecx
+       popl    %edx
+
+       popw    %fs
+
+       /* Clear CF */
+       andl    $~EFLAGS_CF, 0x4(%esp)
+1:
+       IRET
+ENTRY_END(bios_int15)
+
+GLOBAL(__locals)
+
+#include "local.S"
+
+END(__locals)
index 9a6e322c8caa2b1eb1c83338add6e382c344be14..8771bbe0b1ea36cfb20b443ae10092ec0bacd726 100644 (file)
@@ -8,6 +8,7 @@ echo ""
 echo "#define BIOS_ENTRY_SIZE(name) (name##_end - name)"
 echo ""
 
-nm bios-rom.bin.elf | grep ' [Tt] ' | awk '{ print "#define BIOS_OFFSET__" $3 " 0x" $1; }'
+nm bios.bin.elf | grep ' [Tt] ' | awk '{ print "#define BIOS_OFFSET__" $3 " 0x" $1; }'
 
+echo ""
 echo "#endif"