diff -uNr linux-2.6.20.1/arch/i386/kernel/bs2_entry.S linux-2.6.20.1-bs2d/arch/i386/kernel/bs2_entry.S
--- linux-2.6.20.1/arch/i386/kernel/bs2_entry.S	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.20.1-bs2d/arch/i386/kernel/bs2_entry.S	2007-04-19 14:22:57.000000000 +0200
@@ -0,0 +1,113 @@
+/*
+ *  linux/arch/i386/bs2_entry.S
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <linux/linkage.h>
+#include <asm/thread_info.h>
+#include <asm/irqflags.h>
+#include <asm/errno.h>
+#include <asm/segment.h>
+#include <asm/smp.h>
+#include <asm/page.h>
+#include <asm/desc.h>
+#include <asm/percpu.h>
+#include <asm/dwarf2.h>
+#include "irq_vectors.h"
+
+/*
+ * We use macros for low-level operations which need to be overridden
+ * for paravirtualization.  The following will never clobber any registers:
+ *   INTERRUPT_RETURN (aka. "iret")
+ *   GET_CR0_INTO_EAX (aka. "movl %cr0, %eax")
+ *   ENABLE_INTERRUPTS_SYSEXIT (aka "sti; sysexit").
+ *
+ * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must
+ * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY).
+ * Allowing a register to be clobbered can shrink the paravirt replacement
+ * enough to patch inline, increasing performance.
+ */
+
+#define nr_bs2_syscalls ((bs2_syscall_table_size)/4)
+
+CF_MASK		= 0x00000001
+TF_MASK		= 0x00000100
+IF_MASK		= 0x00000200
+DF_MASK		= 0x00000400 
+NT_MASK		= 0x00004000
+VM_MASK		= 0x00020000
+
+#define SAVE_ALL \
+	cld; \
+	pushl %gs; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	/*CFI_REL_OFFSET gs, 0;*/\
+	pushl %es; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	/*CFI_REL_OFFSET es, 0;*/\
+	pushl %ds; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	/*CFI_REL_OFFSET ds, 0;*/\
+	pushl %eax; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	CFI_REL_OFFSET eax, 0;\
+	pushl %ebp; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	CFI_REL_OFFSET ebp, 0;\
+	pushl %edi; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	CFI_REL_OFFSET edi, 0;\
+	pushl %esi; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	CFI_REL_OFFSET esi, 0;\
+	pushl %edx; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	CFI_REL_OFFSET edx, 0;\
+	pushl %ecx; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	CFI_REL_OFFSET ecx, 0;\
+	pushl %ebx; \
+	CFI_ADJUST_CFA_OFFSET 4;\
+	CFI_REL_OFFSET ebx, 0;\
+	movl $(__USER_DS), %edx; \
+	movl %edx, %ds; \
+	movl %edx, %es; \
+	movl $(__KERNEL_PDA), %edx; \
+	movl %edx, %gs
+
+#define RING0_INT_FRAME \
+	CFI_STARTPROC simple;\
+	CFI_SIGNAL_FRAME;\
+	CFI_DEF_CFA esp, 3*4;\
+	/*CFI_OFFSET cs, -2*4;*/\
+	CFI_OFFSET eip, -3*4
+
+
+	# system call handler stub
+ENTRY(bs2_system_call)
+	RING0_INT_FRAME			# can't unwind into user space anyway
+	pushl %eax			# save orig_eax
+	CFI_ADJUST_CFA_OFFSET 4
+	SAVE_ALL
+	GET_THREAD_INFO(%ebp)
+	testl $TF_MASK,PT_EFLAGS(%esp)
+	jz no_singlestep
+	orl $_TIF_SINGLESTEP,TI_flags(%ebp)
+no_singlestep:
+	cmpl $(nr_bs2_syscalls), %eax
+	jae syscall_badsys
+	call *bs2_sys_call_table(,%eax,4)
+	movl %eax,PT_EAX(%esp)		# store the return value
+	jmp syscall_exit
+
+syscall_badsys:
+	movl $-ENOSYS,PT_EAX(%esp)
+	jmp resume_userspace
+	CFI_ENDPROC
+
+
+.section .rodata,"a"
+#include "bs2_syscall_table.S"
+
+bs2_syscall_table_size=(.-bs2_sys_call_table)
diff -uNr linux-2.6.20.1/arch/i386/kernel/bs2_syscall_table.S linux-2.6.20.1-bs2d/arch/i386/kernel/bs2_syscall_table.S
--- linux-2.6.20.1/arch/i386/kernel/bs2_syscall_table.S	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.20.1-bs2d/arch/i386/kernel/bs2_syscall_table.S	2007-04-19 11:41:50.000000000 +0200
@@ -0,0 +1,2 @@
+ENTRY(bs2_sys_call_table)
+  	.long sys_bs2_0           /* 0 */
diff -uNr linux-2.6.20.1/arch/i386/kernel/entry.S linux-2.6.20.1-bs2d/arch/i386/kernel/entry.S
--- linux-2.6.20.1/arch/i386/kernel/entry.S	2007-02-20 07:34:32.000000000 +0100
+++ linux-2.6.20.1-bs2d/arch/i386/kernel/entry.S	2007-04-19 14:23:42.000000000 +0200
@@ -380,7 +380,7 @@
 syscall_call:
 	call *sys_call_table(,%eax,4)
 	movl %eax,PT_EAX(%esp)		# store the return value
-syscall_exit:
+ENTRY(syscall_exit)
 	DISABLE_INTERRUPTS(CLBR_ANY)	# make sure we don't miss an interrupt
 					# setting need_resched or sigpending
 					# between sampling and the iret
diff -uNr linux-2.6.20.1/arch/i386/kernel/i8259.c linux-2.6.20.1-bs2d/arch/i386/kernel/i8259.c
--- linux-2.6.20.1/arch/i386/kernel/i8259.c	2007-02-20 07:34:32.000000000 +0100
+++ linux-2.6.20.1-bs2d/arch/i386/kernel/i8259.c	2007-04-19 11:02:19.000000000 +0200
@@ -400,6 +400,8 @@
 		int vector = FIRST_EXTERNAL_VECTOR + i;
 		if (i >= NR_IRQS)
 			break;
+		if (vector == BS2_SYSCALL_VECTOR)  /* $$$ */
+			continue;
 		if (vector != SYSCALL_VECTOR) 
 			set_intr_gate(vector, interrupt[i]);
 	}
diff -uNr linux-2.6.20.1/arch/i386/kernel/io_apic.c linux-2.6.20.1-bs2d/arch/i386/kernel/io_apic.c
--- linux-2.6.20.1/arch/i386/kernel/io_apic.c	2007-02-20 07:34:32.000000000 +0100
+++ linux-2.6.20.1-bs2d/arch/i386/kernel/io_apic.c	2007-04-19 11:09:07.000000000 +0200
@@ -1247,6 +1247,8 @@
 		return -ENOSPC;
 	if (vector == SYSCALL_VECTOR)
 		goto next;
+	if (vector == BS2_SYSCALL_VECTOR)  /* $$$ */
+		goto next;
 	for (i = 0; i < NR_IRQ_VECTORS; i++)
 		if (irq_vector[i] == vector)
 			goto next;
diff -uNr linux-2.6.20.1/arch/i386/kernel/Makefile linux-2.6.20.1-bs2d/arch/i386/kernel/Makefile
--- linux-2.6.20.1/arch/i386/kernel/Makefile	2007-02-20 07:34:32.000000000 +0100
+++ linux-2.6.20.1-bs2d/arch/i386/kernel/Makefile	2007-04-19 11:04:26.000000000 +0200
@@ -7,7 +7,8 @@
 obj-y	:= process.o signal.o entry.o traps.o irq.o \
 		ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
 		pci-dma.o i386_ksyms.o i387.o bootflag.o e820.o\
-		quirks.o i8237.o topology.o alternative.o i8253.o tsc.o
+		quirks.o i8237.o topology.o alternative.o i8253.o tsc.o \
+		bs2_entry.o  # $$$
 
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-y				+= cpu/
diff -uNr linux-2.6.20.1/arch/i386/kernel/traps.c linux-2.6.20.1-bs2d/arch/i386/kernel/traps.c
--- linux-2.6.20.1/arch/i386/kernel/traps.c	2007-02-20 07:34:32.000000000 +0100
+++ linux-2.6.20.1-bs2d/arch/i386/kernel/traps.c	2007-04-19 11:02:19.000000000 +0200
@@ -62,6 +62,7 @@
 int panic_on_unrecovered_nmi;
 
 asmlinkage int system_call(void);
+asmlinkage int bs2_system_call(void); /* $$$ */
 
 /* Do we ignore FPU interrupts ? */
 char ignore_fpu_irq = 0;
@@ -1176,6 +1177,7 @@
 	}
 
 	set_system_gate(SYSCALL_VECTOR,&system_call);
+	set_system_gate(BS2_SYSCALL_VECTOR,&bs2_system_call); /* $$$ */
 
 	/*
 	 * Should be a barrier for any external CPU state.
diff -uNr linux-2.6.20.1/include/asm-i386/bs2_unistd.h linux-2.6.20.1-bs2d/include/asm-i386/bs2_unistd.h
--- linux-2.6.20.1/include/asm-i386/bs2_unistd.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.20.1-bs2d/include/asm-i386/bs2_unistd.h	2007-04-19 11:38:32.000000000 +0200
@@ -0,0 +1,10 @@
+#ifndef _ASM_I386_BS2_UNISTD_H_
+#define _ASM_I386_BS2_UNISTD_H_
+
+/*
+ * This file contains the BS2 system call numbers.
+ */
+
+#define __NR_bs2_0			0
+
+#endif /* _ASM_I386_BS2_UNISTD_H_ */
diff -uNr linux-2.6.20.1/include/asm-i386/mach-default/irq_vectors.h linux-2.6.20.1-bs2d/include/asm-i386/mach-default/irq_vectors.h
--- linux-2.6.20.1/include/asm-i386/mach-default/irq_vectors.h	2007-02-20 07:34:32.000000000 +0100
+++ linux-2.6.20.1-bs2d/include/asm-i386/mach-default/irq_vectors.h	2007-04-19 11:02:19.000000000 +0200
@@ -29,6 +29,7 @@
 #define FIRST_EXTERNAL_VECTOR	0x20
 
 #define SYSCALL_VECTOR		0x80
+#define BS2_SYSCALL_VECTOR      0x81  /* $$$ */
 
 /*
  * Vectors 0x20-0x2f are used for ISA interrupts.
diff -uNr linux-2.6.20.1/kernel/bs2.c linux-2.6.20.1-bs2d/kernel/bs2.c
--- linux-2.6.20.1/kernel/bs2.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.20.1-bs2d/kernel/bs2.c	2007-04-19 11:10:46.000000000 +0200
@@ -0,0 +1,16 @@
+/*
+ *  linux/kernel/bs2.c
+ *
+ *  simple system call example
+ */
+
+#include <linux/kernel.h>
+
+
+int bs2_0_callno;
+
+asmlinkage long sys_bs2_0(void)
+{
+        printk("bs2_0(): Hello World! call %d\n", bs2_0_callno++);
+        return 0;
+}
diff -uNr linux-2.6.20.1/kernel/Makefile linux-2.6.20.1-bs2d/kernel/Makefile
--- linux-2.6.20.1/kernel/Makefile	2007-02-20 07:34:32.000000000 +0100
+++ linux-2.6.20.1-bs2d/kernel/Makefile	2007-04-19 11:35:33.000000000 +0200
@@ -8,7 +8,7 @@
 	    signal.o sys.o kmod.o workqueue.o pid.o \
 	    rcupdate.o extable.o params.o posix-timers.o \
 	    kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
-	    hrtimer.o rwsem.o latency.o nsproxy.o srcu.o
+	    hrtimer.o rwsem.o latency.o nsproxy.o srcu.o bs2.o  # $$$
 
 obj-$(CONFIG_STACKTRACE) += stacktrace.o
 obj-y += time/
diff -uNr linux-2.6.20.1/localversion-bs2 linux-2.6.20.1-bs2d/localversion-bs2
--- linux-2.6.20.1/localversion-bs2	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.20.1-bs2d/localversion-bs2	2007-04-19 11:03:24.000000000 +0200
@@ -0,0 +1 @@
+-bs2d
