summaryrefslogtreecommitdiff
path: root/packages/linux/linux-colinux-2.4.28/colinux-0.6.1.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux/linux-colinux-2.4.28/colinux-0.6.1.patch')
-rw-r--r--packages/linux/linux-colinux-2.4.28/colinux-0.6.1.patch5156
1 files changed, 0 insertions, 5156 deletions
diff --git a/packages/linux/linux-colinux-2.4.28/colinux-0.6.1.patch b/packages/linux/linux-colinux-2.4.28/colinux-0.6.1.patch
deleted file mode 100644
index fca3c277ee..0000000000
--- a/packages/linux/linux-colinux-2.4.28/colinux-0.6.1.patch
+++ /dev/null
@@ -1,5156 +0,0 @@
-
-#
-# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
-#
-
---- linux-2.4.28/CREDITS~colinux-0.6.1 2004-11-17 06:54:20.000000000 -0500
-+++ linux-2.4.28/CREDITS 2004-11-27 15:59:21.283010512 -0500
-@@ -54,6 +54,12 @@
- S: CH-1015 Lausanne
- S: Switzerland
-
-+A: Dan Aloni
-+E: da-x@gmx.net
-+D: Cooperative Linux
-+D: Various kernel patches
-+S: Israel
-+
- N: Tim Alpaerts
- E: tim_alpaerts@toyota-motor-europe.com
- D: 802.2 class II logical link control layer,
---- linux-2.4.28/Documentation/devices.txt~colinux-0.6.1 2004-02-18 08:36:30.000000000 -0500
-+++ linux-2.4.28/Documentation/devices.txt 2004-11-27 15:59:21.285010208 -0500
-@@ -1926,6 +1926,13 @@
- 17 = /dev/cosa1c1 2nd board, 2nd channel
- ...
-
-+ block coLinux Block devices
-+ 0 = /dev/cobd0 First coLinux device
-+ 1 = /dev/cobd1 Second coLinux device
-+ ...
-+
-+ These block devices map to files or devices in the host FS.
-+
- 118 char Solidum ???
- 0 = /dev/solnp0
- 1 = /dev/solnp1
---- linux-2.4.28/Makefile~colinux-0.6.1 2004-11-17 06:54:22.000000000 -0500
-+++ linux-2.4.28/Makefile 2004-11-27 15:59:30.235649504 -0500
-@@ -1,7 +1,7 @@
- VERSION = 2
- PATCHLEVEL = 4
- SUBLEVEL = 28
--EXTRAVERSION =
-+EXTRAVERSION = -co-0.6.1
-
- KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
-
-@@ -27,7 +27,11 @@
-
- AS = $(CROSS_COMPILE)as
- LD = $(CROSS_COMPILE)ld
--CC = $(CROSS_COMPILE)gcc
-+ifeq ($(GCCTRACE),Y)
-+CC = $(CROSS_COMPILE)$(COLINUX_ROOT)/bin/tracewrapper.py gcc
-+else
-+CC = $(CROSS_COMPILE)gcc
-+endif
- CPP = $(CC) -E
- AR = $(CROSS_COMPILE)ar
- NM = $(CROSS_COMPILE)nm
---- linux-2.4.28/arch/i386/config.in~colinux-0.6.1 2004-11-17 06:54:21.000000000 -0500
-+++ linux-2.4.28/arch/i386/config.in 2004-11-27 15:59:21.286010056 -0500
-@@ -226,13 +226,20 @@
- bool 'MTRR (Memory Type Range Register) support' CONFIG_MTRR
- bool 'Symmetric multi-processing support' CONFIG_SMP
- if [ "$CONFIG_SMP" != "y" ]; then
-- bool 'Local APIC support on uniprocessors' CONFIG_X86_UP_APIC
-- dep_bool 'IO-APIC support on uniprocessors' CONFIG_X86_UP_IOAPIC $CONFIG_X86_UP_APIC
-- if [ "$CONFIG_X86_UP_APIC" = "y" ]; then
-- define_bool CONFIG_X86_LOCAL_APIC y
-- fi
-- if [ "$CONFIG_X86_UP_IOAPIC" = "y" ]; then
-- define_bool CONFIG_X86_IO_APIC y
-+ if [ "$CONFIG_COOPERATIVE" = "y" ]; then
-+ bool 'Cooperative PIC (COPIC) support' CONFIG_X86_UP_COPIC
-+ if [ "$CONFIG_X86_UP_COPIC" = "y" ]; then
-+ define_bool CONFIG_X86_COPIC y
-+ fi
-+ else
-+ bool 'Local APIC support on uniprocessors' CONFIG_X86_UP_APIC
-+ dep_bool 'IO-APIC support on uniprocessors' CONFIG_X86_UP_IOAPIC $CONFIG_X86_UP_APIC
-+ if [ "$CONFIG_X86_UP_APIC" = "y" ]; then
-+ define_bool CONFIG_X86_LOCAL_APIC y
-+ fi
-+ if [ "$CONFIG_X86_UP_IOAPIC" = "y" ]; then
-+ define_bool CONFIG_X86_IO_APIC y
-+ fi
- fi
- else
- int 'Maximum number of CPUs (2-32)' CONFIG_NR_CPUS 32
-@@ -343,12 +350,13 @@
- bool ' Use real mode APM BIOS call to power off' CONFIG_APM_REAL_MODE_POWER_OFF
- fi
-
-+bool 'Cooperative Mode' CONFIG_COOPERATIVE
-+
- source drivers/acpi/Config.in
-
- endmenu
-
- source drivers/mtd/Config.in
--
- source drivers/parport/Config.in
-
- source drivers/pnp/Config.in
-@@ -445,7 +453,11 @@
- if [ "$CONFIG_VT" = "y" ]; then
- mainmenu_option next_comment
- comment 'Console drivers'
-- bool 'VGA text console' CONFIG_VGA_CONSOLE
-+ if [ "$CONFIG_COOPERATIVE" = "n" ]; then
-+ bool 'VGA text console' CONFIG_VGA_CONSOLE
-+ else
-+ bool 'coLinux Pseudo-VGA text console' CONFIG_COOPERATIVE_CONSOLE
-+ fi
- bool 'Video mode selection support' CONFIG_VIDEO_SELECT
- if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
- tristate 'MDA text console (dual-headed) (EXPERIMENTAL)' CONFIG_MDA_CONSOLE
---- linux-2.4.28/arch/i386/kernel/Makefile~colinux-0.6.1 2003-11-28 13:26:19.000000000 -0500
-+++ linux-2.4.28/arch/i386/kernel/Makefile 2004-11-27 15:59:21.287009904 -0500
-@@ -18,7 +18,7 @@
-
- obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
- ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \
-- pci-dma.o i386_ksyms.o i387.o bluesmoke.o dmi_scan.o
-+ pci-dma.o i386_ksyms.o i387.o bluesmoke.o dmi_scan.o cooperative.o \
-
-
- ifdef CONFIG_PCI
---- /dev/null 2004-04-06 13:56:48.000000000 -0400
-+++ linux-2.4.28/arch/i386/kernel/cooperative.c 2004-11-27 15:59:21.287009904 -0500
-@@ -0,0 +1,160 @@
-+#include <linux/kernel.h>
-+#include <linux/string.h>
-+#include <linux/interrupt.h>
-+#include <linux/mm.h>
-+
-+#include <asm/keyboard.h>
-+#include <linux/kbd_ll.h>
-+#include <linux/cooperative.h>
-+#include <asm/smp.h>
-+#include <asm/desc.h>
-+
-+CO_TRACE_STOP;
-+
-+
-+/*
-+ * The next asm code is the first Linux code that runs in the
-+ * coLinux kernel context. It receives %ecx which contains the
-+ * address of the passage page. The passage page code sets %ecx
-+ * to this value in its context restore part.
-+ */
-+
-+asm(
-+ ""
-+ ".section .text\n"
-+ ".globl colinux_start\n"
-+ "colinux_start:\n"
-+ " call colinux_start_arch\n"
-+ ".previous\n"
-+ "");
-+
-+static void colinux_early_cpu_init(void)
-+{
-+ /*
-+ * On the first switch to Linux we must set up a valid TR because
-+ * the passage page code assumes such one exists. This is basically
-+ * copied code from cpu_init().
-+ *
-+ * P.S this is protected by CO_TRACE_STOP so that we don't
-+ * have a monitor context switch.
-+ */
-+
-+ int nr = smp_processor_id();
-+ struct tss_struct * t = &init_tss[nr];
-+
-+ set_tss_desc(nr,t);
-+ gdt_table[__TSS(nr)].b &= 0xfffffdff;
-+ load_TR(nr);
-+ gdt_table[__TSS(nr)].b &= 0xfffffdff;
-+
-+ __asm__ __volatile__("movl %%cr4, %0" : "=r" (mmu_cr4_features));
-+}
-+
-+void colinux_start_arch()
-+{
-+ colinux_early_cpu_init();
-+ colinux_start_c();
-+}
-+
-+extern void ctrl_alt_del(void);
-+
-+void co_handle_device_interrupt(co_linux_message_t *message)
-+{
-+ unsigned long flags;
-+
-+ local_irq_save(flags);
-+
-+ switch (message->device) {
-+ case CO_DEVICE_TIMER: {
-+ co_linux_message_idle_t data = *(co_linux_message_idle_t *)message->data;
-+
-+ if (data.tick_count > HZ) {
-+ xtime.tv_sec += data.tick_count / HZ;
-+ data.tick_count -= ((data.tick_count / HZ) * HZ);
-+ }
-+
-+
-+ while (data.tick_count > 0) {
-+ struct pt_regs regs = {0, };
-+ regs.orig_eax = TIMER_IRQ;
-+ do_IRQ(regs);
-+
-+ data.tick_count--;
-+ }
-+ break;
-+ }
-+ case CO_DEVICE_POWER: {
-+ co_linux_message_power_t *type = (co_scan_code_t *)message->data;
-+ switch (type->type) {
-+ case CO_LINUX_MESSAGE_POWER_ALT_CTRL_DEL: {
-+ ctrl_alt_del();
-+ break;
-+ }
-+ }
-+ break;
-+ }
-+
-+ case CO_DEVICE_KEYBOARD: {
-+ struct pt_regs regs;
-+ co_received_message(message);
-+ regs.orig_eax = KEYBOARD_IRQ;
-+ do_IRQ(regs);
-+ break;
-+ }
-+
-+ case CO_DEVICE_NETWORK: {
-+ struct pt_regs regs;
-+ if (message->size > 1600) {
-+ printk("co_handle_device_interrupt: warning, packet len: %d\n", message->size);
-+ break;
-+ }
-+ co_received_message(message);
-+ regs.orig_eax = NETWORK_IRQ;
-+ do_IRQ(regs);
-+ break;
-+ }
-+ default:
-+ break;
-+ }
-+
-+ local_irq_restore(flags);
-+}
-+
-+void co_switch_wrapper_protected(void)
-+{
-+ /*
-+ * We don't trust the passage page code to safely restore %gs and %fs.
-+ *
-+ * This wrapper ensures that if %fs or %gs are invalid, the processes
-+ * exits with a segmentation fault rather than bringing down the
-+ * machine.
-+ **/
-+ unsigned long fs = 0;
-+ unsigned long gs = 0;
-+
-+ asm volatile("movl %%fs,%0": "=m" (fs));
-+ asm volatile("movl %%gs,%0": "=m" (gs));
-+
-+ /*
-+ * Nullify the registers so the passage page code restores to
-+ * null segment values on return.
-+ */
-+ asm volatile("movl %0, %%fs; movl %0, %%gs" : : "r" (0));
-+
-+ /* And switch... */
-+ co_switch();
-+
-+ /*
-+ * Safely restore the registers.
-+ */
-+ loadsegment(fs, fs);
-+ loadsegment(gs, gs);
-+}
-+
-+void co_switch_wrapper(void)
-+{
-+ co_switch_wrapper_protected();
-+}
-+
-+CO_TRACE_CONTINUE;
-+
---- linux-2.4.28/arch/i386/kernel/head.S~colinux-0.6.1 2003-11-28 13:26:19.000000000 -0500
-+++ linux-2.4.28/arch/i386/kernel/head.S 2004-11-27 15:59:21.287009904 -0500
-@@ -320,7 +320,7 @@
- ret
-
- ENTRY(stack_start)
-- .long SYMBOL_NAME(init_task_union)+8192
-+ .long SYMBOL_NAME(init_task_union)+8192-100
- .long __KERNEL_DS
-
- /* This is the default interrupt "handler" :-) */
-@@ -361,12 +361,14 @@
-
- ALIGN
- .word 0
-+.globl idt_descr
- idt_descr:
- .word IDT_ENTRIES*8-1 # idt contains 256 entries
- SYMBOL_NAME(idt):
- .long SYMBOL_NAME(idt_table)
-
- .word 0
-+.globl gdt_descr
- gdt_descr:
- .word GDT_ENTRIES*8-1
- SYMBOL_NAME(gdt):
---- linux-2.4.28/arch/i386/kernel/i387.c~colinux-0.6.1 2003-08-25 07:44:39.000000000 -0400
-+++ linux-2.4.28/arch/i386/kernel/i387.c 2004-11-27 15:59:21.288009752 -0500
-@@ -342,6 +342,8 @@
- return 1;
- }
-
-+CO_TRACE_STOP;
-+
- int save_i387( struct _fpstate *buf )
- {
- if ( !current->used_math )
-@@ -363,6 +365,8 @@
- }
- }
-
-+CO_TRACE_CONTINUE;
-+
- static inline int restore_i387_fsave( struct _fpstate *buf )
- {
- struct task_struct *tsk = current;
-@@ -383,6 +387,8 @@
- return err ? 1 : convert_fxsr_from_user( &tsk->thread.i387.fxsave, buf );
- }
-
-+CO_TRACE_STOP;
-+
- int restore_i387( struct _fpstate *buf )
- {
- int err;
-@@ -400,6 +406,8 @@
- return err;
- }
-
-+CO_TRACE_CONTINUE;
-+
- /*
- * ptrace request handlers.
- */
---- linux-2.4.28/arch/i386/kernel/i8259.c~colinux-0.6.1 2004-08-07 19:26:04.000000000 -0400
-+++ linux-2.4.28/arch/i386/kernel/i8259.c 2004-11-27 15:59:21.288009752 -0500
-@@ -24,6 +24,7 @@
- #include <asm/apic.h>
-
- #include <linux/irq.h>
-+#include <linux/cooperative.h>
-
- /*
- * Common place to define all x86 IRQ vectors
-@@ -121,6 +122,81 @@
- #undef IRQ
- #undef IRQLIST_16
-
-+#ifdef CONFIG_COOPERATIVE
-+
-+CO_TRACE_STOP;
-+
-+void proxy_interrupt_handler(unsigned long interrupt, struct pt_regs regs)
-+{
-+ co_passage_page->operation = CO_OPERATION_FORWARD_INTERRUPT;
-+ co_passage_page->params[0] = interrupt + 0x20;
-+ co_passage_page->params[1] = regs.eip;
-+ co_passage_page->params[2] = (unsigned long)(&((&interrupt)[10]));
-+ co_passage_page->host_state.flags &= ~(1 << 9); /* Turn IF off */
-+
-+ co_switch_wrapper();
-+ co_callback();
-+}
-+
-+CO_TRACE_CONTINUE;
-+
-+#define IRQLIST_16(x) \
-+ IRQ(x,0) IRQ(x,1) IRQ(x,2) IRQ(x,3) \
-+ IRQ(x,4) IRQ(x,5) IRQ(x,6) IRQ(x,7) \
-+ IRQ(x,8) IRQ(x,9) IRQ(x,a) IRQ(x,b) \
-+ IRQ(x,c) IRQ(x,d) IRQ(x,e) IRQ(x,f)
-+
-+#define IRQLIST_224 \
-+ IRQLIST_16(0x0) IRQLIST_16(0x1) IRQLIST_16(0x2) IRQLIST_16(0x3) \
-+ IRQLIST_16(0x4) IRQLIST_16(0x5) IRQLIST_16(0x6) IRQLIST_16(0x7) \
-+ IRQLIST_16(0x8) IRQLIST_16(0x9) IRQLIST_16(0xa) IRQLIST_16(0xb) \
-+ IRQLIST_16(0xc) IRQLIST_16(0xd)
-+
-+#define IRQ(x,y) \
-+ extern asmlinkage void IRQ_proxy_##x##y##_interrupt(void);
-+IRQLIST_224;
-+#undef IRQ
-+
-+struct _fpstate co_interrupt_register_state;
-+
-+#define BIRQ(id) \
-+asm( \
-+ "\n"__ALIGN_STR"\n" \
-+ ".section .text\n" \
-+ ".globl IRQ_proxy_" #id "_interrupt\n" \
-+ "IRQ_proxy_" #id "_interrupt:\n" \
-+ "push %eax\n\t" \
-+ SAVE_ALL \
-+ \
-+ "pushl $co_interrupt_register_state\n\t" \
-+ "call save_i387\n\t" \
-+ "popl %ebx\n\t" \
-+ "pushl $" #id "\n\t" \
-+ "call proxy_interrupt_handler\n\t" \
-+ "popl %ebx\n\t" \
-+ "pushl $co_interrupt_register_state\n\t" \
-+ "call restore_i387\n\t" \
-+ "popl %ebx\n\t" \
-+ \
-+ "jmp ret_from_intr\n" \
-+ ".previous\n" \
-+ ); \
-+
-+#define IRQ(x,y) BIRQ(x##y)
-+IRQLIST_224;
-+#undef IRQ
-+
-+#define IRQ(x,y) &IRQ_proxy_##x##y##_interrupt,
-+void (*proxy_interrupt[NR_IRQS])(void) = {
-+ IRQLIST_224
-+};
-+#undef IRQ
-+
-+#undef IRQLIST_16
-+#undef IRQLIST_224
-+
-+#endif
-+
- /*
- * This is the 'legacy' 8259A Programmable Interrupt Controller,
- * present in the majority of PC/AT boxes.
-@@ -441,15 +517,74 @@
- }
- }
-
-+#ifdef CONFIG_X86_COPIC
-+
-+/*
-+ * Not like you have any other choice other than using
-+ * COPIC in Cooperative mode.
-+ */
-+
-+static void end_COPIC_irq(unsigned int irq)
-+{
-+}
-+
-+#define shutdown_COPIC_irq disable_COPIC_irq
-+
-+static void mask_and_ack_COPIC(unsigned int irq)
-+{
-+}
-+
-+static unsigned int startup_COPIC_irq(unsigned int irq)
-+{
-+ return 0;
-+}
-+
-+void disable_COPIC_irq(unsigned int irq)
-+{
-+}
-+
-+void enable_COPIC_irq(unsigned int irq)
-+{
-+}
-+
-+static struct hw_interrupt_type co_pic_irq_type = {
-+ "CO-PIC",
-+ startup_COPIC_irq,
-+ shutdown_COPIC_irq,
-+ enable_COPIC_irq,
-+ disable_COPIC_irq,
-+ mask_and_ack_COPIC,
-+ end_COPIC_irq,
-+ NULL
-+};
-+
-+void __init init_COPIC_irqs(void)
-+{
-+ int i;
-+
-+ for (i = 0; i < NR_IRQS; i++) {
-+ irq_desc[i].status = IRQ_DISABLED;
-+ irq_desc[i].action = 0;
-+ irq_desc[i].depth = 1;
-+
-+ irq_desc[i].handler = &co_pic_irq_type;
-+ }
-+
-+}
-+
-+#endif
-+
- void __init init_IRQ(void)
- {
- int i;
-
-+#ifndef CONFIG_COOPERATIVE
- #ifndef CONFIG_X86_VISWS_APIC
- init_ISA_irqs();
- #else
- init_VISWS_APIC_irqs();
- #endif
-+
- /*
- * Cover the whole vector space, no vector can escape
- * us. (some of these will be overridden and become
-@@ -490,6 +625,8 @@
- set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
- #endif
-
-+
-+#ifndef CONFIG_COOPERATIVE
- /*
- * Set the clock to HZ Hz, we already have a valid
- * vector now:
-@@ -509,4 +646,20 @@
- */
- if (boot_cpu_data.hard_math && !cpu_has_fpu)
- setup_irq(13, &irq13);
-+#endif
-+
-+#else
-+ printk("Setting proxy interrupt vectors\n");
-+
-+#ifdef CONFIG_X86_COPIC
-+ init_COPIC_irqs();
-+#endif
-+
-+ for (i = 0; i < NR_IRQS; i++) {
-+ int vector = FIRST_EXTERNAL_VECTOR + i;
-+ if (vector != SYSCALL_VECTOR) {
-+ set_intr_gate(vector, proxy_interrupt[i]);
-+ }
-+ }
-+#endif
- }
---- linux-2.4.28/arch/i386/kernel/ioport.c~colinux-0.6.1 2003-06-13 10:51:29.000000000 -0400
-+++ linux-2.4.28/arch/i386/kernel/ioport.c 2004-11-27 15:59:21.289009600 -0500
-@@ -54,6 +54,7 @@
- */
- asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
- {
-+#ifndef CONFIG_COOPERATIVE
- struct thread_struct * t = &current->thread;
- struct tss_struct * tss = init_tss + smp_processor_id();
-
-@@ -86,6 +87,10 @@
- }
-
- return 0;
-+#else
-+ /* No ports for yer VM */
-+ return -EPERM;
-+#endif
- }
-
- /*
-@@ -101,6 +106,7 @@
-
- asmlinkage int sys_iopl(unsigned long unused)
- {
-+#ifndef CONFIG_COOPERATIVE
- struct pt_regs * regs = (struct pt_regs *) &unused;
- unsigned int level = regs->ebx;
- unsigned int old = (regs->eflags >> 12) & 3;
-@@ -114,4 +120,8 @@
- }
- regs->eflags = (regs->eflags & 0xffffcfff) | (level << 12);
- return 0;
-+#else
-+ /* No IPL for yer VM */
-+ return -EPERM;
-+#endif
- }
---- linux-2.4.28/arch/i386/kernel/process.c~colinux-0.6.1 2004-11-17 06:54:21.000000000 -0500
-+++ linux-2.4.28/arch/i386/kernel/process.c 2004-11-27 15:59:21.289009600 -0500
-@@ -51,6 +51,7 @@
- #include <asm/apic.h>
-
- #include <linux/irq.h>
-+#include <linux/cooperative.h>
-
- asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
-
-@@ -131,11 +132,15 @@
- current->counter = -100;
-
- while (1) {
-+#ifdef CONFIG_COOPERATIVE
-+ co_idle_processor();
-+#else
- void (*idle)(void) = pm_idle;
- if (!idle)
- idle = default_idle;
- while (!current->need_resched)
- idle();
-+#endif
- schedule();
- check_pgt_cache();
- }
-@@ -280,6 +285,7 @@
- */
- void machine_real_restart(unsigned char *code, int length)
- {
-+#ifndef CONFIG_COOPERATIVE
- unsigned long flags;
-
- cli();
-@@ -363,10 +369,14 @@
- __asm__ __volatile__ ("ljmp $0x0008,%0"
- :
- : "i" ((void *) (0x1000 - sizeof (real_mode_switch) - 100)));
-+#else
-+ co_terminate(CO_TERMINATE_REBOOT);
-+#endif
- }
-
- void machine_restart(char * __unused)
- {
-+#ifndef CONFIG_COOPERATIVE
- #if CONFIG_SMP
- int cpuid;
-
-@@ -430,16 +440,26 @@
- }
-
- machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
-+#else
-+ co_terminate(CO_TERMINATE_REBOOT);
-+#endif
- }
-
- void machine_halt(void)
- {
-+#ifdef CONFIG_COOPERATIVE
-+ co_terminate(CO_TERMINATE_HALT);
-+#endif
- }
-
- void machine_power_off(void)
- {
-+#ifndef CONFIG_COOPERATIVE
- if (pm_power_off)
- pm_power_off();
-+#else
-+ co_terminate(CO_TERMINATE_POWEROFF);
-+#endif
- }
-
- extern void show_trace(unsigned long* esp);
-@@ -657,12 +677,20 @@
- */
- tss->esp0 = next->esp0;
-
-+#ifdef CONFIG_COOPERATIVE
-+ /*
-+ * We would save %fs and %gs using an atomic operation in the
-+ * just before the LDT of the next process is loaded. It is
-+ * not here, it's in...
-+ */
-+#else
- /*
- * Save away %fs and %gs. No need to save %es and %ds, as
- * those are always kernel segments while inside the kernel.
- */
- asm volatile("movl %%fs,%0":"=m" (*(int *)&prev->fs));
- asm volatile("movl %%gs,%0":"=m" (*(int *)&prev->gs));
-+#endif
-
- /*
- * Restore %fs and %gs.
---- linux-2.4.28/arch/i386/kernel/setup.c~colinux-0.6.1 2004-08-07 19:26:04.000000000 -0400
-+++ linux-2.4.28/arch/i386/kernel/setup.c 2004-11-27 15:59:21.291009296 -0500
-@@ -108,6 +108,7 @@
- #include <asm/processor.h>
- #include <linux/console.h>
- #include <linux/module.h>
-+#include <linux/cooperative.h>
- #include <asm/mtrr.h>
- #include <asm/uaccess.h>
- #include <asm/system.h>
-@@ -782,9 +783,18 @@
- int len = 0;
- int userdef = 0;
-
-+#ifdef CONFIG_COOPERATIVE
-+ /*
-+ * Better to have 'root=/dev/cobd0' here.
-+ */
-+ from = co_boot_parameters;
-+ snprintf(saved_command_line, COMMAND_LINE_SIZE, "%s",
-+ co_boot_parameters);
-+#else
- /* Save unparsed command line copy for /proc/cmdline */
- memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
- saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
-+#endif
-
- for (;;) {
- if (c != ' ')
-@@ -1044,16 +1054,23 @@
- static unsigned long __init setup_memory(void)
- {
- unsigned long bootmap_size, start_pfn, max_low_pfn;
--
-+#ifdef CONFIG_COOPERATIVE
-+ unsigned long bootmem_size;
-+ unsigned long bootmem_start;
-+#endif
- /*
- * partially used pages are not usable - thus
- * we are rounding upwards:
- */
- start_pfn = PFN_UP(__pa(&_end));
-
-+#ifdef CONFIG_COOPERATIVE
-+ max_low_pfn = max_pfn = co_memory_size / PAGE_SIZE;
-+#else
- find_max_pfn();
-
- max_low_pfn = find_max_low_pfn();
-+#endif
-
- #ifdef CONFIG_HIGHMEM
- highstart_pfn = highend_pfn = max_pfn;
-@@ -1065,12 +1082,19 @@
- #endif
- printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
- pages_to_mb(max_low_pfn));
-+
- /*
- * Initialize the boot-time allocator (with low memory only):
- */
- bootmap_size = init_bootmem(start_pfn, max_low_pfn);
-
-- register_bootmem_low_pages(max_low_pfn);
-+#ifdef CONFIG_COOPERATIVE
-+ bootmap_size = (bootmap_size + PAGE_SIZE - 1) & PAGE_MASK;
-+ bootmem_size = (0x800 << PAGE_SHIFT) - bootmap_size;
-+ bootmem_start = co_core_end + bootmap_size;
-+
-+ free_bootmem(__pa(bootmem_start), bootmem_size);
-+#else
-
- /*
- * Reserve the bootmem bitmap itself as well. We do this in two
-@@ -1124,7 +1148,7 @@
- }
- }
- #endif
--
-+#endif
- return max_low_pfn;
- }
-
-@@ -1176,7 +1200,9 @@
-
- void __init setup_arch(char **cmdline_p)
- {
-+#ifndef CONFIG_COOPERATIVE
- unsigned long max_low_pfn;
-+#endif
-
- #ifdef CONFIG_VISWS
- visws_get_board_type_and_rev();
-@@ -1186,6 +1212,7 @@
- blk_nohighio = 1;
- #endif
-
-+ boot_cpu_data.hard_math = 1;
- ROOT_DEV = to_kdev_t(ORIG_ROOT_DEV);
- drive_info = DRIVE_INFO;
- screen_info = SCREEN_INFO;
-@@ -1203,7 +1230,10 @@
- rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0);
- rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0);
- #endif
-+
-+#ifndef CONFIG_COOPERATIVE
- setup_memory_region();
-+#endif
- copy_edd();
-
- if (!MOUNT_ROOT_RDONLY)
-@@ -1230,8 +1260,10 @@
- #ifdef CONFIG_SMP
- smp_alloc_memory(); /* AP processor realmode stacks in low memory*/
- #endif
-+
- paging_init();
-
-+#ifndef CONFIG_COOPERATIVE
- dmi_scan_machine();
-
- /*
-@@ -1248,14 +1280,19 @@
- #endif
-
- register_memory(max_low_pfn);
-+#endif
-
- #ifdef CONFIG_VT
-+#ifdef CONFIG_COOPERATIVE_CONSOLE
-+ conswitchp = &colinux_con;
-+#else
- #if defined(CONFIG_VGA_CONSOLE)
- conswitchp = &vga_con;
- #elif defined(CONFIG_DUMMY_CONSOLE)
- conswitchp = &dummy_con;
- #endif
- #endif
-+#endif
- }
-
- static int cachesize_override __initdata = -1;
-@@ -3216,29 +3253,41 @@
- if(current->mm)
- BUG();
- enter_lazy_tlb(&init_mm, current, nr);
--
- t->esp0 = current->thread.esp0;
-+
- set_tss_desc(nr,t);
- gdt_table[__TSS(nr)].b &= 0xfffffdff;
-+
- load_TR(nr);
- load_LDT(&init_mm.context);
-
- /*
- * Clear all 6 debug registers:
- */
--
-+#ifndef CONFIG_COOPERATIVE
- #define CD(register) __asm__("movl %0,%%db" #register ::"r"(0) );
-
- CD(0); CD(1); CD(2); CD(3); /* no db4 and db5 */; CD(6); CD(7);
-
- #undef CD
--
-+#endif
- /*
- * Force FPU initialization:
- */
- current->flags &= ~PF_USEDFPU;
- current->used_math = 0;
-+#ifndef CONFIG_COOPERATIVE
- stts();
-+#else
-+#if (0)
-+ clear_in_cr4(X86_CR4_PVI);
-+ clear_in_cr4(X86_CR4_DE);
-+ clear_in_cr4(X86_CR4_MCE);
-+ clear_in_cr4(X86_CR4_PGE);
-+ flush_tlb_all();
-+ clear_in_cr4(X86_CR4_OSXMMEXCPT);
-+#endif
-+#endif
- }
-
- /*
---- linux-2.4.28/arch/i386/kernel/time.c~colinux-0.6.1 2004-02-18 08:36:30.000000000 -0500
-+++ linux-2.4.28/arch/i386/kernel/time.c 2004-11-27 15:59:21.292009144 -0500
-@@ -84,8 +84,24 @@
-
- spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
-
--static inline unsigned long do_fast_gettimeoffset(void)
-+static inline unsigned long long rdtsc_u64(void)
-+{
-+ register unsigned long eax, edx;
-+
-+ rdtsc(eax,edx);
-+
-+ return ((((unsigned long long)edx) << 32) | eax);
-+}
-+
-+#ifdef CONFIG_COOPERATIVE
-+static unsigned long long co_last_interrupt_time;
-+static unsigned long co_tsc_per_5_ticks;
-+static long co_last_time_offset;
-+#endif
-+
-+static inline long do_fast_gettimeoffset(void)
- {
-+#ifndef CONFIG_COOPERATIVE
- register unsigned long eax, edx;
-
- /* Read the Time Stamp Counter */
-@@ -111,6 +127,32 @@
-
- /* our adjusted time offset in microseconds */
- return delay_at_last_interrupt + edx;
-+#else
-+ union {
-+ unsigned long long ll_var;
-+ struct { unsigned long low, high; };
-+ } differential;
-+ unsigned long edx;
-+ unsigned long ret = 0;
-+
-+ differential.ll_var = rdtsc_u64() - co_last_interrupt_time;
-+ if (differential.high)
-+ return 0;
-+
-+ if (co_tsc_per_5_ticks == 0)
-+ return 0;
-+
-+ differential.ll_var *= 50000;
-+
-+ __asm__("divl %2"
-+ :"=a" (ret), "=d" (edx)
-+ :"r" (co_tsc_per_5_ticks),
-+ "0" (differential.low), "1" (differential.high));
-+
-+ ret += co_last_time_offset;
-+
-+ return ret;
-+#endif
- }
-
- #define TICK_SIZE tick
-@@ -121,6 +163,8 @@
-
- extern spinlock_t i8259A_lock;
-
-+#ifndef CONFIG_COOPERATIVE
-+
- #ifndef CONFIG_X86_TSC
-
- /* This function must be called with interrupts disabled
-@@ -254,7 +298,16 @@
- return count;
- }
-
--static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
-+#else
-+
-+static unsigned long do_slow_gettimeoffset(void)
-+{
-+ return 0;
-+}
-+
-+#endif
-+
-+static long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
-
-
- /* IBM Summit (EXA) Cyclone Timer code*/
-@@ -305,7 +358,7 @@
- delay_at_last_interrupt = (count + LATCH/2) / LATCH;
- }
-
--static unsigned long do_gettimeoffset_cyclone(void)
-+static long do_gettimeoffset_cyclone(void)
- {
- u32 offset;
-
-@@ -443,7 +496,8 @@
- void do_gettimeofday(struct timeval *tv)
- {
- unsigned long flags;
-- unsigned long usec, sec;
-+ unsigned long sec;
-+ long usec;
-
- read_lock_irqsave(&xtime_lock, flags);
- usec = do_gettimeoffset();
-@@ -461,6 +515,11 @@
- sec++;
- }
-
-+ if (usec < 0) {
-+ usec = usec + 1000000;
-+ sec -= 1;
-+ }
-+
- tv->tv_sec = sec;
- tv->tv_usec = usec;
- }
-@@ -502,6 +561,7 @@
- */
- static int set_rtc_mmss(unsigned long nowtime)
- {
-+#ifndef CONFIG_COOPERATIVE
- int retval = 0;
- int real_seconds, real_minutes, cmos_minutes;
- unsigned char save_control, save_freq_select;
-@@ -554,8 +614,13 @@
- CMOS_WRITE(save_control, RTC_CONTROL);
- CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
- spin_unlock(&rtc_lock);
--
- return retval;
-+#else
-+ /*
-+ * Don't let Linux change the system time of the host machine.
-+ */
-+ return -1;
-+#endif
- }
-
- /* last time the cmos clock got updated */
-@@ -603,6 +668,7 @@
- smp_local_timer_interrupt(regs);
- #endif
-
-+#ifndef CONFIG_COOPERATIVE
- /*
- * If we have an externally synchronized Linux clock, then update
- * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
-@@ -617,6 +683,7 @@
- else
- last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
- }
-+#endif
-
- #ifdef CONFIG_MCA
- if( MCA_bus ) {
-@@ -655,6 +722,7 @@
- */
- write_lock(&xtime_lock);
-
-+#ifndef CONFIG_COOPERATIVE
- if(use_cyclone)
- mark_timeoffset_cyclone();
- else if (use_tsc) {
-@@ -706,7 +774,15 @@
- count = ((LATCH-1) - count) * TICK_SIZE;
- delay_at_last_interrupt = (count + LATCH/2) / LATCH;
- }
--
-+#else
-+ if (use_tsc) {
-+ if (co_last_interrupt_time == 0)
-+ co_last_time_offset = 0;
-+ else
-+ co_last_time_offset = ((long)do_fast_gettimeoffset()) - 10000;
-+ co_last_interrupt_time = rdtsc_u64();
-+ }
-+#endif
- do_timer_interrupt(irq, NULL, regs);
-
- write_unlock(&xtime_lock);
-@@ -716,6 +792,7 @@
- /* not static: needed by APM */
- unsigned long get_cmos_time(void)
- {
-+#ifndef CONFIG_COOPERATIVE
- unsigned int year, mon, day, hour, min, sec;
- int i;
-
-@@ -753,6 +830,9 @@
- if ((year += 1900) < 1970)
- year += 100;
- return mktime(year, mon, day, hour, min, sec);
-+#else
-+ return co_get_host_time();
-+#endif
- }
-
- static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, 0, "timer", NULL, NULL};
-@@ -818,6 +898,10 @@
- if (endlow <= CALIBRATE_TIME)
- goto bad_ctc;
-
-+#ifdef CONFIG_COOPERATIVE
-+ co_tsc_per_5_ticks = endlow;
-+#endif
-+
- __asm__("divl %2"
- :"=a" (endlow), "=d" (endhigh)
- :"r" (endlow), "0" (0), "1" (CALIBRATE_TIME));
-@@ -870,7 +954,13 @@
-
- if(use_cyclone)
- init_cyclone_clock();
--
-+
-+#ifdef CONFIG_COOPERATIVE
-+ /*
-+ * We pretty much depend on this at the moment...
-+ */
-+ set_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability);
-+#endif
- if (cpu_has_tsc) {
- unsigned long tsc_quotient = calibrate_tsc();
- if (tsc_quotient) {
---- linux-2.4.28/arch/i386/kernel/traps.c~colinux-0.6.1 2002-11-28 18:53:09.000000000 -0500
-+++ linux-2.4.28/arch/i386/kernel/traps.c 2004-11-27 15:59:21.293008992 -0500
-@@ -852,11 +852,20 @@
- "rorl $16,%%eax" \
- : "=m"(*(n)) : "a" (addr), "r"(n), "ir"(limit), "i"(type))
-
-+CO_TRACE_STOP;
-+
-+/*
-+ * We use this in colinux_early_cpu_init(), so it must be protected
-+ * from traces.
-+ */
-+
- void set_tss_desc(unsigned int n, void *addr)
- {
- _set_tssldt_desc(gdt_table+__TSS(n), (int)addr, 235, 0x89);
- }
-
-+CO_TRACE_CONTINUE;
-+
- void set_ldt_desc(unsigned int n, void *addr, unsigned int size)
- {
- _set_tssldt_desc(gdt_table+__LDT(n), (int)addr, ((size << 3)-1), 0x82);
---- linux-2.4.28/arch/i386/mm/fault.c~colinux-0.6.1 2004-08-07 19:26:04.000000000 -0400
-+++ linux-2.4.28/arch/i386/mm/fault.c 2004-11-27 15:59:21.293008992 -0500
-@@ -380,7 +380,11 @@
- pte_t *pte_k;
-
- asm("movl %%cr3,%0":"=r" (pgd));
-+#ifndef CONFIG_COOPERATIVE
- pgd = offset + (pgd_t *)__va(pgd);
-+#else
-+ pgd = offset + (pgd_t *)CO_VA(((unsigned long)pgd));
-+#endif
- pgd_k = init_mm.pgd + offset;
-
- if (!pgd_present(*pgd_k))
---- linux-2.4.28/arch/i386/mm/init.c~colinux-0.6.1 2004-04-14 09:05:25.000000000 -0400
-+++ linux-2.4.28/arch/i386/mm/init.c 2004-11-27 15:59:21.294008840 -0500
-@@ -38,6 +38,8 @@
- #include <asm/apic.h>
- #include <asm/tlb.h>
-
-+#include <linux/cooperative.h>
-+
- mmu_gather_t mmu_gathers[NR_CPUS];
- unsigned long highstart_pfn, highend_pfn;
- static unsigned long totalram_pages;
-@@ -122,7 +124,7 @@
-
- /* References to section boundaries */
-
--extern char _text, _etext, _edata, __bss_start, _end;
-+extern char _text, _etext, _edata, _sdata, __bss_start, _end;
- extern char __init_begin, __init_end;
-
- static inline void set_pte_phys (unsigned long vaddr,
-@@ -204,6 +206,7 @@
-
- static void __init pagetable_init (void)
- {
-+#ifndef CONFIG_COOPERATIVE
- unsigned long vaddr, end;
- pgd_t *pgd, *pgd_base;
- int i, j, k;
-@@ -300,6 +303,8 @@
- */
- pgd_base[0] = pgd_base[USER_PTRS_PER_PGD];
- #endif
-+#else
-+#endif
- }
-
- void __init zap_low_mappings (void)
-@@ -325,6 +330,7 @@
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
- unsigned int max_dma, high, low;
-
-+#ifndef CONFIG_COOPERATIVE
- max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
- low = max_low_pfn;
- high = highend_pfn;
-@@ -338,6 +344,11 @@
- zones_size[ZONE_HIGHMEM] = high - low;
- #endif
- }
-+#else
-+ zones_size[ZONE_DMA] = 0;
-+ zones_size[ZONE_NORMAL] = max_low_pfn;
-+ zones_size[ZONE_HIGHMEM] = 0;
-+#endif
- free_area_init(zones_size);
- }
-
-@@ -485,6 +496,22 @@
-
- bad_ppro = ppro_with_ram_bug();
-
-+#ifdef CONFIG_COOPERATIVE
-+ /*
-+ * Only at this stage, after the buddy allocator's maps
-+ * have been allocated, we can let the kernel use its
-+ * other pseudo physical space.
-+ */
-+ {
-+ unsigned long bootmem_end = co_core_end +
-+ (0x800 << PAGE_SHIFT);
-+ unsigned long physical_end = __PAGE_OFFSET +
-+ (max_low_pfn << PAGE_SHIFT);
-+
-+ free_bootmem(__pa(bootmem_end), physical_end - bootmem_end);
-+ }
-+
-+#endif
- /* this will put all low memory onto the freelists */
- totalram_pages += free_all_bootmem();
-
-@@ -529,7 +556,7 @@
- reservedpages = free_pages_init();
-
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
-- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
-+ datasize = (unsigned long) &_edata - (unsigned long) &_sdata;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
-@@ -546,19 +573,21 @@
- if (!cpu_has_pae)
- panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!");
- #endif
-+#ifndef CONFIG_COOPERATIVE
- if (boot_cpu_data.wp_works_ok < 0)
- test_wp_bit();
--
-+#endif
- /*
- * Subtle. SMP is doing it's boot stuff late (because it has to
- * fork idle threads) - but it also needs low mappings for the
- * protected-mode entry to work. We zap these entries only after
- * the WP-bit has been tested.
- */
-+#ifndef CONFIG_COOPERATIVE
- #ifndef CONFIG_SMP
- zap_low_mappings();
- #endif
--
-+#endif
- }
-
- /* Put this after the callers, so that it cannot be inlined */
---- linux-2.4.28/arch/