Re: ia32 emulation on Pentium I

From: Andi Kleen
Date: Tue Dec 17 2013 - 17:19:44 EST


Dmitry Mikushin <dmitry@xxxxxxxxxxxxx> writes:
>
> So, it seems ia32 emulation assumes Pentium II+. Do you see a quick
> way to make it Pentium I -compatible?

The SYSENTER code path should be never executed, so you could either hack the
assembler to allow it, or just open code it.

Something like (totally untested):

From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

use .byte to implement SYSEXIT for k1om assembler

diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index bba3cf8..1ad2378 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -130,6 +130,8 @@ static inline notrace unsigned long arch_local_irq_save(void)
#define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */

#define INTERRUPT_RETURN iretq
+#define SYSEXIT .byte 0x0f,0x35
+
#define USERGS_SYSRET64 \
swapgs; \
sysretq;
@@ -139,7 +141,7 @@ static inline notrace unsigned long arch_local_irq_save(void)
#define ENABLE_INTERRUPTS_SYSEXIT32 \
swapgs; \
sti; \
- sysexit
+ SYSEXIT

#else
#define INTERRUPT_RETURN iret

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/