diff -urN linux-2.4.24/Documentation/Configure.help linux-2.4.24-hal/Documentation/Configure.help
--- linux-2.4.24/Documentation/Configure.help 2003-11-28 10:26:19.000000000 -0800
+++ linux-2.4.24-hal/Documentation/Configure.help 2004-01-14 12:27:27.000000000 -0800
@@ -16141,6 +16141,19 @@
UMLs on a single host). You may choose more than one without
conflict. If you don't need UML networking, say N.
+Virtual Machines
+CONFIG_X86_HAL
+ Say N here unless you absolutely know you are compiling Linux for
+ use within a Plex86 virtual machine. Otherwise, the resulting
+ kernel will not execute properly on a real machine. If you are
+ compiling to run in a plex86 VM say Y here, in which case you should
+ compile out most all hardware drivers as they are not useful in a VM
+ and having drivers probe for various hardware will likely cause the VM
+ to quit when it sees access to an unhandled device. Please see the
+ following site for more information on compiling for use in a
+ plex86 VM, sample config files, and configuration constraints:
+ .
+
Microtek USB scanner support
CONFIG_USB_MICROTEK
Say Y here if you want support for the Microtek X6USB and
diff -urN linux-2.4.24/arch/i386/Makefile linux-2.4.24-hal/arch/i386/Makefile
--- linux-2.4.24/arch/i386/Makefile 2003-06-13 07:51:29.000000000 -0700
+++ linux-2.4.24-hal/arch/i386/Makefile 2004-01-14 12:29:05.000000000 -0800
@@ -94,6 +94,18 @@
CFLAGS += $(call check_gcc,-march=c3-2,-march=i686)
endif
+ifdef CONFIG_X86_HAL
+# On x86, if compiling for the Hardware Abstraction Layer
+# (running Linux as a guest OS in a Virtual Machine),
+# we need to insert some asm macros which redefine
+# the behaviour of instructions which modify the
+# interrupt flag. You are probably not configuring for
+# this mode. For more info, read 'Documentation/x86-hal.txt'.
+# This needs to be the first include any module sees.
+CFLAGS += -include $(TOPDIR)/include/asm/eflags_if.h
+AFLAGS += -include $(TOPDIR)/include/asm/eflags_if.h
+endif
+
HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
SUBDIRS += arch/i386/kernel arch/i386/mm arch/i386/lib
diff -urN linux-2.4.24/arch/i386/boot/Makefile linux-2.4.24-hal/arch/i386/boot/Makefile
--- linux-2.4.24/arch/i386/boot/Makefile 2001-08-05 13:13:19.000000000 -0700
+++ linux-2.4.24-hal/arch/i386/boot/Makefile 2004-01-14 12:29:52.000000000 -0800
@@ -8,6 +8,10 @@
# Copyright (C) 1994 by Linus Torvalds
#
+ifdef CONFIG_X86_HAL
+AFLAGS += -DNO_X86_HAL_INCLUDES
+endif
+
BOOT_INCL = $(TOPDIR)/include/linux/config.h \
$(TOPDIR)/include/linux/autoconf.h \
$(TOPDIR)/include/asm/boot.h
diff -urN linux-2.4.24/arch/i386/config.in linux-2.4.24-hal/arch/i386/config.in
--- linux-2.4.24/arch/i386/config.in 2003-11-28 10:26:19.000000000 -0800
+++ linux-2.4.24-hal/arch/i386/config.in 2004-01-14 12:31:47.000000000 -0800
@@ -485,5 +485,21 @@
endmenu
+mainmenu_option next_comment
+comment 'Virtual Machines'
+
+if [ "$CONFIG_HIGHMEM" = "n" -a \
+ "$CONFIG_SMP" = "n" -a \
+ "$CONFIG_M386" = "n" -a \
+ "$CONFIG_MATH_EMULATION" = "y" -a \
+ "$CONFIG_X86_UP_APIC" = "n" ]; then
+ bool 'Compile for plex86 VM (experimental)' CONFIG_X86_HAL
+ if [ "$CONFIG_X86_HAL" = "y" ]; then
+ define_bool CONFIG_DUMMY_KEYB y
+ fi
+fi
+
+endmenu
+
source crypto/Config.in
source lib/Config.in
diff -urN linux-2.4.24/arch/i386/kernel/dmi_scan.c linux-2.4.24-hal/arch/i386/kernel/dmi_scan.c
--- linux-2.4.24/arch/i386/kernel/dmi_scan.c 2003-11-28 10:26:19.000000000 -0800
+++ linux-2.4.24-hal/arch/i386/kernel/dmi_scan.c 2004-01-14 12:33:20.000000000 -0800
@@ -434,7 +434,7 @@
#ifdef CONFIG_VT
if (pm_kbd_request_override == NULL)
{
- pm_kbd_request_override = pckbd_pm_resume;
+ pm_kbd_request_override = kbd_pm_resume;
printk(KERN_INFO "%s machine detected. Mousepad Resume Bug workaround enabled.\n", d->ident);
}
#endif
diff -urN linux-2.4.24/drivers/char/dummy_keyb.c linux-2.4.24-hal/drivers/char/dummy_keyb.c
--- linux-2.4.24/drivers/char/dummy_keyb.c 2003-08-25 04:44:41.000000000 -0700
+++ linux-2.4.24-hal/drivers/char/dummy_keyb.c 2004-01-14 14:34:53.000000000 -0800
@@ -29,6 +29,13 @@
#include
#include
#include
+#include
+
+#ifdef CONFIG_X86_HAL
+void panic_blink(void)
+{
+}
+#endif
void kbd_leds(unsigned char leds)
{
@@ -140,3 +147,8 @@
{
printk("Dummy keyboard driver installed.\n");
}
+
+int kbd_pm_resume(struct pm_dev *dev, pm_request_t rqst, void *data)
+{
+ return 0;
+}
diff -urN linux-2.4.24/include/asm-i386/eflags_if.h linux-2.4.24-hal/include/asm-i386/eflags_if.h
--- linux-2.4.24/include/asm-i386/eflags_if.h 1969-12-31 16:00:00.000000000 -0800
+++ linux-2.4.24-hal/include/asm-i386/eflags_if.h 2004-01-14 12:35:30.000000000 -0800
@@ -0,0 +1,162 @@
+#ifndef NO_X86_HAL_INCLUDES
+/*
+ * Routines to manipulate the interrupt flag (EFLAGS.IF). Abstracting
+ * them, makes it easier to compile for a hardware abstraction layer (HAL).
+ *
+ * (c) 2003 Kevin P. Lawton
+ */
+
+#ifndef _LINUX_ASM_IF_H_
+#define _LINUX_ASM_IF_H_
+
+
+/* NOTE: This file is directly included via the "-include include/asm/if.h"
+ * option conditionally added to the compiler flags by the top Makefile when
+ * CONFIG_X86_HAL is defined. None of the header files have been included
+ * at this point.
+ */
+
+/* For a HAL (Hardware Abstraction Layer) compile, the kernel is executed
+ * at PL=3 using PVI (Protected mode Virtual Interrupts), which are the
+ * analog to VME for v86 code. For some reason, The Creators stopped short of
+ * implementing proper IF handling for PUSHF/POPF for PVI, but STI/CLI are
+ * fine. So we have to complete the PVI semantics using the following
+ * sequences.
+ */
+
+/* Shield your eyes. These macros make it possible to use the same
+ * code for asm or C inline asm, with all the quoting, comma, and
+ * newline issues. Q1 is for lines with no commas, and Q2 is for lines
+ * with one comma.
+ */
+#ifdef __ASSEMBLY__
+#define Q1(s0) s0
+#define Q2(s0, s1) s0, s1
+#else
+#define Q1(s0) #s0 "\n\t"
+#define Q2(s0, s1) #s0 "," #s1 "\n\t"
+#endif
+
+
+#ifndef __ASSEMBLY__
+__asm__ (
+#endif
+
+ Q1(.macro cli)
+ Q1(.byte 0xfa) /* cli (native instruction works fine in PVI) */
+ Q1(.endm)
+
+ Q1(.macro sti)
+ Q1(.byte 0xfb) /* sti (native instruction works fine in PVI) */
+ Q1(.endm)
+
+ Q1(.macro iret)
+ Q1(.byte 0xf0) /* LOCK: prefix will cause a fault. */
+ Q1(.byte 0xcf) /* iret */
+ Q1(.endm)
+
+#ifndef __ASSEMBLY__
+ );
+#endif
+
+
+
+/* PUSHFL:
+ * When execution is monitored using PVI (Protected mode Virtual Interrupts),
+ * we have to complete the PVI semantics of the PUSHFL instruction, as
+ * per behaviour of VME.
+ *
+ * b19 b9
+ * CPU image of eflags: VIF IF
+ * |
+ * +------------+
+ * |
+ * v
+ * Stack image of eflags: VIF IF
+ *
+ * Notes: VIF on the stack image could be cleared, if it matters.
+ */
+
+#ifndef __ASSEMBLY__
+__asm__ (
+#endif
+
+ Q1( .macro pushfl)
+ Q1( .byte 0x9c) /* (pushfl) Final eflags stack image. */
+ Q1( .byte 0x9c) /* (pushfl) For restoring arith flags. */
+ Q2( testl $(1<<19), 4(%esp)) /* Was VIF bit set? */
+ Q1( jz 69001f)
+ Q2( orl $(1<<9), 4(%esp)) /* Yes: set stack image of IF. */
+ Q1( jmp 69002f)
+ Q1(69001:) /* Use the zip of Lyon France :^} */
+ Q2( andl $~(1<<9), 4(%esp)) /* No: clear stack image of IF. */
+ Q1(69002:)
+ Q1( .byte 0x9d) /* (popfl) Restore arithmetic flags. */
+ Q1( .endm)
+
+ /* The user may use pushf with an implicit size. Just expand that
+ * to the previous macro.
+ */
+ Q1(.macro pushf)
+ Q1(pushfl)
+ Q1(.endm)
+
+#ifndef __ASSEMBLY__
+ );
+#endif
+
+
+
+/* POPFL:
+ * When execution is monitored using PVI (Protected mode Virtual Interrupts),
+ * we have to complete the PVI semantics of the POPFL instruction, as
+ * per behaviour of VME.
+ *
+ * b19 b9
+ * Stack image of eflags: VIF IF
+ * |
+ * +------------+
+ * |
+ * v
+ * CPU image of eflags: VIF IF
+ *
+ * Notes: IF of the eflags register retains its previous value, which
+ * should be 1 (when monitored down to PL3, the processor ignores this
+ * bit in a POPF).
+ */
+
+#ifndef __ASSEMBLY__
+__asm__ (
+#endif
+
+ Q1( .macro popfl)
+ Q2( testl $(1<<9), 0(%esp)) /* Is IF set on stack image? */
+ Q1( jz 69003f)
+ Q1( .byte 0x9d) /* (popfl) Yes: restore from stack and */
+ Q1( sti) /* force VIF=1. */
+ Q1( jmp 69004f)
+ Q1(69003:)
+ Q1( .byte 0x9d) /* (popfl) No: restore from stack and */
+ Q1( cli) /* force VIF=0. */
+ Q1(69004:)
+ Q1( .endm)
+
+ /* The user may use popf with an implicit size. Just expand that
+ * to the previous macro.
+ */
+ Q1(.macro popf)
+ Q1(popfl)
+ Q1(.endm)
+
+#ifndef __ASSEMBLY__
+ );
+#endif
+
+/* Get rid of quoting macros - good housekeeping. */
+#undef Q1
+#undef Q2
+
+
+#endif /* _LINUX_ASM_IF_H_ */
+
+#endif /* NO_X86_HAL_INCLUDES */
diff -urN linux-2.4.24/include/asm-i386/keyboard.h linux-2.4.24-hal/include/asm-i386/keyboard.h
--- linux-2.4.24/include/asm-i386/keyboard.h 2004-01-14 14:54:31.000000000 -0800
+++ linux-2.4.24-hal/include/asm-i386/keyboard.h 2004-01-14 14:27:51.000000000 -0800
@@ -22,6 +22,26 @@
#define KEYBOARD_IRQ 1
#define DISABLE_KBD_DURING_INTERRUPTS 0
+#ifdef CONFIG_DUMMY_KEYB
+
+extern int kbd_setkeycode(unsigned int scancode, unsigned int keycode);
+extern int kbd_getkeycode(unsigned int scancode);
+extern int kbd_translate(unsigned char scancode, unsigned char *keycode,
+ char raw_mode);
+extern char kbd_unexpected_up(unsigned char keycode);
+extern void kbd_leds(unsigned char leds);
+extern void kbd_init_hw(void);
+extern int kbd_pm_resume(struct pm_dev *, pm_request_t, void *);
+
+#else
+#define kbd_setkeycode pckbd_setkeycode
+#define kbd_getkeycode pckbd_getkeycode
+#define kbd_translate pckbd_translate
+#define kbd_unexpected_up pckbd_unexpected_up
+#define kbd_leds pckbd_leds
+#define kbd_init_hw pckbd_init_hw
+#define kbd_pm_resume pckbd_pm_resume
+
extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
extern int pckbd_getkeycode(unsigned int scancode);
extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
@@ -30,15 +50,11 @@
extern void pckbd_leds(unsigned char leds);
extern void pckbd_init_hw(void);
extern int pckbd_pm_resume(struct pm_dev *, pm_request_t, void *);
+#endif
+
extern pm_callback pm_kbd_request_override;
extern unsigned char pckbd_sysrq_xlate[128];
-#define kbd_setkeycode pckbd_setkeycode
-#define kbd_getkeycode pckbd_getkeycode
-#define kbd_translate pckbd_translate
-#define kbd_unexpected_up pckbd_unexpected_up
-#define kbd_leds pckbd_leds
-#define kbd_init_hw pckbd_init_hw
#define kbd_sysrq_xlate pckbd_sysrq_xlate
#define SYSRQ_KEY 0x54
diff -urN linux-2.4.24/init/main.c linux-2.4.24-hal/init/main.c
--- linux-2.4.24/init/main.c 2003-11-28 10:26:21.000000000 -0800
+++ linux-2.4.24-hal/init/main.c 2004-01-14 12:40:02.000000000 -0800
@@ -162,11 +162,29 @@
better than 1% */
#define LPS_PREC 8
+#define LPJ_BOGOMIPS_RATIO (500000/HZ)
+static unsigned long bogomips = 0;
+
+static int __init bogomips_setup(char *str)
+{
+ bogomips = simple_strtoul(str, 0, 0);
+ loops_per_jiffy = bogomips * LPJ_BOGOMIPS_RATIO;
+ return 1;
+}
+
+__setup("bogomips=", bogomips_setup);
+
+
void __init calibrate_delay(void)
{
unsigned long ticks, loopbit;
int lps_precision = LPS_PREC;
+ /* If the kernel was passed a bogomips= option, calibration is calculated
+ * from that - nothing left to do.
+ */
+ if ( bogomips ) goto print_bogomips;
+
loops_per_jiffy = (1<<12);
printk("Calibrating delay loop... ");
@@ -197,10 +215,12 @@
loops_per_jiffy &= ~loopbit;
}
+print_bogomips:
+
/* Round the value and print it */
printk("%lu.%02lu BogoMIPS\n",
- loops_per_jiffy/(500000/HZ),
- (loops_per_jiffy/(5000/HZ)) % 100);
+ loops_per_jiffy/LPJ_BOGOMIPS_RATIO,
+ (loops_per_jiffy/(LPJ_BOGOMIPS_RATIO/100)) % 100);
}
static int __init debug_kernel(char *str)