From: "Filip Navara" <xnavara@volny.cz>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] KQEMU build on MinGW patch
Date: Sat, 8 Sep 2007 21:37:34 +0200 [thread overview]
Message-ID: <5b31733c0709081237n408fd958h3efdd013550c726f@mail.gmail.com> (raw)
In-Reply-To: <5b31733c0709081235g307e4abdvfb9c49b57a05522d@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 271 bytes --]
Attached patch allows KQEMU to build on pure MinGW installation without the
need for ELF tools or compilation on Linux. I'm not sure if it breaks the
Linux compilation, so it should be carefully tested. Hope it's usefull at
least for someone.
Best regards,
Filip Navara
[-- Attachment #1.2: Type: text/html, Size: 334 bytes --]
[-- Attachment #2: kqemu-mingw.diff --]
[-- Type: application/octet-stream, Size: 5876 bytes --]
--- common/Makefile Tue Feb 6 22:02:00 2007
+++ common/Makefile Sat Sep 8 18:33:00 2007
@@ -28,17 +28,20 @@
/dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
HOST_CC=gcc
-MON_CC=gcc
-MON_LD=ld
ifdef CONFIG_WIN32
TARGET=../kqemu-mod-$(ARCH)-win32.o
-CC=i386-mingw32-gcc
-LD=i386-mingw32-ld
+CROSS_PREFIX=i386-mingw32-
+CC=$(CROSS_PREFIX)gcc
+LD=$(CROSS_PREFIX)ld
+LD_POSTFIX=-win32
else
TARGET=../kqemu-mod-$(ARCH).o
CC=gcc
LD=ld
+LD_POSTFIX=
endif
+MON_CC=$(CROSS_PREFIX)gcc
+MON_LD=$(CROSS_PREFIX)ld
DEFINES=-D__KERNEL__
INCLUDES=-nostdinc -iwithprefix include -I. -I..
@@ -84,7 +87,7 @@
objcopy -O binary $< $@
monitor-image.out: $(ARCH)/nexus_asm.o $(ARCH)/monitor_asm.o monitor.o monitor-utils.o interp.o
- $(MON_LD) -T $(ARCH)/monitor.ld -o $@ $^
+ $(MON_LD) -T $(ARCH)/monitor$(LD_POSTFIX).ld -o $@ $^
$(ARCH)/nexus_asm.o: $(ARCH)/nexus_asm.S monitor_def.h
--- common/genmon.c Tue Feb 6 22:02:00 2007
+++ common/genmon.c Sat Sep 8 02:52:39 2007
@@ -18,11 +18,17 @@
*/
#include <stdlib.h>
#include <stdio.h>
+#ifdef _WIN32
+#include <sys/fcntl.h>
+#endif
int main(int argc, char **argv)
{
int i, c;
+#ifdef _WIN32
+ setmode(0, O_BINARY);
+#endif
printf("const uint8_t monitor_code[] = {\n");
i = 0;
for(;;) {
--- common/i386/monitor-win32.ld Thu Jan 1 01:00:00 1970
+++ common/i386/monitor-win32.ld Sat Sep 8 02:42:26 2007
@@ -0,0 +1,20 @@
+ENTRY(__start)
+SECTIONS
+{
+ . = 0xf0000000;
+ .text : { *(.text) }
+ .rodata : { *(.rodata) }
+ . = ALIGN(4);
+ ___start_seg_ex_table = . ;
+ seg_ex_table : { *(seg_ex_table) }
+ ___stop_seg_ex_table = . ;
+ .data : { *(.data) }
+ .plt : { *(.plt) }
+ .got : { *(.got.plt) *(.got) }
+ .bss : {
+ *(.bss)
+ *(COMMON)
+ }
+ . = ALIGN(4096);
+ _end = . ;
+}
--- common/i386/monitor_asm.S Tue Feb 6 22:02:00 2007
+++ common/i386/monitor_asm.S Sat Sep 8 18:21:31 2007
@@ -151,9 +151,9 @@
jmp *%eax
#define SEG_EXCEPTION(label) \
- .section "seg_ex_table", "a" ; \
+ .section seg_ex_table, "a" ; \
.long label ; \
- .previous
+ .section .text
#ifdef USE_SEG_GP
/* %ebx contains the kqemu_state pointer, %eax the selector,
--- common/i386/nexus_asm.S Tue Feb 6 22:02:00 2007
+++ common/i386/nexus_asm.S Sat Sep 8 02:41:15 2007
@@ -24,14 +24,14 @@
.globl ASM_NAME(monitor2kernel)
.globl ASM_NAME(kernel2monitor_jmp_offset)
.globl ASM_NAME(monitor2kernel_jmp_offset)
-.global _start
+.global ASM_NAME(_start)
-_start:
- .long ASM_NAME(kernel2monitor) - _start
- .long ASM_NAME(interrupt_table) - _start
- .long ASM_NAME(kernel2monitor_jmp_offset) - _start
- .long ASM_NAME(monitor2kernel_jmp_offset) - _start
- .long ASM_NAME(monitor_exec) - _start
+ASM_NAME(_start):
+ .long ASM_NAME(kernel2monitor) - ASM_NAME(_start)
+ .long ASM_NAME(interrupt_table) - ASM_NAME(_start)
+ .long ASM_NAME(kernel2monitor_jmp_offset) - ASM_NAME(_start)
+ .long ASM_NAME(monitor2kernel_jmp_offset) - ASM_NAME(_start)
+ .long ASM_NAME(monitor_exec) - ASM_NAME(_start)
/*
* Assumptions when entering kernel2monitor:
* %ss, %ds, %es, %cs are 4G flat 32 bit segments
@@ -147,7 +147,7 @@
2:
movl KQEMU_STATE_nexus_kaddr(%ebx), %eax
- addl $monitor2kernel_jmp_offset1 - _start, %eax
+ addl $monitor2kernel_jmp_offset1 - ASM_NAME(_start), %eax
jmp *%eax
monitor2kernel_jmp_offset1:
--- common/kqemu_int.h Tue Feb 6 22:02:00 2007
+++ common/kqemu_int.h Sat Sep 8 13:13:12 2007
@@ -1063,14 +1063,14 @@
#ifdef __x86_64__
#define MMU_EXCEPTION(label) \
- ".section \"mmu_ex_table\", \"a\"\n"\
+ ".section mmu_ex_table, \"a\"\n"\
".quad " #label "\n"\
- ".previous\n"
+ ".section .text\n"
#else
#define MMU_EXCEPTION(label) \
- ".section \"mmu_ex_table\", \"a\"\n"\
+ ".section mmu_ex_table, \"a\"\n"\
".long " #label "\n"\
- ".previous\n"
+ ".section .text\n"
#endif
extern char _start;
@@ -1226,14 +1226,14 @@
#ifdef __x86_64__
#define SEG_EXCEPTION(label) \
- ".section \"seg_ex_table\", \"a\"\n"\
+ ".section seg_ex_table, \"a\"\n"\
".quad " #label "\n"\
- ".previous\n"
+ ".section .text\n"
#else
#define SEG_EXCEPTION(label) \
- ".section \"seg_ex_table\", \"a\"\n"\
+ ".section seg_ex_table, \"a\"\n"\
".long " #label "\n"\
- ".previous\n"
+ ".section .text\n"
#endif
static inline unsigned long compute_eflags_user(struct kqemu_state *s,
--- common/x86_64/monitor-win32.ld Thu Jan 1 01:00:00 1970
+++ common/x86_64/monitor-win32.ld Sat Sep 8 18:32:11 2007
@@ -0,0 +1,21 @@
+ENTRY(__start)
+SECTIONS
+{
+ . = 0xf0000000;
+ .text : { *(.text) }
+ .rodata : { *(.rodata) }
+ . = ALIGN(8);
+ ___start_seg_ex_table = . ;
+ seg_ex_table : { *(seg_ex_table) }
+ ___stop_seg_ex_table = . ;
+ .eh_frame : { *(.eh_frame) }
+ .data : { *(.data) }
+ .plt : { *(.plt) }
+ .got : { *(.got.plt) *(.got) }
+ .bss : {
+ *(.bss)
+ *(COMMON)
+ }
+ . = ALIGN(4096);
+ _end = . ;
+}
--- common/x86_64/monitor_asm.S Tue Feb 6 22:02:00 2007
+++ common/x86_64/monitor_asm.S Sat Sep 8 18:21:50 2007
@@ -21,10 +21,10 @@
#include "kqemu_int.h"
#define SEG_EXCEPTION(label) \
- .section "seg_ex_table", "a" ; \
+ .section seg_ex_table, "a" ; \
.align 8 ; \
.quad label ; \
- .previous
+ .section .text
/* unsigned long __exec_binary(unsigned long *eflags, int op,
unsigned long a, unsigned long b) */
next prev parent reply other threads:[~2007-09-08 19:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-08 19:35 [Qemu-devel] KQEMU build on MinGW patch Filip Navara
2007-09-08 19:37 ` Filip Navara [this message]
2007-09-08 20:28 ` Christian MICHON
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=5b31733c0709081237n408fd958h3efdd013550c726f@mail.gmail.com \
--to=xnavara@volny.cz \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).