Index: linux-3.3/arch/x86/Kconfig.cpu
===================================================================
--- linux-3.3.orig/arch/x86/Kconfig.cpu	2012-03-19 00:15:34.000000000 +0100
+++ linux-3.3/arch/x86/Kconfig.cpu	2012-03-20 17:16:42.299678677 +0100
@@ -286,6 +286,19 @@
 
 endchoice
 
+config GEODE_NOPL
+	bool "Geode NOPL emulation"
+	depends on MGEODEGX1 || MGEODE_LX
+	---help---
+	  Select this to emulate the NOPL (long NOP) instruction
+	  This option allows to run binary compiled for i686 arch on
+	  a Geode processor.
+	  The cost of this emulation should only slighty affect performance
+	  since the emulator is just a null function (pratically a C NOP) and
+	  because consecutive NOPL instructions (asm padding, the usual NOPL usage)
+	  are executed in one cycle
+	  For info about NOPL read: http://www.tortall.net/projects/yasm/manual/html/arch-x86.html#arch-x86-nop
+
 config X86_GENERIC
 	bool "Generic x86 support"
 	depends on X86_32
@@ -405,7 +418,7 @@
 # generates cmov.
 config X86_CMOV
 	def_bool y
-	depends on (MK8 || MK7 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MATOM || MGEODE_LX)
+	depends on (MK8 || MK7 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MCRUSOE || MEFFICEON || X86_64 || MATOM || MGEODEGX1 || MGEODE_LX)
 
 config X86_MINIMUM_CPU_FAMILY
 	int
Index: linux-3.3/arch/x86/Makefile_32.cpu
===================================================================
--- linux-3.3.orig/arch/x86/Makefile_32.cpu	2012-03-19 00:15:34.000000000 +0100
+++ linux-3.3/arch/x86/Makefile_32.cpu	2012-03-20 17:16:42.299678677 +0100
@@ -40,8 +40,8 @@
 cflags-$(CONFIG_MELAN)		+= -march=i486
 
 # Geode GX1 support
-cflags-$(CONFIG_MGEODEGX1)	+= -march=pentium-mmx
-cflags-$(CONFIG_MGEODE_LX)	+= $(call cc-option,-march=geode,-march=pentium-mmx)
+cflags-$(CONFIG_MGEODEGX1)	+= -march=i686
+cflags-$(CONFIG_MGEODE_LX)	+= -march=i686
 # add at the end to overwrite eventual tuning options from earlier
 # cpu entries
 cflags-$(CONFIG_X86_GENERIC) 	+= $(call tune,generic,$(call tune,i686))
Index: linux-3.3/arch/x86/kernel/Makefile
===================================================================
--- linux-3.3.orig/arch/x86/kernel/Makefile	2012-03-19 00:15:34.000000000 +0100
+++ linux-3.3/arch/x86/kernel/Makefile	2012-03-20 17:16:42.309678678 +0100
@@ -79,6 +79,7 @@
 obj-$(CONFIG_APB_TIMER)		+= apb_timer.o
 
 obj-$(CONFIG_AMD_NB)		+= amd_nb.o
+obj-$(CONFIG_GEODE_NOPL)	+= nopl_emu.o
 obj-$(CONFIG_DEBUG_RODATA_TEST)	+= test_rodata.o
 obj-$(CONFIG_DEBUG_NX_TEST)	+= test_nx.o
 obj-$(CONFIG_DEBUG_NMI_SELFTEST) += nmi_selftest.o
Index: linux-3.3/arch/x86/kernel/cpu/amd.c
===================================================================
--- linux-3.3.orig/arch/x86/kernel/cpu/amd.c	2012-03-19 00:15:34.000000000 +0100
+++ linux-3.3/arch/x86/kernel/cpu/amd.c	2012-03-20 17:16:42.309678678 +0100
@@ -139,11 +139,15 @@
 		return;
 	}
 
+#ifdef CONFIG_GEODE_NOPL
 	if (c->x86_model == 10) {
-		/* AMD Geode LX is model 10 */
-		/* placeholder for any needed mods */
+		/* Geode only lacks the NOPL instruction to be i686,
+		   but we can promote it to a i686 class cpu
+		   and emulate NOPLs in the exception handler*/
+		boot_cpu_data.x86 = 6;
 		return;
 	}
+#endif
 }
 
 static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c)
Index: linux-3.3/arch/x86/kernel/nopl_emu.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-3.3/arch/x86/kernel/nopl_emu.c	2012-03-21 12:18:56.402149086 +0100
@@ -0,0 +1,132 @@
+/*
+ *  linux/arch/x86/kernel/nopl_emu.c
+ *
+ *  Copyright (C) 2002  Willy Tarreau
+ *  Copyright (C) 2010  Matteo Croce
+ */
+
+#include <linux/percpu.h>
+#include <asm/processor.h>
+#include <asm/traps.h>
+
+#ifdef CONFIG_DEBUG_FS
+#include <linux/debugfs.h>
+#endif
+
+/* This code can be used to allow the AMD Geode to hopefully correctly execute
+ * some code which was originally compiled for an i686, by emulating NOPL,
+ * the only missing i686 instruction in the CPU
+ *
+ * Willy Tarreau <willy@meta-x.org>
+ * Matteo Croce <technoboy85@gmail.com>
+ */
+
+static inline int do_1f(u8 *ip)
+{
+	int length = 3;
+	switch (*ip) {
+	case 0x84:
+		if (!ip[5])
+			length++;
+		else
+			return 0;
+	case 0x80:
+		if (!ip[4] && !ip[3])
+			length += 2;
+		else
+			return 0;
+	case 0x44:
+		if (!ip[2])
+			length++;
+		else
+			return 0;
+	case 0x40:
+		if (!ip[1])
+			length++;
+		else
+			return 0;
+	case 0x00:
+		return length;
+	}
+	return 0;
+}
+
+static inline int do_0f(u8 *ip)
+{
+	if (*ip == 0x1f)
+		return do_1f(ip + 1);
+	return 0;
+}
+
+static inline int do_66(u8 *ip)
+{
+	if (*ip == 0x90)
+		return 2;
+	if (*ip == 0x0f) {
+		int res = do_0f(ip + 1);
+		if (res)
+			return res + 1;
+		else
+			return 0;
+	}
+	return 0;
+}
+
+static inline int do_start(u8 *ip)
+{
+	if (*ip == 0x0f)
+		return do_0f(ip + 1);
+	if (*ip == 0x66)
+		return do_66(ip + 1);
+	return 0;
+}
+
+/* [do_nopl_emu] is called by exception 6 after an invalid opcode has been
+ * encountered. It will try to emulate it by doing nothing,
+ * and will send a SIGILL or SIGSEGV to the process if not possible.
+ * the NOPL can have variable length opcodes:
+
+byte number	opcode
+	2	66 90
+	3	0f 1f 00
+	4	0f 1f 40 00
+	5	0f 1f 44 00 00
+	6	66 0f 1f 44 00 00
+	7	0f 1f 80 00 00 00 00
+	8	0f 1f 84 00 00 00 00 00
+	9	66 0f 1f 84 00 00 00 00 00
+*/
+
+#ifdef CONFIG_DEBUG_FS
+static u32 count;
+
+static int __init nopl_count(void)
+{
+	if(!debugfs_create_u32("emulated_nops", S_IRUGO,
+				arch_debugfs_dir, &count))
+		return -ENOMEM;
+
+	return 0;
+}
+__initcall(nopl_count);
+#endif
+
+void do_nopl_emu(struct pt_regs *regs, long error_code)
+{
+	u8 *ip = (u8 *)instruction_pointer(regs);
+	int res = do_start(ip);
+
+	if (res) {
+		int i = 0;
+		do {
+			ip += res;
+			i++;
+			res = do_start(ip);
+		} while(res);
+#ifdef CONFIG_DEBUG_FS
+		count += i;
+#endif
+		regs->ip = (typeof(regs->ip))ip;
+	} else
+		do_invalid_op(regs, error_code);
+}
Index: linux-3.3/arch/x86/kernel/entry_32.S
===================================================================
--- linux-3.3.orig/arch/x86/kernel/entry_32.S	2012-03-19 00:15:34.000000000 +0100
+++ linux-3.3/arch/x86/kernel/entry_32.S	2012-03-20 17:16:42.319678678 +0100
@@ -929,7 +929,11 @@
 ENTRY(invalid_op)
 	RING0_INT_FRAME
 	pushl_cfi $0
+#ifdef CONFIG_GEODE_NOPL
+	pushl_cfi $do_nopl_emu
+#else
 	pushl_cfi $do_invalid_op
+#endif
 	jmp error_code
 	CFI_ENDPROC
 END(invalid_op)
