Name: QEMU CONFIG Patch
Author: Rusty Russell
Status: Booted on 2.6.4-rc1-bk3
Depends:
Convenient patch based on Fabrice Bellard's documentation on how to
boot an x86 kernel under qemu-fast. Adjusts PAGE_OFFSET, HZ, and
FIXADDR_TOP.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .9001-linux-2.6.5-rc2-bk1/arch/i386/Kconfig .9001-linux-2.6.5-rc2-bk1.updated/arch/i386/Kconfig
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .17956-linux-2.6.7-rc2-bk1/arch/i386/Kconfig .17956-linux-2.6.7-rc2-bk1.updated/arch/i386/Kconfig
--- .17956-linux-2.6.7-rc2-bk1/arch/i386/Kconfig 2004-05-31 09:56:54.000000000 +1000
+++ .17956-linux-2.6.7-rc2-bk1.updated/arch/i386/Kconfig 2004-06-01 14:37:23.000000000 +1000
@@ -332,6 +332,14 @@ config X86_GENERIC
endif
+config QEMU
+ bool "Kernel to run under QEMU"
+ depends on EXPERIMENTAL
+ help
+ Select this if you want to boot the kernel inside qemu-fast,
+ the non-mmu version of the x86 emulator. See
+ . Say N.
+
#
# Define implied options from the CPU selection here
#
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .17956-linux-2.6.7-rc2-bk1/include/asm-i386/fixmap.h .17956-linux-2.6.7-rc2-bk1.updated/include/asm-i386/fixmap.h
--- .17956-linux-2.6.7-rc2-bk1/include/asm-i386/fixmap.h 2004-06-01 14:37:21.000000000 +1000
+++ .17956-linux-2.6.7-rc2-bk1.updated/include/asm-i386/fixmap.h 2004-06-01 14:38:02.000000000 +1000
@@ -20,7 +20,11 @@
* Leave one empty page between vmalloc'ed areas and
* the start of the fixmap.
*/
+#ifdef CONFIG_QEMU
+#define __FIXADDR_TOP 0xa7fff000
+#else
#define __FIXADDR_TOP 0xfffff000
+#endif
#ifndef __ASSEMBLY__
#include
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .17956-linux-2.6.7-rc2-bk1/include/asm-i386/page.h .17956-linux-2.6.7-rc2-bk1.updated/include/asm-i386/page.h
--- .17956-linux-2.6.7-rc2-bk1/include/asm-i386/page.h 2003-09-22 10:06:42.000000000 +1000
+++ .17956-linux-2.6.7-rc2-bk1.updated/include/asm-i386/page.h 2004-06-01 14:37:23.000000000 +1000
@@ -10,10 +10,10 @@
#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
#ifdef __KERNEL__
-#ifndef __ASSEMBLY__
-
#include
+#ifndef __ASSEMBLY__
+
#ifdef CONFIG_X86_USE_3DNOW
#include
@@ -115,12 +115,19 @@ static __inline__ int get_order(unsigned
#endif /* __ASSEMBLY__ */
#ifdef __ASSEMBLY__
+#ifdef CONFIG_QEMU
+#define __PAGE_OFFSET (0x90000000)
+#else
#define __PAGE_OFFSET (0xC0000000)
+#endif /* QEMU */
+#else
+#ifdef CONFIG_QEMU
+#define __PAGE_OFFSET (0x90000000UL)
#else
#define __PAGE_OFFSET (0xC0000000UL)
+#endif /* QEMU */
#endif
-
#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .17956-linux-2.6.7-rc2-bk1/include/asm-i386/param.h .17956-linux-2.6.7-rc2-bk1.updated/include/asm-i386/param.h
--- .17956-linux-2.6.7-rc2-bk1/include/asm-i386/param.h 2004-05-31 09:57:34.000000000 +1000
+++ .17956-linux-2.6.7-rc2-bk1.updated/include/asm-i386/param.h 2004-06-01 14:37:23.000000000 +1000
@@ -2,7 +2,12 @@
#define _ASMi386_PARAM_H
#ifdef __KERNEL__
-# define HZ 1000 /* Internal kernel timer frequency */
+# include
+# ifdef CONFIG_QEMU
+# define HZ 100
+# else
+# define HZ 1000 /* Internal kernel timer frequency */
+# endif
# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
#endif