orc/orc-no-nopl.patch
2011-10-16 14:27:56 +02:00

41 lines
1.5 KiB
Diff

From 4f813175b93ba44ba3f91cec28f8393d996ff918 Mon Sep 17 00:00:00 2001
From: David Schleef <ds@schleef.org>
Date: Thu, 13 Oct 2011 23:02:00 -0700
Subject: [PATCH] x86insn: quick fix for lack of nopl support
Geode (as well as others) don't have nopl. So don't use it
for alignment.
---
orc/orcx86insn.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/orc/orcx86insn.c b/orc/orcx86insn.c
index 659ebc5..78ca30d 100644
--- a/orc/orcx86insn.c
+++ b/orc/orcx86insn.c
@@ -520,12 +520,21 @@ orc_uint8 nop_codes[][16] = {
{ 0 /* MSVC wants something here */ },
{ 0x90 },
{ 0x66, 0x90 }, /* xchg %ax,%ax */
+#if 0
{ 0x0f, 0x1f, 0x00 }, /* nopl (%rax) */
{ 0x0f, 0x1f, 0x40, 0x00 }, /* nopl 0x0(%rax) */
{ 0x0f, 0x1f, 0x44, 0x00, 0x00 }, /* nopl 0x0(%rax,%rax,1) */
{ 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 }, /* nopw 0x0(%rax,%rax,1) */
{ 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00 }, /* nopl 0x0(%rax) */
{ 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* nopl 0x0(%rax,%rax,1) */
+#else
+ { 0x90, 0x90, 0x90 },
+ { 0x90, 0x90, 0x90, 0x90 },
+ { 0x90, 0x90, 0x90, 0x90, 0x90 },
+ { 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 }, /* nopw 0x0(%rax,%rax,1) */
+ { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 },
+ { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 },
+#endif
{ 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* nopw 0x0(%rax,%rax,1) */
/* Forms of nopw %cs:0x0(%rax,%rax,1) */
{ 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 },
--
1.7.0.4