more accurate emulation (do not depend on localtime() or gmtime()
[qemu.git] / linux-2.6-qemu-fast.patch
blob34ca5a232e3e86b689acb63a3d6f3964fce1555a
1 diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .32324-linux-2.6.0/arch/i386/Kconfig .32324-linux-2.6.0.updated/arch/i386/Kconfig
2 --- .32324-linux-2.6.0/arch/i386/Kconfig 2003-10-09 18:02:48.000000000 +1000
3 +++ .32324-linux-2.6.0.updated/arch/i386/Kconfig 2003-12-26 16:46:49.000000000 +1100
4 @@ -307,6 +307,14 @@ config X86_GENERIC
5 when it has moderate overhead. This is intended for generic
6 distributions kernels.
8 +config QEMU
9 + bool "Kernel to run under QEMU"
10 + depends on EXPERIMENTAL
11 + help
12 + Select this if you want to boot the kernel inside qemu-fast,
13 + the non-mmu version of the x86 emulator. See
14 + <http://fabrice.bellard.free.fr/qemu/>. Say N.
17 # Define implied options from the CPU selection here
19 diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .32324-linux-2.6.0/arch/i386/kernel/Makefile .32324-linux-2.6.0.updated/arch/i386/kernel/Makefile
20 --- .32324-linux-2.6.0/arch/i386/kernel/Makefile 2003-09-29 10:25:15.000000000 +1000
21 +++ .32324-linux-2.6.0.updated/arch/i386/kernel/Makefile 2003-12-26 16:46:49.000000000 +1100
22 @@ -46,12 +46,14 @@ quiet_cmd_syscall = SYSCALL $@
23 cmd_syscall = $(CC) -nostdlib $(SYSCFLAGS_$(@F)) \
24 -Wl,-T,$(filter-out FORCE,$^) -o $@
26 +export AFLAGS_vsyscall.lds.o += -P -C -U$(ARCH)
28 vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1
29 SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags)
30 SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags)
32 $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \
33 -$(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
34 +$(obj)/vsyscall-%.so: $(src)/vsyscall.lds.s $(obj)/vsyscall-%.o FORCE
35 $(call if_changed,syscall)
37 # We also create a special relocatable object that should mirror the symbol
38 @@ -62,5 +64,5 @@ $(obj)/built-in.o: $(obj)/vsyscall-syms.
39 $(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o
41 SYSCFLAGS_vsyscall-syms.o = -r
42 -$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds $(obj)/vsyscall-sysenter.o FORCE
43 +$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds.s $(obj)/vsyscall-sysenter.o FORCE
44 $(call if_changed,syscall)
45 diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .32324-linux-2.6.0/arch/i386/kernel/vmlinux.lds.S .32324-linux-2.6.0.updated/arch/i386/kernel/vmlinux.lds.S
46 --- .32324-linux-2.6.0/arch/i386/kernel/vmlinux.lds.S 2003-09-22 10:27:28.000000000 +1000
47 +++ .32324-linux-2.6.0.updated/arch/i386/kernel/vmlinux.lds.S 2003-12-26 16:46:49.000000000 +1100
48 @@ -3,6 +3,7 @@
51 #include <asm-generic/vmlinux.lds.h>
52 +#include <asm/page.h>
54 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
55 OUTPUT_ARCH(i386)
56 @@ -10,7 +11,7 @@ ENTRY(startup_32)
57 jiffies = jiffies_64;
58 SECTIONS
60 - . = 0xC0000000 + 0x100000;
61 + . = __PAGE_OFFSET + 0x100000;
62 /* read-only */
63 _text = .; /* Text and read-only data */
64 .text : {
65 diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .32324-linux-2.6.0/arch/i386/kernel/vsyscall.lds .32324-linux-2.6.0.updated/arch/i386/kernel/vsyscall.lds
66 --- .32324-linux-2.6.0/arch/i386/kernel/vsyscall.lds 2003-09-22 10:07:26.000000000 +1000
67 +++ .32324-linux-2.6.0.updated/arch/i386/kernel/vsyscall.lds 1970-01-01 10:00:00.000000000 +1000
68 @@ -1,67 +0,0 @@
69 -/*
70 - * Linker script for vsyscall DSO. The vsyscall page is an ELF shared
71 - * object prelinked to its virtual address, and with only one read-only
72 - * segment (that fits in one page). This script controls its layout.
73 - */
75 -/* This must match <asm/fixmap.h>. */
76 -VSYSCALL_BASE = 0xffffe000;
78 -SECTIONS
80 - . = VSYSCALL_BASE + SIZEOF_HEADERS;
82 - .hash : { *(.hash) } :text
83 - .dynsym : { *(.dynsym) }
84 - .dynstr : { *(.dynstr) }
85 - .gnu.version : { *(.gnu.version) }
86 - .gnu.version_d : { *(.gnu.version_d) }
87 - .gnu.version_r : { *(.gnu.version_r) }
89 - /* This linker script is used both with -r and with -shared.
90 - For the layouts to match, we need to skip more than enough
91 - space for the dynamic symbol table et al. If this amount
92 - is insufficient, ld -shared will barf. Just increase it here. */
93 - . = VSYSCALL_BASE + 0x400;
95 - .text : { *(.text) } :text =0x90909090
97 - .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
98 - .eh_frame : { KEEP (*(.eh_frame)) } :text
99 - .dynamic : { *(.dynamic) } :text :dynamic
100 - .useless : {
101 - *(.got.plt) *(.got)
102 - *(.data .data.* .gnu.linkonce.d.*)
103 - *(.dynbss)
104 - *(.bss .bss.* .gnu.linkonce.b.*)
105 - } :text
109 - * We must supply the ELF program headers explicitly to get just one
110 - * PT_LOAD segment, and set the flags explicitly to make segments read-only.
111 - */
112 -PHDRS
114 - text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
115 - dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
116 - eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
120 - * This controls what symbols we export from the DSO.
121 - */
122 -VERSION
124 - LINUX_2.5 {
125 - global:
126 - __kernel_vsyscall;
127 - __kernel_sigreturn;
128 - __kernel_rt_sigreturn;
130 - local: *;
131 - };
134 -/* The ELF entry point can be used to set the AT_SYSINFO value. */
135 -ENTRY(__kernel_vsyscall);
136 diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .32324-linux-2.6.0/arch/i386/kernel/vsyscall.lds.S .32324-linux-2.6.0.updated/arch/i386/kernel/vsyscall.lds.S
137 --- .32324-linux-2.6.0/arch/i386/kernel/vsyscall.lds.S 1970-01-01 10:00:00.000000000 +1000
138 +++ .32324-linux-2.6.0.updated/arch/i386/kernel/vsyscall.lds.S 2003-12-26 16:46:49.000000000 +1100
139 @@ -0,0 +1,67 @@
141 + * Linker script for vsyscall DSO. The vsyscall page is an ELF shared
142 + * object prelinked to its virtual address, and with only one read-only
143 + * segment (that fits in one page). This script controls its layout.
144 + */
145 +#include <asm/fixmap.h>
147 +VSYSCALL_BASE = __FIXADDR_TOP - 0x1000;
149 +SECTIONS
151 + . = VSYSCALL_BASE + SIZEOF_HEADERS;
153 + .hash : { *(.hash) } :text
154 + .dynsym : { *(.dynsym) }
155 + .dynstr : { *(.dynstr) }
156 + .gnu.version : { *(.gnu.version) }
157 + .gnu.version_d : { *(.gnu.version_d) }
158 + .gnu.version_r : { *(.gnu.version_r) }
160 + /* This linker script is used both with -r and with -shared.
161 + For the layouts to match, we need to skip more than enough
162 + space for the dynamic symbol table et al. If this amount
163 + is insufficient, ld -shared will barf. Just increase it here. */
164 + . = VSYSCALL_BASE + 0x400;
166 + .text : { *(.text) } :text =0x90909090
168 + .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
169 + .eh_frame : { KEEP (*(.eh_frame)) } :text
170 + .dynamic : { *(.dynamic) } :text :dynamic
171 + .useless : {
172 + *(.got.plt) *(.got)
173 + *(.data .data.* .gnu.linkonce.d.*)
174 + *(.dynbss)
175 + *(.bss .bss.* .gnu.linkonce.b.*)
176 + } :text
180 + * We must supply the ELF program headers explicitly to get just one
181 + * PT_LOAD segment, and set the flags explicitly to make segments read-only.
182 + */
183 +PHDRS
185 + text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
186 + dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
187 + eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
191 + * This controls what symbols we export from the DSO.
192 + */
193 +VERSION
195 + LINUX_2.5 {
196 + global:
197 + __kernel_vsyscall;
198 + __kernel_sigreturn;
199 + __kernel_rt_sigreturn;
201 + local: *;
202 + };
205 +/* The ELF entry point can be used to set the AT_SYSINFO value. */
206 +ENTRY(__kernel_vsyscall);
207 diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .32324-linux-2.6.0/include/asm-i386/fixmap.h .32324-linux-2.6.0.updated/include/asm-i386/fixmap.h
208 --- .32324-linux-2.6.0/include/asm-i386/fixmap.h 2003-09-22 10:09:12.000000000 +1000
209 +++ .32324-linux-2.6.0.updated/include/asm-i386/fixmap.h 2003-12-26 16:46:49.000000000 +1100
210 @@ -14,6 +14,19 @@
211 #define _ASM_FIXMAP_H
213 #include <linux/config.h>
215 +/* used by vmalloc.c, vsyscall.lds.S.
217 + * Leave one empty page between vmalloc'ed areas and
218 + * the start of the fixmap.
219 + */
220 +#ifdef CONFIG_QEMU
221 +#define __FIXADDR_TOP 0xa7fff000
222 +#else
223 +#define __FIXADDR_TOP 0xfffff000
224 +#endif
226 +#ifndef __ASSEMBLY__
227 #include <linux/kernel.h>
228 #include <asm/acpi.h>
229 #include <asm/apicdef.h>
230 @@ -94,13 +107,8 @@ extern void __set_fixmap (enum fixed_add
231 #define clear_fixmap(idx) \
232 __set_fixmap(idx, 0, __pgprot(0))
235 - * used by vmalloc.c.
237 - * Leave one empty page between vmalloc'ed areas and
238 - * the start of the fixmap.
239 - */
240 -#define FIXADDR_TOP (0xfffff000UL)
241 +#define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP)
243 #define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
244 #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
246 @@ -145,4 +153,5 @@ static inline unsigned long virt_to_fix(
247 return __virt_to_fix(vaddr);
250 +#endif /* !__ASSEMBLY__ */
251 #endif
252 diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .32324-linux-2.6.0/include/asm-i386/page.h .32324-linux-2.6.0.updated/include/asm-i386/page.h
253 --- .32324-linux-2.6.0/include/asm-i386/page.h 2003-09-22 10:06:42.000000000 +1000
254 +++ .32324-linux-2.6.0.updated/include/asm-i386/page.h 2003-12-26 16:46:49.000000000 +1100
255 @@ -10,10 +10,10 @@
256 #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
258 #ifdef __KERNEL__
259 -#ifndef __ASSEMBLY__
261 #include <linux/config.h>
263 +#ifndef __ASSEMBLY__
265 #ifdef CONFIG_X86_USE_3DNOW
267 #include <asm/mmx.h>
268 @@ -115,12 +115,19 @@ static __inline__ int get_order(unsigned
269 #endif /* __ASSEMBLY__ */
271 #ifdef __ASSEMBLY__
272 +#ifdef CONFIG_QEMU
273 +#define __PAGE_OFFSET (0x90000000)
274 +#else
275 #define __PAGE_OFFSET (0xC0000000)
276 +#endif /* QEMU */
277 +#else
278 +#ifdef CONFIG_QEMU
279 +#define __PAGE_OFFSET (0x90000000UL)
280 #else
281 #define __PAGE_OFFSET (0xC0000000UL)
282 +#endif /* QEMU */
283 #endif
286 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
287 #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
288 #define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
289 diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .32324-linux-2.6.0/include/asm-i386/param.h .32324-linux-2.6.0.updated/include/asm-i386/param.h
290 --- .32324-linux-2.6.0/include/asm-i386/param.h 2003-09-21 17:26:06.000000000 +1000
291 +++ .32324-linux-2.6.0.updated/include/asm-i386/param.h 2003-12-26 16:46:49.000000000 +1100
292 @@ -2,7 +2,12 @@
293 #define _ASMi386_PARAM_H
295 #ifdef __KERNEL__
296 -# define HZ 1000 /* Internal kernel timer frequency */
297 +# include <linux/config.h>
298 +# ifdef CONFIG_QEMU
299 +# define HZ 100
300 +# else
301 +# define HZ 1000 /* Internal kernel timer frequency */
302 +# endif
303 # define USER_HZ 100 /* .. some user interfaces are in "ticks" */
304 # define CLOCKS_PER_SEC (USER_HZ) /* like times() */
305 #endif