From: Cyrill Gorcunov <gorcunov@gmail.com>
To: penberg@kernel.org
Cc: asias.hejun@gmail.com, mingo@elte.hu, levinsasha928@gmail.com,
prasadjoshi124@gmail.com, kvm@vger.kernel.org,
Cyrill Gorcunov <gorcunov@gmail.com>
Subject: [patch 5/5] kvm tools: Reform bios make fules
Date: Tue, 07 Jun 2011 23:41:16 +0400 [thread overview]
Message-ID: <20110607194154.492625503@gmail.com> (raw)
In-Reply-To: 20110607194111.025052224@gmail.com
[-- Attachment #1: kvm-tools-bios-rename --]
[-- Type: text/plain, Size: 6076 bytes --]
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>
---
tools/kvm/Makefile | 29 +++++++-----
tools/kvm/bios/bios-rom.S | 95 +++---------------------------------------
tools/kvm/bios/bios.S | 95 ++++++++++++++++++++++++++++++++++++++----
tools/kvm/bios/gen-offsets.sh | 3 -
4 files changed, 115 insertions(+), 107 deletions(-)
Index: linux-2.6.git/tools/kvm/Makefile
===================================================================
--- linux-2.6.git.orig/tools/kvm/Makefile
+++ linux-2.6.git/tools/kvm/Makefile
@@ -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: linux-2.6.git/tools/kvm/bios/bios-rom.S
===================================================================
--- linux-2.6.git.orig/tools/kvm/bios/bios-rom.S
+++ linux-2.6.git/tools/kvm/bios/bios-rom.S
@@ -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: linux-2.6.git/tools/kvm/bios/bios.S
===================================================================
--- linux-2.6.git.orig/tools/kvm/bios/bios.S
+++ linux-2.6.git/tools/kvm/bios/bios.S
@@ -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: linux-2.6.git/tools/kvm/bios/gen-offsets.sh
===================================================================
--- linux-2.6.git.orig/tools/kvm/bios/gen-offsets.sh
+++ linux-2.6.git/tools/kvm/bios/gen-offsets.sh
@@ -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"
prev parent reply other threads:[~2011-06-07 19:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 19:41 [patch 0/5] kvm tools: A few fixes Cyrill Gorcunov
2011-06-07 19:41 ` [patch 1/5] kvm tools: Options parser to handle hex numbers Cyrill Gorcunov
2011-06-07 19:41 ` [patch 2/5] kvm tools: Introduce vidmode parmeter Cyrill Gorcunov
2011-06-07 19:53 ` Pekka Enberg
2011-06-07 20:03 ` Cyrill Gorcunov
2011-06-07 20:10 ` Cyrill Gorcunov
2011-06-07 20:22 ` Cyrill Gorcunov
2011-06-07 19:41 ` [patch 3/5] kvm tools: Delete dangling cursor from int10 Cyrill Gorcunov
2011-06-07 19:41 ` [patch 4/5] kvm tools: Get rid of spaces in ld script Cyrill Gorcunov
2011-06-07 19:41 ` Cyrill Gorcunov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110607194154.492625503@gmail.com \
--to=gorcunov@gmail.com \
--cc=asias.hejun@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mingo@elte.hu \
--cc=penberg@kernel.org \
--cc=prasadjoshi124@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox