summaryrefslogtreecommitdiff
path: root/src/liblink
diff options
context:
space:
mode:
Diffstat (limited to 'src/liblink')
-rw-r--r--src/liblink/asm5.c618
-rw-r--r--src/liblink/asm6.c1672
-rw-r--r--src/liblink/asm8.c1074
-rw-r--r--src/liblink/data.c2
-rw-r--r--src/liblink/ld.c36
-rw-r--r--src/liblink/list5.c17
-rw-r--r--src/liblink/list6.c2
-rw-r--r--src/liblink/list8.c2
-rw-r--r--src/liblink/obj5.c250
-rw-r--r--src/liblink/obj6.c263
-rw-r--r--src/liblink/obj8.c129
-rw-r--r--src/liblink/objfile.c78
-rw-r--r--src/liblink/pcln.c2
-rw-r--r--src/liblink/sym.c43
14 files changed, 2251 insertions, 1937 deletions
diff --git a/src/liblink/asm5.c b/src/liblink/asm5.c
index 465b645b2..96df9f791 100644
--- a/src/liblink/asm5.c
+++ b/src/liblink/asm5.c
@@ -35,7 +35,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/5l/5.out.h"
-#include "../pkg/runtime/stack.h"
+#include "../runtime/stack.h"
typedef struct Optab Optab;
typedef struct Oprang Oprang;
@@ -43,7 +43,7 @@ typedef uchar Opcross[32][2][32];
struct Optab
{
- char as;
+ uchar as;
uchar a1;
char a2;
uchar a3;
@@ -65,52 +65,6 @@ enum
LTO = 1<<1,
LPOOL = 1<<2,
LPCREL = 1<<3,
-
- C_NONE = 0,
- C_REG,
- C_REGREG,
- C_REGREG2,
- C_SHIFT,
- C_FREG,
- C_PSR,
- C_FCR,
-
- C_RCON, /* 0xff rotated */
- C_NCON, /* ~RCON */
- C_SCON, /* 0xffff */
- C_LCON,
- C_LCONADDR,
- C_ZFCON,
- C_SFCON,
- C_LFCON,
-
- C_RACON,
- C_LACON,
-
- C_SBRA,
- C_LBRA,
-
- C_HAUTO, /* halfword insn offset (-0xff to 0xff) */
- C_FAUTO, /* float insn offset (0 to 0x3fc, word aligned) */
- C_HFAUTO, /* both H and F */
- C_SAUTO, /* -0xfff to 0xfff */
- C_LAUTO,
-
- C_HOREG,
- C_FOREG,
- C_HFOREG,
- C_SOREG,
- C_ROREG,
- C_SROREG, /* both nil and R */
- C_LOREG,
-
- C_PC,
- C_SP,
- C_HREG,
-
- C_ADDR, /* reference to relocatable address */
-
- C_GOK,
};
static Optab optab[] =
@@ -355,10 +309,14 @@ static Optab optab[] =
{ AUSEFIELD, C_ADDR, C_NONE, C_NONE, 0, 0, 0 },
{ APCDATA, C_LCON, C_NONE, C_LCON, 0, 0, 0 },
{ AFUNCDATA, C_LCON, C_NONE, C_ADDR, 0, 0, 0 },
+ { ANOP, C_NONE, C_NONE, C_NONE, 0, 0, 0 },
{ ADUFFZERO, C_NONE, C_NONE, C_SBRA, 5, 4, 0 }, // same as ABL
{ ADUFFCOPY, C_NONE, C_NONE, C_SBRA, 5, 4, 0 }, // same as ABL
+ { ADATABUNDLE, C_NONE, C_NONE, C_NONE, 100, 4, 0 },
+ { ADATABUNDLEEND, C_NONE, C_NONE, C_NONE, 100, 0, 0 },
+
{ AXXX, C_NONE, C_NONE, C_NONE, 0, 4, 0 },
};
@@ -372,6 +330,7 @@ static int checkpool(Link*, Prog*, int);
static int flushpool(Link*, Prog*, int, int);
static void addpool(Link*, Prog*, Addr*);
static void asmout(Link*, Prog*, Optab*, int32*);
+static int asmoutnacl(Link*, int32, Prog*, Optab*, int32 *);
static Optab* oplook(Link*, Prog*);
static int32 oprrr(Link*, int, int);
static int32 olr(Link*, int32, int, int, int);
@@ -390,10 +349,8 @@ static int32 immrot(uint32);
static int32 immaddr(int32);
static int32 opbra(Link*, int, int);
-static Opcross opcross[8];
static Oprang oprange[ALAST];
-static char xcmp[C_GOK+1][C_GOK+1];
-static uchar repop[ALAST];
+static uchar xcmp[C_GOK+1][C_GOK+1];
static Prog zprg = {
.as = AGOK,
@@ -411,6 +368,8 @@ static Prog zprg = {
},
};
+static LSym *deferreturn;
+
static void
nocache(Prog *p)
{
@@ -419,19 +378,6 @@ nocache(Prog *p)
p->to.class = 0;
}
-static int
-scan(Link *ctxt, Prog *op, Prog *p, int c)
-{
- Prog *q;
-
- for(q = op->link; q != p && q != nil; q = q->link){
- q->pc = c;
- c += oplook(ctxt, q)->size;
- nocache(q);
- }
- return c;
-}
-
/* size of a case statement including jump table */
static int32
casesz(Link *ctxt, Prog *p)
@@ -453,13 +399,250 @@ casesz(Link *ctxt, Prog *p)
static void buildop(Link*);
+// asmoutnacl assembles the instruction p. It replaces asmout for NaCl.
+// It returns the total number of bytes put in out, and it can change
+// p->pc if extra padding is necessary.
+// In rare cases, asmoutnacl might split p into two instructions.
+// origPC is the PC for this Prog (no padding is taken into account).
+static int
+asmoutnacl(Link *ctxt, int32 origPC, Prog *p, Optab *o, int32 *out)
+{
+ int size, reg;
+ Prog *q;
+ Addr *a, *a2;
+
+ size = o->size;
+
+ // instruction specific
+ switch(p->as) {
+ default:
+ if(out != nil)
+ asmout(ctxt, p, o, out);
+ break;
+ case ADATABUNDLE: // align to 16-byte boundary
+ case ADATABUNDLEEND: // zero width instruction, just to align next instruction to 16-byte boundary
+ p->pc = (p->pc+15) & ~15;
+ if(out != nil)
+ asmout(ctxt, p, o, out);
+ break;
+ case AUNDEF:
+ case APLD:
+ size = 4;
+ if(out != nil) {
+ switch(p->as) {
+ case AUNDEF:
+ out[0] = 0xe7fedef0; // NACL_INSTR_ARM_ABORT_NOW (UDF #0xEDE0)
+ break;
+ case APLD:
+ out[0] = 0xe1a01001; // (MOVW R1, R1)
+ break;
+ }
+ }
+ break;
+ case AB:
+ case ABL:
+ if(p->to.type != D_OREG) {
+ if(out != nil)
+ asmout(ctxt, p, o, out);
+ } else {
+ if(p->to.offset != 0 || size != 4 || p->to.reg >= 16 || p->to.reg < 0)
+ ctxt->diag("unsupported instruction: %P", p);
+ if((p->pc&15) == 12)
+ p->pc += 4;
+ if(out != nil) {
+ out[0] = ((p->scond&C_SCOND)<<28) | 0x03c0013f | (p->to.reg << 12) | (p->to.reg << 16); // BIC $0xc000000f, Rx
+ if(p->as == AB)
+ out[1] = ((p->scond&C_SCOND)<<28) | 0x012fff10 | p->to.reg; // BX Rx
+ else // ABL
+ out[1] = ((p->scond&C_SCOND)<<28) | 0x012fff30 | p->to.reg; // BLX Rx
+ }
+ size = 8;
+ }
+ // align the last instruction (the actual BL) to the last instruction in a bundle
+ if(p->as == ABL) {
+ if(deferreturn == nil)
+ deferreturn = linklookup(ctxt, "runtime.deferreturn", 0);
+ if(p->to.sym == deferreturn)
+ p->pc = ((origPC+15) & ~15) + 16 - size;
+ else
+ p->pc += (16 - ((p->pc+size)&15)) & 15;
+ }
+ break;
+ case ALDREX:
+ case ALDREXD:
+ case AMOVB:
+ case AMOVBS:
+ case AMOVBU:
+ case AMOVD:
+ case AMOVF:
+ case AMOVH:
+ case AMOVHS:
+ case AMOVHU:
+ case AMOVM:
+ case AMOVW:
+ case ASTREX:
+ case ASTREXD:
+ if(p->to.type == D_REG && p->to.reg == 15 && p->from.reg == 13) { // MOVW.W x(R13), PC
+ if(out != nil)
+ asmout(ctxt, p, o, out);
+ if(size == 4) {
+ if(out != nil) {
+ // Note: 5c and 5g reg.c know that DIV/MOD smashes R12
+ // so that this return instruction expansion is valid.
+ out[0] = out[0] & ~0x3000; // change PC to R12
+ out[1] = ((p->scond&C_SCOND)<<28) | 0x03ccc13f; // BIC $0xc000000f, R12
+ out[2] = ((p->scond&C_SCOND)<<28) | 0x012fff1c; // BX R12
+ }
+ size += 8;
+ if(((p->pc+size) & 15) == 4)
+ p->pc += 4;
+ break;
+ } else {
+ // if the instruction used more than 4 bytes, then it must have used a very large
+ // offset to update R13, so we need to additionally mask R13.
+ if(out != nil) {
+ out[size/4-1] &= ~0x3000; // change PC to R12
+ out[size/4] = ((p->scond&C_SCOND)<<28) | 0x03cdd103; // BIC $0xc0000000, R13
+ out[size/4+1] = ((p->scond&C_SCOND)<<28) | 0x03ccc13f; // BIC $0xc000000f, R12
+ out[size/4+2] = ((p->scond&C_SCOND)<<28) | 0x012fff1c; // BX R12
+ }
+ // p->pc+size is only ok at 4 or 12 mod 16.
+ if((p->pc+size)%8 == 0)
+ p->pc += 4;
+ size += 12;
+ break;
+ }
+ }
+
+ if(p->to.type == D_REG && p->to.reg == 15)
+ ctxt->diag("unsupported instruction (move to another register and use indirect jump instead): %P", p);
+
+ if(p->to.type == D_OREG && p->to.reg == 13 && (p->scond & C_WBIT) && size > 4) {
+ // function prolog with very large frame size: MOVW.W R14,-100004(R13)
+ // split it into two instructions:
+ // ADD $-100004, R13
+ // MOVW R14, 0(R13)
+ q = ctxt->arch->prg();
+ p->scond &= ~C_WBIT;
+ *q = *p;
+ a = &p->to;
+ if(p->to.type == D_OREG)
+ a2 = &q->to;
+ else
+ a2 = &q->from;
+ nocache(q);
+ nocache(p);
+ // insert q after p
+ q->link = p->link;
+ p->link = q;
+ q->pcond = nil;
+ // make p into ADD $X, R13
+ p->as = AADD;
+ p->from = *a;
+ p->from.reg = NREG;
+ p->from.type = D_CONST;
+ p->to = zprg.to;
+ p->to.type = D_REG;
+ p->to.reg = 13;
+ // make q into p but load/store from 0(R13)
+ q->spadj = 0;
+ *a2 = zprg.from;
+ a2->type = D_OREG;
+ a2->reg = 13;
+ a2->sym = nil;
+ a2->offset = 0;
+ size = oplook(ctxt, p)->size;
+ break;
+ }
+
+ if((p->to.type == D_OREG && p->to.reg != 13 && p->to.reg != 9) || // MOVW Rx, X(Ry), y != 13 && y != 9
+ (p->from.type == D_OREG && p->from.reg != 13 && p->from.reg != 9)) { // MOVW X(Rx), Ry, x != 13 && x != 9
+ if(p->to.type == D_OREG)
+ a = &p->to;
+ else
+ a = &p->from;
+ reg = a->reg;
+ if(size == 4) {
+ // if addr.reg == NREG, then it is probably load from x(FP) with small x, no need to modify.
+ if(reg == NREG) {
+ if(out != nil)
+ asmout(ctxt, p, o, out);
+ } else {
+ if(out != nil)
+ out[0] = ((p->scond&C_SCOND)<<28) | 0x03c00103 | (reg << 16) | (reg << 12); // BIC $0xc0000000, Rx
+ if((p->pc&15) == 12)
+ p->pc += 4;
+ size += 4;
+ if(out != nil)
+ asmout(ctxt, p, o, &out[1]);
+ }
+ break;
+ } else {
+ // if a load/store instruction takes more than 1 word to implement, then
+ // we need to seperate the instruction into two:
+ // 1. explicitly load the address into R11.
+ // 2. load/store from R11.
+ // This won't handle .W/.P, so we should reject such code.
+ if(p->scond & (C_PBIT|C_WBIT))
+ ctxt->diag("unsupported instruction (.P/.W): %P", p);
+ q = ctxt->arch->prg();
+ *q = *p;
+ if(p->to.type == D_OREG)
+ a2 = &q->to;
+ else
+ a2 = &q->from;
+ nocache(q);
+ nocache(p);
+ // insert q after p
+ q->link = p->link;
+ p->link = q;
+ q->pcond = nil;
+ // make p into MOVW $X(R), R11
+ p->as = AMOVW;
+ p->from = *a;
+ p->from.type = D_CONST;
+ p->to = zprg.to;
+ p->to.type = D_REG;
+ p->to.reg = 11;
+ // make q into p but load/store from 0(R11)
+ *a2 = zprg.from;
+ a2->type = D_OREG;
+ a2->reg = 11;
+ a2->sym = nil;
+ a2->offset = 0;
+ size = oplook(ctxt, p)->size;
+ break;
+ }
+ } else if(out != nil)
+ asmout(ctxt, p, o, out);
+ break;
+ }
+
+ // destination register specific
+ if(p->to.type == D_REG) {
+ switch(p->to.reg) {
+ case 9:
+ ctxt->diag("invalid instruction, cannot write to R9: %P", p);
+ break;
+ case 13:
+ if(out != nil)
+ out[size/4] = 0xe3cdd103; // BIC $0xc0000000, R13
+ if(((p->pc+size) & 15) == 0)
+ p->pc += 4;
+ size += 4;
+ break;
+ }
+ }
+ return size;
+}
+
void
span5(Link *ctxt, LSym *cursym)
{
Prog *p, *op;
Optab *o;
- int m, bflag, i, v;
- int32 c, out[6];
+ int m, bflag, i, v, times;
+ int32 c, opc, out[6+3];
uchar *bp;
p = cursym->text;
@@ -472,21 +655,39 @@ span5(Link *ctxt, LSym *cursym)
ctxt->cursym = cursym;
ctxt->autosize = p->to.offset + 4;
- c = 0;
+ c = 0;
- for(op = p, p = p->link; p != nil; op = p, p = p->link) {
+ for(op = p, p = p->link; p != nil || ctxt->blitrl != nil; op = p, p = p->link) {
+ if(p == nil) {
+ if(checkpool(ctxt, op, 0)) {
+ p = op;
+ continue;
+ }
+ // can't happen: blitrl is not nil, but checkpool didn't flushpool
+ ctxt->diag("internal inconsistency");
+ break;
+ }
ctxt->curp = p;
p->pc = c;
o = oplook(ctxt, p);
- m = o->size;
+ if(ctxt->headtype != Hnacl) {
+ m = o->size;
+ } else {
+ m = asmoutnacl(ctxt, c, p, o, nil);
+ c = p->pc; // asmoutnacl might change pc for alignment
+ o = oplook(ctxt, p); // asmoutnacl might change p in rare cases
+ }
+ if(m % 4 != 0 || p->pc % 4 != 0) {
+ ctxt->diag("!pc invalid: %P size=%d", p, m);
+ }
// must check literal pool here in case p generates many instructions
if(ctxt->blitrl){
if(checkpool(ctxt, op, p->as == ACASE ? casesz(ctxt, p) : m)) {
- p->pc = scan(ctxt, op, p, c);
- c = p->pc;
+ p = op;
+ continue;
}
}
- if(m == 0 && (p->as != AFUNCDATA && p->as != APCDATA)) {
+ if(m == 0 && (p->as != AFUNCDATA && p->as != APCDATA && p->as != ADATABUNDLEEND && p->as != ANOP)) {
ctxt->diag("zero-width instruction\n%P", p);
continue;
}
@@ -506,10 +707,6 @@ span5(Link *ctxt, LSym *cursym)
flushpool(ctxt, p, 0, 0);
c += m;
}
- if(ctxt->blitrl){
- if(checkpool(ctxt, op, 0))
- c = scan(ctxt, op, nil, c);
- }
cursym->size = c;
/*
@@ -518,15 +715,19 @@ span5(Link *ctxt, LSym *cursym)
* generate extra passes putting branches
* around jmps to fix. this is rare.
*/
+ times = 0;
do {
if(ctxt->debugvlog)
Bprint(ctxt->bso, "%5.2f span1\n", cputime());
bflag = 0;
c = 0;
+ times++;
+ cursym->text->pc = 0; // force re-layout the code.
for(p = cursym->text; p != nil; p = p->link) {
ctxt->curp = p;
- p->pc = c;
o = oplook(ctxt,p);
+ if(c > p->pc)
+ p->pc = c;
/* very large branches
if(o->type == 6 && p->pcond) {
otxt = p->pcond->pc - c;
@@ -550,8 +751,22 @@ span5(Link *ctxt, LSym *cursym)
}
}
*/
- m = o->size;
- if(m == 0 && (p->as != AFUNCDATA && p->as != APCDATA)) {
+ opc = p->pc;
+ if(ctxt->headtype != Hnacl)
+ m = o->size;
+ else
+ m = asmoutnacl(ctxt, c, p, o, nil);
+ if(p->pc != opc) {
+ bflag = 1;
+ //print("%P pc changed %d to %d in iter. %d\n", p, opc, (int32)p->pc, times);
+ }
+ c = p->pc + m;
+ if(m % 4 != 0 || p->pc % 4 != 0) {
+ ctxt->diag("pc invalid: %P size=%d", p, m);
+ }
+ if(m/4 > nelem(out))
+ ctxt->diag("instruction size too large: %d > %d", m/4, nelem(out));
+ if(m == 0 && (p->as != AFUNCDATA && p->as != APCDATA && p->as != ADATABUNDLEEND && p->as != ANOP)) {
if(p->as == ATEXT) {
ctxt->autosize = p->to.offset + 4;
continue;
@@ -559,10 +774,12 @@ span5(Link *ctxt, LSym *cursym)
ctxt->diag("zero-width instruction\n%P", p);
continue;
}
- c += m;
}
cursym->size = c;
} while(bflag);
+ if(c % 4 != 0) {
+ ctxt->diag("sym->size=%d, invalid", c);
+ }
/*
* lay out the code. all the pc-relative code references,
@@ -572,26 +789,49 @@ span5(Link *ctxt, LSym *cursym)
* code references to be relocated too, and then
* perhaps we'd be able to parallelize the span loop above.
*/
- if(ctxt->gmsym == nil)
- ctxt->gmsym = linklookup(ctxt, "runtime.tlsgm", 0);
+ if(ctxt->tlsg == nil)
+ ctxt->tlsg = linklookup(ctxt, "runtime.tlsg", 0);
p = cursym->text;
ctxt->autosize = p->to.offset + 4;
symgrow(ctxt, cursym, cursym->size);
bp = cursym->p;
+ c = p->pc; // even p->link might need extra padding
for(p = p->link; p != nil; p = p->link) {
ctxt->pc = p->pc;
ctxt->curp = p;
o = oplook(ctxt, p);
- asmout(ctxt, p, o, out);
- for(i=0; i<o->size/4; i++) {
+ opc = p->pc;
+ if(ctxt->headtype != Hnacl) {
+ asmout(ctxt, p, o, out);
+ m = o->size;
+ } else {
+ m = asmoutnacl(ctxt, c, p, o, out);
+ if(opc != p->pc)
+ ctxt->diag("asmoutnacl broken: pc changed (%d->%d) in last stage: %P", opc, (int32)p->pc, p);
+ }
+ if(m % 4 != 0 || p->pc % 4 != 0) {
+ ctxt->diag("final stage: pc invalid: %P size=%d", p, m);
+ }
+ if(c > p->pc)
+ ctxt->diag("PC padding invalid: want %#lld, has %#d: %P", p->pc, c, p);
+ while(c != p->pc) {
+ // emit 0xe1a00000 (MOVW R0, R0)
+ *bp++ = 0x00;
+ *bp++ = 0x00;
+ *bp++ = 0xa0;
+ *bp++ = 0xe1;
+ c += 4;
+ }
+ for(i=0; i<m/4; i++) {
v = out[i];
*bp++ = v;
*bp++ = v>>8;
*bp++ = v>>16;
*bp++ = v>>24;
}
+ c += m;
}
}
@@ -604,7 +844,7 @@ span5(Link *ctxt, LSym *cursym)
static int
checkpool(Link *ctxt, Prog *p, int sz)
{
- if(pool.size >= 0xffc || immaddr((p->pc+sz+4)+4+pool.size - pool.start+8) == 0)
+ if(pool.size >= 0xff0 || immaddr((p->pc+sz+4)+4+(12+pool.size) - (pool.start+8)) == 0)
return flushpool(ctxt, p, 1, 0);
else if(p->link == nil)
return flushpool(ctxt, p, 2, 0);
@@ -627,8 +867,15 @@ flushpool(Link *ctxt, Prog *p, int skip, int force)
q->lineno = p->lineno;
ctxt->blitrl = q;
}
- else if(!force && (p->pc+pool.size-pool.start < 2048))
+ else if(!force && (p->pc+(12+pool.size)-pool.start < 2048)) // 12 take into account the maximum nacl literal pool alignment padding size
return 0;
+ if(ctxt->headtype == Hnacl && pool.size % 16 != 0) {
+ // if pool is not multiple of 16 bytes, add an alignment marker
+ q = ctxt->arch->prg();
+ q->as = ADATABUNDLEEND;
+ ctxt->elitrl->link = q;
+ ctxt->elitrl = q;
+ }
ctxt->elitrl->link = p->link;
p->link = ctxt->blitrl;
// BUG(minux): how to correctly handle line number for constant pool entries?
@@ -661,7 +908,11 @@ addpool(Link *ctxt, Prog *p, Addr *a)
switch(c) {
default:
- t.to = *a;
+ t.to.offset = a->offset;
+ t.to.sym = a->sym;
+ t.to.type = a->type;
+ t.to.name = a->name;
+
if(ctxt->flag_shared && t.to.sym != nil)
t.pcrel = p;
break;
@@ -689,6 +940,22 @@ addpool(Link *ctxt, Prog *p, Addr *a)
}
}
+ if(ctxt->headtype == Hnacl && pool.size%16 == 0) {
+ // start a new data bundle
+ q = ctxt->arch->prg();
+ *q = zprg;
+ q->as = ADATABUNDLE;
+ q->pc = pool.size;
+ pool.size += 4;
+ if(ctxt->blitrl == nil) {
+ ctxt->blitrl = q;
+ pool.start = p->pc;
+ } else {
+ ctxt->elitrl->link = q;
+ }
+ ctxt->elitrl = q;
+ }
+
q = ctxt->arch->prg();
*q = t;
q->pc = pool.size;
@@ -758,6 +1025,8 @@ immhalf(int32 v)
return 0;
}
+static int aconsize(Link *ctxt);
+
static int
aclass(Link *ctxt, Addr *a)
{
@@ -792,7 +1061,6 @@ aclass(Link *ctxt, Addr *a)
case D_STATIC:
if(a->sym == 0 || a->sym->name == 0) {
print("null sym external\n");
- print("%D\n", a);
return C_GOK;
}
ctxt->instoffset = 0; // s.b. unused but just in case
@@ -869,7 +1137,7 @@ aclass(Link *ctxt, Addr *a)
case D_NONE:
ctxt->instoffset = a->offset;
if(a->reg != NREG)
- goto aconsize;
+ return aconsize(ctxt);
t = immrot(ctxt->instoffset);
if(t)
@@ -889,15 +1157,11 @@ aclass(Link *ctxt, Addr *a)
case D_AUTO:
ctxt->instoffset = ctxt->autosize + a->offset;
- goto aconsize;
+ return aconsize(ctxt);
case D_PARAM:
ctxt->instoffset = ctxt->autosize + a->offset + 4L;
- aconsize:
- t = immrot(ctxt->instoffset);
- if(t)
- return C_RACON;
- return C_LACON;
+ return aconsize(ctxt);
}
return C_GOK;
@@ -907,6 +1171,17 @@ aclass(Link *ctxt, Addr *a)
return C_GOK;
}
+static int
+aconsize(Link *ctxt)
+{
+ int t;
+
+ t = immrot(ctxt->instoffset);
+ if(t)
+ return C_RACON;
+ return C_LACON;
+}
+
static void
prasm(Prog *p)
{
@@ -917,7 +1192,7 @@ static Optab*
oplook(Link *ctxt, Prog *p)
{
int a1, a2, a3, r;
- char *c1, *c3;
+ uchar *c1, *c3;
Optab *o, *e;
a1 = p->optab;
@@ -941,15 +1216,10 @@ oplook(Link *ctxt, Prog *p)
r = p->as;
o = oprange[r].start;
if(o == 0) {
- a1 = opcross[repop[r]][a1][a2][a3];
- if(a1) {
- p->optab = a1+1;
- return optab+a1;
- }
o = oprange[r].stop; /* just generate an error */
}
if(0 /*debug['O']*/) {
- print("oplook %A %d %d %d\n",
+ print("oplook %A %^ %^ %^\n",
(int)p->as, a1, a2, a3);
print(" %d %d\n", p->from.type, p->to.type);
}
@@ -963,7 +1233,7 @@ oplook(Link *ctxt, Prog *p)
p->optab = (o-optab)+1;
return o;
}
- ctxt->diag("illegal combination %P; %d %d %d, %d %d",
+ ctxt->diag("illegal combination %P; %^ %^ %^, %d %d",
p, a1, a2, a3, p->from.type, p->to.type);
ctxt->diag("from %d %d to %d %d\n", p->from.type, p->from.name, p->to.type, p->to.name);
prasm(p);
@@ -1210,11 +1480,16 @@ buildop(Link *ctxt)
case ACLZ:
case AFUNCDATA:
case APCDATA:
+ case ANOP:
+ case ADATABUNDLE:
+ case ADATABUNDLEEND:
break;
}
}
}
+static int32 mov(Link*, Prog*);
+
static void
asmout(Link *ctxt, Prog *p, Optab *o, int32 *out)
{
@@ -1272,19 +1547,7 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
break;
case 3: /* add R<<[IR],[R],R */
- mov:
- aclass(ctxt, &p->from);
- o1 = oprrr(ctxt, p->as, p->scond);
- o1 |= p->from.offset;
- rt = p->to.reg;
- r = p->reg;
- if(p->to.type == D_NONE)
- rt = 0;
- if(p->as == AMOVW || p->as == AMVN)
- r = 0;
- else if(r == NREG)
- r = rt;
- o1 |= (r<<16) | (rt<<12);
+ o1 = mov(ctxt, p);
break;
case 4: /* add $I,[R],R */
@@ -1377,11 +1640,11 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
rel->sym = p->to.sym;
rel->add = p->to.offset;
- // runtime.tlsgm (aka gmsym) is special.
+ // runtime.tlsg is special.
// Its "address" is the offset from the TLS thread pointer
// to the thread-local g and m pointers.
// Emit a TLS relocation instead of a standard one.
- if(rel->sym == ctxt->gmsym) {
+ if(rel->sym == ctxt->tlsg) {
rel->type = R_TLS;
if(ctxt->flag_shared)
rel->add += ctxt->pc - p->pcrel->pc - 8 - rel->siz;
@@ -1557,19 +1820,23 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
o1 |= p->from.reg << 0;
break;
- case 38: /* movm $con,oreg -> stm */
- o1 = (0x4 << 25);
- o1 |= p->from.offset & 0xffff;
- o1 |= p->to.reg << 16;
- aclass(ctxt, &p->to);
- goto movm;
-
- case 39: /* movm oreg,$con -> ldm */
- o1 = (0x4 << 25) | (1 << 20);
- o1 |= p->to.offset & 0xffff;
- o1 |= p->from.reg << 16;
- aclass(ctxt, &p->from);
- movm:
+ case 38:
+ case 39:
+ switch(o->type) {
+ case 38: /* movm $con,oreg -> stm */
+ o1 = (0x4 << 25);
+ o1 |= p->from.offset & 0xffff;
+ o1 |= p->to.reg << 16;
+ aclass(ctxt, &p->to);
+ break;
+
+ case 39: /* movm oreg,$con -> ldm */
+ o1 = (0x4 << 25) | (1 << 20);
+ o1 |= p->to.offset & 0xffff;
+ o1 |= p->from.reg << 16;
+ aclass(ctxt, &p->from);
+ break;
+ }
if(ctxt->instoffset != 0)
ctxt->diag("offset must be zero in MOVM; %P", p);
o1 |= (p->scond & C_SCOND) << 28;
@@ -1677,7 +1944,8 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
if(p->from.reg == NREG) {
if(p->as != AMOVW)
ctxt->diag("byte MOV from shifter operand");
- goto mov;
+ o1 = mov(ctxt, p);
+ break;
}
if(p->from.offset&(1<<4))
ctxt->diag("bad shift in LDR");
@@ -1689,7 +1957,8 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
case 60: /* movb R(R),R -> ldrsb indexed */
if(p->from.reg == NREG) {
ctxt->diag("byte MOV from shifter operand");
- goto mov;
+ o1 = mov(ctxt, p);
+ break;
}
if(p->from.offset&(~0xf))
ctxt->diag("bad shift in LDRSB");
@@ -2029,6 +2298,12 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
o1 |= p->reg;
o1 |= p->to.offset << 16;
break;
+ case 100:
+ // DATABUNDLE: BKPT $0x5be0, signify the start of NaCl data bundle;
+ // DATABUNDLEEND: zero width alignment marker
+ if(p->as == ADATABUNDLE)
+ o1 = 0xe125be70;
+ break;
}
out[0] = o1;
@@ -2038,64 +2313,27 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
out[4] = o5;
out[5] = o6;
return;
+}
-#ifdef NOTDEF
- v = p->pc;
- switch(o->size) {
- default:
- if(debug['a'])
- Bprint(&bso, " %.8ux:\t\t%P\n", v, p);
- break;
- case 4:
- if(debug['a'])
- Bprint(&bso, " %.8ux: %.8ux\t%P\n", v, o1, p);
- lputl(o1);
- break;
- case 8:
- if(debug['a'])
- Bprint(&bso, " %.8ux: %.8ux %.8ux%P\n", v, o1, o2, p);
- lputl(o1);
- lputl(o2);
- break;
- case 12:
- if(debug['a'])
- Bprint(&bso, " %.8ux: %.8ux %.8ux %.8ux%P\n", v, o1, o2, o3, p);
- lputl(o1);
- lputl(o2);
- lputl(o3);
- break;
- case 16:
- if(debug['a'])
- Bprint(&bso, " %.8ux: %.8ux %.8ux %.8ux %.8ux%P\n",
- v, o1, o2, o3, o4, p);
- lputl(o1);
- lputl(o2);
- lputl(o3);
- lputl(o4);
- break;
- case 20:
- if(debug['a'])
- Bprint(&bso, " %.8ux: %.8ux %.8ux %.8ux %.8ux %.8ux%P\n",
- v, o1, o2, o3, o4, o5, p);
- lputl(o1);
- lputl(o2);
- lputl(o3);
- lputl(o4);
- lputl(o5);
- break;
- case 24:
- if(debug['a'])
- Bprint(&bso, " %.8ux: %.8ux %.8ux %.8ux %.8ux %.8ux %.8ux%P\n",
- v, o1, o2, o3, o4, o5, o6, p);
- lputl(o1);
- lputl(o2);
- lputl(o3);
- lputl(o4);
- lputl(o5);
- lputl(o6);
- break;
- }
-#endif
+static int32
+mov(Link *ctxt, Prog *p)
+{
+ int32 o1;
+ int rt, r;
+
+ aclass(ctxt, &p->from);
+ o1 = oprrr(ctxt, p->as, p->scond);
+ o1 |= p->from.offset;
+ rt = p->to.reg;
+ r = p->reg;
+ if(p->to.type == D_NONE)
+ rt = 0;
+ if(p->as == AMOVW || p->as == AMVN)
+ r = 0;
+ else if(r == NREG)
+ r = rt;
+ o1 |= (r<<16) | (rt<<12);
+ return o1;
}
static int32
diff --git a/src/liblink/asm6.c b/src/liblink/asm6.c
index 66afc7a12..428eb9442 100644
--- a/src/liblink/asm6.c
+++ b/src/liblink/asm6.c
@@ -35,7 +35,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/6l/6.out.h"
-#include "../pkg/runtime/stack.h"
+#include "../runtime/stack.h"
enum
{
@@ -60,8 +60,6 @@ enum
FuncAlign = 16
};
-extern char *anames6[];
-
typedef struct Optab Optab;
typedef struct Movtab Movtab;
@@ -187,7 +185,7 @@ enum
Maxand = 10, /* in -a output width of the byte codes */
};
-static char ycover[Ymax*Ymax];
+static uchar ycover[Ymax*Ymax];
static int reg[D_NONE];
static int regrex[D_NONE+1];
static void asmins(Link *ctxt, Prog *p);
@@ -821,722 +819,735 @@ static uchar yaes2[] =
* encoded addressing mode for the Yml arg), and then a single immediate byte.
* Zilo_m is the same but a long (32-bit) immediate.
*/
-Optab optab[] =
+static Optab optab[] =
/* as, ytab, andproto, opcode */
{
{ AXXX },
- { AAAA, ynone, P32, 0x37 },
- { AAAD, ynone, P32, 0xd5,0x0a },
- { AAAM, ynone, P32, 0xd4,0x0a },
- { AAAS, ynone, P32, 0x3f },
- { AADCB, yxorb, Pb, 0x14,0x80,(02),0x10,0x10 },
- { AADCL, yxorl, Px, 0x83,(02),0x15,0x81,(02),0x11,0x13 },
- { AADCQ, yxorl, Pw, 0x83,(02),0x15,0x81,(02),0x11,0x13 },
- { AADCW, yxorl, Pe, 0x83,(02),0x15,0x81,(02),0x11,0x13 },
- { AADDB, yxorb, Pb, 0x04,0x80,(00),0x00,0x02 },
- { AADDL, yaddl, Px, 0x83,(00),0x05,0x81,(00),0x01,0x03 },
- { AADDPD, yxm, Pq, 0x58 },
- { AADDPS, yxm, Pm, 0x58 },
- { AADDQ, yaddl, Pw, 0x83,(00),0x05,0x81,(00),0x01,0x03 },
- { AADDSD, yxm, Pf2, 0x58 },
- { AADDSS, yxm, Pf3, 0x58 },
- { AADDW, yaddl, Pe, 0x83,(00),0x05,0x81,(00),0x01,0x03 },
+ { AAAA, ynone, P32, {0x37} },
+ { AAAD, ynone, P32, {0xd5,0x0a} },
+ { AAAM, ynone, P32, {0xd4,0x0a} },
+ { AAAS, ynone, P32, {0x3f} },
+ { AADCB, yxorb, Pb, {0x14,0x80,(02),0x10,0x10} },
+ { AADCL, yxorl, Px, {0x83,(02),0x15,0x81,(02),0x11,0x13} },
+ { AADCQ, yxorl, Pw, {0x83,(02),0x15,0x81,(02),0x11,0x13} },
+ { AADCW, yxorl, Pe, {0x83,(02),0x15,0x81,(02),0x11,0x13} },
+ { AADDB, yxorb, Pb, {0x04,0x80,(00),0x00,0x02} },
+ { AADDL, yaddl, Px, {0x83,(00),0x05,0x81,(00),0x01,0x03} },
+ { AADDPD, yxm, Pq, {0x58} },
+ { AADDPS, yxm, Pm, {0x58} },
+ { AADDQ, yaddl, Pw, {0x83,(00),0x05,0x81,(00),0x01,0x03} },
+ { AADDSD, yxm, Pf2, {0x58} },
+ { AADDSS, yxm, Pf3, {0x58} },
+ { AADDW, yaddl, Pe, {0x83,(00),0x05,0x81,(00),0x01,0x03} },
{ AADJSP },
- { AANDB, yxorb, Pb, 0x24,0x80,(04),0x20,0x22 },
- { AANDL, yxorl, Px, 0x83,(04),0x25,0x81,(04),0x21,0x23 },
- { AANDNPD, yxm, Pq, 0x55 },
- { AANDNPS, yxm, Pm, 0x55 },
- { AANDPD, yxm, Pq, 0x54 },
- { AANDPS, yxm, Pq, 0x54 },
- { AANDQ, yxorl, Pw, 0x83,(04),0x25,0x81,(04),0x21,0x23 },
- { AANDW, yxorl, Pe, 0x83,(04),0x25,0x81,(04),0x21,0x23 },
- { AARPL, yrl_ml, P32, 0x63 },
- { ABOUNDL, yrl_m, P32, 0x62 },
- { ABOUNDW, yrl_m, Pe, 0x62 },
- { ABSFL, yml_rl, Pm, 0xbc },
- { ABSFQ, yml_rl, Pw, 0x0f,0xbc },
- { ABSFW, yml_rl, Pq, 0xbc },
- { ABSRL, yml_rl, Pm, 0xbd },
- { ABSRQ, yml_rl, Pw, 0x0f,0xbd },
- { ABSRW, yml_rl, Pq, 0xbd },
- { ABSWAPL, ybswap, Px, 0x0f,0xc8 },
- { ABSWAPQ, ybswap, Pw, 0x0f,0xc8 },
- { ABTCL, ybtl, Pm, 0xba,(07),0xbb },
- { ABTCQ, ybtl, Pw, 0x0f,0xba,(07),0x0f,0xbb },
- { ABTCW, ybtl, Pq, 0xba,(07),0xbb },
- { ABTL, ybtl, Pm, 0xba,(04),0xa3 },
- { ABTQ, ybtl, Pw, 0x0f,0xba,(04),0x0f,0xa3},
- { ABTRL, ybtl, Pm, 0xba,(06),0xb3 },
- { ABTRQ, ybtl, Pw, 0x0f,0xba,(06),0x0f,0xb3 },
- { ABTRW, ybtl, Pq, 0xba,(06),0xb3 },
- { ABTSL, ybtl, Pm, 0xba,(05),0xab },
- { ABTSQ, ybtl, Pw, 0x0f,0xba,(05),0x0f,0xab },
- { ABTSW, ybtl, Pq, 0xba,(05),0xab },
- { ABTW, ybtl, Pq, 0xba,(04),0xa3 },
- { ABYTE, ybyte, Px, 1 },
- { ACALL, ycall, Px, 0xff,(02),0xe8 },
- { ACDQ, ynone, Px, 0x99 },
- { ACLC, ynone, Px, 0xf8 },
- { ACLD, ynone, Px, 0xfc },
- { ACLI, ynone, Px, 0xfa },
- { ACLTS, ynone, Pm, 0x06 },
- { ACMC, ynone, Px, 0xf5 },
- { ACMOVLCC, yml_rl, Pm, 0x43 },
- { ACMOVLCS, yml_rl, Pm, 0x42 },
- { ACMOVLEQ, yml_rl, Pm, 0x44 },
- { ACMOVLGE, yml_rl, Pm, 0x4d },
- { ACMOVLGT, yml_rl, Pm, 0x4f },
- { ACMOVLHI, yml_rl, Pm, 0x47 },
- { ACMOVLLE, yml_rl, Pm, 0x4e },
- { ACMOVLLS, yml_rl, Pm, 0x46 },
- { ACMOVLLT, yml_rl, Pm, 0x4c },
- { ACMOVLMI, yml_rl, Pm, 0x48 },
- { ACMOVLNE, yml_rl, Pm, 0x45 },
- { ACMOVLOC, yml_rl, Pm, 0x41 },
- { ACMOVLOS, yml_rl, Pm, 0x40 },
- { ACMOVLPC, yml_rl, Pm, 0x4b },
- { ACMOVLPL, yml_rl, Pm, 0x49 },
- { ACMOVLPS, yml_rl, Pm, 0x4a },
- { ACMOVQCC, yml_rl, Pw, 0x0f,0x43 },
- { ACMOVQCS, yml_rl, Pw, 0x0f,0x42 },
- { ACMOVQEQ, yml_rl, Pw, 0x0f,0x44 },
- { ACMOVQGE, yml_rl, Pw, 0x0f,0x4d },
- { ACMOVQGT, yml_rl, Pw, 0x0f,0x4f },
- { ACMOVQHI, yml_rl, Pw, 0x0f,0x47 },
- { ACMOVQLE, yml_rl, Pw, 0x0f,0x4e },
- { ACMOVQLS, yml_rl, Pw, 0x0f,0x46 },
- { ACMOVQLT, yml_rl, Pw, 0x0f,0x4c },
- { ACMOVQMI, yml_rl, Pw, 0x0f,0x48 },
- { ACMOVQNE, yml_rl, Pw, 0x0f,0x45 },
- { ACMOVQOC, yml_rl, Pw, 0x0f,0x41 },
- { ACMOVQOS, yml_rl, Pw, 0x0f,0x40 },
- { ACMOVQPC, yml_rl, Pw, 0x0f,0x4b },
- { ACMOVQPL, yml_rl, Pw, 0x0f,0x49 },
- { ACMOVQPS, yml_rl, Pw, 0x0f,0x4a },
- { ACMOVWCC, yml_rl, Pq, 0x43 },
- { ACMOVWCS, yml_rl, Pq, 0x42 },
- { ACMOVWEQ, yml_rl, Pq, 0x44 },
- { ACMOVWGE, yml_rl, Pq, 0x4d },
- { ACMOVWGT, yml_rl, Pq, 0x4f },
- { ACMOVWHI, yml_rl, Pq, 0x47 },
- { ACMOVWLE, yml_rl, Pq, 0x4e },
- { ACMOVWLS, yml_rl, Pq, 0x46 },
- { ACMOVWLT, yml_rl, Pq, 0x4c },
- { ACMOVWMI, yml_rl, Pq, 0x48 },
- { ACMOVWNE, yml_rl, Pq, 0x45 },
- { ACMOVWOC, yml_rl, Pq, 0x41 },
- { ACMOVWOS, yml_rl, Pq, 0x40 },
- { ACMOVWPC, yml_rl, Pq, 0x4b },
- { ACMOVWPL, yml_rl, Pq, 0x49 },
- { ACMOVWPS, yml_rl, Pq, 0x4a },
- { ACMPB, ycmpb, Pb, 0x3c,0x80,(07),0x38,0x3a },
- { ACMPL, ycmpl, Px, 0x83,(07),0x3d,0x81,(07),0x39,0x3b },
- { ACMPPD, yxcmpi, Px, Pe,0xc2 },
- { ACMPPS, yxcmpi, Pm, 0xc2,0 },
- { ACMPQ, ycmpl, Pw, 0x83,(07),0x3d,0x81,(07),0x39,0x3b },
- { ACMPSB, ynone, Pb, 0xa6 },
- { ACMPSD, yxcmpi, Px, Pf2,0xc2 },
- { ACMPSL, ynone, Px, 0xa7 },
- { ACMPSQ, ynone, Pw, 0xa7 },
- { ACMPSS, yxcmpi, Px, Pf3,0xc2 },
- { ACMPSW, ynone, Pe, 0xa7 },
- { ACMPW, ycmpl, Pe, 0x83,(07),0x3d,0x81,(07),0x39,0x3b },
- { ACOMISD, yxcmp, Pe, 0x2f },
- { ACOMISS, yxcmp, Pm, 0x2f },
- { ACPUID, ynone, Pm, 0xa2 },
- { ACVTPL2PD, yxcvm2, Px, Pf3,0xe6,Pe,0x2a },
- { ACVTPL2PS, yxcvm2, Pm, 0x5b,0,0x2a,0, },
- { ACVTPD2PL, yxcvm1, Px, Pf2,0xe6,Pe,0x2d },
- { ACVTPD2PS, yxm, Pe, 0x5a },
- { ACVTPS2PL, yxcvm1, Px, Pe,0x5b,Pm,0x2d },
- { ACVTPS2PD, yxm, Pm, 0x5a },
- { API2FW, ymfp, Px, 0x0c },
- { ACVTSD2SL, yxcvfl, Pf2, 0x2d },
- { ACVTSD2SQ, yxcvfq, Pw, Pf2,0x2d },
- { ACVTSD2SS, yxm, Pf2, 0x5a },
- { ACVTSL2SD, yxcvlf, Pf2, 0x2a },
- { ACVTSQ2SD, yxcvqf, Pw, Pf2,0x2a },
- { ACVTSL2SS, yxcvlf, Pf3, 0x2a },
- { ACVTSQ2SS, yxcvqf, Pw, Pf3,0x2a },
- { ACVTSS2SD, yxm, Pf3, 0x5a },
- { ACVTSS2SL, yxcvfl, Pf3, 0x2d },
- { ACVTSS2SQ, yxcvfq, Pw, Pf3,0x2d },
- { ACVTTPD2PL, yxcvm1, Px, Pe,0xe6,Pe,0x2c },
- { ACVTTPS2PL, yxcvm1, Px, Pf3,0x5b,Pm,0x2c },
- { ACVTTSD2SL, yxcvfl, Pf2, 0x2c },
- { ACVTTSD2SQ, yxcvfq, Pw, Pf2,0x2c },
- { ACVTTSS2SL, yxcvfl, Pf3, 0x2c },
- { ACVTTSS2SQ, yxcvfq, Pw, Pf3,0x2c },
- { ACWD, ynone, Pe, 0x99 },
- { ACQO, ynone, Pw, 0x99 },
- { ADAA, ynone, P32, 0x27 },
- { ADAS, ynone, P32, 0x2f },
+ { AANDB, yxorb, Pb, {0x24,0x80,(04),0x20,0x22} },
+ { AANDL, yxorl, Px, {0x83,(04),0x25,0x81,(04),0x21,0x23} },
+ { AANDNPD, yxm, Pq, {0x55} },
+ { AANDNPS, yxm, Pm, {0x55} },
+ { AANDPD, yxm, Pq, {0x54} },
+ { AANDPS, yxm, Pq, {0x54} },
+ { AANDQ, yxorl, Pw, {0x83,(04),0x25,0x81,(04),0x21,0x23} },
+ { AANDW, yxorl, Pe, {0x83,(04),0x25,0x81,(04),0x21,0x23} },
+ { AARPL, yrl_ml, P32, {0x63} },
+ { ABOUNDL, yrl_m, P32, {0x62} },
+ { ABOUNDW, yrl_m, Pe, {0x62} },
+ { ABSFL, yml_rl, Pm, {0xbc} },
+ { ABSFQ, yml_rl, Pw, {0x0f,0xbc} },
+ { ABSFW, yml_rl, Pq, {0xbc} },
+ { ABSRL, yml_rl, Pm, {0xbd} },
+ { ABSRQ, yml_rl, Pw, {0x0f,0xbd} },
+ { ABSRW, yml_rl, Pq, {0xbd} },
+ { ABSWAPL, ybswap, Px, {0x0f,0xc8} },
+ { ABSWAPQ, ybswap, Pw, {0x0f,0xc8} },
+ { ABTCL, ybtl, Pm, {0xba,(07),0xbb} },
+ { ABTCQ, ybtl, Pw, {0x0f,0xba,(07),0x0f,0xbb} },
+ { ABTCW, ybtl, Pq, {0xba,(07),0xbb} },
+ { ABTL, ybtl, Pm, {0xba,(04),0xa3} },
+ { ABTQ, ybtl, Pw, {0x0f,0xba,(04),0x0f,0xa3}},
+ { ABTRL, ybtl, Pm, {0xba,(06),0xb3} },
+ { ABTRQ, ybtl, Pw, {0x0f,0xba,(06),0x0f,0xb3} },
+ { ABTRW, ybtl, Pq, {0xba,(06),0xb3} },
+ { ABTSL, ybtl, Pm, {0xba,(05),0xab } },
+ { ABTSQ, ybtl, Pw, {0x0f,0xba,(05),0x0f,0xab} },
+ { ABTSW, ybtl, Pq, {0xba,(05),0xab } },
+ { ABTW, ybtl, Pq, {0xba,(04),0xa3} },
+ { ABYTE, ybyte, Px, {1} },
+ { ACALL, ycall, Px, {0xff,(02),0xe8} },
+ { ACDQ, ynone, Px, {0x99} },
+ { ACLC, ynone, Px, {0xf8} },
+ { ACLD, ynone, Px, {0xfc} },
+ { ACLI, ynone, Px, {0xfa} },
+ { ACLTS, ynone, Pm, {0x06} },
+ { ACMC, ynone, Px, {0xf5} },
+ { ACMOVLCC, yml_rl, Pm, {0x43} },
+ { ACMOVLCS, yml_rl, Pm, {0x42} },
+ { ACMOVLEQ, yml_rl, Pm, {0x44} },
+ { ACMOVLGE, yml_rl, Pm, {0x4d} },
+ { ACMOVLGT, yml_rl, Pm, {0x4f} },
+ { ACMOVLHI, yml_rl, Pm, {0x47} },
+ { ACMOVLLE, yml_rl, Pm, {0x4e} },
+ { ACMOVLLS, yml_rl, Pm, {0x46} },
+ { ACMOVLLT, yml_rl, Pm, {0x4c} },
+ { ACMOVLMI, yml_rl, Pm, {0x48} },
+ { ACMOVLNE, yml_rl, Pm, {0x45} },
+ { ACMOVLOC, yml_rl, Pm, {0x41} },
+ { ACMOVLOS, yml_rl, Pm, {0x40} },
+ { ACMOVLPC, yml_rl, Pm, {0x4b} },
+ { ACMOVLPL, yml_rl, Pm, {0x49} },
+ { ACMOVLPS, yml_rl, Pm, {0x4a} },
+ { ACMOVQCC, yml_rl, Pw, {0x0f,0x43} },
+ { ACMOVQCS, yml_rl, Pw, {0x0f,0x42} },
+ { ACMOVQEQ, yml_rl, Pw, {0x0f,0x44} },
+ { ACMOVQGE, yml_rl, Pw, {0x0f,0x4d} },
+ { ACMOVQGT, yml_rl, Pw, {0x0f,0x4f} },
+ { ACMOVQHI, yml_rl, Pw, {0x0f,0x47} },
+ { ACMOVQLE, yml_rl, Pw, {0x0f,0x4e} },
+ { ACMOVQLS, yml_rl, Pw, {0x0f,0x46} },
+ { ACMOVQLT, yml_rl, Pw, {0x0f,0x4c} },
+ { ACMOVQMI, yml_rl, Pw, {0x0f,0x48} },
+ { ACMOVQNE, yml_rl, Pw, {0x0f,0x45} },
+ { ACMOVQOC, yml_rl, Pw, {0x0f,0x41} },
+ { ACMOVQOS, yml_rl, Pw, {0x0f,0x40} },
+ { ACMOVQPC, yml_rl, Pw, {0x0f,0x4b} },
+ { ACMOVQPL, yml_rl, Pw, {0x0f,0x49} },
+ { ACMOVQPS, yml_rl, Pw, {0x0f,0x4a} },
+ { ACMOVWCC, yml_rl, Pq, {0x43} },
+ { ACMOVWCS, yml_rl, Pq, {0x42} },
+ { ACMOVWEQ, yml_rl, Pq, {0x44} },
+ { ACMOVWGE, yml_rl, Pq, {0x4d} },
+ { ACMOVWGT, yml_rl, Pq, {0x4f} },
+ { ACMOVWHI, yml_rl, Pq, {0x47} },
+ { ACMOVWLE, yml_rl, Pq, {0x4e} },
+ { ACMOVWLS, yml_rl, Pq, {0x46} },
+ { ACMOVWLT, yml_rl, Pq, {0x4c} },
+ { ACMOVWMI, yml_rl, Pq, {0x48} },
+ { ACMOVWNE, yml_rl, Pq, {0x45} },
+ { ACMOVWOC, yml_rl, Pq, {0x41} },
+ { ACMOVWOS, yml_rl, Pq, {0x40} },
+ { ACMOVWPC, yml_rl, Pq, {0x4b} },
+ { ACMOVWPL, yml_rl, Pq, {0x49} },
+ { ACMOVWPS, yml_rl, Pq, {0x4a} },
+ { ACMPB, ycmpb, Pb, {0x3c,0x80,(07),0x38,0x3a} },
+ { ACMPL, ycmpl, Px, {0x83,(07),0x3d,0x81,(07),0x39,0x3b} },
+ { ACMPPD, yxcmpi, Px, {Pe,0xc2} },
+ { ACMPPS, yxcmpi, Pm, {0xc2,0} },
+ { ACMPQ, ycmpl, Pw, {0x83,(07),0x3d,0x81,(07),0x39,0x3b} },
+ { ACMPSB, ynone, Pb, {0xa6} },
+ { ACMPSD, yxcmpi, Px, {Pf2,0xc2} },
+ { ACMPSL, ynone, Px, {0xa7} },
+ { ACMPSQ, ynone, Pw, {0xa7} },
+ { ACMPSS, yxcmpi, Px, {Pf3,0xc2} },
+ { ACMPSW, ynone, Pe, {0xa7} },
+ { ACMPW, ycmpl, Pe, {0x83,(07),0x3d,0x81,(07),0x39,0x3b} },
+ { ACOMISD, yxcmp, Pe, {0x2f} },
+ { ACOMISS, yxcmp, Pm, {0x2f} },
+ { ACPUID, ynone, Pm, {0xa2} },
+ { ACVTPL2PD, yxcvm2, Px, {Pf3,0xe6,Pe,0x2a} },
+ { ACVTPL2PS, yxcvm2, Pm, {0x5b,0,0x2a,0,} },
+ { ACVTPD2PL, yxcvm1, Px, {Pf2,0xe6,Pe,0x2d} },
+ { ACVTPD2PS, yxm, Pe, {0x5a} },
+ { ACVTPS2PL, yxcvm1, Px, {Pe,0x5b,Pm,0x2d} },
+ { ACVTPS2PD, yxm, Pm, {0x5a} },
+ { API2FW, ymfp, Px, {0x0c} },
+ { ACVTSD2SL, yxcvfl, Pf2, {0x2d} },
+ { ACVTSD2SQ, yxcvfq, Pw, {Pf2,0x2d} },
+ { ACVTSD2SS, yxm, Pf2, {0x5a} },
+ { ACVTSL2SD, yxcvlf, Pf2, {0x2a} },
+ { ACVTSQ2SD, yxcvqf, Pw, {Pf2,0x2a} },
+ { ACVTSL2SS, yxcvlf, Pf3, {0x2a} },
+ { ACVTSQ2SS, yxcvqf, Pw, {Pf3,0x2a} },
+ { ACVTSS2SD, yxm, Pf3, {0x5a} },
+ { ACVTSS2SL, yxcvfl, Pf3, {0x2d} },
+ { ACVTSS2SQ, yxcvfq, Pw, {Pf3,0x2d} },
+ { ACVTTPD2PL, yxcvm1, Px, {Pe,0xe6,Pe,0x2c} },
+ { ACVTTPS2PL, yxcvm1, Px, {Pf3,0x5b,Pm,0x2c} },
+ { ACVTTSD2SL, yxcvfl, Pf2, {0x2c} },
+ { ACVTTSD2SQ, yxcvfq, Pw, {Pf2,0x2c} },
+ { ACVTTSS2SL, yxcvfl, Pf3, {0x2c} },
+ { ACVTTSS2SQ, yxcvfq, Pw, {Pf3,0x2c} },
+ { ACWD, ynone, Pe, {0x99} },
+ { ACQO, ynone, Pw, {0x99} },
+ { ADAA, ynone, P32, {0x27} },
+ { ADAS, ynone, P32, {0x2f} },
{ ADATA },
- { ADECB, yincb, Pb, 0xfe,(01) },
- { ADECL, yincl, Px, 0xff,(01) },
- { ADECQ, yincl, Pw, 0xff,(01) },
- { ADECW, yincw, Pe, 0xff,(01) },
- { ADIVB, ydivb, Pb, 0xf6,(06) },
- { ADIVL, ydivl, Px, 0xf7,(06) },
- { ADIVPD, yxm, Pe, 0x5e },
- { ADIVPS, yxm, Pm, 0x5e },
- { ADIVQ, ydivl, Pw, 0xf7,(06) },
- { ADIVSD, yxm, Pf2, 0x5e },
- { ADIVSS, yxm, Pf3, 0x5e },
- { ADIVW, ydivl, Pe, 0xf7,(06) },
- { AEMMS, ynone, Pm, 0x77 },
+ { ADECB, yincb, Pb, {0xfe,(01)} },
+ { ADECL, yincl, Px, {0xff,(01)} },
+ { ADECQ, yincl, Pw, {0xff,(01)} },
+ { ADECW, yincw, Pe, {0xff,(01)} },
+ { ADIVB, ydivb, Pb, {0xf6,(06)} },
+ { ADIVL, ydivl, Px, {0xf7,(06)} },
+ { ADIVPD, yxm, Pe, {0x5e} },
+ { ADIVPS, yxm, Pm, {0x5e} },
+ { ADIVQ, ydivl, Pw, {0xf7,(06)} },
+ { ADIVSD, yxm, Pf2, {0x5e} },
+ { ADIVSS, yxm, Pf3, {0x5e} },
+ { ADIVW, ydivl, Pe, {0xf7,(06)} },
+ { AEMMS, ynone, Pm, {0x77} },
{ AENTER }, /* botch */
- { AFXRSTOR, ysvrs, Pm, 0xae,(01),0xae,(01) },
- { AFXSAVE, ysvrs, Pm, 0xae,(00),0xae,(00) },
- { AFXRSTOR64, ysvrs, Pw, 0x0f,0xae,(01),0x0f,0xae,(01) },
- { AFXSAVE64, ysvrs, Pw, 0x0f,0xae,(00),0x0f,0xae,(00) },
+ { AFXRSTOR, ysvrs, Pm, {0xae,(01),0xae,(01)} },
+ { AFXSAVE, ysvrs, Pm, {0xae,(00),0xae,(00)} },
+ { AFXRSTOR64, ysvrs, Pw, {0x0f,0xae,(01),0x0f,0xae,(01)} },
+ { AFXSAVE64, ysvrs, Pw, {0x0f,0xae,(00),0x0f,0xae,(00)} },
{ AGLOBL },
{ AGOK },
{ AHISTORY },
- { AHLT, ynone, Px, 0xf4 },
- { AIDIVB, ydivb, Pb, 0xf6,(07) },
- { AIDIVL, ydivl, Px, 0xf7,(07) },
- { AIDIVQ, ydivl, Pw, 0xf7,(07) },
- { AIDIVW, ydivl, Pe, 0xf7,(07) },
- { AIMULB, ydivb, Pb, 0xf6,(05) },
- { AIMULL, yimul, Px, 0xf7,(05),0x6b,0x69,Pm,0xaf },
- { AIMULQ, yimul, Pw, 0xf7,(05),0x6b,0x69,Pm,0xaf },
- { AIMULW, yimul, Pe, 0xf7,(05),0x6b,0x69,Pm,0xaf },
- { AIMUL3Q, yimul3, Pw, 0x6b,(00) },
- { AINB, yin, Pb, 0xe4,0xec },
- { AINCB, yincb, Pb, 0xfe,(00) },
- { AINCL, yincl, Px, 0xff,(00) },
- { AINCQ, yincl, Pw, 0xff,(00) },
- { AINCW, yincw, Pe, 0xff,(00) },
- { AINL, yin, Px, 0xe5,0xed },
- { AINSB, ynone, Pb, 0x6c },
- { AINSL, ynone, Px, 0x6d },
- { AINSW, ynone, Pe, 0x6d },
- { AINT, yint, Px, 0xcd },
- { AINTO, ynone, P32, 0xce },
- { AINW, yin, Pe, 0xe5,0xed },
- { AIRETL, ynone, Px, 0xcf },
- { AIRETQ, ynone, Pw, 0xcf },
- { AIRETW, ynone, Pe, 0xcf },
- { AJCC, yjcond, Px, 0x73,0x83,(00) },
- { AJCS, yjcond, Px, 0x72,0x82 },
- { AJCXZL, yloop, Px, 0xe3 },
- { AJCXZQ, yloop, Px, 0xe3 },
- { AJEQ, yjcond, Px, 0x74,0x84 },
- { AJGE, yjcond, Px, 0x7d,0x8d },
- { AJGT, yjcond, Px, 0x7f,0x8f },
- { AJHI, yjcond, Px, 0x77,0x87 },
- { AJLE, yjcond, Px, 0x7e,0x8e },
- { AJLS, yjcond, Px, 0x76,0x86 },
- { AJLT, yjcond, Px, 0x7c,0x8c },
- { AJMI, yjcond, Px, 0x78,0x88 },
- { AJMP, yjmp, Px, 0xff,(04),0xeb,0xe9 },
- { AJNE, yjcond, Px, 0x75,0x85 },
- { AJOC, yjcond, Px, 0x71,0x81,(00) },
- { AJOS, yjcond, Px, 0x70,0x80,(00) },
- { AJPC, yjcond, Px, 0x7b,0x8b },
- { AJPL, yjcond, Px, 0x79,0x89 },
- { AJPS, yjcond, Px, 0x7a,0x8a },
- { ALAHF, ynone, Px, 0x9f },
- { ALARL, yml_rl, Pm, 0x02 },
- { ALARW, yml_rl, Pq, 0x02 },
- { ALDMXCSR, ysvrs, Pm, 0xae,(02),0xae,(02) },
- { ALEAL, ym_rl, Px, 0x8d },
- { ALEAQ, ym_rl, Pw, 0x8d },
- { ALEAVEL, ynone, P32, 0xc9 },
- { ALEAVEQ, ynone, Py, 0xc9 },
- { ALEAVEW, ynone, Pe, 0xc9 },
- { ALEAW, ym_rl, Pe, 0x8d },
- { ALOCK, ynone, Px, 0xf0 },
- { ALODSB, ynone, Pb, 0xac },
- { ALODSL, ynone, Px, 0xad },
- { ALODSQ, ynone, Pw, 0xad },
- { ALODSW, ynone, Pe, 0xad },
- { ALONG, ybyte, Px, 4 },
- { ALOOP, yloop, Px, 0xe2 },
- { ALOOPEQ, yloop, Px, 0xe1 },
- { ALOOPNE, yloop, Px, 0xe0 },
- { ALSLL, yml_rl, Pm, 0x03 },
- { ALSLW, yml_rl, Pq, 0x03 },
- { AMASKMOVOU, yxr, Pe, 0xf7 },
- { AMASKMOVQ, ymr, Pm, 0xf7 },
- { AMAXPD, yxm, Pe, 0x5f },
- { AMAXPS, yxm, Pm, 0x5f },
- { AMAXSD, yxm, Pf2, 0x5f },
- { AMAXSS, yxm, Pf3, 0x5f },
- { AMINPD, yxm, Pe, 0x5d },
- { AMINPS, yxm, Pm, 0x5d },
- { AMINSD, yxm, Pf2, 0x5d },
- { AMINSS, yxm, Pf3, 0x5d },
- { AMOVAPD, yxmov, Pe, 0x28,0x29 },
- { AMOVAPS, yxmov, Pm, 0x28,0x29 },
- { AMOVB, ymovb, Pb, 0x88,0x8a,0xb0,0xc6,(00) },
- { AMOVBLSX, ymb_rl, Pm, 0xbe },
- { AMOVBLZX, ymb_rl, Pm, 0xb6 },
- { AMOVBQSX, ymb_rl, Pw, 0x0f,0xbe },
- { AMOVBQZX, ymb_rl, Pw, 0x0f,0xb6 },
- { AMOVBWSX, ymb_rl, Pq, 0xbe },
- { AMOVBWZX, ymb_rl, Pq, 0xb6 },
- { AMOVO, yxmov, Pe, 0x6f,0x7f },
- { AMOVOU, yxmov, Pf3, 0x6f,0x7f },
- { AMOVHLPS, yxr, Pm, 0x12 },
- { AMOVHPD, yxmov, Pe, 0x16,0x17 },
- { AMOVHPS, yxmov, Pm, 0x16,0x17 },
- { AMOVL, ymovl, Px, 0x89,0x8b,0x31,0xb8,0xc7,(00),0x6e,0x7e,Pe,0x6e,Pe,0x7e,0 },
- { AMOVLHPS, yxr, Pm, 0x16 },
- { AMOVLPD, yxmov, Pe, 0x12,0x13 },
- { AMOVLPS, yxmov, Pm, 0x12,0x13 },
- { AMOVLQSX, yml_rl, Pw, 0x63 },
- { AMOVLQZX, yml_rl, Px, 0x8b },
- { AMOVMSKPD, yxrrl, Pq, 0x50 },
- { AMOVMSKPS, yxrrl, Pm, 0x50 },
- { AMOVNTO, yxr_ml, Pe, 0xe7 },
- { AMOVNTPD, yxr_ml, Pe, 0x2b },
- { AMOVNTPS, yxr_ml, Pm, 0x2b },
- { AMOVNTQ, ymr_ml, Pm, 0xe7 },
- { AMOVQ, ymovq, Pw, 0x89, 0x8b, 0x31, 0xc7,(00), 0xb8, 0xc7,(00), 0x6f, 0x7f, 0x6e, 0x7e, Pf2,0xd6, Pf3,0x7e, Pe,0xd6, Pe,0x6e, Pe,0x7e,0 },
- { AMOVQOZX, ymrxr, Pf3, 0xd6,0x7e },
- { AMOVSB, ynone, Pb, 0xa4 },
- { AMOVSD, yxmov, Pf2, 0x10,0x11 },
- { AMOVSL, ynone, Px, 0xa5 },
- { AMOVSQ, ynone, Pw, 0xa5 },
- { AMOVSS, yxmov, Pf3, 0x10,0x11 },
- { AMOVSW, ynone, Pe, 0xa5 },
- { AMOVUPD, yxmov, Pe, 0x10,0x11 },
- { AMOVUPS, yxmov, Pm, 0x10,0x11 },
- { AMOVW, ymovw, Pe, 0x89,0x8b,0x31,0xb8,0xc7,(00),0 },
- { AMOVWLSX, yml_rl, Pm, 0xbf },
- { AMOVWLZX, yml_rl, Pm, 0xb7 },
- { AMOVWQSX, yml_rl, Pw, 0x0f,0xbf },
- { AMOVWQZX, yml_rl, Pw, 0x0f,0xb7 },
- { AMULB, ydivb, Pb, 0xf6,(04) },
- { AMULL, ydivl, Px, 0xf7,(04) },
- { AMULPD, yxm, Pe, 0x59 },
- { AMULPS, yxm, Ym, 0x59 },
- { AMULQ, ydivl, Pw, 0xf7,(04) },
- { AMULSD, yxm, Pf2, 0x59 },
- { AMULSS, yxm, Pf3, 0x59 },
- { AMULW, ydivl, Pe, 0xf7,(04) },
+ { AHLT, ynone, Px, {0xf4} },
+ { AIDIVB, ydivb, Pb, {0xf6,(07)} },
+ { AIDIVL, ydivl, Px, {0xf7,(07)} },
+ { AIDIVQ, ydivl, Pw, {0xf7,(07)} },
+ { AIDIVW, ydivl, Pe, {0xf7,(07)} },
+ { AIMULB, ydivb, Pb, {0xf6,(05)} },
+ { AIMULL, yimul, Px, {0xf7,(05),0x6b,0x69,Pm,0xaf} },
+ { AIMULQ, yimul, Pw, {0xf7,(05),0x6b,0x69,Pm,0xaf} },
+ { AIMULW, yimul, Pe, {0xf7,(05),0x6b,0x69,Pm,0xaf} },
+ { AIMUL3Q, yimul3, Pw, {0x6b,(00)} },
+ { AINB, yin, Pb, {0xe4,0xec} },
+ { AINCB, yincb, Pb, {0xfe,(00)} },
+ { AINCL, yincl, Px, {0xff,(00)} },
+ { AINCQ, yincl, Pw, {0xff,(00)} },
+ { AINCW, yincw, Pe, {0xff,(00)} },
+ { AINL, yin, Px, {0xe5,0xed} },
+ { AINSB, ynone, Pb, {0x6c} },
+ { AINSL, ynone, Px, {0x6d} },
+ { AINSW, ynone, Pe, {0x6d} },
+ { AINT, yint, Px, {0xcd} },
+ { AINTO, ynone, P32, {0xce} },
+ { AINW, yin, Pe, {0xe5,0xed} },
+ { AIRETL, ynone, Px, {0xcf} },
+ { AIRETQ, ynone, Pw, {0xcf} },
+ { AIRETW, ynone, Pe, {0xcf} },
+ { AJCC, yjcond, Px, {0x73,0x83,(00)} },
+ { AJCS, yjcond, Px, {0x72,0x82} },
+ { AJCXZL, yloop, Px, {0xe3} },
+ { AJCXZQ, yloop, Px, {0xe3} },
+ { AJEQ, yjcond, Px, {0x74,0x84} },
+ { AJGE, yjcond, Px, {0x7d,0x8d} },
+ { AJGT, yjcond, Px, {0x7f,0x8f} },
+ { AJHI, yjcond, Px, {0x77,0x87} },
+ { AJLE, yjcond, Px, {0x7e,0x8e} },
+ { AJLS, yjcond, Px, {0x76,0x86} },
+ { AJLT, yjcond, Px, {0x7c,0x8c} },
+ { AJMI, yjcond, Px, {0x78,0x88} },
+ { AJMP, yjmp, Px, {0xff,(04),0xeb,0xe9} },
+ { AJNE, yjcond, Px, {0x75,0x85} },
+ { AJOC, yjcond, Px, {0x71,0x81,(00)} },
+ { AJOS, yjcond, Px, {0x70,0x80,(00)} },
+ { AJPC, yjcond, Px, {0x7b,0x8b} },
+ { AJPL, yjcond, Px, {0x79,0x89} },
+ { AJPS, yjcond, Px, {0x7a,0x8a} },
+ { ALAHF, ynone, Px, {0x9f} },
+ { ALARL, yml_rl, Pm, {0x02} },
+ { ALARW, yml_rl, Pq, {0x02} },
+ { ALDMXCSR, ysvrs, Pm, {0xae,(02),0xae,(02)} },
+ { ALEAL, ym_rl, Px, {0x8d} },
+ { ALEAQ, ym_rl, Pw, {0x8d} },
+ { ALEAVEL, ynone, P32, {0xc9} },
+ { ALEAVEQ, ynone, Py, {0xc9} },
+ { ALEAVEW, ynone, Pe, {0xc9} },
+ { ALEAW, ym_rl, Pe, {0x8d} },
+ { ALOCK, ynone, Px, {0xf0} },
+ { ALODSB, ynone, Pb, {0xac} },
+ { ALODSL, ynone, Px, {0xad} },
+ { ALODSQ, ynone, Pw, {0xad} },
+ { ALODSW, ynone, Pe, {0xad} },
+ { ALONG, ybyte, Px, {4} },
+ { ALOOP, yloop, Px, {0xe2} },
+ { ALOOPEQ, yloop, Px, {0xe1} },
+ { ALOOPNE, yloop, Px, {0xe0} },
+ { ALSLL, yml_rl, Pm, {0x03 } },
+ { ALSLW, yml_rl, Pq, {0x03 } },
+ { AMASKMOVOU, yxr, Pe, {0xf7} },
+ { AMASKMOVQ, ymr, Pm, {0xf7} },
+ { AMAXPD, yxm, Pe, {0x5f} },
+ { AMAXPS, yxm, Pm, {0x5f} },
+ { AMAXSD, yxm, Pf2, {0x5f} },
+ { AMAXSS, yxm, Pf3, {0x5f} },
+ { AMINPD, yxm, Pe, {0x5d} },
+ { AMINPS, yxm, Pm, {0x5d} },
+ { AMINSD, yxm, Pf2, {0x5d} },
+ { AMINSS, yxm, Pf3, {0x5d} },
+ { AMOVAPD, yxmov, Pe, {0x28,0x29} },
+ { AMOVAPS, yxmov, Pm, {0x28,0x29} },
+ { AMOVB, ymovb, Pb, {0x88,0x8a,0xb0,0xc6,(00)} },
+ { AMOVBLSX, ymb_rl, Pm, {0xbe} },
+ { AMOVBLZX, ymb_rl, Pm, {0xb6} },
+ { AMOVBQSX, ymb_rl, Pw, {0x0f,0xbe} },
+ { AMOVBQZX, ymb_rl, Pm, {0xb6} },
+ { AMOVBWSX, ymb_rl, Pq, {0xbe} },
+ { AMOVBWZX, ymb_rl, Pq, {0xb6} },
+ { AMOVO, yxmov, Pe, {0x6f,0x7f} },
+ { AMOVOU, yxmov, Pf3, {0x6f,0x7f} },
+ { AMOVHLPS, yxr, Pm, {0x12} },
+ { AMOVHPD, yxmov, Pe, {0x16,0x17} },
+ { AMOVHPS, yxmov, Pm, {0x16,0x17} },
+ { AMOVL, ymovl, Px, {0x89,0x8b,0x31,0xb8,0xc7,(00),0x6e,0x7e,Pe,0x6e,Pe,0x7e,0} },
+ { AMOVLHPS, yxr, Pm, {0x16} },
+ { AMOVLPD, yxmov, Pe, {0x12,0x13} },
+ { AMOVLPS, yxmov, Pm, {0x12,0x13} },
+ { AMOVLQSX, yml_rl, Pw, {0x63} },
+ { AMOVLQZX, yml_rl, Px, {0x8b} },
+ { AMOVMSKPD, yxrrl, Pq, {0x50} },
+ { AMOVMSKPS, yxrrl, Pm, {0x50} },
+ { AMOVNTO, yxr_ml, Pe, {0xe7} },
+ { AMOVNTPD, yxr_ml, Pe, {0x2b} },
+ { AMOVNTPS, yxr_ml, Pm, {0x2b} },
+ { AMOVNTQ, ymr_ml, Pm, {0xe7} },
+ { AMOVQ, ymovq, Pw, {0x89, 0x8b, 0x31, 0xc7,(00), 0xb8, 0xc7,(00), 0x6f, 0x7f, 0x6e, 0x7e, Pf2,0xd6, Pf3,0x7e, Pe,0xd6, Pe,0x6e, Pe,0x7e,0} },
+ { AMOVQOZX, ymrxr, Pf3, {0xd6,0x7e} },
+ { AMOVSB, ynone, Pb, {0xa4} },
+ { AMOVSD, yxmov, Pf2, {0x10,0x11} },
+ { AMOVSL, ynone, Px, {0xa5} },
+ { AMOVSQ, ynone, Pw, {0xa5} },
+ { AMOVSS, yxmov, Pf3, {0x10,0x11} },
+ { AMOVSW, ynone, Pe, {0xa5} },
+ { AMOVUPD, yxmov, Pe, {0x10,0x11} },
+ { AMOVUPS, yxmov, Pm, {0x10,0x11} },
+ { AMOVW, ymovw, Pe, {0x89,0x8b,0x31,0xb8,0xc7,(00),0} },
+ { AMOVWLSX, yml_rl, Pm, {0xbf} },
+ { AMOVWLZX, yml_rl, Pm, {0xb7} },
+ { AMOVWQSX, yml_rl, Pw, {0x0f,0xbf} },
+ { AMOVWQZX, yml_rl, Pw, {0x0f,0xb7} },
+ { AMULB, ydivb, Pb, {0xf6,(04)} },
+ { AMULL, ydivl, Px, {0xf7,(04)} },
+ { AMULPD, yxm, Pe, {0x59} },
+ { AMULPS, yxm, Ym, {0x59} },
+ { AMULQ, ydivl, Pw, {0xf7,(04)} },
+ { AMULSD, yxm, Pf2, {0x59} },
+ { AMULSS, yxm, Pf3, {0x59} },
+ { AMULW, ydivl, Pe, {0xf7,(04)} },
{ ANAME },
- { ANEGB, yscond, Pb, 0xf6,(03) },
- { ANEGL, yscond, Px, 0xf7,(03) },
- { ANEGQ, yscond, Pw, 0xf7,(03) },
- { ANEGW, yscond, Pe, 0xf7,(03) },
- { ANOP, ynop, Px, 0,0 },
- { ANOTB, yscond, Pb, 0xf6,(02) },
- { ANOTL, yscond, Px, 0xf7,(02) },
- { ANOTQ, yscond, Pw, 0xf7,(02) },
- { ANOTW, yscond, Pe, 0xf7,(02) },
- { AORB, yxorb, Pb, 0x0c,0x80,(01),0x08,0x0a },
- { AORL, yxorl, Px, 0x83,(01),0x0d,0x81,(01),0x09,0x0b },
- { AORPD, yxm, Pq, 0x56 },
- { AORPS, yxm, Pm, 0x56 },
- { AORQ, yxorl, Pw, 0x83,(01),0x0d,0x81,(01),0x09,0x0b },
- { AORW, yxorl, Pe, 0x83,(01),0x0d,0x81,(01),0x09,0x0b },
- { AOUTB, yin, Pb, 0xe6,0xee },
- { AOUTL, yin, Px, 0xe7,0xef },
- { AOUTSB, ynone, Pb, 0x6e },
- { AOUTSL, ynone, Px, 0x6f },
- { AOUTSW, ynone, Pe, 0x6f },
- { AOUTW, yin, Pe, 0xe7,0xef },
- { APACKSSLW, ymm, Py, 0x6b,Pe,0x6b },
- { APACKSSWB, ymm, Py, 0x63,Pe,0x63 },
- { APACKUSWB, ymm, Py, 0x67,Pe,0x67 },
- { APADDB, ymm, Py, 0xfc,Pe,0xfc },
- { APADDL, ymm, Py, 0xfe,Pe,0xfe },
- { APADDQ, yxm, Pe, 0xd4 },
- { APADDSB, ymm, Py, 0xec,Pe,0xec },
- { APADDSW, ymm, Py, 0xed,Pe,0xed },
- { APADDUSB, ymm, Py, 0xdc,Pe,0xdc },
- { APADDUSW, ymm, Py, 0xdd,Pe,0xdd },
- { APADDW, ymm, Py, 0xfd,Pe,0xfd },
- { APAND, ymm, Py, 0xdb,Pe,0xdb },
- { APANDN, ymm, Py, 0xdf,Pe,0xdf },
- { APAUSE, ynone, Px, 0xf3,0x90 },
- { APAVGB, ymm, Py, 0xe0,Pe,0xe0 },
- { APAVGW, ymm, Py, 0xe3,Pe,0xe3 },
- { APCMPEQB, ymm, Py, 0x74,Pe,0x74 },
- { APCMPEQL, ymm, Py, 0x76,Pe,0x76 },
- { APCMPEQW, ymm, Py, 0x75,Pe,0x75 },
- { APCMPGTB, ymm, Py, 0x64,Pe,0x64 },
- { APCMPGTL, ymm, Py, 0x66,Pe,0x66 },
- { APCMPGTW, ymm, Py, 0x65,Pe,0x65 },
- { APEXTRW, yextrw, Pq, 0xc5,(00) },
- { APF2IL, ymfp, Px, 0x1d },
- { APF2IW, ymfp, Px, 0x1c },
- { API2FL, ymfp, Px, 0x0d },
- { APFACC, ymfp, Px, 0xae },
- { APFADD, ymfp, Px, 0x9e },
- { APFCMPEQ, ymfp, Px, 0xb0 },
- { APFCMPGE, ymfp, Px, 0x90 },
- { APFCMPGT, ymfp, Px, 0xa0 },
- { APFMAX, ymfp, Px, 0xa4 },
- { APFMIN, ymfp, Px, 0x94 },
- { APFMUL, ymfp, Px, 0xb4 },
- { APFNACC, ymfp, Px, 0x8a },
- { APFPNACC, ymfp, Px, 0x8e },
- { APFRCP, ymfp, Px, 0x96 },
- { APFRCPIT1, ymfp, Px, 0xa6 },
- { APFRCPI2T, ymfp, Px, 0xb6 },
- { APFRSQIT1, ymfp, Px, 0xa7 },
- { APFRSQRT, ymfp, Px, 0x97 },
- { APFSUB, ymfp, Px, 0x9a },
- { APFSUBR, ymfp, Px, 0xaa },
- { APINSRW, yinsrw, Pq, 0xc4,(00) },
- { APINSRD, yinsr, Pq, 0x3a, 0x22, (00) },
- { APINSRQ, yinsr, Pq3, 0x3a, 0x22, (00) },
- { APMADDWL, ymm, Py, 0xf5,Pe,0xf5 },
- { APMAXSW, yxm, Pe, 0xee },
- { APMAXUB, yxm, Pe, 0xde },
- { APMINSW, yxm, Pe, 0xea },
- { APMINUB, yxm, Pe, 0xda },
- { APMOVMSKB, ymskb, Px, Pe,0xd7,0xd7 },
- { APMULHRW, ymfp, Px, 0xb7 },
- { APMULHUW, ymm, Py, 0xe4,Pe,0xe4 },
- { APMULHW, ymm, Py, 0xe5,Pe,0xe5 },
- { APMULLW, ymm, Py, 0xd5,Pe,0xd5 },
- { APMULULQ, ymm, Py, 0xf4,Pe,0xf4 },
- { APOPAL, ynone, P32, 0x61 },
- { APOPAW, ynone, Pe, 0x61 },
- { APOPFL, ynone, P32, 0x9d },
- { APOPFQ, ynone, Py, 0x9d },
- { APOPFW, ynone, Pe, 0x9d },
- { APOPL, ypopl, P32, 0x58,0x8f,(00) },
- { APOPQ, ypopl, Py, 0x58,0x8f,(00) },
- { APOPW, ypopl, Pe, 0x58,0x8f,(00) },
- { APOR, ymm, Py, 0xeb,Pe,0xeb },
- { APSADBW, yxm, Pq, 0xf6 },
- { APSHUFHW, yxshuf, Pf3, 0x70,(00) },
- { APSHUFL, yxshuf, Pq, 0x70,(00) },
- { APSHUFLW, yxshuf, Pf2, 0x70,(00) },
- { APSHUFW, ymshuf, Pm, 0x70,(00) },
- { APSHUFB, ymshufb,Pq, 0x38, 0x00 },
- { APSLLO, ypsdq, Pq, 0x73,(07) },
- { APSLLL, yps, Py, 0xf2, 0x72,(06), Pe,0xf2, Pe,0x72,(06) },
- { APSLLQ, yps, Py, 0xf3, 0x73,(06), Pe,0xf3, Pe,0x73,(06) },
- { APSLLW, yps, Py, 0xf1, 0x71,(06), Pe,0xf1, Pe,0x71,(06) },
- { APSRAL, yps, Py, 0xe2, 0x72,(04), Pe,0xe2, Pe,0x72,(04) },
- { APSRAW, yps, Py, 0xe1, 0x71,(04), Pe,0xe1, Pe,0x71,(04) },
- { APSRLO, ypsdq, Pq, 0x73,(03) },
- { APSRLL, yps, Py, 0xd2, 0x72,(02), Pe,0xd2, Pe,0x72,(02) },
- { APSRLQ, yps, Py, 0xd3, 0x73,(02), Pe,0xd3, Pe,0x73,(02) },
- { APSRLW, yps, Py, 0xd1, 0x71,(02), Pe,0xe1, Pe,0x71,(02) },
- { APSUBB, yxm, Pe, 0xf8 },
- { APSUBL, yxm, Pe, 0xfa },
- { APSUBQ, yxm, Pe, 0xfb },
- { APSUBSB, yxm, Pe, 0xe8 },
- { APSUBSW, yxm, Pe, 0xe9 },
- { APSUBUSB, yxm, Pe, 0xd8 },
- { APSUBUSW, yxm, Pe, 0xd9 },
- { APSUBW, yxm, Pe, 0xf9 },
- { APSWAPL, ymfp, Px, 0xbb },
- { APUNPCKHBW, ymm, Py, 0x68,Pe,0x68 },
- { APUNPCKHLQ, ymm, Py, 0x6a,Pe,0x6a },
- { APUNPCKHQDQ, yxm, Pe, 0x6d },
- { APUNPCKHWL, ymm, Py, 0x69,Pe,0x69 },
- { APUNPCKLBW, ymm, Py, 0x60,Pe,0x60 },
- { APUNPCKLLQ, ymm, Py, 0x62,Pe,0x62 },
- { APUNPCKLQDQ, yxm, Pe, 0x6c },
- { APUNPCKLWL, ymm, Py, 0x61,Pe,0x61 },
- { APUSHAL, ynone, P32, 0x60 },
- { APUSHAW, ynone, Pe, 0x60 },
- { APUSHFL, ynone, P32, 0x9c },
- { APUSHFQ, ynone, Py, 0x9c },
- { APUSHFW, ynone, Pe, 0x9c },
- { APUSHL, ypushl, P32, 0x50,0xff,(06),0x6a,0x68 },
- { APUSHQ, ypushl, Py, 0x50,0xff,(06),0x6a,0x68 },
- { APUSHW, ypushl, Pe, 0x50,0xff,(06),0x6a,0x68 },
- { APXOR, ymm, Py, 0xef,Pe,0xef },
- { AQUAD, ybyte, Px, 8 },
- { ARCLB, yshb, Pb, 0xd0,(02),0xc0,(02),0xd2,(02) },
- { ARCLL, yshl, Px, 0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02) },
- { ARCLQ, yshl, Pw, 0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02) },
- { ARCLW, yshl, Pe, 0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02) },
- { ARCPPS, yxm, Pm, 0x53 },
- { ARCPSS, yxm, Pf3, 0x53 },
- { ARCRB, yshb, Pb, 0xd0,(03),0xc0,(03),0xd2,(03) },
- { ARCRL, yshl, Px, 0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03) },
- { ARCRQ, yshl, Pw, 0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03) },
- { ARCRW, yshl, Pe, 0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03) },
- { AREP, ynone, Px, 0xf3 },
- { AREPN, ynone, Px, 0xf2 },
- { ARET, ynone, Px, 0xc3 },
- { ARETFW, yret, Pe, 0xcb,0xca },
- { ARETFL, yret, Px, 0xcb,0xca },
- { ARETFQ, yret, Pw, 0xcb,0xca },
- { AROLB, yshb, Pb, 0xd0,(00),0xc0,(00),0xd2,(00) },
- { AROLL, yshl, Px, 0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00) },
- { AROLQ, yshl, Pw, 0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00) },
- { AROLW, yshl, Pe, 0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00) },
- { ARORB, yshb, Pb, 0xd0,(01),0xc0,(01),0xd2,(01) },
- { ARORL, yshl, Px, 0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01) },
- { ARORQ, yshl, Pw, 0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01) },
- { ARORW, yshl, Pe, 0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01) },
- { ARSQRTPS, yxm, Pm, 0x52 },
- { ARSQRTSS, yxm, Pf3, 0x52 },
- { ASAHF, ynone, Px, 0x86,0xe0,0x50,0x9d }, /* XCHGB AH,AL; PUSH AX; POPFL */
- { ASALB, yshb, Pb, 0xd0,(04),0xc0,(04),0xd2,(04) },
- { ASALL, yshl, Px, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASALQ, yshl, Pw, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASALW, yshl, Pe, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASARB, yshb, Pb, 0xd0,(07),0xc0,(07),0xd2,(07) },
- { ASARL, yshl, Px, 0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07) },
- { ASARQ, yshl, Pw, 0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07) },
- { ASARW, yshl, Pe, 0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07) },
- { ASBBB, yxorb, Pb, 0x1c,0x80,(03),0x18,0x1a },
- { ASBBL, yxorl, Px, 0x83,(03),0x1d,0x81,(03),0x19,0x1b },
- { ASBBQ, yxorl, Pw, 0x83,(03),0x1d,0x81,(03),0x19,0x1b },
- { ASBBW, yxorl, Pe, 0x83,(03),0x1d,0x81,(03),0x19,0x1b },
- { ASCASB, ynone, Pb, 0xae },
- { ASCASL, ynone, Px, 0xaf },
- { ASCASQ, ynone, Pw, 0xaf },
- { ASCASW, ynone, Pe, 0xaf },
- { ASETCC, yscond, Pm, 0x93,(00) },
- { ASETCS, yscond, Pm, 0x92,(00) },
- { ASETEQ, yscond, Pm, 0x94,(00) },
- { ASETGE, yscond, Pm, 0x9d,(00) },
- { ASETGT, yscond, Pm, 0x9f,(00) },
- { ASETHI, yscond, Pm, 0x97,(00) },
- { ASETLE, yscond, Pm, 0x9e,(00) },
- { ASETLS, yscond, Pm, 0x96,(00) },
- { ASETLT, yscond, Pm, 0x9c,(00) },
- { ASETMI, yscond, Pm, 0x98,(00) },
- { ASETNE, yscond, Pm, 0x95,(00) },
- { ASETOC, yscond, Pm, 0x91,(00) },
- { ASETOS, yscond, Pm, 0x90,(00) },
- { ASETPC, yscond, Pm, 0x96,(00) },
- { ASETPL, yscond, Pm, 0x99,(00) },
- { ASETPS, yscond, Pm, 0x9a,(00) },
- { ASHLB, yshb, Pb, 0xd0,(04),0xc0,(04),0xd2,(04) },
- { ASHLL, yshl, Px, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASHLQ, yshl, Pw, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASHLW, yshl, Pe, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASHRB, yshb, Pb, 0xd0,(05),0xc0,(05),0xd2,(05) },
- { ASHRL, yshl, Px, 0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05) },
- { ASHRQ, yshl, Pw, 0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05) },
- { ASHRW, yshl, Pe, 0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05) },
- { ASHUFPD, yxshuf, Pq, 0xc6,(00) },
- { ASHUFPS, yxshuf, Pm, 0xc6,(00) },
- { ASQRTPD, yxm, Pe, 0x51 },
- { ASQRTPS, yxm, Pm, 0x51 },
- { ASQRTSD, yxm, Pf2, 0x51 },
- { ASQRTSS, yxm, Pf3, 0x51 },
- { ASTC, ynone, Px, 0xf9 },
- { ASTD, ynone, Px, 0xfd },
- { ASTI, ynone, Px, 0xfb },
- { ASTMXCSR, ysvrs, Pm, 0xae,(03),0xae,(03) },
- { ASTOSB, ynone, Pb, 0xaa },
- { ASTOSL, ynone, Px, 0xab },
- { ASTOSQ, ynone, Pw, 0xab },
- { ASTOSW, ynone, Pe, 0xab },
- { ASUBB, yxorb, Pb, 0x2c,0x80,(05),0x28,0x2a },
- { ASUBL, yaddl, Px, 0x83,(05),0x2d,0x81,(05),0x29,0x2b },
- { ASUBPD, yxm, Pe, 0x5c },
- { ASUBPS, yxm, Pm, 0x5c },
- { ASUBQ, yaddl, Pw, 0x83,(05),0x2d,0x81,(05),0x29,0x2b },
- { ASUBSD, yxm, Pf2, 0x5c },
- { ASUBSS, yxm, Pf3, 0x5c },
- { ASUBW, yaddl, Pe, 0x83,(05),0x2d,0x81,(05),0x29,0x2b },
- { ASWAPGS, ynone, Pm, 0x01,0xf8 },
- { ASYSCALL, ynone, Px, 0x0f,0x05 }, /* fast syscall */
- { ATESTB, ytestb, Pb, 0xa8,0xf6,(00),0x84,0x84 },
- { ATESTL, ytestl, Px, 0xa9,0xf7,(00),0x85,0x85 },
- { ATESTQ, ytestl, Pw, 0xa9,0xf7,(00),0x85,0x85 },
- { ATESTW, ytestl, Pe, 0xa9,0xf7,(00),0x85,0x85 },
+ { ANEGB, yscond, Pb, {0xf6,(03)} },
+ { ANEGL, yscond, Px, {0xf7,(03)} },
+ { ANEGQ, yscond, Pw, {0xf7,(03)} },
+ { ANEGW, yscond, Pe, {0xf7,(03)} },
+ { ANOP, ynop, Px, {0,0} },
+ { ANOTB, yscond, Pb, {0xf6,(02)} },
+ { ANOTL, yscond, Px, {0xf7,(02)} },
+ { ANOTQ, yscond, Pw, {0xf7,(02)} },
+ { ANOTW, yscond, Pe, {0xf7,(02)} },
+ { AORB, yxorb, Pb, {0x0c,0x80,(01),0x08,0x0a} },
+ { AORL, yxorl, Px, {0x83,(01),0x0d,0x81,(01),0x09,0x0b} },
+ { AORPD, yxm, Pq, {0x56} },
+ { AORPS, yxm, Pm, {0x56} },
+ { AORQ, yxorl, Pw, {0x83,(01),0x0d,0x81,(01),0x09,0x0b} },
+ { AORW, yxorl, Pe, {0x83,(01),0x0d,0x81,(01),0x09,0x0b} },
+ { AOUTB, yin, Pb, {0xe6,0xee} },
+ { AOUTL, yin, Px, {0xe7,0xef} },
+ { AOUTSB, ynone, Pb, {0x6e} },
+ { AOUTSL, ynone, Px, {0x6f} },
+ { AOUTSW, ynone, Pe, {0x6f} },
+ { AOUTW, yin, Pe, {0xe7,0xef} },
+ { APACKSSLW, ymm, Py, {0x6b,Pe,0x6b} },
+ { APACKSSWB, ymm, Py, {0x63,Pe,0x63} },
+ { APACKUSWB, ymm, Py, {0x67,Pe,0x67} },
+ { APADDB, ymm, Py, {0xfc,Pe,0xfc} },
+ { APADDL, ymm, Py, {0xfe,Pe,0xfe} },
+ { APADDQ, yxm, Pe, {0xd4} },
+ { APADDSB, ymm, Py, {0xec,Pe,0xec} },
+ { APADDSW, ymm, Py, {0xed,Pe,0xed} },
+ { APADDUSB, ymm, Py, {0xdc,Pe,0xdc} },
+ { APADDUSW, ymm, Py, {0xdd,Pe,0xdd} },
+ { APADDW, ymm, Py, {0xfd,Pe,0xfd} },
+ { APAND, ymm, Py, {0xdb,Pe,0xdb} },
+ { APANDN, ymm, Py, {0xdf,Pe,0xdf} },
+ { APAUSE, ynone, Px, {0xf3,0x90} },
+ { APAVGB, ymm, Py, {0xe0,Pe,0xe0} },
+ { APAVGW, ymm, Py, {0xe3,Pe,0xe3} },
+ { APCMPEQB, ymm, Py, {0x74,Pe,0x74} },
+ { APCMPEQL, ymm, Py, {0x76,Pe,0x76} },
+ { APCMPEQW, ymm, Py, {0x75,Pe,0x75} },
+ { APCMPGTB, ymm, Py, {0x64,Pe,0x64} },
+ { APCMPGTL, ymm, Py, {0x66,Pe,0x66} },
+ { APCMPGTW, ymm, Py, {0x65,Pe,0x65} },
+ { APEXTRW, yextrw, Pq, {0xc5,(00)} },
+ { APF2IL, ymfp, Px, {0x1d} },
+ { APF2IW, ymfp, Px, {0x1c} },
+ { API2FL, ymfp, Px, {0x0d} },
+ { APFACC, ymfp, Px, {0xae} },
+ { APFADD, ymfp, Px, {0x9e} },
+ { APFCMPEQ, ymfp, Px, {0xb0} },
+ { APFCMPGE, ymfp, Px, {0x90} },
+ { APFCMPGT, ymfp, Px, {0xa0} },
+ { APFMAX, ymfp, Px, {0xa4} },
+ { APFMIN, ymfp, Px, {0x94} },
+ { APFMUL, ymfp, Px, {0xb4} },
+ { APFNACC, ymfp, Px, {0x8a} },
+ { APFPNACC, ymfp, Px, {0x8e} },
+ { APFRCP, ymfp, Px, {0x96} },
+ { APFRCPIT1, ymfp, Px, {0xa6} },
+ { APFRCPI2T, ymfp, Px, {0xb6} },
+ { APFRSQIT1, ymfp, Px, {0xa7} },
+ { APFRSQRT, ymfp, Px, {0x97} },
+ { APFSUB, ymfp, Px, {0x9a} },
+ { APFSUBR, ymfp, Px, {0xaa} },
+ { APINSRW, yinsrw, Pq, {0xc4,(00)} },
+ { APINSRD, yinsr, Pq, {0x3a, 0x22, (00)} },
+ { APINSRQ, yinsr, Pq3, {0x3a, 0x22, (00)} },
+ { APMADDWL, ymm, Py, {0xf5,Pe,0xf5} },
+ { APMAXSW, yxm, Pe, {0xee} },
+ { APMAXUB, yxm, Pe, {0xde} },
+ { APMINSW, yxm, Pe, {0xea} },
+ { APMINUB, yxm, Pe, {0xda} },
+ { APMOVMSKB, ymskb, Px, {Pe,0xd7,0xd7} },
+ { APMULHRW, ymfp, Px, {0xb7} },
+ { APMULHUW, ymm, Py, {0xe4,Pe,0xe4} },
+ { APMULHW, ymm, Py, {0xe5,Pe,0xe5} },
+ { APMULLW, ymm, Py, {0xd5,Pe,0xd5} },
+ { APMULULQ, ymm, Py, {0xf4,Pe,0xf4} },
+ { APOPAL, ynone, P32, {0x61} },
+ { APOPAW, ynone, Pe, {0x61} },
+ { APOPFL, ynone, P32, {0x9d} },
+ { APOPFQ, ynone, Py, {0x9d} },
+ { APOPFW, ynone, Pe, {0x9d} },
+ { APOPL, ypopl, P32, {0x58,0x8f,(00)} },
+ { APOPQ, ypopl, Py, {0x58,0x8f,(00)} },
+ { APOPW, ypopl, Pe, {0x58,0x8f,(00)} },
+ { APOR, ymm, Py, {0xeb,Pe,0xeb} },
+ { APSADBW, yxm, Pq, {0xf6} },
+ { APSHUFHW, yxshuf, Pf3, {0x70,(00)} },
+ { APSHUFL, yxshuf, Pq, {0x70,(00)} },
+ { APSHUFLW, yxshuf, Pf2, {0x70,(00)} },
+ { APSHUFW, ymshuf, Pm, {0x70,(00)} },
+ { APSHUFB, ymshufb,Pq, {0x38, 0x00} },
+ { APSLLO, ypsdq, Pq, {0x73,(07)} },
+ { APSLLL, yps, Py, {0xf2, 0x72,(06), Pe,0xf2, Pe,0x72,(06)} },
+ { APSLLQ, yps, Py, {0xf3, 0x73,(06), Pe,0xf3, Pe,0x73,(06)} },
+ { APSLLW, yps, Py, {0xf1, 0x71,(06), Pe,0xf1, Pe,0x71,(06)} },
+ { APSRAL, yps, Py, {0xe2, 0x72,(04), Pe,0xe2, Pe,0x72,(04)} },
+ { APSRAW, yps, Py, {0xe1, 0x71,(04), Pe,0xe1, Pe,0x71,(04)} },
+ { APSRLO, ypsdq, Pq, {0x73,(03)} },
+ { APSRLL, yps, Py, {0xd2, 0x72,(02), Pe,0xd2, Pe,0x72,(02)} },
+ { APSRLQ, yps, Py, {0xd3, 0x73,(02), Pe,0xd3, Pe,0x73,(02)} },
+ { APSRLW, yps, Py, {0xd1, 0x71,(02), Pe,0xe1, Pe,0x71,(02)} },
+ { APSUBB, yxm, Pe, {0xf8} },
+ { APSUBL, yxm, Pe, {0xfa} },
+ { APSUBQ, yxm, Pe, {0xfb} },
+ { APSUBSB, yxm, Pe, {0xe8} },
+ { APSUBSW, yxm, Pe, {0xe9} },
+ { APSUBUSB, yxm, Pe, {0xd8} },
+ { APSUBUSW, yxm, Pe, {0xd9} },
+ { APSUBW, yxm, Pe, {0xf9} },
+ { APSWAPL, ymfp, Px, {0xbb} },
+ { APUNPCKHBW, ymm, Py, {0x68,Pe,0x68} },
+ { APUNPCKHLQ, ymm, Py, {0x6a,Pe,0x6a} },
+ { APUNPCKHQDQ, yxm, Pe, {0x6d} },
+ { APUNPCKHWL, ymm, Py, {0x69,Pe,0x69} },
+ { APUNPCKLBW, ymm, Py, {0x60,Pe,0x60} },
+ { APUNPCKLLQ, ymm, Py, {0x62,Pe,0x62} },
+ { APUNPCKLQDQ, yxm, Pe, {0x6c} },
+ { APUNPCKLWL, ymm, Py, {0x61,Pe,0x61} },
+ { APUSHAL, ynone, P32, {0x60} },
+ { APUSHAW, ynone, Pe, {0x60} },
+ { APUSHFL, ynone, P32, {0x9c} },
+ { APUSHFQ, ynone, Py, {0x9c} },
+ { APUSHFW, ynone, Pe, {0x9c} },
+ { APUSHL, ypushl, P32, {0x50,0xff,(06),0x6a,0x68} },
+ { APUSHQ, ypushl, Py, {0x50,0xff,(06),0x6a,0x68} },
+ { APUSHW, ypushl, Pe, {0x50,0xff,(06),0x6a,0x68} },
+ { APXOR, ymm, Py, {0xef,Pe,0xef} },
+ { AQUAD, ybyte, Px, {8} },
+ { ARCLB, yshb, Pb, {0xd0,(02),0xc0,(02),0xd2,(02)} },
+ { ARCLL, yshl, Px, {0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02)} },
+ { ARCLQ, yshl, Pw, {0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02)} },
+ { ARCLW, yshl, Pe, {0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02)} },
+ { ARCPPS, yxm, Pm, {0x53} },
+ { ARCPSS, yxm, Pf3, {0x53} },
+ { ARCRB, yshb, Pb, {0xd0,(03),0xc0,(03),0xd2,(03)} },
+ { ARCRL, yshl, Px, {0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03)} },
+ { ARCRQ, yshl, Pw, {0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03)} },
+ { ARCRW, yshl, Pe, {0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03)} },
+ { AREP, ynone, Px, {0xf3} },
+ { AREPN, ynone, Px, {0xf2} },
+ { ARET, ynone, Px, {0xc3} },
+ { ARETFW, yret, Pe, {0xcb,0xca} },
+ { ARETFL, yret, Px, {0xcb,0xca} },
+ { ARETFQ, yret, Pw, {0xcb,0xca} },
+ { AROLB, yshb, Pb, {0xd0,(00),0xc0,(00),0xd2,(00)} },
+ { AROLL, yshl, Px, {0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00)} },
+ { AROLQ, yshl, Pw, {0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00)} },
+ { AROLW, yshl, Pe, {0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00)} },
+ { ARORB, yshb, Pb, {0xd0,(01),0xc0,(01),0xd2,(01)} },
+ { ARORL, yshl, Px, {0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01)} },
+ { ARORQ, yshl, Pw, {0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01)} },
+ { ARORW, yshl, Pe, {0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01)} },
+ { ARSQRTPS, yxm, Pm, {0x52} },
+ { ARSQRTSS, yxm, Pf3, {0x52} },
+ { ASAHF, ynone, Px, {0x86,0xe0,0x50,0x9d} }, /* XCHGB AH,AL; PUSH AX; POPFL */
+ { ASALB, yshb, Pb, {0xd0,(04),0xc0,(04),0xd2,(04)} },
+ { ASALL, yshl, Px, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASALQ, yshl, Pw, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASALW, yshl, Pe, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASARB, yshb, Pb, {0xd0,(07),0xc0,(07),0xd2,(07)} },
+ { ASARL, yshl, Px, {0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07)} },
+ { ASARQ, yshl, Pw, {0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07)} },
+ { ASARW, yshl, Pe, {0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07)} },
+ { ASBBB, yxorb, Pb, {0x1c,0x80,(03),0x18,0x1a} },
+ { ASBBL, yxorl, Px, {0x83,(03),0x1d,0x81,(03),0x19,0x1b} },
+ { ASBBQ, yxorl, Pw, {0x83,(03),0x1d,0x81,(03),0x19,0x1b} },
+ { ASBBW, yxorl, Pe, {0x83,(03),0x1d,0x81,(03),0x19,0x1b} },
+ { ASCASB, ynone, Pb, {0xae} },
+ { ASCASL, ynone, Px, {0xaf} },
+ { ASCASQ, ynone, Pw, {0xaf} },
+ { ASCASW, ynone, Pe, {0xaf} },
+ { ASETCC, yscond, Pm, {0x93,(00)} },
+ { ASETCS, yscond, Pm, {0x92,(00)} },
+ { ASETEQ, yscond, Pm, {0x94,(00)} },
+ { ASETGE, yscond, Pm, {0x9d,(00)} },
+ { ASETGT, yscond, Pm, {0x9f,(00)} },
+ { ASETHI, yscond, Pm, {0x97,(00)} },
+ { ASETLE, yscond, Pm, {0x9e,(00)} },
+ { ASETLS, yscond, Pm, {0x96,(00)} },
+ { ASETLT, yscond, Pm, {0x9c,(00)} },
+ { ASETMI, yscond, Pm, {0x98,(00)} },
+ { ASETNE, yscond, Pm, {0x95,(00)} },
+ { ASETOC, yscond, Pm, {0x91,(00)} },
+ { ASETOS, yscond, Pm, {0x90,(00)} },
+ { ASETPC, yscond, Pm, {0x9b,(00)} },
+ { ASETPL, yscond, Pm, {0x99,(00)} },
+ { ASETPS, yscond, Pm, {0x9a,(00)} },
+ { ASHLB, yshb, Pb, {0xd0,(04),0xc0,(04),0xd2,(04)} },
+ { ASHLL, yshl, Px, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASHLQ, yshl, Pw, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASHLW, yshl, Pe, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASHRB, yshb, Pb, {0xd0,(05),0xc0,(05),0xd2,(05)} },
+ { ASHRL, yshl, Px, {0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05)} },
+ { ASHRQ, yshl, Pw, {0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05)} },
+ { ASHRW, yshl, Pe, {0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05)} },
+ { ASHUFPD, yxshuf, Pq, {0xc6,(00)} },
+ { ASHUFPS, yxshuf, Pm, {0xc6,(00)} },
+ { ASQRTPD, yxm, Pe, {0x51} },
+ { ASQRTPS, yxm, Pm, {0x51} },
+ { ASQRTSD, yxm, Pf2, {0x51} },
+ { ASQRTSS, yxm, Pf3, {0x51} },
+ { ASTC, ynone, Px, {0xf9} },
+ { ASTD, ynone, Px, {0xfd} },
+ { ASTI, ynone, Px, {0xfb} },
+ { ASTMXCSR, ysvrs, Pm, {0xae,(03),0xae,(03)} },
+ { ASTOSB, ynone, Pb, {0xaa} },
+ { ASTOSL, ynone, Px, {0xab} },
+ { ASTOSQ, ynone, Pw, {0xab} },
+ { ASTOSW, ynone, Pe, {0xab} },
+ { ASUBB, yxorb, Pb, {0x2c,0x80,(05),0x28,0x2a} },
+ { ASUBL, yaddl, Px, {0x83,(05),0x2d,0x81,(05),0x29,0x2b} },
+ { ASUBPD, yxm, Pe, {0x5c} },
+ { ASUBPS, yxm, Pm, {0x5c} },
+ { ASUBQ, yaddl, Pw, {0x83,(05),0x2d,0x81,(05),0x29,0x2b} },
+ { ASUBSD, yxm, Pf2, {0x5c} },
+ { ASUBSS, yxm, Pf3, {0x5c} },
+ { ASUBW, yaddl, Pe, {0x83,(05),0x2d,0x81,(05),0x29,0x2b} },
+ { ASWAPGS, ynone, Pm, {0x01,0xf8} },
+ { ASYSCALL, ynone, Px, {0x0f,0x05} }, /* fast syscall */
+ { ATESTB, ytestb, Pb, {0xa8,0xf6,(00),0x84,0x84} },
+ { ATESTL, ytestl, Px, {0xa9,0xf7,(00),0x85,0x85} },
+ { ATESTQ, ytestl, Pw, {0xa9,0xf7,(00),0x85,0x85} },
+ { ATESTW, ytestl, Pe, {0xa9,0xf7,(00),0x85,0x85} },
{ ATEXT, ytext, Px },
- { AUCOMISD, yxcmp, Pe, 0x2e },
- { AUCOMISS, yxcmp, Pm, 0x2e },
- { AUNPCKHPD, yxm, Pe, 0x15 },
- { AUNPCKHPS, yxm, Pm, 0x15 },
- { AUNPCKLPD, yxm, Pe, 0x14 },
- { AUNPCKLPS, yxm, Pm, 0x14 },
- { AVERR, ydivl, Pm, 0x00,(04) },
- { AVERW, ydivl, Pm, 0x00,(05) },
- { AWAIT, ynone, Px, 0x9b },
- { AWORD, ybyte, Px, 2 },
- { AXCHGB, yml_mb, Pb, 0x86,0x86 },
- { AXCHGL, yxchg, Px, 0x90,0x90,0x87,0x87 },
- { AXCHGQ, yxchg, Pw, 0x90,0x90,0x87,0x87 },
- { AXCHGW, yxchg, Pe, 0x90,0x90,0x87,0x87 },
- { AXLAT, ynone, Px, 0xd7 },
- { AXORB, yxorb, Pb, 0x34,0x80,(06),0x30,0x32 },
- { AXORL, yxorl, Px, 0x83,(06),0x35,0x81,(06),0x31,0x33 },
- { AXORPD, yxm, Pe, 0x57 },
- { AXORPS, yxm, Pm, 0x57 },
- { AXORQ, yxorl, Pw, 0x83,(06),0x35,0x81,(06),0x31,0x33 },
- { AXORW, yxorl, Pe, 0x83,(06),0x35,0x81,(06),0x31,0x33 },
-
- { AFMOVB, yfmvx, Px, 0xdf,(04) },
- { AFMOVBP, yfmvp, Px, 0xdf,(06) },
- { AFMOVD, yfmvd, Px, 0xdd,(00),0xdd,(02),0xd9,(00),0xdd,(02) },
- { AFMOVDP, yfmvdp, Px, 0xdd,(03),0xdd,(03) },
- { AFMOVF, yfmvf, Px, 0xd9,(00),0xd9,(02) },
- { AFMOVFP, yfmvp, Px, 0xd9,(03) },
- { AFMOVL, yfmvf, Px, 0xdb,(00),0xdb,(02) },
- { AFMOVLP, yfmvp, Px, 0xdb,(03) },
- { AFMOVV, yfmvx, Px, 0xdf,(05) },
- { AFMOVVP, yfmvp, Px, 0xdf,(07) },
- { AFMOVW, yfmvf, Px, 0xdf,(00),0xdf,(02) },
- { AFMOVWP, yfmvp, Px, 0xdf,(03) },
- { AFMOVX, yfmvx, Px, 0xdb,(05) },
- { AFMOVXP, yfmvp, Px, 0xdb,(07) },
+ { AUCOMISD, yxcmp, Pe, {0x2e} },
+ { AUCOMISS, yxcmp, Pm, {0x2e} },
+ { AUNPCKHPD, yxm, Pe, {0x15} },
+ { AUNPCKHPS, yxm, Pm, {0x15} },
+ { AUNPCKLPD, yxm, Pe, {0x14} },
+ { AUNPCKLPS, yxm, Pm, {0x14} },
+ { AVERR, ydivl, Pm, {0x00,(04)} },
+ { AVERW, ydivl, Pm, {0x00,(05)} },
+ { AWAIT, ynone, Px, {0x9b} },
+ { AWORD, ybyte, Px, {2} },
+ { AXCHGB, yml_mb, Pb, {0x86,0x86} },
+ { AXCHGL, yxchg, Px, {0x90,0x90,0x87,0x87} },
+ { AXCHGQ, yxchg, Pw, {0x90,0x90,0x87,0x87} },
+ { AXCHGW, yxchg, Pe, {0x90,0x90,0x87,0x87} },
+ { AXLAT, ynone, Px, {0xd7} },
+ { AXORB, yxorb, Pb, {0x34,0x80,(06),0x30,0x32} },
+ { AXORL, yxorl, Px, {0x83,(06),0x35,0x81,(06),0x31,0x33} },
+ { AXORPD, yxm, Pe, {0x57} },
+ { AXORPS, yxm, Pm, {0x57} },
+ { AXORQ, yxorl, Pw, {0x83,(06),0x35,0x81,(06),0x31,0x33} },
+ { AXORW, yxorl, Pe, {0x83,(06),0x35,0x81,(06),0x31,0x33} },
+
+ { AFMOVB, yfmvx, Px, {0xdf,(04)} },
+ { AFMOVBP, yfmvp, Px, {0xdf,(06)} },
+ { AFMOVD, yfmvd, Px, {0xdd,(00),0xdd,(02),0xd9,(00),0xdd,(02)} },
+ { AFMOVDP, yfmvdp, Px, {0xdd,(03),0xdd,(03)} },
+ { AFMOVF, yfmvf, Px, {0xd9,(00),0xd9,(02)} },
+ { AFMOVFP, yfmvp, Px, {0xd9,(03)} },
+ { AFMOVL, yfmvf, Px, {0xdb,(00),0xdb,(02)} },
+ { AFMOVLP, yfmvp, Px, {0xdb,(03)} },
+ { AFMOVV, yfmvx, Px, {0xdf,(05)} },
+ { AFMOVVP, yfmvp, Px, {0xdf,(07)} },
+ { AFMOVW, yfmvf, Px, {0xdf,(00),0xdf,(02)} },
+ { AFMOVWP, yfmvp, Px, {0xdf,(03)} },
+ { AFMOVX, yfmvx, Px, {0xdb,(05)} },
+ { AFMOVXP, yfmvp, Px, {0xdb,(07)} },
{ AFCOMB },
{ AFCOMBP },
- { AFCOMD, yfadd, Px, 0xdc,(02),0xd8,(02),0xdc,(02) }, /* botch */
- { AFCOMDP, yfadd, Px, 0xdc,(03),0xd8,(03),0xdc,(03) }, /* botch */
- { AFCOMDPP, ycompp, Px, 0xde,(03) },
- { AFCOMF, yfmvx, Px, 0xd8,(02) },
- { AFCOMFP, yfmvx, Px, 0xd8,(03) },
- { AFCOML, yfmvx, Px, 0xda,(02) },
- { AFCOMLP, yfmvx, Px, 0xda,(03) },
- { AFCOMW, yfmvx, Px, 0xde,(02) },
- { AFCOMWP, yfmvx, Px, 0xde,(03) },
-
- { AFUCOM, ycompp, Px, 0xdd,(04) },
- { AFUCOMP, ycompp, Px, 0xdd,(05) },
- { AFUCOMPP, ycompp, Px, 0xda,(13) },
-
- { AFADDDP, yfaddp, Px, 0xde,(00) },
- { AFADDW, yfmvx, Px, 0xde,(00) },
- { AFADDL, yfmvx, Px, 0xda,(00) },
- { AFADDF, yfmvx, Px, 0xd8,(00) },
- { AFADDD, yfadd, Px, 0xdc,(00),0xd8,(00),0xdc,(00) },
-
- { AFMULDP, yfaddp, Px, 0xde,(01) },
- { AFMULW, yfmvx, Px, 0xde,(01) },
- { AFMULL, yfmvx, Px, 0xda,(01) },
- { AFMULF, yfmvx, Px, 0xd8,(01) },
- { AFMULD, yfadd, Px, 0xdc,(01),0xd8,(01),0xdc,(01) },
-
- { AFSUBDP, yfaddp, Px, 0xde,(05) },
- { AFSUBW, yfmvx, Px, 0xde,(04) },
- { AFSUBL, yfmvx, Px, 0xda,(04) },
- { AFSUBF, yfmvx, Px, 0xd8,(04) },
- { AFSUBD, yfadd, Px, 0xdc,(04),0xd8,(04),0xdc,(05) },
-
- { AFSUBRDP, yfaddp, Px, 0xde,(04) },
- { AFSUBRW, yfmvx, Px, 0xde,(05) },
- { AFSUBRL, yfmvx, Px, 0xda,(05) },
- { AFSUBRF, yfmvx, Px, 0xd8,(05) },
- { AFSUBRD, yfadd, Px, 0xdc,(05),0xd8,(05),0xdc,(04) },
-
- { AFDIVDP, yfaddp, Px, 0xde,(07) },
- { AFDIVW, yfmvx, Px, 0xde,(06) },
- { AFDIVL, yfmvx, Px, 0xda,(06) },
- { AFDIVF, yfmvx, Px, 0xd8,(06) },
- { AFDIVD, yfadd, Px, 0xdc,(06),0xd8,(06),0xdc,(07) },
-
- { AFDIVRDP, yfaddp, Px, 0xde,(06) },
- { AFDIVRW, yfmvx, Px, 0xde,(07) },
- { AFDIVRL, yfmvx, Px, 0xda,(07) },
- { AFDIVRF, yfmvx, Px, 0xd8,(07) },
- { AFDIVRD, yfadd, Px, 0xdc,(07),0xd8,(07),0xdc,(06) },
-
- { AFXCHD, yfxch, Px, 0xd9,(01),0xd9,(01) },
+ { AFCOMD, yfadd, Px, {0xdc,(02),0xd8,(02),0xdc,(02)} }, /* botch */
+ { AFCOMDP, yfadd, Px, {0xdc,(03),0xd8,(03),0xdc,(03)} }, /* botch */
+ { AFCOMDPP, ycompp, Px, {0xde,(03)} },
+ { AFCOMF, yfmvx, Px, {0xd8,(02)} },
+ { AFCOMFP, yfmvx, Px, {0xd8,(03)} },
+ { AFCOML, yfmvx, Px, {0xda,(02)} },
+ { AFCOMLP, yfmvx, Px, {0xda,(03)} },
+ { AFCOMW, yfmvx, Px, {0xde,(02)} },
+ { AFCOMWP, yfmvx, Px, {0xde,(03)} },
+
+ { AFUCOM, ycompp, Px, {0xdd,(04)} },
+ { AFUCOMP, ycompp, Px, {0xdd,(05)} },
+ { AFUCOMPP, ycompp, Px, {0xda,(13)} },
+
+ { AFADDDP, yfaddp, Px, {0xde,(00)} },
+ { AFADDW, yfmvx, Px, {0xde,(00)} },
+ { AFADDL, yfmvx, Px, {0xda,(00)} },
+ { AFADDF, yfmvx, Px, {0xd8,(00)} },
+ { AFADDD, yfadd, Px, {0xdc,(00),0xd8,(00),0xdc,(00)} },
+
+ { AFMULDP, yfaddp, Px, {0xde,(01)} },
+ { AFMULW, yfmvx, Px, {0xde,(01)} },
+ { AFMULL, yfmvx, Px, {0xda,(01)} },
+ { AFMULF, yfmvx, Px, {0xd8,(01)} },
+ { AFMULD, yfadd, Px, {0xdc,(01),0xd8,(01),0xdc,(01)} },
+
+ { AFSUBDP, yfaddp, Px, {0xde,(05)} },
+ { AFSUBW, yfmvx, Px, {0xde,(04)} },
+ { AFSUBL, yfmvx, Px, {0xda,(04)} },
+ { AFSUBF, yfmvx, Px, {0xd8,(04)} },
+ { AFSUBD, yfadd, Px, {0xdc,(04),0xd8,(04),0xdc,(05)} },
+
+ { AFSUBRDP, yfaddp, Px, {0xde,(04)} },
+ { AFSUBRW, yfmvx, Px, {0xde,(05)} },
+ { AFSUBRL, yfmvx, Px, {0xda,(05)} },
+ { AFSUBRF, yfmvx, Px, {0xd8,(05)} },
+ { AFSUBRD, yfadd, Px, {0xdc,(05),0xd8,(05),0xdc,(04)} },
+
+ { AFDIVDP, yfaddp, Px, {0xde,(07)} },
+ { AFDIVW, yfmvx, Px, {0xde,(06)} },
+ { AFDIVL, yfmvx, Px, {0xda,(06)} },
+ { AFDIVF, yfmvx, Px, {0xd8,(06)} },
+ { AFDIVD, yfadd, Px, {0xdc,(06),0xd8,(06),0xdc,(07)} },
+
+ { AFDIVRDP, yfaddp, Px, {0xde,(06)} },
+ { AFDIVRW, yfmvx, Px, {0xde,(07)} },
+ { AFDIVRL, yfmvx, Px, {0xda,(07)} },
+ { AFDIVRF, yfmvx, Px, {0xd8,(07)} },
+ { AFDIVRD, yfadd, Px, {0xdc,(07),0xd8,(07),0xdc,(06)} },
+
+ { AFXCHD, yfxch, Px, {0xd9,(01),0xd9,(01)} },
{ AFFREE },
- { AFLDCW, ystcw, Px, 0xd9,(05),0xd9,(05) },
- { AFLDENV, ystcw, Px, 0xd9,(04),0xd9,(04) },
- { AFRSTOR, ysvrs, Px, 0xdd,(04),0xdd,(04) },
- { AFSAVE, ysvrs, Px, 0xdd,(06),0xdd,(06) },
- { AFSTCW, ystcw, Px, 0xd9,(07),0xd9,(07) },
- { AFSTENV, ystcw, Px, 0xd9,(06),0xd9,(06) },
- { AFSTSW, ystsw, Px, 0xdd,(07),0xdf,0xe0 },
- { AF2XM1, ynone, Px, 0xd9, 0xf0 },
- { AFABS, ynone, Px, 0xd9, 0xe1 },
- { AFCHS, ynone, Px, 0xd9, 0xe0 },
- { AFCLEX, ynone, Px, 0xdb, 0xe2 },
- { AFCOS, ynone, Px, 0xd9, 0xff },
- { AFDECSTP, ynone, Px, 0xd9, 0xf6 },
- { AFINCSTP, ynone, Px, 0xd9, 0xf7 },
- { AFINIT, ynone, Px, 0xdb, 0xe3 },
- { AFLD1, ynone, Px, 0xd9, 0xe8 },
- { AFLDL2E, ynone, Px, 0xd9, 0xea },
- { AFLDL2T, ynone, Px, 0xd9, 0xe9 },
- { AFLDLG2, ynone, Px, 0xd9, 0xec },
- { AFLDLN2, ynone, Px, 0xd9, 0xed },
- { AFLDPI, ynone, Px, 0xd9, 0xeb },
- { AFLDZ, ynone, Px, 0xd9, 0xee },
- { AFNOP, ynone, Px, 0xd9, 0xd0 },
- { AFPATAN, ynone, Px, 0xd9, 0xf3 },
- { AFPREM, ynone, Px, 0xd9, 0xf8 },
- { AFPREM1, ynone, Px, 0xd9, 0xf5 },
- { AFPTAN, ynone, Px, 0xd9, 0xf2 },
- { AFRNDINT, ynone, Px, 0xd9, 0xfc },
- { AFSCALE, ynone, Px, 0xd9, 0xfd },
- { AFSIN, ynone, Px, 0xd9, 0xfe },
- { AFSINCOS, ynone, Px, 0xd9, 0xfb },
- { AFSQRT, ynone, Px, 0xd9, 0xfa },
- { AFTST, ynone, Px, 0xd9, 0xe4 },
- { AFXAM, ynone, Px, 0xd9, 0xe5 },
- { AFXTRACT, ynone, Px, 0xd9, 0xf4 },
- { AFYL2X, ynone, Px, 0xd9, 0xf1 },
- { AFYL2XP1, ynone, Px, 0xd9, 0xf9 },
-
- { ACMPXCHGB, yrb_mb, Pb, 0x0f,0xb0 },
- { ACMPXCHGL, yrl_ml, Px, 0x0f,0xb1 },
- { ACMPXCHGW, yrl_ml, Pe, 0x0f,0xb1 },
- { ACMPXCHGQ, yrl_ml, Pw, 0x0f,0xb1 },
- { ACMPXCHG8B, yscond, Pm, 0xc7,(01) },
- { AINVD, ynone, Pm, 0x08 },
- { AINVLPG, ymbs, Pm, 0x01,(07) },
- { ALFENCE, ynone, Pm, 0xae,0xe8 },
- { AMFENCE, ynone, Pm, 0xae,0xf0 },
- { AMOVNTIL, yrl_ml, Pm, 0xc3 },
- { AMOVNTIQ, yrl_ml, Pw, 0x0f,0xc3 },
- { ARDMSR, ynone, Pm, 0x32 },
- { ARDPMC, ynone, Pm, 0x33 },
- { ARDTSC, ynone, Pm, 0x31 },
- { ARSM, ynone, Pm, 0xaa },
- { ASFENCE, ynone, Pm, 0xae,0xf8 },
- { ASYSRET, ynone, Pm, 0x07 },
- { AWBINVD, ynone, Pm, 0x09 },
- { AWRMSR, ynone, Pm, 0x30 },
-
- { AXADDB, yrb_mb, Pb, 0x0f,0xc0 },
- { AXADDL, yrl_ml, Px, 0x0f,0xc1 },
- { AXADDQ, yrl_ml, Pw, 0x0f,0xc1 },
- { AXADDW, yrl_ml, Pe, 0x0f,0xc1 },
-
- { ACRC32B, ycrc32l,Px, 0xf2,0x0f,0x38,0xf0,0 },
- { ACRC32Q, ycrc32l,Pw, 0xf2,0x0f,0x38,0xf1,0 },
+ { AFLDCW, ystcw, Px, {0xd9,(05),0xd9,(05)} },
+ { AFLDENV, ystcw, Px, {0xd9,(04),0xd9,(04)} },
+ { AFRSTOR, ysvrs, Px, {0xdd,(04),0xdd,(04)} },
+ { AFSAVE, ysvrs, Px, {0xdd,(06),0xdd,(06)} },
+ { AFSTCW, ystcw, Px, {0xd9,(07),0xd9,(07)} },
+ { AFSTENV, ystcw, Px, {0xd9,(06),0xd9,(06)} },
+ { AFSTSW, ystsw, Px, {0xdd,(07),0xdf,0xe0} },
+ { AF2XM1, ynone, Px, {0xd9, 0xf0} },
+ { AFABS, ynone, Px, {0xd9, 0xe1} },
+ { AFCHS, ynone, Px, {0xd9, 0xe0} },
+ { AFCLEX, ynone, Px, {0xdb, 0xe2} },
+ { AFCOS, ynone, Px, {0xd9, 0xff} },
+ { AFDECSTP, ynone, Px, {0xd9, 0xf6} },
+ { AFINCSTP, ynone, Px, {0xd9, 0xf7} },
+ { AFINIT, ynone, Px, {0xdb, 0xe3} },
+ { AFLD1, ynone, Px, {0xd9, 0xe8} },
+ { AFLDL2E, ynone, Px, {0xd9, 0xea} },
+ { AFLDL2T, ynone, Px, {0xd9, 0xe9} },
+ { AFLDLG2, ynone, Px, {0xd9, 0xec} },
+ { AFLDLN2, ynone, Px, {0xd9, 0xed} },
+ { AFLDPI, ynone, Px, {0xd9, 0xeb} },
+ { AFLDZ, ynone, Px, {0xd9, 0xee} },
+ { AFNOP, ynone, Px, {0xd9, 0xd0} },
+ { AFPATAN, ynone, Px, {0xd9, 0xf3} },
+ { AFPREM, ynone, Px, {0xd9, 0xf8} },
+ { AFPREM1, ynone, Px, {0xd9, 0xf5} },
+ { AFPTAN, ynone, Px, {0xd9, 0xf2} },
+ { AFRNDINT, ynone, Px, {0xd9, 0xfc} },
+ { AFSCALE, ynone, Px, {0xd9, 0xfd} },
+ { AFSIN, ynone, Px, {0xd9, 0xfe} },
+ { AFSINCOS, ynone, Px, {0xd9, 0xfb} },
+ { AFSQRT, ynone, Px, {0xd9, 0xfa} },
+ { AFTST, ynone, Px, {0xd9, 0xe4} },
+ { AFXAM, ynone, Px, {0xd9, 0xe5} },
+ { AFXTRACT, ynone, Px, {0xd9, 0xf4} },
+ { AFYL2X, ynone, Px, {0xd9, 0xf1} },
+ { AFYL2XP1, ynone, Px, {0xd9, 0xf9} },
+
+ { ACMPXCHGB, yrb_mb, Pb, {0x0f,0xb0} },
+ { ACMPXCHGL, yrl_ml, Px, {0x0f,0xb1} },
+ { ACMPXCHGW, yrl_ml, Pe, {0x0f,0xb1} },
+ { ACMPXCHGQ, yrl_ml, Pw, {0x0f,0xb1} },
+ { ACMPXCHG8B, yscond, Pm, {0xc7,(01)} },
+ { AINVD, ynone, Pm, {0x08} },
+ { AINVLPG, ymbs, Pm, {0x01,(07)} },
+ { ALFENCE, ynone, Pm, {0xae,0xe8} },
+ { AMFENCE, ynone, Pm, {0xae,0xf0} },
+ { AMOVNTIL, yrl_ml, Pm, {0xc3} },
+ { AMOVNTIQ, yrl_ml, Pw, {0x0f,0xc3} },
+ { ARDMSR, ynone, Pm, {0x32} },
+ { ARDPMC, ynone, Pm, {0x33} },
+ { ARDTSC, ynone, Pm, {0x31} },
+ { ARSM, ynone, Pm, {0xaa} },
+ { ASFENCE, ynone, Pm, {0xae,0xf8} },
+ { ASYSRET, ynone, Pm, {0x07} },
+ { AWBINVD, ynone, Pm, {0x09} },
+ { AWRMSR, ynone, Pm, {0x30} },
+
+ { AXADDB, yrb_mb, Pb, {0x0f,0xc0} },
+ { AXADDL, yrl_ml, Px, {0x0f,0xc1} },
+ { AXADDQ, yrl_ml, Pw, {0x0f,0xc1} },
+ { AXADDW, yrl_ml, Pe, {0x0f,0xc1} },
+
+ { ACRC32B, ycrc32l,Px, {0xf2,0x0f,0x38,0xf0,0} },
+ { ACRC32Q, ycrc32l,Pw, {0xf2,0x0f,0x38,0xf1,0} },
- { APREFETCHT0, yprefetch, Pm, 0x18,(01) },
- { APREFETCHT1, yprefetch, Pm, 0x18,(02) },
- { APREFETCHT2, yprefetch, Pm, 0x18,(03) },
- { APREFETCHNTA, yprefetch, Pm, 0x18,(00) },
+ { APREFETCHT0, yprefetch, Pm, {0x18,(01)} },
+ { APREFETCHT1, yprefetch, Pm, {0x18,(02)} },
+ { APREFETCHT2, yprefetch, Pm, {0x18,(03)} },
+ { APREFETCHNTA, yprefetch, Pm, {0x18,(00)} },
- { AMOVQL, yrl_ml, Px, 0x89 },
+ { AMOVQL, yrl_ml, Px, {0x89} },
- { AUNDEF, ynone, Px, 0x0f, 0x0b },
+ { AUNDEF, ynone, Px, {0x0f, 0x0b} },
- { AAESENC, yaes, Pq, 0x38,0xdc,(0) },
- { AAESENCLAST, yaes, Pq, 0x38,0xdd,(0) },
- { AAESDEC, yaes, Pq, 0x38,0xde,(0) },
- { AAESDECLAST, yaes, Pq, 0x38,0xdf,(0) },
- { AAESIMC, yaes, Pq, 0x38,0xdb,(0) },
- { AAESKEYGENASSIST, yaes2, Pq, 0x3a,0xdf,(0) },
+ { AAESENC, yaes, Pq, {0x38,0xdc,(0)} },
+ { AAESENCLAST, yaes, Pq, {0x38,0xdd,(0)} },
+ { AAESDEC, yaes, Pq, {0x38,0xde,(0)} },
+ { AAESDECLAST, yaes, Pq, {0x38,0xdf,(0)} },
+ { AAESIMC, yaes, Pq, {0x38,0xdb,(0)} },
+ { AAESKEYGENASSIST, yaes2, Pq, {0x3a,0xdf,(0)} },
- { APSHUFD, yaes2, Pq, 0x70,(0) },
- { APCLMULQDQ, yxshuf, Pq, 0x3a,0x44,0 },
+ { APSHUFD, yaes2, Pq, {0x70,(0)} },
+ { APCLMULQDQ, yxshuf, Pq, {0x3a,0x44,0} },
- { AUSEFIELD, ynop, Px, 0,0 },
+ { AUSEFIELD, ynop, Px, {0,0} },
{ ATYPE },
- { AFUNCDATA, yfuncdata, Px, 0,0 },
- { APCDATA, ypcdata, Px, 0,0 },
+ { AFUNCDATA, yfuncdata, Px, {0,0} },
+ { APCDATA, ypcdata, Px, {0,0} },
{ ACHECKNIL },
{ AVARDEF },
{ AVARKILL },
- { ADUFFCOPY, yduff, Px, 0xe8 },
- { ADUFFZERO, yduff, Px, 0xe8 },
+ { ADUFFCOPY, yduff, Px, {0xe8} },
+ { ADUFFZERO, yduff, Px, {0xe8} },
{ AEND },
- 0
+ {0}
};
static Optab* opindex[ALAST+1];
static vlong vaddr(Link*, Addr*, Reloc*);
+// isextern reports whether s describes an external symbol that must avoid pc-relative addressing.
+// This happens on systems like Solaris that call .so functions instead of system calls.
+// It does not seem to be necessary for any other systems. This is probably working
+// around a Solaris-specific bug that should be fixed differently, but we don't know
+// what that bug is. And this does fix it.
+static int
+isextern(LSym *s)
+{
+ // All the Solaris dynamic imports from libc.so begin with "libc·", which
+ // the compiler rewrites to "libc." by the time liblink gets it.
+ return strncmp(s->name, "libc.", 5) == 0;
+}
+
// single-instruction no-ops of various lengths.
// constructed by hand and disassembled with gdb to verify.
// see http://www.agner.org/optimize/optimizing_assembly.pdf for discussion.
@@ -1901,7 +1912,6 @@ prefixof(Link *ctxt, Addr *a)
case Hlinux:
case Hnetbsd:
case Hopenbsd:
- case Hplan9:
case Hsolaris:
return 0x64; // FS
case Hdarwin:
@@ -1935,10 +1945,9 @@ oclass(Link *ctxt, Addr *a)
switch(a->index) {
case D_EXTERN:
case D_STATIC:
- if(ctxt->flag_shared || ctxt->headtype == Hnacl)
- return Yiauto;
- else
- return Yi32; /* TO DO: Yi64 */
+ if(a->sym != nil && isextern(a->sym))
+ return Yi32;
+ return Yiauto; // use pc-relative addressing
case D_AUTO:
case D_PARAM:
return Yiauto;
@@ -2115,7 +2124,7 @@ oclass(Link *ctxt, Addr *a)
return Yi32; /* unsigned */
return Yi64;
}
- return Yi32; /* TO DO: D_ADDR as Yi64 */
+ return Yi32;
case D_BRANCH:
return Ybr;
@@ -2288,20 +2297,22 @@ vaddr(Link *ctxt, Addr *a, Reloc *r)
ctxt->diag("need reloc for %D", a);
sysfatal("reloc");
}
- r->siz = 4; // TODO: 8 for external symbols
+ if(isextern(s)) {
+ r->siz = 4;
+ r->type = R_ADDR;
+ } else {
+ r->siz = 4;
+ r->type = R_PCREL;
+ }
r->off = -1; // caller must fill in
r->sym = s;
r->add = v;
v = 0;
- if(ctxt->flag_shared || ctxt->headtype == Hnacl) {
- if(s->type == STLSBSS) {
- r->xadd = r->add - r->siz;
- r->type = R_TLS;
- r->xsym = s;
- } else
- r->type = R_PCREL;
- } else
- r->type = R_ADDR;
+ if(s->type == STLSBSS) {
+ r->xadd = r->add - r->siz;
+ r->type = R_TLS;
+ r->xsym = s;
+ }
break;
case D_INDIR+D_TLS:
@@ -2336,9 +2347,9 @@ asmandsz(Link *ctxt, Addr *a, int r, int rex, int m64)
switch(t) {
default:
goto bad;
- case D_STATIC:
case D_EXTERN:
- if(ctxt->flag_shared || ctxt->headtype == Hnacl)
+ case D_STATIC:
+ if(!isextern(a->sym))
goto bad;
t = D_NONE;
v = vaddr(ctxt, a, &rel);
@@ -2402,7 +2413,7 @@ asmandsz(Link *ctxt, Addr *a, int r, int rex, int m64)
ctxt->rexflag |= (regrex[t] & Rxb) | rex;
if(t == D_NONE || (D_CS <= t && t <= D_GS) || t == D_TLS) {
- if((ctxt->flag_shared || ctxt->headtype == Hnacl) && t == D_NONE && (a->type == D_STATIC || a->type == D_EXTERN) || ctxt->asmode != 64) {
+ if((a->sym == nil || !isextern(a->sym)) && t == D_NONE && (a->type == D_STATIC || a->type == D_EXTERN) || ctxt->asmode != 64) {
*ctxt->andptr++ = (0 << 6) | (5 << 0) | (r << 3);
goto putrelv;
}
@@ -2485,7 +2496,7 @@ asmando(Link *ctxt, Addr *a, int o)
}
static void
-bytereg(Addr *a, char *t)
+bytereg(Addr *a, uint8 *t)
{
if(a->index == D_NONE && (a->type >= D_AX && a->type <= D_R15)) {
a->type = D_AL + (a->type-D_AX);
@@ -2493,139 +2504,141 @@ bytereg(Addr *a, char *t)
}
}
-#define E 0xff
+enum {
+ E = 0xff,
+};
static Movtab ymovtab[] =
{
/* push */
- {APUSHL, Ycs, Ynone, 0, 0x0e,E,0,0},
- {APUSHL, Yss, Ynone, 0, 0x16,E,0,0},
- {APUSHL, Yds, Ynone, 0, 0x1e,E,0,0},
- {APUSHL, Yes, Ynone, 0, 0x06,E,0,0},
- {APUSHL, Yfs, Ynone, 0, 0x0f,0xa0,E,0},
- {APUSHL, Ygs, Ynone, 0, 0x0f,0xa8,E,0},
- {APUSHQ, Yfs, Ynone, 0, 0x0f,0xa0,E,0},
- {APUSHQ, Ygs, Ynone, 0, 0x0f,0xa8,E,0},
-
- {APUSHW, Ycs, Ynone, 0, Pe,0x0e,E,0},
- {APUSHW, Yss, Ynone, 0, Pe,0x16,E,0},
- {APUSHW, Yds, Ynone, 0, Pe,0x1e,E,0},
- {APUSHW, Yes, Ynone, 0, Pe,0x06,E,0},
- {APUSHW, Yfs, Ynone, 0, Pe,0x0f,0xa0,E},
- {APUSHW, Ygs, Ynone, 0, Pe,0x0f,0xa8,E},
+ {APUSHL, Ycs, Ynone, 0, {0x0e,E,0,0}},
+ {APUSHL, Yss, Ynone, 0, {0x16,E,0,0}},
+ {APUSHL, Yds, Ynone, 0, {0x1e,E,0,0}},
+ {APUSHL, Yes, Ynone, 0, {0x06,E,0,0}},
+ {APUSHL, Yfs, Ynone, 0, {0x0f,0xa0,E,0}},
+ {APUSHL, Ygs, Ynone, 0, {0x0f,0xa8,E,0}},
+ {APUSHQ, Yfs, Ynone, 0, {0x0f,0xa0,E,0}},
+ {APUSHQ, Ygs, Ynone, 0, {0x0f,0xa8,E,0}},
+
+ {APUSHW, Ycs, Ynone, 0, {Pe,0x0e,E,0}},
+ {APUSHW, Yss, Ynone, 0, {Pe,0x16,E,0}},
+ {APUSHW, Yds, Ynone, 0, {Pe,0x1e,E,0}},
+ {APUSHW, Yes, Ynone, 0, {Pe,0x06,E,0}},
+ {APUSHW, Yfs, Ynone, 0, {Pe,0x0f,0xa0,E}},
+ {APUSHW, Ygs, Ynone, 0, {Pe,0x0f,0xa8,E}},
/* pop */
- {APOPL, Ynone, Yds, 0, 0x1f,E,0,0},
- {APOPL, Ynone, Yes, 0, 0x07,E,0,0},
- {APOPL, Ynone, Yss, 0, 0x17,E,0,0},
- {APOPL, Ynone, Yfs, 0, 0x0f,0xa1,E,0},
- {APOPL, Ynone, Ygs, 0, 0x0f,0xa9,E,0},
- {APOPQ, Ynone, Yfs, 0, 0x0f,0xa1,E,0},
- {APOPQ, Ynone, Ygs, 0, 0x0f,0xa9,E,0},
-
- {APOPW, Ynone, Yds, 0, Pe,0x1f,E,0},
- {APOPW, Ynone, Yes, 0, Pe,0x07,E,0},
- {APOPW, Ynone, Yss, 0, Pe,0x17,E,0},
- {APOPW, Ynone, Yfs, 0, Pe,0x0f,0xa1,E},
- {APOPW, Ynone, Ygs, 0, Pe,0x0f,0xa9,E},
+ {APOPL, Ynone, Yds, 0, {0x1f,E,0,0}},
+ {APOPL, Ynone, Yes, 0, {0x07,E,0,0}},
+ {APOPL, Ynone, Yss, 0, {0x17,E,0,0}},
+ {APOPL, Ynone, Yfs, 0, {0x0f,0xa1,E,0}},
+ {APOPL, Ynone, Ygs, 0, {0x0f,0xa9,E,0}},
+ {APOPQ, Ynone, Yfs, 0, {0x0f,0xa1,E,0}},
+ {APOPQ, Ynone, Ygs, 0, {0x0f,0xa9,E,0}},
+
+ {APOPW, Ynone, Yds, 0, {Pe,0x1f,E,0}},
+ {APOPW, Ynone, Yes, 0, {Pe,0x07,E,0}},
+ {APOPW, Ynone, Yss, 0, {Pe,0x17,E,0}},
+ {APOPW, Ynone, Yfs, 0, {Pe,0x0f,0xa1,E}},
+ {APOPW, Ynone, Ygs, 0, {Pe,0x0f,0xa9,E}},
/* mov seg */
- {AMOVW, Yes, Yml, 1, 0x8c,0,0,0},
- {AMOVW, Ycs, Yml, 1, 0x8c,1,0,0},
- {AMOVW, Yss, Yml, 1, 0x8c,2,0,0},
- {AMOVW, Yds, Yml, 1, 0x8c,3,0,0},
- {AMOVW, Yfs, Yml, 1, 0x8c,4,0,0},
- {AMOVW, Ygs, Yml, 1, 0x8c,5,0,0},
-
- {AMOVW, Yml, Yes, 2, 0x8e,0,0,0},
- {AMOVW, Yml, Ycs, 2, 0x8e,1,0,0},
- {AMOVW, Yml, Yss, 2, 0x8e,2,0,0},
- {AMOVW, Yml, Yds, 2, 0x8e,3,0,0},
- {AMOVW, Yml, Yfs, 2, 0x8e,4,0,0},
- {AMOVW, Yml, Ygs, 2, 0x8e,5,0,0},
+ {AMOVW, Yes, Yml, 1, {0x8c,0,0,0}},
+ {AMOVW, Ycs, Yml, 1, {0x8c,1,0,0}},
+ {AMOVW, Yss, Yml, 1, {0x8c,2,0,0}},
+ {AMOVW, Yds, Yml, 1, {0x8c,3,0,0}},
+ {AMOVW, Yfs, Yml, 1, {0x8c,4,0,0}},
+ {AMOVW, Ygs, Yml, 1, {0x8c,5,0,0}},
+
+ {AMOVW, Yml, Yes, 2, {0x8e,0,0,0}},
+ {AMOVW, Yml, Ycs, 2, {0x8e,1,0,0}},
+ {AMOVW, Yml, Yss, 2, {0x8e,2,0,0}},
+ {AMOVW, Yml, Yds, 2, {0x8e,3,0,0}},
+ {AMOVW, Yml, Yfs, 2, {0x8e,4,0,0}},
+ {AMOVW, Yml, Ygs, 2, {0x8e,5,0,0}},
/* mov cr */
- {AMOVL, Ycr0, Yml, 3, 0x0f,0x20,0,0},
- {AMOVL, Ycr2, Yml, 3, 0x0f,0x20,2,0},
- {AMOVL, Ycr3, Yml, 3, 0x0f,0x20,3,0},
- {AMOVL, Ycr4, Yml, 3, 0x0f,0x20,4,0},
- {AMOVL, Ycr8, Yml, 3, 0x0f,0x20,8,0},
- {AMOVQ, Ycr0, Yml, 3, 0x0f,0x20,0,0},
- {AMOVQ, Ycr2, Yml, 3, 0x0f,0x20,2,0},
- {AMOVQ, Ycr3, Yml, 3, 0x0f,0x20,3,0},
- {AMOVQ, Ycr4, Yml, 3, 0x0f,0x20,4,0},
- {AMOVQ, Ycr8, Yml, 3, 0x0f,0x20,8,0},
-
- {AMOVL, Yml, Ycr0, 4, 0x0f,0x22,0,0},
- {AMOVL, Yml, Ycr2, 4, 0x0f,0x22,2,0},
- {AMOVL, Yml, Ycr3, 4, 0x0f,0x22,3,0},
- {AMOVL, Yml, Ycr4, 4, 0x0f,0x22,4,0},
- {AMOVL, Yml, Ycr8, 4, 0x0f,0x22,8,0},
- {AMOVQ, Yml, Ycr0, 4, 0x0f,0x22,0,0},
- {AMOVQ, Yml, Ycr2, 4, 0x0f,0x22,2,0},
- {AMOVQ, Yml, Ycr3, 4, 0x0f,0x22,3,0},
- {AMOVQ, Yml, Ycr4, 4, 0x0f,0x22,4,0},
- {AMOVQ, Yml, Ycr8, 4, 0x0f,0x22,8,0},
+ {AMOVL, Ycr0, Yml, 3, {0x0f,0x20,0,0}},
+ {AMOVL, Ycr2, Yml, 3, {0x0f,0x20,2,0}},
+ {AMOVL, Ycr3, Yml, 3, {0x0f,0x20,3,0}},
+ {AMOVL, Ycr4, Yml, 3, {0x0f,0x20,4,0}},
+ {AMOVL, Ycr8, Yml, 3, {0x0f,0x20,8,0}},
+ {AMOVQ, Ycr0, Yml, 3, {0x0f,0x20,0,0}},
+ {AMOVQ, Ycr2, Yml, 3, {0x0f,0x20,2,0}},
+ {AMOVQ, Ycr3, Yml, 3, {0x0f,0x20,3,0}},
+ {AMOVQ, Ycr4, Yml, 3, {0x0f,0x20,4,0}},
+ {AMOVQ, Ycr8, Yml, 3, {0x0f,0x20,8,0}},
+
+ {AMOVL, Yml, Ycr0, 4, {0x0f,0x22,0,0}},
+ {AMOVL, Yml, Ycr2, 4, {0x0f,0x22,2,0}},
+ {AMOVL, Yml, Ycr3, 4, {0x0f,0x22,3,0}},
+ {AMOVL, Yml, Ycr4, 4, {0x0f,0x22,4,0}},
+ {AMOVL, Yml, Ycr8, 4, {0x0f,0x22,8,0}},
+ {AMOVQ, Yml, Ycr0, 4, {0x0f,0x22,0,0}},
+ {AMOVQ, Yml, Ycr2, 4, {0x0f,0x22,2,0}},
+ {AMOVQ, Yml, Ycr3, 4, {0x0f,0x22,3,0}},
+ {AMOVQ, Yml, Ycr4, 4, {0x0f,0x22,4,0}},
+ {AMOVQ, Yml, Ycr8, 4, {0x0f,0x22,8,0}},
/* mov dr */
- {AMOVL, Ydr0, Yml, 3, 0x0f,0x21,0,0},
- {AMOVL, Ydr6, Yml, 3, 0x0f,0x21,6,0},
- {AMOVL, Ydr7, Yml, 3, 0x0f,0x21,7,0},
- {AMOVQ, Ydr0, Yml, 3, 0x0f,0x21,0,0},
- {AMOVQ, Ydr6, Yml, 3, 0x0f,0x21,6,0},
- {AMOVQ, Ydr7, Yml, 3, 0x0f,0x21,7,0},
-
- {AMOVL, Yml, Ydr0, 4, 0x0f,0x23,0,0},
- {AMOVL, Yml, Ydr6, 4, 0x0f,0x23,6,0},
- {AMOVL, Yml, Ydr7, 4, 0x0f,0x23,7,0},
- {AMOVQ, Yml, Ydr0, 4, 0x0f,0x23,0,0},
- {AMOVQ, Yml, Ydr6, 4, 0x0f,0x23,6,0},
- {AMOVQ, Yml, Ydr7, 4, 0x0f,0x23,7,0},
+ {AMOVL, Ydr0, Yml, 3, {0x0f,0x21,0,0}},
+ {AMOVL, Ydr6, Yml, 3, {0x0f,0x21,6,0}},
+ {AMOVL, Ydr7, Yml, 3, {0x0f,0x21,7,0}},
+ {AMOVQ, Ydr0, Yml, 3, {0x0f,0x21,0,0}},
+ {AMOVQ, Ydr6, Yml, 3, {0x0f,0x21,6,0}},
+ {AMOVQ, Ydr7, Yml, 3, {0x0f,0x21,7,0}},
+
+ {AMOVL, Yml, Ydr0, 4, {0x0f,0x23,0,0}},
+ {AMOVL, Yml, Ydr6, 4, {0x0f,0x23,6,0}},
+ {AMOVL, Yml, Ydr7, 4, {0x0f,0x23,7,0}},
+ {AMOVQ, Yml, Ydr0, 4, {0x0f,0x23,0,0}},
+ {AMOVQ, Yml, Ydr6, 4, {0x0f,0x23,6,0}},
+ {AMOVQ, Yml, Ydr7, 4, {0x0f,0x23,7,0}},
/* mov tr */
- {AMOVL, Ytr6, Yml, 3, 0x0f,0x24,6,0},
- {AMOVL, Ytr7, Yml, 3, 0x0f,0x24,7,0},
+ {AMOVL, Ytr6, Yml, 3, {0x0f,0x24,6,0}},
+ {AMOVL, Ytr7, Yml, 3, {0x0f,0x24,7,0}},
- {AMOVL, Yml, Ytr6, 4, 0x0f,0x26,6,E},
- {AMOVL, Yml, Ytr7, 4, 0x0f,0x26,7,E},
+ {AMOVL, Yml, Ytr6, 4, {0x0f,0x26,6,E}},
+ {AMOVL, Yml, Ytr7, 4, {0x0f,0x26,7,E}},
/* lgdt, sgdt, lidt, sidt */
- {AMOVL, Ym, Ygdtr, 4, 0x0f,0x01,2,0},
- {AMOVL, Ygdtr, Ym, 3, 0x0f,0x01,0,0},
- {AMOVL, Ym, Yidtr, 4, 0x0f,0x01,3,0},
- {AMOVL, Yidtr, Ym, 3, 0x0f,0x01,1,0},
- {AMOVQ, Ym, Ygdtr, 4, 0x0f,0x01,2,0},
- {AMOVQ, Ygdtr, Ym, 3, 0x0f,0x01,0,0},
- {AMOVQ, Ym, Yidtr, 4, 0x0f,0x01,3,0},
- {AMOVQ, Yidtr, Ym, 3, 0x0f,0x01,1,0},
+ {AMOVL, Ym, Ygdtr, 4, {0x0f,0x01,2,0}},
+ {AMOVL, Ygdtr, Ym, 3, {0x0f,0x01,0,0}},
+ {AMOVL, Ym, Yidtr, 4, {0x0f,0x01,3,0}},
+ {AMOVL, Yidtr, Ym, 3, {0x0f,0x01,1,0}},
+ {AMOVQ, Ym, Ygdtr, 4, {0x0f,0x01,2,0}},
+ {AMOVQ, Ygdtr, Ym, 3, {0x0f,0x01,0,0}},
+ {AMOVQ, Ym, Yidtr, 4, {0x0f,0x01,3,0}},
+ {AMOVQ, Yidtr, Ym, 3, {0x0f,0x01,1,0}},
/* lldt, sldt */
- {AMOVW, Yml, Yldtr, 4, 0x0f,0x00,2,0},
- {AMOVW, Yldtr, Yml, 3, 0x0f,0x00,0,0},
+ {AMOVW, Yml, Yldtr, 4, {0x0f,0x00,2,0}},
+ {AMOVW, Yldtr, Yml, 3, {0x0f,0x00,0,0}},
/* lmsw, smsw */
- {AMOVW, Yml, Ymsw, 4, 0x0f,0x01,6,0},
- {AMOVW, Ymsw, Yml, 3, 0x0f,0x01,4,0},
+ {AMOVW, Yml, Ymsw, 4, {0x0f,0x01,6,0}},
+ {AMOVW, Ymsw, Yml, 3, {0x0f,0x01,4,0}},
/* ltr, str */
- {AMOVW, Yml, Ytask, 4, 0x0f,0x00,3,0},
- {AMOVW, Ytask, Yml, 3, 0x0f,0x00,1,0},
+ {AMOVW, Yml, Ytask, 4, {0x0f,0x00,3,0}},
+ {AMOVW, Ytask, Yml, 3, {0x0f,0x00,1,0}},
/* load full pointer */
- {AMOVL, Yml, Ycol, 5, 0,0,0,0},
- {AMOVW, Yml, Ycol, 5, Pe,0,0,0},
+ {AMOVL, Yml, Ycol, 5, {0,0,0,0}},
+ {AMOVW, Yml, Ycol, 5, {Pe,0,0,0}},
/* double shift */
- {ASHLL, Ycol, Yml, 6, 0xa4,0xa5,0,0},
- {ASHRL, Ycol, Yml, 6, 0xac,0xad,0,0},
- {ASHLQ, Ycol, Yml, 6, Pw,0xa4,0xa5,0},
- {ASHRQ, Ycol, Yml, 6, Pw,0xac,0xad,0},
- {ASHLW, Ycol, Yml, 6, Pe,0xa4,0xa5,0},
- {ASHRW, Ycol, Yml, 6, Pe,0xac,0xad,0},
+ {ASHLL, Ycol, Yml, 6, {0xa4,0xa5,0,0}},
+ {ASHRL, Ycol, Yml, 6, {0xac,0xad,0,0}},
+ {ASHLQ, Ycol, Yml, 6, {Pw,0xa4,0xa5,0}},
+ {ASHRQ, Ycol, Yml, 6, {Pw,0xac,0xad,0}},
+ {ASHLW, Ycol, Yml, 6, {Pe,0xa4,0xa5,0}},
+ {ASHRW, Ycol, Yml, 6, {Pe,0xac,0xad,0}},
/* load TLS base */
- {AMOVQ, Ytls, Yrl, 7, 0,0,0,0},
+ {AMOVQ, Ytls, Yrl, 7, {0,0,0,0}},
- 0
+ {0}
};
static int
@@ -2687,7 +2700,7 @@ mediaop(Link *ctxt, Optab *o, int op, int osize, int z)
break;
}
default:
- if(ctxt->andptr == ctxt->and || ctxt->andptr[-1] != Pm)
+ if(ctxt->andptr == ctxt->and || ctxt->and[ctxt->andptr - ctxt->and - 1] != Pm)
*ctxt->andptr++ = Pm;
break;
}
@@ -2903,8 +2916,13 @@ found:
asmando(ctxt, &p->to, o->op[z+1]);
break;
+ case Zcallindreg:
+ r = addrel(ctxt->cursym);
+ r->off = p->pc;
+ r->type = R_CALLIND;
+ r->siz = 0;
+ // fallthrough
case Zo_m64:
- case_Zo_m64:
*ctxt->andptr++ = op;
asmandsz(ctxt, &p->to, o->op[z+1], 0, 1);
break;
@@ -3062,6 +3080,7 @@ found:
break;
case Zclr:
+ ctxt->rexflag &= ~Pw;
*ctxt->andptr++ = op;
asmand(ctxt, &p->to, &p->to);
break;
@@ -3081,13 +3100,6 @@ found:
put4(ctxt, 0);
break;
- case Zcallindreg:
- r = addrel(ctxt->cursym);
- r->off = p->pc;
- r->type = R_CALLIND;
- r->siz = 0;
- goto case_Zo_m64;
-
case Zbr:
case Zjmp:
case Zloop:
@@ -3365,6 +3377,19 @@ mfound:
default:
sysfatal("unknown TLS base location for %s", headstr(ctxt->headtype));
+ case Hplan9:
+ if(ctxt->plan9privates == nil)
+ ctxt->plan9privates = linklookup(ctxt, "_privates", 0);
+ memset(&pp.from, 0, sizeof pp.from);
+ pp.from.type = D_EXTERN;
+ pp.from.sym = ctxt->plan9privates;
+ pp.from.offset = 0;
+ pp.from.index = D_NONE;
+ ctxt->rexflag |= Pw;
+ *ctxt->andptr++ = 0x8B;
+ asmand(ctxt, &pp.from, &p->to);
+ break;
+
case Hsolaris: // TODO(rsc): Delete Hsolaris from list. Should not use this code. See progedit in obj6.c.
// TLS base is 0(FS).
pp.from = p->from;
@@ -3436,7 +3461,7 @@ nacltrunc(Link *ctxt, int reg)
static void
asmins(Link *ctxt, Prog *p)
{
- int n, np, c;
+ int i, n, np, c;
uchar *and0;
Reloc *r;
@@ -3561,7 +3586,8 @@ asmins(Link *ctxt, Prog *p)
ctxt->andptr++;
}
n = ctxt->andptr - ctxt->and;
- for(r=ctxt->cursym->r+ctxt->cursym->nr; r-- > ctxt->cursym->r; ) {
+ for(i=ctxt->cursym->nr-1; i>=0; i--) {
+ r = ctxt->cursym->r+i;
if(r->off < p->pc)
break;
if(ctxt->rexflag)
diff --git a/src/liblink/asm8.c b/src/liblink/asm8.c
index 3ab527ce8..b6627d5fd 100644
--- a/src/liblink/asm8.c
+++ b/src/liblink/asm8.c
@@ -35,7 +35,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/8l/8.out.h"
-#include "../pkg/runtime/stack.h"
+#include "../runtime/stack.h"
enum
{
@@ -43,8 +43,6 @@ enum
FuncAlign = 16
};
-extern char *anames6[];
-
typedef struct Optab Optab;
struct Optab
@@ -142,7 +140,7 @@ enum
};
static uchar ycover[Ymax*Ymax];
-static char reg[D_NONE];
+static int reg[D_NONE];
static void asmins(Link *ctxt, Prog *p);
static uchar ynone[] =
@@ -617,548 +615,548 @@ static Optab optab[] =
/* as, ytab, andproto, opcode */
{
{ AXXX },
- { AAAA, ynone, Px, 0x37 },
- { AAAD, ynone, Px, 0xd5,0x0a },
- { AAAM, ynone, Px, 0xd4,0x0a },
- { AAAS, ynone, Px, 0x3f },
- { AADCB, yxorb, Pb, 0x14,0x80,(02),0x10,0x10 },
- { AADCL, yxorl, Px, 0x83,(02),0x15,0x81,(02),0x11,0x13 },
- { AADCW, yxorl, Pe, 0x83,(02),0x15,0x81,(02),0x11,0x13 },
- { AADDB, yxorb, Px, 0x04,0x80,(00),0x00,0x02 },
- { AADDL, yaddl, Px, 0x83,(00),0x05,0x81,(00),0x01,0x03 },
- { AADDW, yaddl, Pe, 0x83,(00),0x05,0x81,(00),0x01,0x03 },
+ { AAAA, ynone, Px, {0x37} },
+ { AAAD, ynone, Px, {0xd5,0x0a} },
+ { AAAM, ynone, Px, {0xd4,0x0a} },
+ { AAAS, ynone, Px, {0x3f} },
+ { AADCB, yxorb, Pb, {0x14,0x80,(02),0x10,0x10} },
+ { AADCL, yxorl, Px, {0x83,(02),0x15,0x81,(02),0x11,0x13} },
+ { AADCW, yxorl, Pe, {0x83,(02),0x15,0x81,(02),0x11,0x13} },
+ { AADDB, yxorb, Px, {0x04,0x80,(00),0x00,0x02} },
+ { AADDL, yaddl, Px, {0x83,(00),0x05,0x81,(00),0x01,0x03} },
+ { AADDW, yaddl, Pe, {0x83,(00),0x05,0x81,(00),0x01,0x03} },
{ AADJSP },
- { AANDB, yxorb, Pb, 0x24,0x80,(04),0x20,0x22 },
- { AANDL, yxorl, Px, 0x83,(04),0x25,0x81,(04),0x21,0x23 },
- { AANDW, yxorl, Pe, 0x83,(04),0x25,0x81,(04),0x21,0x23 },
- { AARPL, yrl_ml, Px, 0x63 },
- { ABOUNDL, yrl_m, Px, 0x62 },
- { ABOUNDW, yrl_m, Pe, 0x62 },
- { ABSFL, yml_rl, Pm, 0xbc },
- { ABSFW, yml_rl, Pq, 0xbc },
- { ABSRL, yml_rl, Pm, 0xbd },
- { ABSRW, yml_rl, Pq, 0xbd },
- { ABTL, yml_rl, Pm, 0xa3 },
- { ABTW, yml_rl, Pq, 0xa3 },
- { ABTCL, yml_rl, Pm, 0xbb },
- { ABTCW, yml_rl, Pq, 0xbb },
- { ABTRL, yml_rl, Pm, 0xb3 },
- { ABTRW, yml_rl, Pq, 0xb3 },
- { ABTSL, yml_rl, Pm, 0xab },
- { ABTSW, yml_rl, Pq, 0xab },
- { ABYTE, ybyte, Px, 1 },
- { ACALL, ycall, Px, 0xff,(02),0xff,(0x15),0xe8 },
- { ACLC, ynone, Px, 0xf8 },
- { ACLD, ynone, Px, 0xfc },
- { ACLI, ynone, Px, 0xfa },
- { ACLTS, ynone, Pm, 0x06 },
- { ACMC, ynone, Px, 0xf5 },
- { ACMPB, ycmpb, Pb, 0x3c,0x80,(07),0x38,0x3a },
- { ACMPL, ycmpl, Px, 0x83,(07),0x3d,0x81,(07),0x39,0x3b },
- { ACMPW, ycmpl, Pe, 0x83,(07),0x3d,0x81,(07),0x39,0x3b },
- { ACMPSB, ynone, Pb, 0xa6 },
- { ACMPSL, ynone, Px, 0xa7 },
- { ACMPSW, ynone, Pe, 0xa7 },
- { ADAA, ynone, Px, 0x27 },
- { ADAS, ynone, Px, 0x2f },
+ { AANDB, yxorb, Pb, {0x24,0x80,(04),0x20,0x22} },
+ { AANDL, yxorl, Px, {0x83,(04),0x25,0x81,(04),0x21,0x23} },
+ { AANDW, yxorl, Pe, {0x83,(04),0x25,0x81,(04),0x21,0x23} },
+ { AARPL, yrl_ml, Px, {0x63} },
+ { ABOUNDL, yrl_m, Px, {0x62} },
+ { ABOUNDW, yrl_m, Pe, {0x62} },
+ { ABSFL, yml_rl, Pm, {0xbc} },
+ { ABSFW, yml_rl, Pq, {0xbc} },
+ { ABSRL, yml_rl, Pm, {0xbd} },
+ { ABSRW, yml_rl, Pq, {0xbd} },
+ { ABTL, yml_rl, Pm, {0xa3} },
+ { ABTW, yml_rl, Pq, {0xa3} },
+ { ABTCL, yml_rl, Pm, {0xbb} },
+ { ABTCW, yml_rl, Pq, {0xbb} },
+ { ABTRL, yml_rl, Pm, {0xb3} },
+ { ABTRW, yml_rl, Pq, {0xb3} },
+ { ABTSL, yml_rl, Pm, {0xab} },
+ { ABTSW, yml_rl, Pq, {0xab} },
+ { ABYTE, ybyte, Px, {1} },
+ { ACALL, ycall, Px, {0xff,(02),0xff,(0x15),0xe8} },
+ { ACLC, ynone, Px, {0xf8} },
+ { ACLD, ynone, Px, {0xfc} },
+ { ACLI, ynone, Px, {0xfa} },
+ { ACLTS, ynone, Pm, {0x06} },
+ { ACMC, ynone, Px, {0xf5} },
+ { ACMPB, ycmpb, Pb, {0x3c,0x80,(07),0x38,0x3a} },
+ { ACMPL, ycmpl, Px, {0x83,(07),0x3d,0x81,(07),0x39,0x3b} },
+ { ACMPW, ycmpl, Pe, {0x83,(07),0x3d,0x81,(07),0x39,0x3b} },
+ { ACMPSB, ynone, Pb, {0xa6} },
+ { ACMPSL, ynone, Px, {0xa7} },
+ { ACMPSW, ynone, Pe, {0xa7} },
+ { ADAA, ynone, Px, {0x27} },
+ { ADAS, ynone, Px, {0x2f} },
{ ADATA },
- { ADECB, yincb, Pb, 0xfe,(01) },
- { ADECL, yincl, Px, 0x48,0xff,(01) },
- { ADECW, yincl, Pe, 0x48,0xff,(01) },
- { ADIVB, ydivb, Pb, 0xf6,(06) },
- { ADIVL, ydivl, Px, 0xf7,(06) },
- { ADIVW, ydivl, Pe, 0xf7,(06) },
+ { ADECB, yincb, Pb, {0xfe,(01)} },
+ { ADECL, yincl, Px, {0x48,0xff,(01)} },
+ { ADECW, yincl, Pe, {0x48,0xff,(01)} },
+ { ADIVB, ydivb, Pb, {0xf6,(06)} },
+ { ADIVL, ydivl, Px, {0xf7,(06)} },
+ { ADIVW, ydivl, Pe, {0xf7,(06)} },
{ AENTER }, /* botch */
{ AGLOBL },
{ AGOK },
{ AHISTORY },
- { AHLT, ynone, Px, 0xf4 },
- { AIDIVB, ydivb, Pb, 0xf6,(07) },
- { AIDIVL, ydivl, Px, 0xf7,(07) },
- { AIDIVW, ydivl, Pe, 0xf7,(07) },
- { AIMULB, ydivb, Pb, 0xf6,(05) },
- { AIMULL, yimul, Px, 0xf7,(05),0x6b,0x69 },
- { AIMULW, yimul, Pe, 0xf7,(05),0x6b,0x69 },
- { AINB, yin, Pb, 0xe4,0xec },
- { AINL, yin, Px, 0xe5,0xed },
- { AINW, yin, Pe, 0xe5,0xed },
- { AINCB, yincb, Pb, 0xfe,(00) },
- { AINCL, yincl, Px, 0x40,0xff,(00) },
- { AINCW, yincl, Pe, 0x40,0xff,(00) },
- { AINSB, ynone, Pb, 0x6c },
- { AINSL, ynone, Px, 0x6d },
- { AINSW, ynone, Pe, 0x6d },
- { AINT, yint, Px, 0xcd },
- { AINTO, ynone, Px, 0xce },
- { AIRETL, ynone, Px, 0xcf },
- { AIRETW, ynone, Pe, 0xcf },
- { AJCC, yjcond, Px, 0x73,0x83,(00) },
- { AJCS, yjcond, Px, 0x72,0x82 },
- { AJCXZL, yloop, Px, 0xe3 },
- { AJCXZW, yloop, Px, 0xe3 },
- { AJEQ, yjcond, Px, 0x74,0x84 },
- { AJGE, yjcond, Px, 0x7d,0x8d },
- { AJGT, yjcond, Px, 0x7f,0x8f },
- { AJHI, yjcond, Px, 0x77,0x87 },
- { AJLE, yjcond, Px, 0x7e,0x8e },
- { AJLS, yjcond, Px, 0x76,0x86 },
- { AJLT, yjcond, Px, 0x7c,0x8c },
- { AJMI, yjcond, Px, 0x78,0x88 },
- { AJMP, yjmp, Px, 0xff,(04),0xeb,0xe9 },
- { AJNE, yjcond, Px, 0x75,0x85 },
- { AJOC, yjcond, Px, 0x71,0x81,(00) },
- { AJOS, yjcond, Px, 0x70,0x80,(00) },
- { AJPC, yjcond, Px, 0x7b,0x8b },
- { AJPL, yjcond, Px, 0x79,0x89 },
- { AJPS, yjcond, Px, 0x7a,0x8a },
- { ALAHF, ynone, Px, 0x9f },
- { ALARL, yml_rl, Pm, 0x02 },
- { ALARW, yml_rl, Pq, 0x02 },
- { ALEAL, ym_rl, Px, 0x8d },
- { ALEAW, ym_rl, Pe, 0x8d },
- { ALEAVEL, ynone, Px, 0xc9 },
- { ALEAVEW, ynone, Pe, 0xc9 },
- { ALOCK, ynone, Px, 0xf0 },
- { ALODSB, ynone, Pb, 0xac },
- { ALODSL, ynone, Px, 0xad },
- { ALODSW, ynone, Pe, 0xad },
- { ALONG, ybyte, Px, 4 },
- { ALOOP, yloop, Px, 0xe2 },
- { ALOOPEQ, yloop, Px, 0xe1 },
- { ALOOPNE, yloop, Px, 0xe0 },
- { ALSLL, yml_rl, Pm, 0x03 },
- { ALSLW, yml_rl, Pq, 0x03 },
- { AMOVB, ymovb, Pb, 0x88,0x8a,0xb0,0xc6,(00) },
- { AMOVL, ymovl, Px, 0x89,0x8b,0x31,0x83,(04),0xb8,0xc7,(00),Pe,0x6e,Pe,0x7e,0 },
- { AMOVW, ymovw, Pe, 0x89,0x8b,0x31,0x83,(04),0xb8,0xc7,(00),0 },
- { AMOVQ, ymovq, Pf3, 0x7e },
- { AMOVBLSX, ymb_rl, Pm, 0xbe },
- { AMOVBLZX, ymb_rl, Pm, 0xb6 },
- { AMOVBWSX, ymb_rl, Pq, 0xbe },
- { AMOVBWZX, ymb_rl, Pq, 0xb6 },
- { AMOVWLSX, yml_rl, Pm, 0xbf },
- { AMOVWLZX, yml_rl, Pm, 0xb7 },
- { AMOVSB, ynone, Pb, 0xa4 },
- { AMOVSL, ynone, Px, 0xa5 },
- { AMOVSW, ynone, Pe, 0xa5 },
- { AMULB, ydivb, Pb, 0xf6,(04) },
- { AMULL, ydivl, Px, 0xf7,(04) },
- { AMULW, ydivl, Pe, 0xf7,(04) },
+ { AHLT, ynone, Px, {0xf4} },
+ { AIDIVB, ydivb, Pb, {0xf6,(07)} },
+ { AIDIVL, ydivl, Px, {0xf7,(07)} },
+ { AIDIVW, ydivl, Pe, {0xf7,(07)} },
+ { AIMULB, ydivb, Pb, {0xf6,(05)} },
+ { AIMULL, yimul, Px, {0xf7,(05),0x6b,0x69} },
+ { AIMULW, yimul, Pe, {0xf7,(05),0x6b,0x69} },
+ { AINB, yin, Pb, {0xe4,0xec} },
+ { AINL, yin, Px, {0xe5,0xed} },
+ { AINW, yin, Pe, {0xe5,0xed} },
+ { AINCB, yincb, Pb, {0xfe,(00)} },
+ { AINCL, yincl, Px, {0x40,0xff,(00)} },
+ { AINCW, yincl, Pe, {0x40,0xff,(00)} },
+ { AINSB, ynone, Pb, {0x6c} },
+ { AINSL, ynone, Px, {0x6d} },
+ { AINSW, ynone, Pe, {0x6d} },
+ { AINT, yint, Px, {0xcd} },
+ { AINTO, ynone, Px, {0xce} },
+ { AIRETL, ynone, Px, {0xcf} },
+ { AIRETW, ynone, Pe, {0xcf} },
+ { AJCC, yjcond, Px, {0x73,0x83,(00)} },
+ { AJCS, yjcond, Px, {0x72,0x82} },
+ { AJCXZL, yloop, Px, {0xe3} },
+ { AJCXZW, yloop, Px, {0xe3} },
+ { AJEQ, yjcond, Px, {0x74,0x84} },
+ { AJGE, yjcond, Px, {0x7d,0x8d} },
+ { AJGT, yjcond, Px, {0x7f,0x8f} },
+ { AJHI, yjcond, Px, {0x77,0x87} },
+ { AJLE, yjcond, Px, {0x7e,0x8e} },
+ { AJLS, yjcond, Px, {0x76,0x86} },
+ { AJLT, yjcond, Px, {0x7c,0x8c} },
+ { AJMI, yjcond, Px, {0x78,0x88} },
+ { AJMP, yjmp, Px, {0xff,(04),0xeb,0xe9} },
+ { AJNE, yjcond, Px, {0x75,0x85} },
+ { AJOC, yjcond, Px, {0x71,0x81,(00)} },
+ { AJOS, yjcond, Px, {0x70,0x80,(00)} },
+ { AJPC, yjcond, Px, {0x7b,0x8b} },
+ { AJPL, yjcond, Px, {0x79,0x89} },
+ { AJPS, yjcond, Px, {0x7a,0x8a} },
+ { ALAHF, ynone, Px, {0x9f} },
+ { ALARL, yml_rl, Pm, {0x02} },
+ { ALARW, yml_rl, Pq, {0x02} },
+ { ALEAL, ym_rl, Px, {0x8d} },
+ { ALEAW, ym_rl, Pe, {0x8d} },
+ { ALEAVEL, ynone, Px, {0xc9} },
+ { ALEAVEW, ynone, Pe, {0xc9} },
+ { ALOCK, ynone, Px, {0xf0} },
+ { ALODSB, ynone, Pb, {0xac} },
+ { ALODSL, ynone, Px, {0xad} },
+ { ALODSW, ynone, Pe, {0xad} },
+ { ALONG, ybyte, Px, {4} },
+ { ALOOP, yloop, Px, {0xe2} },
+ { ALOOPEQ, yloop, Px, {0xe1} },
+ { ALOOPNE, yloop, Px, {0xe0} },
+ { ALSLL, yml_rl, Pm, {0x03 } },
+ { ALSLW, yml_rl, Pq, {0x03 } },
+ { AMOVB, ymovb, Pb, {0x88,0x8a,0xb0,0xc6,(00)} },
+ { AMOVL, ymovl, Px, {0x89,0x8b,0x31,0x83,(04),0xb8,0xc7,(00),Pe,0x6e,Pe,0x7e,0} },
+ { AMOVW, ymovw, Pe, {0x89,0x8b,0x31,0x83,(04),0xb8,0xc7,(00),0} },
+ { AMOVQ, ymovq, Pf3, {0x7e} },
+ { AMOVBLSX, ymb_rl, Pm, {0xbe} },
+ { AMOVBLZX, ymb_rl, Pm, {0xb6} },
+ { AMOVBWSX, ymb_rl, Pq, {0xbe} },
+ { AMOVBWZX, ymb_rl, Pq, {0xb6} },
+ { AMOVWLSX, yml_rl, Pm, {0xbf} },
+ { AMOVWLZX, yml_rl, Pm, {0xb7} },
+ { AMOVSB, ynone, Pb, {0xa4} },
+ { AMOVSL, ynone, Px, {0xa5} },
+ { AMOVSW, ynone, Pe, {0xa5} },
+ { AMULB, ydivb, Pb, {0xf6,(04)} },
+ { AMULL, ydivl, Px, {0xf7,(04)} },
+ { AMULW, ydivl, Pe, {0xf7,(04)} },
{ ANAME },
- { ANEGB, yscond, Px, 0xf6,(03) },
- { ANEGL, yscond, Px, 0xf7,(03) },
- { ANEGW, yscond, Pe, 0xf7,(03) },
- { ANOP, ynop, Px,0,0 },
- { ANOTB, yscond, Px, 0xf6,(02) },
- { ANOTL, yscond, Px, 0xf7,(02) },
- { ANOTW, yscond, Pe, 0xf7,(02) },
- { AORB, yxorb, Pb, 0x0c,0x80,(01),0x08,0x0a },
- { AORL, yxorl, Px, 0x83,(01),0x0d,0x81,(01),0x09,0x0b },
- { AORW, yxorl, Pe, 0x83,(01),0x0d,0x81,(01),0x09,0x0b },
- { AOUTB, yin, Pb, 0xe6,0xee },
- { AOUTL, yin, Px, 0xe7,0xef },
- { AOUTW, yin, Pe, 0xe7,0xef },
- { AOUTSB, ynone, Pb, 0x6e },
- { AOUTSL, ynone, Px, 0x6f },
- { AOUTSW, ynone, Pe, 0x6f },
- { APAUSE, ynone, Px, 0xf3,0x90 },
- { APOPAL, ynone, Px, 0x61 },
- { APOPAW, ynone, Pe, 0x61 },
- { APOPFL, ynone, Px, 0x9d },
- { APOPFW, ynone, Pe, 0x9d },
- { APOPL, ypopl, Px, 0x58,0x8f,(00) },
- { APOPW, ypopl, Pe, 0x58,0x8f,(00) },
- { APUSHAL, ynone, Px, 0x60 },
- { APUSHAW, ynone, Pe, 0x60 },
- { APUSHFL, ynone, Px, 0x9c },
- { APUSHFW, ynone, Pe, 0x9c },
- { APUSHL, ypushl, Px, 0x50,0xff,(06),0x6a,0x68 },
- { APUSHW, ypushl, Pe, 0x50,0xff,(06),0x6a,0x68 },
- { ARCLB, yshb, Pb, 0xd0,(02),0xc0,(02),0xd2,(02) },
- { ARCLL, yshl, Px, 0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02) },
- { ARCLW, yshl, Pe, 0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02) },
- { ARCRB, yshb, Pb, 0xd0,(03),0xc0,(03),0xd2,(03) },
- { ARCRL, yshl, Px, 0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03) },
- { ARCRW, yshl, Pe, 0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03) },
- { AREP, ynone, Px, 0xf3 },
- { AREPN, ynone, Px, 0xf2 },
- { ARET, ynone, Px, 0xc3 },
- { AROLB, yshb, Pb, 0xd0,(00),0xc0,(00),0xd2,(00) },
- { AROLL, yshl, Px, 0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00) },
- { AROLW, yshl, Pe, 0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00) },
- { ARORB, yshb, Pb, 0xd0,(01),0xc0,(01),0xd2,(01) },
- { ARORL, yshl, Px, 0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01) },
- { ARORW, yshl, Pe, 0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01) },
- { ASAHF, ynone, Px, 0x9e },
- { ASALB, yshb, Pb, 0xd0,(04),0xc0,(04),0xd2,(04) },
- { ASALL, yshl, Px, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASALW, yshl, Pe, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASARB, yshb, Pb, 0xd0,(07),0xc0,(07),0xd2,(07) },
- { ASARL, yshl, Px, 0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07) },
- { ASARW, yshl, Pe, 0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07) },
- { ASBBB, yxorb, Pb, 0x1c,0x80,(03),0x18,0x1a },
- { ASBBL, yxorl, Px, 0x83,(03),0x1d,0x81,(03),0x19,0x1b },
- { ASBBW, yxorl, Pe, 0x83,(03),0x1d,0x81,(03),0x19,0x1b },
- { ASCASB, ynone, Pb, 0xae },
- { ASCASL, ynone, Px, 0xaf },
- { ASCASW, ynone, Pe, 0xaf },
- { ASETCC, yscond, Pm, 0x93,(00) },
- { ASETCS, yscond, Pm, 0x92,(00) },
- { ASETEQ, yscond, Pm, 0x94,(00) },
- { ASETGE, yscond, Pm, 0x9d,(00) },
- { ASETGT, yscond, Pm, 0x9f,(00) },
- { ASETHI, yscond, Pm, 0x97,(00) },
- { ASETLE, yscond, Pm, 0x9e,(00) },
- { ASETLS, yscond, Pm, 0x96,(00) },
- { ASETLT, yscond, Pm, 0x9c,(00) },
- { ASETMI, yscond, Pm, 0x98,(00) },
- { ASETNE, yscond, Pm, 0x95,(00) },
- { ASETOC, yscond, Pm, 0x91,(00) },
- { ASETOS, yscond, Pm, 0x90,(00) },
- { ASETPC, yscond, Pm, 0x96,(00) },
- { ASETPL, yscond, Pm, 0x99,(00) },
- { ASETPS, yscond, Pm, 0x9a,(00) },
- { ACDQ, ynone, Px, 0x99 },
- { ACWD, ynone, Pe, 0x99 },
- { ASHLB, yshb, Pb, 0xd0,(04),0xc0,(04),0xd2,(04) },
- { ASHLL, yshl, Px, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASHLW, yshl, Pe, 0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04) },
- { ASHRB, yshb, Pb, 0xd0,(05),0xc0,(05),0xd2,(05) },
- { ASHRL, yshl, Px, 0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05) },
- { ASHRW, yshl, Pe, 0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05) },
- { ASTC, ynone, Px, 0xf9 },
- { ASTD, ynone, Px, 0xfd },
- { ASTI, ynone, Px, 0xfb },
- { ASTOSB, ynone, Pb, 0xaa },
- { ASTOSL, ynone, Px, 0xab },
- { ASTOSW, ynone, Pe, 0xab },
- { ASUBB, yxorb, Pb, 0x2c,0x80,(05),0x28,0x2a },
- { ASUBL, yaddl, Px, 0x83,(05),0x2d,0x81,(05),0x29,0x2b },
- { ASUBW, yaddl, Pe, 0x83,(05),0x2d,0x81,(05),0x29,0x2b },
- { ASYSCALL, ynone, Px, 0xcd,100 },
- { ATESTB, ytestb, Pb, 0xa8,0xf6,(00),0x84,0x84 },
- { ATESTL, ytestl, Px, 0xa9,0xf7,(00),0x85,0x85 },
- { ATESTW, ytestl, Pe, 0xa9,0xf7,(00),0x85,0x85 },
+ { ANEGB, yscond, Px, {0xf6,(03)} },
+ { ANEGL, yscond, Px, {0xf7,(03)} },
+ { ANEGW, yscond, Pe, {0xf7,(03)} },
+ { ANOP, ynop, Px, {0,0} },
+ { ANOTB, yscond, Px, {0xf6,(02)} },
+ { ANOTL, yscond, Px, {0xf7,(02)} },
+ { ANOTW, yscond, Pe, {0xf7,(02)} },
+ { AORB, yxorb, Pb, {0x0c,0x80,(01),0x08,0x0a} },
+ { AORL, yxorl, Px, {0x83,(01),0x0d,0x81,(01),0x09,0x0b} },
+ { AORW, yxorl, Pe, {0x83,(01),0x0d,0x81,(01),0x09,0x0b} },
+ { AOUTB, yin, Pb, {0xe6,0xee} },
+ { AOUTL, yin, Px, {0xe7,0xef} },
+ { AOUTW, yin, Pe, {0xe7,0xef} },
+ { AOUTSB, ynone, Pb, {0x6e} },
+ { AOUTSL, ynone, Px, {0x6f} },
+ { AOUTSW, ynone, Pe, {0x6f} },
+ { APAUSE, ynone, Px, {0xf3,0x90} },
+ { APOPAL, ynone, Px, {0x61} },
+ { APOPAW, ynone, Pe, {0x61} },
+ { APOPFL, ynone, Px, {0x9d} },
+ { APOPFW, ynone, Pe, {0x9d} },
+ { APOPL, ypopl, Px, {0x58,0x8f,(00)} },
+ { APOPW, ypopl, Pe, {0x58,0x8f,(00)} },
+ { APUSHAL, ynone, Px, {0x60} },
+ { APUSHAW, ynone, Pe, {0x60} },
+ { APUSHFL, ynone, Px, {0x9c} },
+ { APUSHFW, ynone, Pe, {0x9c} },
+ { APUSHL, ypushl, Px, {0x50,0xff,(06),0x6a,0x68} },
+ { APUSHW, ypushl, Pe, {0x50,0xff,(06),0x6a,0x68} },
+ { ARCLB, yshb, Pb, {0xd0,(02),0xc0,(02),0xd2,(02)} },
+ { ARCLL, yshl, Px, {0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02)} },
+ { ARCLW, yshl, Pe, {0xd1,(02),0xc1,(02),0xd3,(02),0xd3,(02)} },
+ { ARCRB, yshb, Pb, {0xd0,(03),0xc0,(03),0xd2,(03)} },
+ { ARCRL, yshl, Px, {0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03)} },
+ { ARCRW, yshl, Pe, {0xd1,(03),0xc1,(03),0xd3,(03),0xd3,(03)} },
+ { AREP, ynone, Px, {0xf3} },
+ { AREPN, ynone, Px, {0xf2} },
+ { ARET, ynone, Px, {0xc3} },
+ { AROLB, yshb, Pb, {0xd0,(00),0xc0,(00),0xd2,(00)} },
+ { AROLL, yshl, Px, {0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00)} },
+ { AROLW, yshl, Pe, {0xd1,(00),0xc1,(00),0xd3,(00),0xd3,(00)} },
+ { ARORB, yshb, Pb, {0xd0,(01),0xc0,(01),0xd2,(01)} },
+ { ARORL, yshl, Px, {0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01)} },
+ { ARORW, yshl, Pe, {0xd1,(01),0xc1,(01),0xd3,(01),0xd3,(01)} },
+ { ASAHF, ynone, Px, {0x9e} },
+ { ASALB, yshb, Pb, {0xd0,(04),0xc0,(04),0xd2,(04)} },
+ { ASALL, yshl, Px, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASALW, yshl, Pe, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASARB, yshb, Pb, {0xd0,(07),0xc0,(07),0xd2,(07)} },
+ { ASARL, yshl, Px, {0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07)} },
+ { ASARW, yshl, Pe, {0xd1,(07),0xc1,(07),0xd3,(07),0xd3,(07)} },
+ { ASBBB, yxorb, Pb, {0x1c,0x80,(03),0x18,0x1a} },
+ { ASBBL, yxorl, Px, {0x83,(03),0x1d,0x81,(03),0x19,0x1b} },
+ { ASBBW, yxorl, Pe, {0x83,(03),0x1d,0x81,(03),0x19,0x1b} },
+ { ASCASB, ynone, Pb, {0xae} },
+ { ASCASL, ynone, Px, {0xaf} },
+ { ASCASW, ynone, Pe, {0xaf} },
+ { ASETCC, yscond, Pm, {0x93,(00)} },
+ { ASETCS, yscond, Pm, {0x92,(00)} },
+ { ASETEQ, yscond, Pm, {0x94,(00)} },
+ { ASETGE, yscond, Pm, {0x9d,(00)} },
+ { ASETGT, yscond, Pm, {0x9f,(00)} },
+ { ASETHI, yscond, Pm, {0x97,(00)} },
+ { ASETLE, yscond, Pm, {0x9e,(00)} },
+ { ASETLS, yscond, Pm, {0x96,(00)} },
+ { ASETLT, yscond, Pm, {0x9c,(00)} },
+ { ASETMI, yscond, Pm, {0x98,(00)} },
+ { ASETNE, yscond, Pm, {0x95,(00)} },
+ { ASETOC, yscond, Pm, {0x91,(00)} },
+ { ASETOS, yscond, Pm, {0x90,(00)} },
+ { ASETPC, yscond, Pm, {0x9b,(00)} },
+ { ASETPL, yscond, Pm, {0x99,(00)} },
+ { ASETPS, yscond, Pm, {0x9a,(00)} },
+ { ACDQ, ynone, Px, {0x99} },
+ { ACWD, ynone, Pe, {0x99} },
+ { ASHLB, yshb, Pb, {0xd0,(04),0xc0,(04),0xd2,(04)} },
+ { ASHLL, yshl, Px, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASHLW, yshl, Pe, {0xd1,(04),0xc1,(04),0xd3,(04),0xd3,(04)} },
+ { ASHRB, yshb, Pb, {0xd0,(05),0xc0,(05),0xd2,(05)} },
+ { ASHRL, yshl, Px, {0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05)} },
+ { ASHRW, yshl, Pe, {0xd1,(05),0xc1,(05),0xd3,(05),0xd3,(05)} },
+ { ASTC, ynone, Px, {0xf9} },
+ { ASTD, ynone, Px, {0xfd} },
+ { ASTI, ynone, Px, {0xfb} },
+ { ASTOSB, ynone, Pb, {0xaa} },
+ { ASTOSL, ynone, Px, {0xab} },
+ { ASTOSW, ynone, Pe, {0xab} },
+ { ASUBB, yxorb, Pb, {0x2c,0x80,(05),0x28,0x2a} },
+ { ASUBL, yaddl, Px, {0x83,(05),0x2d,0x81,(05),0x29,0x2b} },
+ { ASUBW, yaddl, Pe, {0x83,(05),0x2d,0x81,(05),0x29,0x2b} },
+ { ASYSCALL, ynone, Px, {0xcd,100} },
+ { ATESTB, ytestb, Pb, {0xa8,0xf6,(00),0x84,0x84} },
+ { ATESTL, ytestl, Px, {0xa9,0xf7,(00),0x85,0x85} },
+ { ATESTW, ytestl, Pe, {0xa9,0xf7,(00),0x85,0x85} },
{ ATEXT, ytext, Px },
- { AVERR, ydivl, Pm, 0x00,(04) },
- { AVERW, ydivl, Pm, 0x00,(05) },
- { AWAIT, ynone, Px, 0x9b },
- { AWORD, ybyte, Px, 2 },
- { AXCHGB, yml_mb, Pb, 0x86,0x86 },
- { AXCHGL, yxchg, Px, 0x90,0x90,0x87,0x87 },
- { AXCHGW, yxchg, Pe, 0x90,0x90,0x87,0x87 },
- { AXLAT, ynone, Px, 0xd7 },
- { AXORB, yxorb, Pb, 0x34,0x80,(06),0x30,0x32 },
- { AXORL, yxorl, Px, 0x83,(06),0x35,0x81,(06),0x31,0x33 },
- { AXORW, yxorl, Pe, 0x83,(06),0x35,0x81,(06),0x31,0x33 },
-
- { AFMOVB, yfmvx, Px, 0xdf,(04) },
- { AFMOVBP, yfmvp, Px, 0xdf,(06) },
- { AFMOVD, yfmvd, Px, 0xdd,(00),0xdd,(02),0xd9,(00),0xdd,(02) },
- { AFMOVDP, yfmvdp, Px, 0xdd,(03),0xdd,(03) },
- { AFMOVF, yfmvf, Px, 0xd9,(00),0xd9,(02) },
- { AFMOVFP, yfmvp, Px, 0xd9,(03) },
- { AFMOVL, yfmvf, Px, 0xdb,(00),0xdb,(02) },
- { AFMOVLP, yfmvp, Px, 0xdb,(03) },
- { AFMOVV, yfmvx, Px, 0xdf,(05) },
- { AFMOVVP, yfmvp, Px, 0xdf,(07) },
- { AFMOVW, yfmvf, Px, 0xdf,(00),0xdf,(02) },
- { AFMOVWP, yfmvp, Px, 0xdf,(03) },
- { AFMOVX, yfmvx, Px, 0xdb,(05) },
- { AFMOVXP, yfmvp, Px, 0xdb,(07) },
+ { AVERR, ydivl, Pm, {0x00,(04)} },
+ { AVERW, ydivl, Pm, {0x00,(05)} },
+ { AWAIT, ynone, Px, {0x9b} },
+ { AWORD, ybyte, Px, {2} },
+ { AXCHGB, yml_mb, Pb, {0x86,0x86} },
+ { AXCHGL, yxchg, Px, {0x90,0x90,0x87,0x87} },
+ { AXCHGW, yxchg, Pe, {0x90,0x90,0x87,0x87} },
+ { AXLAT, ynone, Px, {0xd7} },
+ { AXORB, yxorb, Pb, {0x34,0x80,(06),0x30,0x32} },
+ { AXORL, yxorl, Px, {0x83,(06),0x35,0x81,(06),0x31,0x33} },
+ { AXORW, yxorl, Pe, {0x83,(06),0x35,0x81,(06),0x31,0x33} },
+
+ { AFMOVB, yfmvx, Px, {0xdf,(04)} },
+ { AFMOVBP, yfmvp, Px, {0xdf,(06)} },
+ { AFMOVD, yfmvd, Px, {0xdd,(00),0xdd,(02),0xd9,(00),0xdd,(02)} },
+ { AFMOVDP, yfmvdp, Px, {0xdd,(03),0xdd,(03)} },
+ { AFMOVF, yfmvf, Px, {0xd9,(00),0xd9,(02)} },
+ { AFMOVFP, yfmvp, Px, {0xd9,(03)} },
+ { AFMOVL, yfmvf, Px, {0xdb,(00),0xdb,(02)} },
+ { AFMOVLP, yfmvp, Px, {0xdb,(03)} },
+ { AFMOVV, yfmvx, Px, {0xdf,(05)} },
+ { AFMOVVP, yfmvp, Px, {0xdf,(07)} },
+ { AFMOVW, yfmvf, Px, {0xdf,(00),0xdf,(02)} },
+ { AFMOVWP, yfmvp, Px, {0xdf,(03)} },
+ { AFMOVX, yfmvx, Px, {0xdb,(05)} },
+ { AFMOVXP, yfmvp, Px, {0xdb,(07)} },
{ AFCOMB },
{ AFCOMBP },
- { AFCOMD, yfadd, Px, 0xdc,(02),0xd8,(02),0xdc,(02) }, /* botch */
- { AFCOMDP, yfadd, Px, 0xdc,(03),0xd8,(03),0xdc,(03) }, /* botch */
- { AFCOMDPP, ycompp, Px, 0xde,(03) },
- { AFCOMF, yfmvx, Px, 0xd8,(02) },
- { AFCOMFP, yfmvx, Px, 0xd8,(03) },
- { AFCOMI, yfmvx, Px, 0xdb,(06) },
- { AFCOMIP, yfmvx, Px, 0xdf,(06) },
- { AFCOML, yfmvx, Px, 0xda,(02) },
- { AFCOMLP, yfmvx, Px, 0xda,(03) },
- { AFCOMW, yfmvx, Px, 0xde,(02) },
- { AFCOMWP, yfmvx, Px, 0xde,(03) },
-
- { AFUCOM, ycompp, Px, 0xdd,(04) },
- { AFUCOMI, ycompp, Px, 0xdb,(05) },
- { AFUCOMIP, ycompp, Px, 0xdf,(05) },
- { AFUCOMP, ycompp, Px, 0xdd,(05) },
- { AFUCOMPP, ycompp, Px, 0xda,(13) },
-
- { AFADDDP, yfaddp, Px, 0xde,(00) },
- { AFADDW, yfmvx, Px, 0xde,(00) },
- { AFADDL, yfmvx, Px, 0xda,(00) },
- { AFADDF, yfmvx, Px, 0xd8,(00) },
- { AFADDD, yfadd, Px, 0xdc,(00),0xd8,(00),0xdc,(00) },
-
- { AFMULDP, yfaddp, Px, 0xde,(01) },
- { AFMULW, yfmvx, Px, 0xde,(01) },
- { AFMULL, yfmvx, Px, 0xda,(01) },
- { AFMULF, yfmvx, Px, 0xd8,(01) },
- { AFMULD, yfadd, Px, 0xdc,(01),0xd8,(01),0xdc,(01) },
-
- { AFSUBDP, yfaddp, Px, 0xde,(05) },
- { AFSUBW, yfmvx, Px, 0xde,(04) },
- { AFSUBL, yfmvx, Px, 0xda,(04) },
- { AFSUBF, yfmvx, Px, 0xd8,(04) },
- { AFSUBD, yfadd, Px, 0xdc,(04),0xd8,(04),0xdc,(05) },
-
- { AFSUBRDP, yfaddp, Px, 0xde,(04) },
- { AFSUBRW, yfmvx, Px, 0xde,(05) },
- { AFSUBRL, yfmvx, Px, 0xda,(05) },
- { AFSUBRF, yfmvx, Px, 0xd8,(05) },
- { AFSUBRD, yfadd, Px, 0xdc,(05),0xd8,(05),0xdc,(04) },
-
- { AFDIVDP, yfaddp, Px, 0xde,(07) },
- { AFDIVW, yfmvx, Px, 0xde,(06) },
- { AFDIVL, yfmvx, Px, 0xda,(06) },
- { AFDIVF, yfmvx, Px, 0xd8,(06) },
- { AFDIVD, yfadd, Px, 0xdc,(06),0xd8,(06),0xdc,(07) },
-
- { AFDIVRDP, yfaddp, Px, 0xde,(06) },
- { AFDIVRW, yfmvx, Px, 0xde,(07) },
- { AFDIVRL, yfmvx, Px, 0xda,(07) },
- { AFDIVRF, yfmvx, Px, 0xd8,(07) },
- { AFDIVRD, yfadd, Px, 0xdc,(07),0xd8,(07),0xdc,(06) },
-
- { AFXCHD, yfxch, Px, 0xd9,(01),0xd9,(01) },
+ { AFCOMD, yfadd, Px, {0xdc,(02),0xd8,(02),0xdc,(02)} }, /* botch */
+ { AFCOMDP, yfadd, Px, {0xdc,(03),0xd8,(03),0xdc,(03)} }, /* botch */
+ { AFCOMDPP, ycompp, Px, {0xde,(03)} },
+ { AFCOMF, yfmvx, Px, {0xd8,(02)} },
+ { AFCOMFP, yfmvx, Px, {0xd8,(03)} },
+ { AFCOMI, yfmvx, Px, {0xdb,(06)} },
+ { AFCOMIP, yfmvx, Px, {0xdf,(06)} },
+ { AFCOML, yfmvx, Px, {0xda,(02)} },
+ { AFCOMLP, yfmvx, Px, {0xda,(03)} },
+ { AFCOMW, yfmvx, Px, {0xde,(02)} },
+ { AFCOMWP, yfmvx, Px, {0xde,(03)} },
+
+ { AFUCOM, ycompp, Px, {0xdd,(04)} },
+ { AFUCOMI, ycompp, Px, {0xdb,(05)} },
+ { AFUCOMIP, ycompp, Px, {0xdf,(05)} },
+ { AFUCOMP, ycompp, Px, {0xdd,(05)} },
+ { AFUCOMPP, ycompp, Px, {0xda,(13)} },
+
+ { AFADDDP, yfaddp, Px, {0xde,(00)} },
+ { AFADDW, yfmvx, Px, {0xde,(00)} },
+ { AFADDL, yfmvx, Px, {0xda,(00)} },
+ { AFADDF, yfmvx, Px, {0xd8,(00)} },
+ { AFADDD, yfadd, Px, {0xdc,(00),0xd8,(00),0xdc,(00)} },
+
+ { AFMULDP, yfaddp, Px, {0xde,(01)} },
+ { AFMULW, yfmvx, Px, {0xde,(01)} },
+ { AFMULL, yfmvx, Px, {0xda,(01)} },
+ { AFMULF, yfmvx, Px, {0xd8,(01)} },
+ { AFMULD, yfadd, Px, {0xdc,(01),0xd8,(01),0xdc,(01)} },
+
+ { AFSUBDP, yfaddp, Px, {0xde,(05)} },
+ { AFSUBW, yfmvx, Px, {0xde,(04)} },
+ { AFSUBL, yfmvx, Px, {0xda,(04)} },
+ { AFSUBF, yfmvx, Px, {0xd8,(04)} },
+ { AFSUBD, yfadd, Px, {0xdc,(04),0xd8,(04),0xdc,(05)} },
+
+ { AFSUBRDP, yfaddp, Px, {0xde,(04)} },
+ { AFSUBRW, yfmvx, Px, {0xde,(05)} },
+ { AFSUBRL, yfmvx, Px, {0xda,(05)} },
+ { AFSUBRF, yfmvx, Px, {0xd8,(05)} },
+ { AFSUBRD, yfadd, Px, {0xdc,(05),0xd8,(05),0xdc,(04)} },
+
+ { AFDIVDP, yfaddp, Px, {0xde,(07)} },
+ { AFDIVW, yfmvx, Px, {0xde,(06)} },
+ { AFDIVL, yfmvx, Px, {0xda,(06)} },
+ { AFDIVF, yfmvx, Px, {0xd8,(06)} },
+ { AFDIVD, yfadd, Px, {0xdc,(06),0xd8,(06),0xdc,(07)} },
+
+ { AFDIVRDP, yfaddp, Px, {0xde,(06)} },
+ { AFDIVRW, yfmvx, Px, {0xde,(07)} },
+ { AFDIVRL, yfmvx, Px, {0xda,(07)} },
+ { AFDIVRF, yfmvx, Px, {0xd8,(07)} },
+ { AFDIVRD, yfadd, Px, {0xdc,(07),0xd8,(07),0xdc,(06)} },
+
+ { AFXCHD, yfxch, Px, {0xd9,(01),0xd9,(01)} },
{ AFFREE },
- { AFLDCW, ystcw, Px, 0xd9,(05),0xd9,(05) },
- { AFLDENV, ystcw, Px, 0xd9,(04),0xd9,(04) },
- { AFRSTOR, ysvrs, Px, 0xdd,(04),0xdd,(04) },
- { AFSAVE, ysvrs, Px, 0xdd,(06),0xdd,(06) },
- { AFSTCW, ystcw, Px, 0xd9,(07),0xd9,(07) },
- { AFSTENV, ystcw, Px, 0xd9,(06),0xd9,(06) },
- { AFSTSW, ystsw, Px, 0xdd,(07),0xdf,0xe0 },
- { AF2XM1, ynone, Px, 0xd9, 0xf0 },
- { AFABS, ynone, Px, 0xd9, 0xe1 },
- { AFCHS, ynone, Px, 0xd9, 0xe0 },
- { AFCLEX, ynone, Px, 0xdb, 0xe2 },
- { AFCOS, ynone, Px, 0xd9, 0xff },
- { AFDECSTP, ynone, Px, 0xd9, 0xf6 },
- { AFINCSTP, ynone, Px, 0xd9, 0xf7 },
- { AFINIT, ynone, Px, 0xdb, 0xe3 },
- { AFLD1, ynone, Px, 0xd9, 0xe8 },
- { AFLDL2E, ynone, Px, 0xd9, 0xea },
- { AFLDL2T, ynone, Px, 0xd9, 0xe9 },
- { AFLDLG2, ynone, Px, 0xd9, 0xec },
- { AFLDLN2, ynone, Px, 0xd9, 0xed },
- { AFLDPI, ynone, Px, 0xd9, 0xeb },
- { AFLDZ, ynone, Px, 0xd9, 0xee },
- { AFNOP, ynone, Px, 0xd9, 0xd0 },
- { AFPATAN, ynone, Px, 0xd9, 0xf3 },
- { AFPREM, ynone, Px, 0xd9, 0xf8 },
- { AFPREM1, ynone, Px, 0xd9, 0xf5 },
- { AFPTAN, ynone, Px, 0xd9, 0xf2 },
- { AFRNDINT, ynone, Px, 0xd9, 0xfc },
- { AFSCALE, ynone, Px, 0xd9, 0xfd },
- { AFSIN, ynone, Px, 0xd9, 0xfe },
- { AFSINCOS, ynone, Px, 0xd9, 0xfb },
- { AFSQRT, ynone, Px, 0xd9, 0xfa },
- { AFTST, ynone, Px, 0xd9, 0xe4 },
- { AFXAM, ynone, Px, 0xd9, 0xe5 },
- { AFXTRACT, ynone, Px, 0xd9, 0xf4 },
- { AFYL2X, ynone, Px, 0xd9, 0xf1 },
- { AFYL2XP1, ynone, Px, 0xd9, 0xf9 },
+ { AFLDCW, ystcw, Px, {0xd9,(05),0xd9,(05)} },
+ { AFLDENV, ystcw, Px, {0xd9,(04),0xd9,(04)} },
+ { AFRSTOR, ysvrs, Px, {0xdd,(04),0xdd,(04)} },
+ { AFSAVE, ysvrs, Px, {0xdd,(06),0xdd,(06)} },
+ { AFSTCW, ystcw, Px, {0xd9,(07),0xd9,(07)} },
+ { AFSTENV, ystcw, Px, {0xd9,(06),0xd9,(06)} },
+ { AFSTSW, ystsw, Px, {0xdd,(07),0xdf,0xe0} },
+ { AF2XM1, ynone, Px, {0xd9, 0xf0} },
+ { AFABS, ynone, Px, {0xd9, 0xe1} },
+ { AFCHS, ynone, Px, {0xd9, 0xe0} },
+ { AFCLEX, ynone, Px, {0xdb, 0xe2} },
+ { AFCOS, ynone, Px, {0xd9, 0xff} },
+ { AFDECSTP, ynone, Px, {0xd9, 0xf6} },
+ { AFINCSTP, ynone, Px, {0xd9, 0xf7} },
+ { AFINIT, ynone, Px, {0xdb, 0xe3} },
+ { AFLD1, ynone, Px, {0xd9, 0xe8} },
+ { AFLDL2E, ynone, Px, {0xd9, 0xea} },
+ { AFLDL2T, ynone, Px, {0xd9, 0xe9} },
+ { AFLDLG2, ynone, Px, {0xd9, 0xec} },
+ { AFLDLN2, ynone, Px, {0xd9, 0xed} },
+ { AFLDPI, ynone, Px, {0xd9, 0xeb} },
+ { AFLDZ, ynone, Px, {0xd9, 0xee} },
+ { AFNOP, ynone, Px, {0xd9, 0xd0} },
+ { AFPATAN, ynone, Px, {0xd9, 0xf3} },
+ { AFPREM, ynone, Px, {0xd9, 0xf8} },
+ { AFPREM1, ynone, Px, {0xd9, 0xf5} },
+ { AFPTAN, ynone, Px, {0xd9, 0xf2} },
+ { AFRNDINT, ynone, Px, {0xd9, 0xfc} },
+ { AFSCALE, ynone, Px, {0xd9, 0xfd} },
+ { AFSIN, ynone, Px, {0xd9, 0xfe} },
+ { AFSINCOS, ynone, Px, {0xd9, 0xfb} },
+ { AFSQRT, ynone, Px, {0xd9, 0xfa} },
+ { AFTST, ynone, Px, {0xd9, 0xe4} },
+ { AFXAM, ynone, Px, {0xd9, 0xe5} },
+ { AFXTRACT, ynone, Px, {0xd9, 0xf4} },
+ { AFYL2X, ynone, Px, {0xd9, 0xf1} },
+ { AFYL2XP1, ynone, Px, {0xd9, 0xf9} },
{ AEND },
{ ADYNT_ },
{ AINIT_ },
{ ASIGNAME },
- { ACMPXCHGB, yrb_mb, Pm, 0xb0 },
- { ACMPXCHGL, yrl_ml, Pm, 0xb1 },
- { ACMPXCHGW, yrl_ml, Pm, 0xb1 },
- { ACMPXCHG8B, yscond, Pm, 0xc7,(01) },
-
- { ACPUID, ynone, Pm, 0xa2 },
- { ARDTSC, ynone, Pm, 0x31 },
-
- { AXADDB, yrb_mb, Pb, 0x0f,0xc0 },
- { AXADDL, yrl_ml, Pm, 0xc1 },
- { AXADDW, yrl_ml, Pe, 0x0f,0xc1 },
-
- { ACMOVLCC, yml_rl, Pm, 0x43 },
- { ACMOVLCS, yml_rl, Pm, 0x42 },
- { ACMOVLEQ, yml_rl, Pm, 0x44 },
- { ACMOVLGE, yml_rl, Pm, 0x4d },
- { ACMOVLGT, yml_rl, Pm, 0x4f },
- { ACMOVLHI, yml_rl, Pm, 0x47 },
- { ACMOVLLE, yml_rl, Pm, 0x4e },
- { ACMOVLLS, yml_rl, Pm, 0x46 },
- { ACMOVLLT, yml_rl, Pm, 0x4c },
- { ACMOVLMI, yml_rl, Pm, 0x48 },
- { ACMOVLNE, yml_rl, Pm, 0x45 },
- { ACMOVLOC, yml_rl, Pm, 0x41 },
- { ACMOVLOS, yml_rl, Pm, 0x40 },
- { ACMOVLPC, yml_rl, Pm, 0x4b },
- { ACMOVLPL, yml_rl, Pm, 0x49 },
- { ACMOVLPS, yml_rl, Pm, 0x4a },
- { ACMOVWCC, yml_rl, Pq, 0x43 },
- { ACMOVWCS, yml_rl, Pq, 0x42 },
- { ACMOVWEQ, yml_rl, Pq, 0x44 },
- { ACMOVWGE, yml_rl, Pq, 0x4d },
- { ACMOVWGT, yml_rl, Pq, 0x4f },
- { ACMOVWHI, yml_rl, Pq, 0x47 },
- { ACMOVWLE, yml_rl, Pq, 0x4e },
- { ACMOVWLS, yml_rl, Pq, 0x46 },
- { ACMOVWLT, yml_rl, Pq, 0x4c },
- { ACMOVWMI, yml_rl, Pq, 0x48 },
- { ACMOVWNE, yml_rl, Pq, 0x45 },
- { ACMOVWOC, yml_rl, Pq, 0x41 },
- { ACMOVWOS, yml_rl, Pq, 0x40 },
- { ACMOVWPC, yml_rl, Pq, 0x4b },
- { ACMOVWPL, yml_rl, Pq, 0x49 },
- { ACMOVWPS, yml_rl, Pq, 0x4a },
-
- { AFCMOVCC, yfcmv, Px, 0xdb,(00) },
- { AFCMOVCS, yfcmv, Px, 0xda,(00) },
- { AFCMOVEQ, yfcmv, Px, 0xda,(01) },
- { AFCMOVHI, yfcmv, Px, 0xdb,(02) },
- { AFCMOVLS, yfcmv, Px, 0xda,(02) },
- { AFCMOVNE, yfcmv, Px, 0xdb,(01) },
- { AFCMOVNU, yfcmv, Px, 0xdb,(03) },
- { AFCMOVUN, yfcmv, Px, 0xda,(03) },
-
- { ALFENCE, ynone, Pm, 0xae,0xe8 },
- { AMFENCE, ynone, Pm, 0xae,0xf0 },
- { ASFENCE, ynone, Pm, 0xae,0xf8 },
-
- { AEMMS, ynone, Pm, 0x77 },
-
- { APREFETCHT0, yprefetch, Pm, 0x18,(01) },
- { APREFETCHT1, yprefetch, Pm, 0x18,(02) },
- { APREFETCHT2, yprefetch, Pm, 0x18,(03) },
- { APREFETCHNTA, yprefetch, Pm, 0x18,(00) },
-
- { ABSWAPL, ybswap, Pm, 0xc8 },
+ { ACMPXCHGB, yrb_mb, Pm, {0xb0} },
+ { ACMPXCHGL, yrl_ml, Pm, {0xb1} },
+ { ACMPXCHGW, yrl_ml, Pm, {0xb1} },
+ { ACMPXCHG8B, yscond, Pm, {0xc7,(01)} },
+
+ { ACPUID, ynone, Pm, {0xa2} },
+ { ARDTSC, ynone, Pm, {0x31} },
+
+ { AXADDB, yrb_mb, Pb, {0x0f,0xc0} },
+ { AXADDL, yrl_ml, Pm, {0xc1} },
+ { AXADDW, yrl_ml, Pe, {0x0f,0xc1} },
+
+ { ACMOVLCC, yml_rl, Pm, {0x43} },
+ { ACMOVLCS, yml_rl, Pm, {0x42} },
+ { ACMOVLEQ, yml_rl, Pm, {0x44} },
+ { ACMOVLGE, yml_rl, Pm, {0x4d} },
+ { ACMOVLGT, yml_rl, Pm, {0x4f} },
+ { ACMOVLHI, yml_rl, Pm, {0x47} },
+ { ACMOVLLE, yml_rl, Pm, {0x4e} },
+ { ACMOVLLS, yml_rl, Pm, {0x46} },
+ { ACMOVLLT, yml_rl, Pm, {0x4c} },
+ { ACMOVLMI, yml_rl, Pm, {0x48} },
+ { ACMOVLNE, yml_rl, Pm, {0x45} },
+ { ACMOVLOC, yml_rl, Pm, {0x41} },
+ { ACMOVLOS, yml_rl, Pm, {0x40} },
+ { ACMOVLPC, yml_rl, Pm, {0x4b} },
+ { ACMOVLPL, yml_rl, Pm, {0x49} },
+ { ACMOVLPS, yml_rl, Pm, {0x4a} },
+ { ACMOVWCC, yml_rl, Pq, {0x43} },
+ { ACMOVWCS, yml_rl, Pq, {0x42} },
+ { ACMOVWEQ, yml_rl, Pq, {0x44} },
+ { ACMOVWGE, yml_rl, Pq, {0x4d} },
+ { ACMOVWGT, yml_rl, Pq, {0x4f} },
+ { ACMOVWHI, yml_rl, Pq, {0x47} },
+ { ACMOVWLE, yml_rl, Pq, {0x4e} },
+ { ACMOVWLS, yml_rl, Pq, {0x46} },
+ { ACMOVWLT, yml_rl, Pq, {0x4c} },
+ { ACMOVWMI, yml_rl, Pq, {0x48} },
+ { ACMOVWNE, yml_rl, Pq, {0x45} },
+ { ACMOVWOC, yml_rl, Pq, {0x41} },
+ { ACMOVWOS, yml_rl, Pq, {0x40} },
+ { ACMOVWPC, yml_rl, Pq, {0x4b} },
+ { ACMOVWPL, yml_rl, Pq, {0x49} },
+ { ACMOVWPS, yml_rl, Pq, {0x4a} },
+
+ { AFCMOVCC, yfcmv, Px, {0xdb,(00)} },
+ { AFCMOVCS, yfcmv, Px, {0xda,(00)} },
+ { AFCMOVEQ, yfcmv, Px, {0xda,(01)} },
+ { AFCMOVHI, yfcmv, Px, {0xdb,(02)} },
+ { AFCMOVLS, yfcmv, Px, {0xda,(02)} },
+ { AFCMOVNE, yfcmv, Px, {0xdb,(01)} },
+ { AFCMOVNU, yfcmv, Px, {0xdb,(03)} },
+ { AFCMOVUN, yfcmv, Px, {0xda,(03)} },
+
+ { ALFENCE, ynone, Pm, {0xae,0xe8} },
+ { AMFENCE, ynone, Pm, {0xae,0xf0} },
+ { ASFENCE, ynone, Pm, {0xae,0xf8} },
+
+ { AEMMS, ynone, Pm, {0x77} },
+
+ { APREFETCHT0, yprefetch, Pm, {0x18,(01)} },
+ { APREFETCHT1, yprefetch, Pm, {0x18,(02)} },
+ { APREFETCHT2, yprefetch, Pm, {0x18,(03)} },
+ { APREFETCHNTA, yprefetch, Pm, {0x18,(00)} },
+
+ { ABSWAPL, ybswap, Pm, {0xc8} },
- { AUNDEF, ynone, Px, 0x0f, 0x0b },
-
- { AADDPD, yxm, Pq, 0x58 },
- { AADDPS, yxm, Pm, 0x58 },
- { AADDSD, yxm, Pf2, 0x58 },
- { AADDSS, yxm, Pf3, 0x58 },
- { AANDNPD, yxm, Pq, 0x55 },
- { AANDNPS, yxm, Pm, 0x55 },
- { AANDPD, yxm, Pq, 0x54 },
- { AANDPS, yxm, Pq, 0x54 },
- { ACMPPD, yxcmpi, Px, Pe,0xc2 },
- { ACMPPS, yxcmpi, Pm, 0xc2,0 },
- { ACMPSD, yxcmpi, Px, Pf2,0xc2 },
- { ACMPSS, yxcmpi, Px, Pf3,0xc2 },
- { ACOMISD, yxcmp, Pe, 0x2f },
- { ACOMISS, yxcmp, Pm, 0x2f },
- { ACVTPL2PD, yxcvm2, Px, Pf3,0xe6,Pe,0x2a },
- { ACVTPL2PS, yxcvm2, Pm, 0x5b,0,0x2a,0, },
- { ACVTPD2PL, yxcvm1, Px, Pf2,0xe6,Pe,0x2d },
- { ACVTPD2PS, yxm, Pe, 0x5a },
- { ACVTPS2PL, yxcvm1, Px, Pe,0x5b,Pm,0x2d },
- { ACVTPS2PD, yxm, Pm, 0x5a },
- { ACVTSD2SL, yxcvfl, Pf2, 0x2d },
- { ACVTSD2SS, yxm, Pf2, 0x5a },
- { ACVTSL2SD, yxcvlf, Pf2, 0x2a },
- { ACVTSL2SS, yxcvlf, Pf3, 0x2a },
- { ACVTSS2SD, yxm, Pf3, 0x5a },
- { ACVTSS2SL, yxcvfl, Pf3, 0x2d },
- { ACVTTPD2PL, yxcvm1, Px, Pe,0xe6,Pe,0x2c },
- { ACVTTPS2PL, yxcvm1, Px, Pf3,0x5b,Pm,0x2c },
- { ACVTTSD2SL, yxcvfl, Pf2, 0x2c },
- { ACVTTSS2SL, yxcvfl, Pf3, 0x2c },
- { ADIVPD, yxm, Pe, 0x5e },
- { ADIVPS, yxm, Pm, 0x5e },
- { ADIVSD, yxm, Pf2, 0x5e },
- { ADIVSS, yxm, Pf3, 0x5e },
- { AMASKMOVOU, yxr, Pe, 0xf7 },
- { AMAXPD, yxm, Pe, 0x5f },
- { AMAXPS, yxm, Pm, 0x5f },
- { AMAXSD, yxm, Pf2, 0x5f },
- { AMAXSS, yxm, Pf3, 0x5f },
- { AMINPD, yxm, Pe, 0x5d },
- { AMINPS, yxm, Pm, 0x5d },
- { AMINSD, yxm, Pf2, 0x5d },
- { AMINSS, yxm, Pf3, 0x5d },
- { AMOVAPD, yxmov, Pe, 0x28,0x29 },
- { AMOVAPS, yxmov, Pm, 0x28,0x29 },
- { AMOVO, yxmov, Pe, 0x6f,0x7f },
- { AMOVOU, yxmov, Pf3, 0x6f,0x7f },
- { AMOVHLPS, yxr, Pm, 0x12 },
- { AMOVHPD, yxmov, Pe, 0x16,0x17 },
- { AMOVHPS, yxmov, Pm, 0x16,0x17 },
- { AMOVLHPS, yxr, Pm, 0x16 },
- { AMOVLPD, yxmov, Pe, 0x12,0x13 },
- { AMOVLPS, yxmov, Pm, 0x12,0x13 },
- { AMOVMSKPD, yxrrl, Pq, 0x50 },
- { AMOVMSKPS, yxrrl, Pm, 0x50 },
- { AMOVNTO, yxr_ml, Pe, 0xe7 },
- { AMOVNTPD, yxr_ml, Pe, 0x2b },
- { AMOVNTPS, yxr_ml, Pm, 0x2b },
- { AMOVSD, yxmov, Pf2, 0x10,0x11 },
- { AMOVSS, yxmov, Pf3, 0x10,0x11 },
- { AMOVUPD, yxmov, Pe, 0x10,0x11 },
- { AMOVUPS, yxmov, Pm, 0x10,0x11 },
- { AMULPD, yxm, Pe, 0x59 },
- { AMULPS, yxm, Ym, 0x59 },
- { AMULSD, yxm, Pf2, 0x59 },
- { AMULSS, yxm, Pf3, 0x59 },
- { AORPD, yxm, Pq, 0x56 },
- { AORPS, yxm, Pm, 0x56 },
- { APADDQ, yxm, Pe, 0xd4 },
- { APAND, yxm, Pe, 0xdb },
- { APCMPEQB, yxmq, Pe ,0x74 },
- { APMAXSW, yxm, Pe, 0xee },
- { APMAXUB, yxm, Pe, 0xde },
- { APMINSW, yxm, Pe, 0xea },
- { APMINUB, yxm, Pe, 0xda },
- { APMOVMSKB, ymskb, Px, Pe,0xd7,0xd7 },
- { APSADBW, yxm, Pq, 0xf6 },
- { APSUBB, yxm, Pe, 0xf8 },
- { APSUBL, yxm, Pe, 0xfa },
- { APSUBQ, yxm, Pe, 0xfb },
- { APSUBSB, yxm, Pe, 0xe8 },
- { APSUBSW, yxm, Pe, 0xe9 },
- { APSUBUSB, yxm, Pe, 0xd8 },
- { APSUBUSW, yxm, Pe, 0xd9 },
- { APSUBW, yxm, Pe, 0xf9 },
- { APUNPCKHQDQ, yxm, Pe, 0x6d },
- { APUNPCKLQDQ, yxm, Pe, 0x6c },
- { APXOR, yxm, Pe, 0xef },
- { ARCPPS, yxm, Pm, 0x53 },
- { ARCPSS, yxm, Pf3, 0x53 },
- { ARSQRTPS, yxm, Pm, 0x52 },
- { ARSQRTSS, yxm, Pf3, 0x52 },
- { ASQRTPD, yxm, Pe, 0x51 },
- { ASQRTPS, yxm, Pm, 0x51 },
- { ASQRTSD, yxm, Pf2, 0x51 },
- { ASQRTSS, yxm, Pf3, 0x51 },
- { ASUBPD, yxm, Pe, 0x5c },
- { ASUBPS, yxm, Pm, 0x5c },
- { ASUBSD, yxm, Pf2, 0x5c },
- { ASUBSS, yxm, Pf3, 0x5c },
- { AUCOMISD, yxcmp, Pe, 0x2e },
- { AUCOMISS, yxcmp, Pm, 0x2e },
- { AUNPCKHPD, yxm, Pe, 0x15 },
- { AUNPCKHPS, yxm, Pm, 0x15 },
- { AUNPCKLPD, yxm, Pe, 0x14 },
- { AUNPCKLPS, yxm, Pm, 0x14 },
- { AXORPD, yxm, Pe, 0x57 },
- { AXORPS, yxm, Pm, 0x57 },
-
- { AAESENC, yaes, Pq, 0x38,0xdc,(0) },
- { APINSRD, yinsrd, Pq, 0x3a, 0x22, (00) },
- { APSHUFB, ymshufb,Pq, 0x38, 0x00 },
-
- { AUSEFIELD, ynop, Px, 0,0 },
+ { AUNDEF, ynone, Px, {0x0f, 0x0b} },
+
+ { AADDPD, yxm, Pq, {0x58} },
+ { AADDPS, yxm, Pm, {0x58} },
+ { AADDSD, yxm, Pf2, {0x58} },
+ { AADDSS, yxm, Pf3, {0x58} },
+ { AANDNPD, yxm, Pq, {0x55} },
+ { AANDNPS, yxm, Pm, {0x55} },
+ { AANDPD, yxm, Pq, {0x54} },
+ { AANDPS, yxm, Pq, {0x54} },
+ { ACMPPD, yxcmpi, Px, {Pe,0xc2} },
+ { ACMPPS, yxcmpi, Pm, {0xc2,0} },
+ { ACMPSD, yxcmpi, Px, {Pf2,0xc2} },
+ { ACMPSS, yxcmpi, Px, {Pf3,0xc2} },
+ { ACOMISD, yxcmp, Pe, {0x2f} },
+ { ACOMISS, yxcmp, Pm, {0x2f} },
+ { ACVTPL2PD, yxcvm2, Px, {Pf3,0xe6,Pe,0x2a} },
+ { ACVTPL2PS, yxcvm2, Pm, {0x5b,0,0x2a,0,} },
+ { ACVTPD2PL, yxcvm1, Px, {Pf2,0xe6,Pe,0x2d} },
+ { ACVTPD2PS, yxm, Pe, {0x5a} },
+ { ACVTPS2PL, yxcvm1, Px, {Pe,0x5b,Pm,0x2d} },
+ { ACVTPS2PD, yxm, Pm, {0x5a} },
+ { ACVTSD2SL, yxcvfl, Pf2, {0x2d} },
+ { ACVTSD2SS, yxm, Pf2, {0x5a} },
+ { ACVTSL2SD, yxcvlf, Pf2, {0x2a} },
+ { ACVTSL2SS, yxcvlf, Pf3, {0x2a} },
+ { ACVTSS2SD, yxm, Pf3, {0x5a} },
+ { ACVTSS2SL, yxcvfl, Pf3, {0x2d} },
+ { ACVTTPD2PL, yxcvm1, Px, {Pe,0xe6,Pe,0x2c} },
+ { ACVTTPS2PL, yxcvm1, Px, {Pf3,0x5b,Pm,0x2c} },
+ { ACVTTSD2SL, yxcvfl, Pf2, {0x2c} },
+ { ACVTTSS2SL, yxcvfl, Pf3, {0x2c} },
+ { ADIVPD, yxm, Pe, {0x5e} },
+ { ADIVPS, yxm, Pm, {0x5e} },
+ { ADIVSD, yxm, Pf2, {0x5e} },
+ { ADIVSS, yxm, Pf3, {0x5e} },
+ { AMASKMOVOU, yxr, Pe, {0xf7} },
+ { AMAXPD, yxm, Pe, {0x5f} },
+ { AMAXPS, yxm, Pm, {0x5f} },
+ { AMAXSD, yxm, Pf2, {0x5f} },
+ { AMAXSS, yxm, Pf3, {0x5f} },
+ { AMINPD, yxm, Pe, {0x5d} },
+ { AMINPS, yxm, Pm, {0x5d} },
+ { AMINSD, yxm, Pf2, {0x5d} },
+ { AMINSS, yxm, Pf3, {0x5d} },
+ { AMOVAPD, yxmov, Pe, {0x28,0x29} },
+ { AMOVAPS, yxmov, Pm, {0x28,0x29} },
+ { AMOVO, yxmov, Pe, {0x6f,0x7f} },
+ { AMOVOU, yxmov, Pf3, {0x6f,0x7f} },
+ { AMOVHLPS, yxr, Pm, {0x12} },
+ { AMOVHPD, yxmov, Pe, {0x16,0x17} },
+ { AMOVHPS, yxmov, Pm, {0x16,0x17} },
+ { AMOVLHPS, yxr, Pm, {0x16} },
+ { AMOVLPD, yxmov, Pe, {0x12,0x13} },
+ { AMOVLPS, yxmov, Pm, {0x12,0x13} },
+ { AMOVMSKPD, yxrrl, Pq, {0x50} },
+ { AMOVMSKPS, yxrrl, Pm, {0x50} },
+ { AMOVNTO, yxr_ml, Pe, {0xe7} },
+ { AMOVNTPD, yxr_ml, Pe, {0x2b} },
+ { AMOVNTPS, yxr_ml, Pm, {0x2b} },
+ { AMOVSD, yxmov, Pf2, {0x10,0x11} },
+ { AMOVSS, yxmov, Pf3, {0x10,0x11} },
+ { AMOVUPD, yxmov, Pe, {0x10,0x11} },
+ { AMOVUPS, yxmov, Pm, {0x10,0x11} },
+ { AMULPD, yxm, Pe, {0x59} },
+ { AMULPS, yxm, Ym, {0x59} },
+ { AMULSD, yxm, Pf2, {0x59} },
+ { AMULSS, yxm, Pf3, {0x59} },
+ { AORPD, yxm, Pq, {0x56} },
+ { AORPS, yxm, Pm, {0x56} },
+ { APADDQ, yxm, Pe, {0xd4} },
+ { APAND, yxm, Pe, {0xdb} },
+ { APCMPEQB, yxmq, Pe, {0x74} },
+ { APMAXSW, yxm, Pe, {0xee} },
+ { APMAXUB, yxm, Pe, {0xde} },
+ { APMINSW, yxm, Pe, {0xea} },
+ { APMINUB, yxm, Pe, {0xda} },
+ { APMOVMSKB, ymskb, Px, {Pe,0xd7,0xd7} },
+ { APSADBW, yxm, Pq, {0xf6} },
+ { APSUBB, yxm, Pe, {0xf8} },
+ { APSUBL, yxm, Pe, {0xfa} },
+ { APSUBQ, yxm, Pe, {0xfb} },
+ { APSUBSB, yxm, Pe, {0xe8} },
+ { APSUBSW, yxm, Pe, {0xe9} },
+ { APSUBUSB, yxm, Pe, {0xd8} },
+ { APSUBUSW, yxm, Pe, {0xd9} },
+ { APSUBW, yxm, Pe, {0xf9} },
+ { APUNPCKHQDQ, yxm, Pe, {0x6d} },
+ { APUNPCKLQDQ, yxm, Pe, {0x6c} },
+ { APXOR, yxm, Pe, {0xef} },
+ { ARCPPS, yxm, Pm, {0x53} },
+ { ARCPSS, yxm, Pf3, {0x53} },
+ { ARSQRTPS, yxm, Pm, {0x52} },
+ { ARSQRTSS, yxm, Pf3, {0x52} },
+ { ASQRTPD, yxm, Pe, {0x51} },
+ { ASQRTPS, yxm, Pm, {0x51} },
+ { ASQRTSD, yxm, Pf2, {0x51} },
+ { ASQRTSS, yxm, Pf3, {0x51} },
+ { ASUBPD, yxm, Pe, {0x5c} },
+ { ASUBPS, yxm, Pm, {0x5c} },
+ { ASUBSD, yxm, Pf2, {0x5c} },
+ { ASUBSS, yxm, Pf3, {0x5c} },
+ { AUCOMISD, yxcmp, Pe, {0x2e} },
+ { AUCOMISS, yxcmp, Pm, {0x2e} },
+ { AUNPCKHPD, yxm, Pe, {0x15} },
+ { AUNPCKHPS, yxm, Pm, {0x15} },
+ { AUNPCKLPD, yxm, Pe, {0x14} },
+ { AUNPCKLPS, yxm, Pm, {0x14} },
+ { AXORPD, yxm, Pe, {0x57} },
+ { AXORPS, yxm, Pm, {0x57} },
+
+ { AAESENC, yaes, Pq, {0x38,0xdc,(0)} },
+ { APINSRD, yinsrd, Pq, {0x3a, 0x22, (00)} },
+ { APSHUFB, ymshufb,Pq, {0x38, 0x00} },
+
+ { AUSEFIELD, ynop, Px, {0,0} },
{ ATYPE },
- { AFUNCDATA, yfuncdata, Px, 0,0 },
- { APCDATA, ypcdata, Px, 0,0 },
+ { AFUNCDATA, yfuncdata, Px, {0,0} },
+ { APCDATA, ypcdata, Px, {0,0} },
{ ACHECKNIL },
{ AVARDEF },
{ AVARKILL },
- { ADUFFCOPY, yduff, Px, 0xe8 },
- { ADUFFZERO, yduff, Px, 0xe8 },
+ { ADUFFCOPY, yduff, Px, {0xe8} },
+ { ADUFFZERO, yduff, Px, {0xe8} },
- 0
+ {0}
};
static int32 vaddr(Link*, Addr*, Reloc*);
@@ -1902,7 +1900,11 @@ bad:
return;
}
-#define E 0xff
+enum
+{
+ E = 0xff,
+};
+
static uchar ymovtab[] =
{
/* push */
@@ -2134,7 +2136,7 @@ mediaop(Link *ctxt, Optab *o, int op, int osize, int z)
break;
}
default:
- if(ctxt->andptr == ctxt->and || ctxt->andptr[-1] != Pm)
+ if(ctxt->andptr == ctxt->and || ctxt->and[ctxt->andptr - ctxt->and - 1] != Pm)
*ctxt->andptr++ = Pm;
break;
}
@@ -2289,8 +2291,13 @@ found:
*ctxt->andptr++ = p->from.offset;
break;
+ case Zcallindreg:
+ r = addrel(ctxt->cursym);
+ r->off = p->pc;
+ r->type = R_CALLIND;
+ r->siz = 0;
+ // fallthrough
case Zo_m:
- case_Zo_m:
*ctxt->andptr++ = op;
asmand(ctxt, &p->to, o->op[z+1]);
break;
@@ -2511,13 +2518,6 @@ found:
put4(ctxt, 0);
break;
- case Zcallindreg:
- r = addrel(ctxt->cursym);
- r->off = p->pc;
- r->type = R_CALLIND;
- r->siz = 0;
- goto case_Zo_m;
-
case Zbyte:
v = vaddr(ctxt, &p->from, &rel);
if(rel.siz != 0) {
@@ -2707,11 +2707,11 @@ mfound:
break;
case Hplan9:
- if(ctxt->plan9tos == nil)
- ctxt->plan9tos = linklookup(ctxt, "_tos", 0);
+ if(ctxt->plan9privates == nil)
+ ctxt->plan9privates = linklookup(ctxt, "_privates", 0);
memset(&pp.from, 0, sizeof pp.from);
pp.from.type = D_EXTERN;
- pp.from.sym = ctxt->plan9tos;
+ pp.from.sym = ctxt->plan9privates;
pp.from.offset = 0;
pp.from.index = D_NONE;
*ctxt->andptr++ = 0x8B;
diff --git a/src/liblink/data.c b/src/liblink/data.c
index 4504f4171..e5efa2eb2 100644
--- a/src/liblink/data.c
+++ b/src/liblink/data.c
@@ -83,6 +83,8 @@ savedata(Link *ctxt, LSym *s, Prog *p, char *pn)
siz = ctxt->arch->datasize(p);
if(off < 0 || siz < 0 || off >= 1<<30 || siz >= 100)
mangle(pn);
+ if(ctxt->enforce_data_order && off < s->np)
+ ctxt->diag("data out of order (already have %d)\n%P", p);
symgrow(ctxt, s, off+siz);
if(p->to.type == ctxt->arch->D_FCONST) {
diff --git a/src/liblink/ld.c b/src/liblink/ld.c
index 9ea0e9a73..6d0fe4a2a 100644
--- a/src/liblink/ld.c
+++ b/src/liblink/ld.c
@@ -130,16 +130,26 @@ find1(int32 l, int c)
}
void
-nuxiinit(void)
+nuxiinit(LinkArch *arch)
{
int i, c;
+ if(arch->endian != BigEndian && arch->endian != LittleEndian)
+ sysfatal("unknown endian (%#x) for arch %s", arch->endian, arch->name);
+
for(i=0; i<4; i++) {
- c = find1(0x04030201L, i+1);
- if(i < 2)
- inuxi2[i] = c;
- if(i < 1)
- inuxi1[i] = c;
+ c = find1(arch->endian, i+1);
+ if(arch->endian == LittleEndian) {
+ if(i < 2)
+ inuxi2[i] = c;
+ if(i < 1)
+ inuxi1[i] = c;
+ } else {
+ if(i >= 2)
+ inuxi2[i-2] = c;
+ if(i >= 3)
+ inuxi1[i-3] = c;
+ }
inuxi4[i] = c;
if(c == i) {
inuxi8[i] = c;
@@ -149,8 +159,13 @@ nuxiinit(void)
inuxi8[i+4] = c;
}
fnuxi4[i] = c;
- fnuxi8[i] = c;
- fnuxi8[i+4] = c+4;
+ if(c == i) {
+ fnuxi8[i] = c;
+ fnuxi8[i+4] = c+4;
+ } else {
+ fnuxi8[i] = c+4;
+ fnuxi8[i+4] = c;
+ }
}
}
@@ -161,7 +176,10 @@ uchar inuxi2[2];
uchar inuxi4[4];
uchar inuxi8[8];
-#define LOG 5
+enum
+{
+ LOG = 5,
+};
void
mkfwd(LSym *sym)
{
diff --git a/src/liblink/list5.c b/src/liblink/list5.c
index 4a4e8c71f..a91df55e6 100644
--- a/src/liblink/list5.c
+++ b/src/liblink/list5.c
@@ -46,6 +46,7 @@ static int Pconv(Fmt *fp);
static int Rconv(Fmt *fp);
static int RAconv(Fmt *fp);
static int DSconv(Fmt *fp);
+static int DRconv(Fmt*);
#pragma varargck type "$" char*
#pragma varargck type "M" Addr*
@@ -59,6 +60,9 @@ listinit5(void)
fmtinstall('P', Pconv);
fmtinstall('R', Rconv);
+ // for liblink internal use
+ fmtinstall('^', DRconv);
+
// for internal use
fmtinstall('$', DSconv);
fmtinstall('M', Mconv);
@@ -314,6 +318,19 @@ Rconv(Fmt *fp)
}
static int
+DRconv(Fmt *fp)
+{
+ char *s;
+ int a;
+
+ a = va_arg(fp->args, int);
+ s = "C_??";
+ if(a >= C_NONE && a <= C_NCLASS)
+ s = cnames5[a];
+ return fmtstrcpy(fp, s);
+}
+
+static int
Mconv(Fmt *fp)
{
char str[STRINGSZ];
diff --git a/src/liblink/list6.c b/src/liblink/list6.c
index fe708d877..0635fdf1f 100644
--- a/src/liblink/list6.c
+++ b/src/liblink/list6.c
@@ -217,7 +217,7 @@ conv:
return fmtstrcpy(fp, str);
}
-char* regstr[] =
+static char* regstr[] =
{
"AL", /* [D_AL] */
"CL",
diff --git a/src/liblink/list8.c b/src/liblink/list8.c
index 786692416..63d96b9f9 100644
--- a/src/liblink/list8.c
+++ b/src/liblink/list8.c
@@ -211,7 +211,7 @@ conv:
return fmtstrcpy(fp, str);
}
-char* regstr[] =
+static char* regstr[] =
{
"AL", /* [D_AL] */
"CL",
diff --git a/src/liblink/obj5.c b/src/liblink/obj5.c
index ccd4c81c7..d7f2714ed 100644
--- a/src/liblink/obj5.c
+++ b/src/liblink/obj5.c
@@ -33,7 +33,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/5l/5.out.h"
-#include "../pkg/runtime/stack.h"
+#include "../runtime/stack.h"
static Prog zprg = {
.as = AGOK,
@@ -92,7 +92,7 @@ progedit(Link *ctxt, Prog *p)
{
char literal[64];
LSym *s;
- LSym *tlsfallback;
+ static LSym *tlsfallback;
p->from.class = 0;
p->to.class = 0;
@@ -111,19 +111,43 @@ progedit(Link *ctxt, Prog *p)
// Replace TLS register fetches on older ARM procesors.
switch(p->as) {
case AMRC:
- // If the instruction matches MRC 15, 0, <reg>, C13, C0, 3, replace it.
- if(ctxt->goarm < 7 && (p->to.offset & 0xffff0fff) == 0xee1d0f70) {
- tlsfallback = linklookup(ctxt, "runtime.read_tls_fallback", 0);
+ // Treat MRC 15, 0, <reg>, C13, C0, 3 specially.
+ if((p->to.offset & 0xffff0fff) == 0xee1d0f70) {
+ // Because the instruction might be rewriten to a BL which returns in R0
+ // the register must be zero.
+ if ((p->to.offset & 0xf000) != 0)
+ ctxt->diag("%L: TLS MRC instruction must write to R0 as it might get translated into a BL instruction", p->lineno);
+
+ if(ctxt->goarm < 7) {
+ // Replace it with BL runtime.read_tls_fallback(SB) for ARM CPUs that lack the tls extension.
+ if(tlsfallback == nil)
+ tlsfallback = linklookup(ctxt, "runtime.read_tls_fallback", 0);
+ // MOVW LR, R11
+ p->as = AMOVW;
+ p->from.type = D_REG;
+ p->from.reg = REGLINK;
+ p->to.type = D_REG;
+ p->to.reg = REGTMP;
- // BL runtime.read_tls_fallback(SB)
- p->as = ABL;
- p->to.type = D_BRANCH;
- p->to.sym = tlsfallback;
- p->to.offset = 0;
- } else {
- // Otherwise, MRC/MCR instructions need no further treatment.
- p->as = AWORD;
+ // BL runtime.read_tls_fallback(SB)
+ p = appendp(ctxt, p);
+ p->as = ABL;
+ p->to.type = D_BRANCH;
+ p->to.sym = tlsfallback;
+ p->to.offset = 0;
+
+ // MOVW R11, LR
+ p = appendp(ctxt, p);
+ p->as = AMOVW;
+ p->from.type = D_REG;
+ p->from.reg = REGTMP;
+ p->to.type = D_REG;
+ p->to.reg = REGLINK;
+ break;
+ }
}
+ // Otherwise, MRC/MCR instructions need no further treatment.
+ p->as = AWORD;
break;
}
@@ -173,15 +197,15 @@ progedit(Link *ctxt, Prog *p)
if(ctxt->flag_shared) {
// Shared libraries use R_ARM_TLS_IE32 instead of
// R_ARM_TLS_LE32, replacing the link time constant TLS offset in
- // runtime.tlsgm with an address to a GOT entry containing the
- // offset. Rewrite $runtime.tlsgm(SB) to runtime.tlsgm(SB) to
+ // runtime.tlsg with an address to a GOT entry containing the
+ // offset. Rewrite $runtime.tlsg(SB) to runtime.tlsg(SB) to
// compensate.
- if(ctxt->gmsym == nil)
- ctxt->gmsym = linklookup(ctxt, "runtime.tlsgm", 0);
+ if(ctxt->tlsg == nil)
+ ctxt->tlsg = linklookup(ctxt, "runtime.tlsg", 0);
- if(p->from.type == D_CONST && p->from.name == D_EXTERN && p->from.sym == ctxt->gmsym)
+ if(p->from.type == D_CONST && p->from.name == D_EXTERN && p->from.sym == ctxt->tlsg)
p->from.type = D_OREG;
- if(p->to.type == D_CONST && p->to.name == D_EXTERN && p->to.sym == ctxt->gmsym)
+ if(p->to.type == D_CONST && p->to.name == D_EXTERN && p->to.sym == ctxt->tlsg)
p->to.type = D_OREG;
}
}
@@ -233,7 +257,7 @@ nocache(Prog *p)
static void
addstacksplit(Link *ctxt, LSym *cursym)
{
- Prog *p, *pl, *q, *q1, *q2;
+ Prog *p, *pl, *p1, *p2, *q, *q1, *q2;
int o;
int32 autosize, autoffset;
@@ -429,32 +453,89 @@ addstacksplit(Link *ctxt, LSym *cursym)
p->spadj = autosize;
if(cursym->text->reg & WRAPPER) {
- // g->panicwrap += autosize;
- // MOVW panicwrap_offset(g), R3
- // ADD $autosize, R3
- // MOVW R3 panicwrap_offset(g)
+ // if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
+ //
+ // MOVW g_panic(g), R1
+ // CMP $0, R1
+ // B.EQ end
+ // MOVW panic_argp(R1), R2
+ // ADD $(autosize+4), R13, R3
+ // CMP R2, R3
+ // B.NE end
+ // ADD $4, R13, R4
+ // MOVW R4, panic_argp(R1)
+ // end:
+ // NOP
+ //
+ // The NOP is needed to give the jumps somewhere to land.
+ // It is a liblink NOP, not an ARM NOP: it encodes to 0 instruction bytes.
+
p = appendp(ctxt, p);
p->as = AMOVW;
p->from.type = D_OREG;
p->from.reg = REGG;
- p->from.offset = 2*ctxt->arch->ptrsize;
+ p->from.offset = 4*ctxt->arch->ptrsize; // G.panic
p->to.type = D_REG;
- p->to.reg = 3;
+ p->to.reg = 1;
+
+ p = appendp(ctxt, p);
+ p->as = ACMP;
+ p->from.type = D_CONST;
+ p->from.offset = 0;
+ p->reg = 1;
+
+ p = appendp(ctxt, p);
+ p->as = ABEQ;
+ p->to.type = D_BRANCH;
+ p1 = p;
+
+ p = appendp(ctxt, p);
+ p->as = AMOVW;
+ p->from.type = D_OREG;
+ p->from.reg = 1;
+ p->from.offset = 0; // Panic.argp
+ p->to.type = D_REG;
+ p->to.reg = 2;
p = appendp(ctxt, p);
p->as = AADD;
p->from.type = D_CONST;
- p->from.offset = autosize;
+ p->from.offset = autosize+4;
+ p->reg = 13;
p->to.type = D_REG;
p->to.reg = 3;
-
+
+ p = appendp(ctxt, p);
+ p->as = ACMP;
+ p->from.type = D_REG;
+ p->from.reg = 2;
+ p->reg = 3;
+
+ p = appendp(ctxt, p);
+ p->as = ABNE;
+ p->to.type = D_BRANCH;
+ p2 = p;
+
+ p = appendp(ctxt, p);
+ p->as = AADD;
+ p->from.type = D_CONST;
+ p->from.offset = 4;
+ p->reg = 13;
+ p->to.type = D_REG;
+ p->to.reg = 4;
+
p = appendp(ctxt, p);
p->as = AMOVW;
p->from.type = D_REG;
- p->from.reg = 3;
+ p->from.reg = 4;
p->to.type = D_OREG;
- p->to.reg = REGG;
- p->to.offset = 2*ctxt->arch->ptrsize;
+ p->to.reg = 1;
+ p->to.offset = 0; // Panic.argp
+
+ p = appendp(ctxt, p);
+ p->as = ANOP;
+ p1->pcond = p;
+ p2->pcond = p;
}
break;
@@ -475,44 +556,6 @@ addstacksplit(Link *ctxt, LSym *cursym)
}
}
- if(cursym->text->reg & WRAPPER) {
- int scond;
-
- // Preserve original RET's cond, to allow RET.EQ
- // in the implementation of reflect.call.
- scond = p->scond;
- p->scond = C_SCOND_NONE;
-
- // g->panicwrap -= autosize;
- // MOVW panicwrap_offset(g), R3
- // SUB $autosize, R3
- // MOVW R3 panicwrap_offset(g)
- p->as = AMOVW;
- p->from.type = D_OREG;
- p->from.reg = REGG;
- p->from.offset = 2*ctxt->arch->ptrsize;
- p->to.type = D_REG;
- p->to.reg = 3;
- p = appendp(ctxt, p);
-
- p->as = ASUB;
- p->from.type = D_CONST;
- p->from.offset = autosize;
- p->to.type = D_REG;
- p->to.reg = 3;
- p = appendp(ctxt, p);
-
- p->as = AMOVW;
- p->from.type = D_REG;
- p->from.reg = 3;
- p->to.type = D_OREG;
- p->to.reg = REGG;
- p->to.offset = 2*ctxt->arch->ptrsize;
- p = appendp(ctxt, p);
-
- p->scond = scond;
- }
-
p->as = AMOVW;
p->scond |= C_PBIT;
p->from.type = D_OREG;
@@ -707,41 +750,42 @@ softfloat(Link *ctxt, LSym *cursym)
default:
goto notsoft;
+ }
- soft:
- if (!wasfloat || (p->mark&LABEL)) {
- next = ctxt->arch->prg();
- *next = *p;
+ soft:
+ if (!wasfloat || (p->mark&LABEL)) {
+ next = ctxt->arch->prg();
+ *next = *p;
- // BL _sfloat(SB)
- *p = zprg;
- p->link = next;
- p->as = ABL;
+ // BL _sfloat(SB)
+ *p = zprg;
+ p->link = next;
+ p->as = ABL;
p->to.type = D_BRANCH;
- p->to.sym = symsfloat;
- p->lineno = next->lineno;
-
- p = next;
- wasfloat = 1;
- }
- break;
+ p->to.sym = symsfloat;
+ p->lineno = next->lineno;
- notsoft:
- wasfloat = 0;
+ p = next;
+ wasfloat = 1;
}
+ continue;
+
+ notsoft:
+ wasfloat = 0;
}
}
static Prog*
stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt)
{
- int32 arg;
-
// MOVW g_stackguard(g), R1
p = appendp(ctxt, p);
p->as = AMOVW;
p->from.type = D_OREG;
p->from.reg = REGG;
+ p->from.offset = 2*ctxt->arch->ptrsize; // G.stackguard0
+ if(ctxt->cursym->cfunc)
+ p->from.offset = 3*ctxt->arch->ptrsize; // G.stackguard1
p->to.type = D_REG;
p->to.reg = 1;
@@ -820,29 +864,6 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt)
p->scond = C_SCOND_NE;
}
- // MOVW.LS $framesize, R1
- p = appendp(ctxt, p);
- p->as = AMOVW;
- p->scond = C_SCOND_LS;
- p->from.type = D_CONST;
- p->from.offset = framesize;
- p->to.type = D_REG;
- p->to.reg = 1;
-
- // MOVW.LS $args, R2
- p = appendp(ctxt, p);
- p->as = AMOVW;
- p->scond = C_SCOND_LS;
- p->from.type = D_CONST;
- arg = ctxt->cursym->text->to.offset2;
- if(arg == 1) // special marker for known 0
- arg = 0;
- if(arg&3)
- ctxt->diag("misaligned argument size in stack split");
- p->from.offset = arg;
- p->to.type = D_REG;
- p->to.reg = 2;
-
// MOVW.LS R14, R3
p = appendp(ctxt, p);
p->as = AMOVW;
@@ -857,7 +878,10 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt)
p->as = ABL;
p->scond = C_SCOND_LS;
p->to.type = D_BRANCH;
- p->to.sym = ctxt->symmorestack[noctxt];
+ if(ctxt->cursym->cfunc)
+ p->to.sym = linklookup(ctxt, "runtime.morestackc", 0);
+ else
+ p->to.sym = ctxt->symmorestack[noctxt];
// BLS start
p = appendp(ctxt, p);
@@ -1025,6 +1049,7 @@ loop:
LinkArch linkarm = {
.name = "arm",
.thechar = '5',
+ .endian = LittleEndian,
.addstacksplit = addstacksplit,
.assemble = span5,
@@ -1052,6 +1077,7 @@ LinkArch linkarm = {
.D_PARAM = D_PARAM,
.D_SCONST = D_SCONST,
.D_STATIC = D_STATIC,
+ .D_OREG = D_OREG,
.ACALL = ABL,
.ADATA = ADATA,
diff --git a/src/liblink/obj6.c b/src/liblink/obj6.c
index b1bcd0dc0..2acfd2f70 100644
--- a/src/liblink/obj6.c
+++ b/src/liblink/obj6.c
@@ -33,7 +33,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/6l/6.out.h"
-#include "../pkg/runtime/stack.h"
+#include "../runtime/stack.h"
static Prog zprg = {
.back = 2,
@@ -103,7 +103,7 @@ static int
canuselocaltls(Link *ctxt)
{
switch(ctxt->headtype) {
-// case Hlinux:
+ case Hplan9:
case Hwindows:
return 0;
}
@@ -342,32 +342,6 @@ nacladdr(Link *ctxt, Prog *p, Addr *a)
}
}
-static char*
-morename[] =
-{
- "runtime.morestack00",
- "runtime.morestack00_noctxt",
- "runtime.morestack10",
- "runtime.morestack10_noctxt",
- "runtime.morestack01",
- "runtime.morestack01_noctxt",
- "runtime.morestack11",
- "runtime.morestack11_noctxt",
-
- "runtime.morestack8",
- "runtime.morestack8_noctxt",
- "runtime.morestack16",
- "runtime.morestack16_noctxt",
- "runtime.morestack24",
- "runtime.morestack24_noctxt",
- "runtime.morestack32",
- "runtime.morestack32_noctxt",
- "runtime.morestack40",
- "runtime.morestack40_noctxt",
- "runtime.morestack48",
- "runtime.morestack48_noctxt",
-};
-
static Prog* load_g_cx(Link*, Prog*);
static Prog* stacksplit(Link*, Prog*, int32, int32, int, Prog**);
static void indir_cx(Link*, Addr*);
@@ -388,20 +362,21 @@ parsetextconst(vlong arg, vlong *textstksiz, vlong *textarg)
static void
addstacksplit(Link *ctxt, LSym *cursym)
{
- Prog *p, *q, *q1;
+ Prog *p, *q, *p1, *p2;
int32 autoffset, deltasp;
int a, pcsize;
- uint32 i;
vlong textstksiz, textarg;
- if(ctxt->gmsym == nil)
- ctxt->gmsym = linklookup(ctxt, "runtime.tlsgm", 0);
+ if(ctxt->tlsg == nil)
+ ctxt->tlsg = linklookup(ctxt, "runtime.tlsg", 0);
if(ctxt->symmorestack[0] == nil) {
- if(nelem(morename) > nelem(ctxt->symmorestack))
- sysfatal("Link.symmorestack needs at least %d elements", nelem(morename));
- for(i=0; i<nelem(morename); i++)
- ctxt->symmorestack[i] = linklookup(ctxt, morename[i], 0);
+ ctxt->symmorestack[0] = linklookup(ctxt, "runtime.morestack", 0);
+ ctxt->symmorestack[1] = linklookup(ctxt, "runtime.morestack_noctxt", 0);
}
+
+ if(ctxt->headtype == Hplan9 && ctxt->plan9privates == nil)
+ ctxt->plan9privates = linklookup(ctxt, "_privates", 0);
+
ctxt->cursym = cursym;
if(cursym->text == nil || cursym->text->link == nil)
@@ -459,51 +434,88 @@ addstacksplit(Link *ctxt, LSym *cursym)
deltasp = autoffset;
if(cursym->text->from.scale & WRAPPER) {
- // g->panicwrap += autoffset + ctxt->arch->regsize;
- p = appendp(ctxt, p);
- p->as = AADDL;
- p->from.type = D_CONST;
- p->from.offset = autoffset + ctxt->arch->regsize;
- indir_cx(ctxt, &p->to);
- p->to.offset = 2*ctxt->arch->ptrsize;
- }
+ // if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
+ //
+ // MOVQ g_panic(CX), BX
+ // TESTQ BX, BX
+ // JEQ end
+ // LEAQ (autoffset+8)(SP), DI
+ // CMPQ panic_argp(BX), DI
+ // JNE end
+ // MOVQ SP, panic_argp(BX)
+ // end:
+ // NOP
+ //
+ // The NOP is needed to give the jumps somewhere to land.
+ // It is a liblink NOP, not an x86 NOP: it encodes to 0 instruction bytes.
- if(ctxt->debugstack > 1 && autoffset) {
- // 6l -K -K means double-check for stack overflow
- // even after calling morestack and even if the
- // function is marked as nosplit.
p = appendp(ctxt, p);
p->as = AMOVQ;
- indir_cx(ctxt, &p->from);
- p->from.offset = 0;
+ p->from.type = D_INDIR+D_CX;
+ p->from.offset = 4*ctxt->arch->ptrsize; // G.panic
p->to.type = D_BX;
+ if(ctxt->headtype == Hnacl) {
+ p->as = AMOVL;
+ p->from.type = D_INDIR+D_R15;
+ p->from.scale = 1;
+ p->from.index = D_CX;
+ }
p = appendp(ctxt, p);
- p->as = ASUBQ;
- p->from.type = D_CONST;
- p->from.offset = StackSmall+32;
+ p->as = ATESTQ;
+ p->from.type = D_BX;
p->to.type = D_BX;
+ if(ctxt->headtype == Hnacl)
+ p->as = ATESTL;
+
+ p = appendp(ctxt, p);
+ p->as = AJEQ;
+ p->to.type = D_BRANCH;
+ p1 = p;
+
+ p = appendp(ctxt, p);
+ p->as = ALEAQ;
+ p->from.type = D_INDIR+D_SP;
+ p->from.offset = autoffset+8;
+ p->to.type = D_DI;
+ if(ctxt->headtype == Hnacl)
+ p->as = ALEAL;
p = appendp(ctxt, p);
p->as = ACMPQ;
- p->from.type = D_SP;
- p->to.type = D_BX;
+ p->from.type = D_INDIR+D_BX;
+ p->from.offset = 0; // Panic.argp
+ p->to.type = D_DI;
+ if(ctxt->headtype == Hnacl) {
+ p->as = ACMPL;
+ p->from.type = D_INDIR+D_R15;
+ p->from.scale = 1;
+ p->from.index = D_BX;
+ }
p = appendp(ctxt, p);
- p->as = AJHI;
+ p->as = AJNE;
p->to.type = D_BRANCH;
- q1 = p;
+ p2 = p;
p = appendp(ctxt, p);
- p->as = AINT;
- p->from.type = D_CONST;
- p->from.offset = 3;
+ p->as = AMOVQ;
+ p->from.type = D_SP;
+ p->to.type = D_INDIR+D_BX;
+ p->to.offset = 0; // Panic.argp
+ if(ctxt->headtype == Hnacl) {
+ p->as = AMOVL;
+ p->to.type = D_INDIR+D_R15;
+ p->to.scale = 1;
+ p->to.index = D_BX;
+ }
p = appendp(ctxt, p);
p->as = ANOP;
- q1->pcond = p;
+ p1->pcond = p;
+ p2->pcond = p;
}
-
+
if(ctxt->debugzerostack && autoffset && !(cursym->text->from.scale&NOSPLIT)) {
// 6l -Z means zero the stack frame on entry.
// This slows down function calls but can help avoid
@@ -585,19 +597,6 @@ addstacksplit(Link *ctxt, LSym *cursym)
if(autoffset != deltasp)
ctxt->diag("unbalanced PUSH/POP");
- if(cursym->text->from.scale & WRAPPER) {
- p = load_g_cx(ctxt, p);
- p = appendp(ctxt, p);
- // g->panicwrap -= autoffset + ctxt->arch->regsize;
- p->as = ASUBL;
- p->from.type = D_CONST;
- p->from.offset = autoffset + ctxt->arch->regsize;
- indir_cx(ctxt, &p->to);
- p->to.offset = 2*ctxt->arch->ptrsize;
- p = appendp(ctxt, p);
- p->as = ARET;
- }
-
if(autoffset) {
p->as = AADJSP;
p->from.type = D_CONST;
@@ -667,9 +666,9 @@ static Prog*
stacksplit(Link *ctxt, Prog *p, int32 framesize, int32 textarg, int noctxt, Prog **jmpok)
{
Prog *q, *q1;
- uint32 moreconst1, moreconst2, i;
int cmp, lea, mov, sub;
+ USED(textarg);
cmp = ACMPQ;
lea = ALEAQ;
mov = AMOVQ;
@@ -682,35 +681,6 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int32 textarg, int noctxt, Prog
sub = ASUBL;
}
- if(ctxt->debugstack) {
- // 6l -K means check not only for stack
- // overflow but stack underflow.
- // On underflow, INT 3 (breakpoint).
- // Underflow itself is rare but this also
- // catches out-of-sync stack guard info
-
- p = appendp(ctxt, p);
- p->as = cmp;
- indir_cx(ctxt, &p->from);
- p->from.offset = 8;
- p->to.type = D_SP;
-
- p = appendp(ctxt, p);
- p->as = AJHI;
- p->to.type = D_BRANCH;
- p->to.offset = 4;
- q1 = p;
-
- p = appendp(ctxt, p);
- p->as = AINT;
- p->from.type = D_CONST;
- p->from.offset = 3;
-
- p = appendp(ctxt, p);
- p->as = ANOP;
- q1->pcond = p;
- }
-
q1 = nil;
if(framesize <= StackSmall) {
// small stack: SP <= stackguard
@@ -719,6 +689,9 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int32 textarg, int noctxt, Prog
p->as = cmp;
p->from.type = D_SP;
indir_cx(ctxt, &p->to);
+ p->to.offset = 2*ctxt->arch->ptrsize; // G.stackguard0
+ if(ctxt->cursym->cfunc)
+ p->to.offset = 3*ctxt->arch->ptrsize; // G.stackguard1
} else if(framesize <= StackBig) {
// large stack: SP-framesize <= stackguard-StackSmall
// LEAQ -xxx(SP), AX
@@ -733,6 +706,9 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int32 textarg, int noctxt, Prog
p->as = cmp;
p->from.type = D_AX;
indir_cx(ctxt, &p->to);
+ p->to.offset = 2*ctxt->arch->ptrsize; // G.stackguard0
+ if(ctxt->cursym->cfunc)
+ p->to.offset = 3*ctxt->arch->ptrsize; // G.stackguard1
} else {
// Such a large stack we need to protect against wraparound.
// If SP is close to zero:
@@ -752,7 +728,9 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int32 textarg, int noctxt, Prog
p = appendp(ctxt, p);
p->as = mov;
indir_cx(ctxt, &p->from);
- p->from.offset = 0;
+ p->from.offset = 2*ctxt->arch->ptrsize; // G.stackguard0
+ if(ctxt->cursym->cfunc)
+ p->from.offset = 3*ctxt->arch->ptrsize; // G.stackguard1
p->to.type = D_SI;
p = appendp(ctxt, p);
@@ -790,70 +768,13 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int32 textarg, int noctxt, Prog
p->to.type = D_BRANCH;
q = p;
- // If we ask for more stack, we'll get a minimum of StackMin bytes.
- // We need a stack frame large enough to hold the top-of-stack data,
- // the function arguments+results, our caller's PC, our frame,
- // a word for the return PC of the next call, and then the StackLimit bytes
- // that must be available on entry to any function called from a function
- // that did a stack check. If StackMin is enough, don't ask for a specific
- // amount: then we can use the custom functions and save a few
- // instructions.
- moreconst1 = 0;
- if(StackTop + textarg + ctxt->arch->ptrsize + framesize + ctxt->arch->ptrsize + StackLimit >= StackMin)
- moreconst1 = framesize;
- moreconst2 = textarg;
- if(moreconst2 == 1) // special marker
- moreconst2 = 0;
- if((moreconst2&7) != 0)
- ctxt->diag("misaligned argument size in stack split");
- // 4 varieties varieties (const1==0 cross const2==0)
- // and 6 subvarieties of (const1==0 and const2!=0)
p = appendp(ctxt, p);
- if(moreconst1 == 0 && moreconst2 == 0) {
- p->as = ACALL;
- p->to.type = D_BRANCH;
- p->to.sym = ctxt->symmorestack[0*2+noctxt];
- } else
- if(moreconst1 != 0 && moreconst2 == 0) {
- p->as = AMOVL;
- p->from.type = D_CONST;
- p->from.offset = moreconst1;
- p->to.type = D_AX;
-
- p = appendp(ctxt, p);
- p->as = ACALL;
- p->to.type = D_BRANCH;
- p->to.sym = ctxt->symmorestack[1*2+noctxt];
- } else
- if(moreconst1 == 0 && moreconst2 <= 48 && moreconst2%8 == 0) {
- i = moreconst2/8 + 3;
- p->as = ACALL;
- p->to.type = D_BRANCH;
- p->to.sym = ctxt->symmorestack[i*2+noctxt];
- } else
- if(moreconst1 == 0 && moreconst2 != 0) {
- p->as = AMOVL;
- p->from.type = D_CONST;
- p->from.offset = moreconst2;
- p->to.type = D_AX;
-
- p = appendp(ctxt, p);
- p->as = ACALL;
- p->to.type = D_BRANCH;
- p->to.sym = ctxt->symmorestack[2*2+noctxt];
- } else {
- // Pass framesize and argsize.
- p->as = AMOVQ;
- p->from.type = D_CONST;
- p->from.offset = (uint64)moreconst2 << 32;
- p->from.offset |= moreconst1;
- p->to.type = D_AX;
-
- p = appendp(ctxt, p);
- p->as = ACALL;
- p->to.type = D_BRANCH;
- p->to.sym = ctxt->symmorestack[3*2+noctxt];
- }
+ p->as = ACALL;
+ p->to.type = D_BRANCH;
+ if(ctxt->cursym->cfunc)
+ p->to.sym = linklookup(ctxt, "runtime.morestackc", 0);
+ else
+ p->to.sym = ctxt->symmorestack[noctxt];
p = appendp(ctxt, p);
p->as = AJMP;
@@ -954,7 +875,7 @@ xfol(Link *ctxt, Prog *p, Prog **last)
{
Prog *q;
int i;
- enum as a;
+ int a;
loop:
if(p == nil)
@@ -1083,6 +1004,7 @@ prg(void)
LinkArch linkamd64 = {
.name = "amd64",
.thechar = '6',
+ .endian = LittleEndian,
.addstacksplit = addstacksplit,
.assemble = span6,
@@ -1128,6 +1050,7 @@ LinkArch linkamd64 = {
LinkArch linkamd64p32 = {
.name = "amd64p32",
.thechar = '6',
+ .endian = LittleEndian,
.addstacksplit = addstacksplit,
.assemble = span6,
diff --git a/src/liblink/obj8.c b/src/liblink/obj8.c
index 72934c149..f54153ae9 100644
--- a/src/liblink/obj8.c
+++ b/src/liblink/obj8.c
@@ -33,7 +33,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/8l/8.out.h"
-#include "../pkg/runtime/stack.h"
+#include "../runtime/stack.h"
static Prog zprg = {
.back = 2,
@@ -261,7 +261,7 @@ static Prog* stacksplit(Link*, Prog*, int32, int, Prog**);
static void
addstacksplit(Link *ctxt, LSym *cursym)
{
- Prog *p, *q;
+ Prog *p, *q, *p1, *p2;
int32 autoffset, deltasp;
int a;
@@ -270,8 +270,8 @@ addstacksplit(Link *ctxt, LSym *cursym)
ctxt->symmorestack[1] = linklookup(ctxt, "runtime.morestack_noctxt", 0);
}
- if(ctxt->headtype == Hplan9 && ctxt->plan9tos == nil)
- ctxt->plan9tos = linklookup(ctxt, "_tos", 0);
+ if(ctxt->headtype == Hplan9 && ctxt->plan9privates == nil)
+ ctxt->plan9privates = linklookup(ctxt, "_privates", 0);
ctxt->cursym = cursym;
@@ -317,13 +317,64 @@ addstacksplit(Link *ctxt, LSym *cursym)
deltasp = autoffset;
if(cursym->text->from.scale & WRAPPER) {
- // g->panicwrap += autoffset + ctxt->arch->ptrsize;
+ // if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
+ //
+ // MOVL g_panic(CX), BX
+ // TESTL BX, BX
+ // JEQ end
+ // LEAL (autoffset+4)(SP), DI
+ // CMPL panic_argp(BX), DI
+ // JNE end
+ // MOVL SP, panic_argp(BX)
+ // end:
+ // NOP
+ //
+ // The NOP is needed to give the jumps somewhere to land.
+ // It is a liblink NOP, not an x86 NOP: it encodes to 0 instruction bytes.
+
p = appendp(ctxt, p);
- p->as = AADDL;
- p->from.type = D_CONST;
- p->from.offset = autoffset + ctxt->arch->ptrsize;
- p->to.type = D_INDIR+D_CX;
- p->to.offset = 2*ctxt->arch->ptrsize;
+ p->as = AMOVL;
+ p->from.type = D_INDIR+D_CX;
+ p->from.offset = 4*ctxt->arch->ptrsize; // G.panic
+ p->to.type = D_BX;
+
+ p = appendp(ctxt, p);
+ p->as = ATESTL;
+ p->from.type = D_BX;
+ p->to.type = D_BX;
+
+ p = appendp(ctxt, p);
+ p->as = AJEQ;
+ p->to.type = D_BRANCH;
+ p1 = p;
+
+ p = appendp(ctxt, p);
+ p->as = ALEAL;
+ p->from.type = D_INDIR+D_SP;
+ p->from.offset = autoffset+4;
+ p->to.type = D_DI;
+
+ p = appendp(ctxt, p);
+ p->as = ACMPL;
+ p->from.type = D_INDIR+D_BX;
+ p->from.offset = 0; // Panic.argp
+ p->to.type = D_DI;
+
+ p = appendp(ctxt, p);
+ p->as = AJNE;
+ p->to.type = D_BRANCH;
+ p2 = p;
+
+ p = appendp(ctxt, p);
+ p->as = AMOVL;
+ p->from.type = D_SP;
+ p->to.type = D_INDIR+D_BX;
+ p->to.offset = 0; // Panic.argp
+
+ p = appendp(ctxt, p);
+ p->as = ANOP;
+ p1->pcond = p;
+ p2->pcond = p;
}
if(ctxt->debugzerostack && autoffset && !(cursym->text->from.scale&NOSPLIT)) {
@@ -396,19 +447,6 @@ addstacksplit(Link *ctxt, LSym *cursym)
if(autoffset != deltasp)
ctxt->diag("unbalanced PUSH/POP");
- if(cursym->text->from.scale & WRAPPER) {
- p = load_g_cx(ctxt, p);
- p = appendp(ctxt, p);
- // g->panicwrap -= autoffset + ctxt->arch->ptrsize;
- p->as = ASUBL;
- p->from.type = D_CONST;
- p->from.offset = autoffset + ctxt->arch->ptrsize;
- p->to.type = D_INDIR+D_CX;
- p->to.offset = 2*ctxt->arch->ptrsize;
- p = appendp(ctxt, p);
- p->as = ARET;
- }
-
if(autoffset) {
p->as = AADJSP;
p->from.type = D_CONST;
@@ -463,7 +501,6 @@ static Prog*
stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt, Prog **jmpok)
{
Prog *q, *q1;
- int arg;
if(ctxt->debugstack) {
// 8l -K means check not only for stack
@@ -501,6 +538,9 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt, Prog **jmpok)
p->as = ACMPL;
p->from.type = D_SP;
p->to.type = D_INDIR+D_CX;
+ p->to.offset = 2*ctxt->arch->ptrsize; // G.stackguard0
+ if(ctxt->cursym->cfunc)
+ p->to.offset = 3*ctxt->arch->ptrsize; // G.stackguard1
} else if(framesize <= StackBig) {
// large stack: SP-framesize <= stackguard-StackSmall
// LEAL -(framesize-StackSmall)(SP), AX
@@ -515,6 +555,9 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt, Prog **jmpok)
p->as = ACMPL;
p->from.type = D_AX;
p->to.type = D_INDIR+D_CX;
+ p->to.offset = 2*ctxt->arch->ptrsize; // G.stackguard0
+ if(ctxt->cursym->cfunc)
+ p->to.offset = 3*ctxt->arch->ptrsize; // G.stackguard1
} else {
// Such a large stack we need to protect against wraparound
// if SP is close to zero.
@@ -534,6 +577,9 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt, Prog **jmpok)
p->as = AMOVL;
p->from.type = D_INDIR+D_CX;
p->from.offset = 0;
+ p->from.offset = 2*ctxt->arch->ptrsize; // G.stackguard0
+ if(ctxt->cursym->cfunc)
+ p->from.offset = 3*ctxt->arch->ptrsize; // G.stackguard1
p->to.type = D_SI;
p = appendp(ctxt, p);
@@ -573,37 +619,13 @@ stacksplit(Link *ctxt, Prog *p, int32 framesize, int noctxt, Prog **jmpok)
p->to.offset = 4;
q = p;
- p = appendp(ctxt, p); // save frame size in DI
- p->as = AMOVL;
- p->to.type = D_DI;
- p->from.type = D_CONST;
-
- // If we ask for more stack, we'll get a minimum of StackMin bytes.
- // We need a stack frame large enough to hold the top-of-stack data,
- // the function arguments+results, our caller's PC, our frame,
- // a word for the return PC of the next call, and then the StackLimit bytes
- // that must be available on entry to any function called from a function
- // that did a stack check. If StackMin is enough, don't ask for a specific
- // amount: then we can use the custom functions and save a few
- // instructions.
- if(StackTop + ctxt->cursym->text->to.offset2 + ctxt->arch->ptrsize + framesize + ctxt->arch->ptrsize + StackLimit >= StackMin)
- p->from.offset = (framesize+7) & ~7LL;
-
- arg = ctxt->cursym->text->to.offset2;
- if(arg == 1) // special marker for known 0
- arg = 0;
- if(arg&3)
- ctxt->diag("misaligned argument size in stack split");
- p = appendp(ctxt, p); // save arg size in AX
- p->as = AMOVL;
- p->to.type = D_AX;
- p->from.type = D_CONST;
- p->from.offset = arg;
-
p = appendp(ctxt, p);
p->as = ACALL;
p->to.type = D_BRANCH;
- p->to.sym = ctxt->symmorestack[noctxt];
+ if(ctxt->cursym->cfunc)
+ p->to.sym = linklookup(ctxt, "runtime.morestackc", 0);
+ else
+ p->to.sym = ctxt->symmorestack[noctxt];
p = appendp(ctxt, p);
p->as = AJMP;
@@ -697,7 +719,7 @@ xfol(Link *ctxt, Prog *p, Prog **last)
{
Prog *q;
int i;
- enum as a;
+ int a;
loop:
if(p == nil)
@@ -816,6 +838,7 @@ loop:
LinkArch link386 = {
.name = "386",
.thechar = '8',
+ .endian = LittleEndian,
.addstacksplit = addstacksplit,
.assemble = span8,
diff --git a/src/liblink/objfile.c b/src/liblink/objfile.c
index 610f87954..b2478ec17 100644
--- a/src/liblink/objfile.c
+++ b/src/liblink/objfile.c
@@ -38,7 +38,8 @@
// - type [int]
// - name [string]
// - version [int]
-// - dupok [int]
+// - flags [int]
+// 1 dupok
// - size [int]
// - gotype [symbol reference]
// - p [data block]
@@ -50,7 +51,9 @@
// - args [int]
// - locals [int]
// - nosplit [int]
-// - leaf [int]
+// - flags [int]
+// 1 leaf
+// 2 C function
// - nlocal [int]
// - local [nlocal automatics]
// - pcln [pcln table]
@@ -100,6 +103,7 @@
#include <bio.h>
#include <link.h>
#include "../cmd/ld/textflag.h"
+#include "../runtime/funcdata.h"
static void writesym(Link*, Biobuf*, LSym*);
static void wrint(Biobuf*, int64);
@@ -121,7 +125,7 @@ static LSym *rdsym(Link*, Biobuf*, char*);
void
writeobj(Link *ctxt, Biobuf *b)
{
- int flag;
+ int flag, found;
Hist *h;
LSym *s, *text, *etext, *curtext, *data, *edata;
Plist *pl;
@@ -183,12 +187,7 @@ writeobj(Link *ctxt, Biobuf *b)
s->size = p->to.offset;
if(s->type == 0 || s->type == SXREF)
s->type = SBSS;
-
- if(ctxt->arch->thechar == '5')
- flag = p->reg;
- else
- flag = p->from.scale;
-
+ flag = ctxt->arch->textflag(p);
if(flag & DUPOK)
s->dupok = 1;
if(flag & RODATA)
@@ -221,10 +220,7 @@ writeobj(Link *ctxt, Biobuf *b)
else
etext->next = s;
etext = s;
- if(ctxt->arch->thechar == '5')
- flag = p->reg;
- else
- flag = p->from.scale;
+ flag = ctxt->arch->textflag(p);
if(flag & DUPOK)
s->dupok = 1;
if(flag & NOSPLIT)
@@ -237,6 +233,17 @@ writeobj(Link *ctxt, Biobuf *b)
continue;
}
+ if(p->as == ctxt->arch->AFUNCDATA) {
+ // Rewrite reference to go_args_stackmap(SB) to the Go-provided declaration information.
+ if(curtext == nil) // func _() {}
+ continue;
+ if(strcmp(p->to.sym->name, "go_args_stackmap") == 0) {
+ if(p->from.type != ctxt->arch->D_CONST || p->from.offset != FUNCDATA_ArgsPointerMaps)
+ ctxt->diag("FUNCDATA use of go_args_stackmap(SB) without FUNCDATA_ArgsPointerMaps");
+ p->to.sym = linklookup(ctxt, smprint("%s.args_stackmap", curtext->name), curtext->version);
+ }
+ }
+
if(curtext == nil)
continue;
s = curtext;
@@ -244,6 +251,32 @@ writeobj(Link *ctxt, Biobuf *b)
s->etext = p;
}
}
+
+ // Add reference to Go arguments for C or assembly functions without them.
+ for(s = text; s != nil; s = s->next) {
+ if(strncmp(s->name, "\"\".", 3) != 0)
+ continue;
+ found = 0;
+ for(p = s->text; p != nil; p = p->link) {
+ if(p->as == ctxt->arch->AFUNCDATA && p->from.type == ctxt->arch->D_CONST && p->from.offset == FUNCDATA_ArgsPointerMaps) {
+ found = 1;
+ break;
+ }
+ }
+ if(!found) {
+ p = appendp(ctxt, s->text);
+ p->as = ctxt->arch->AFUNCDATA;
+ p->from.type = ctxt->arch->D_CONST;
+ p->from.offset = FUNCDATA_ArgsPointerMaps;
+ if(ctxt->arch->thechar == '6' || ctxt->arch->thechar == '8')
+ p->to.type = ctxt->arch->D_EXTERN;
+ else {
+ p->to.type = ctxt->arch->D_OREG;
+ p->to.name = ctxt->arch->D_EXTERN;
+ }
+ p->to.sym = linklookup(ctxt, smprint("%s.args_stackmap", s->name), s->version);
+ }
+ }
// Turn functions into machine code images.
for(s = text; s != nil; s = s->next) {
@@ -297,6 +330,8 @@ writesym(Link *ctxt, Biobuf *b, LSym *s)
Bprint(ctxt->bso, "t=%d ", s->type);
if(s->dupok)
Bprint(ctxt->bso, "dupok ");
+ if(s->cfunc)
+ Bprint(ctxt->bso, "cfunc ");
if(s->nosplit)
Bprint(ctxt->bso, "nosplit ");
Bprint(ctxt->bso, "size=%lld value=%lld", (vlong)s->size, (vlong)s->value);
@@ -359,7 +394,7 @@ writesym(Link *ctxt, Biobuf *b, LSym *s)
wrint(b, s->args);
wrint(b, s->locals);
wrint(b, s->nosplit);
- wrint(b, s->leaf);
+ wrint(b, s->leaf | s->cfunc<<1);
n = 0;
for(a = s->autom; a != nil; a = a->link)
n++;
@@ -515,7 +550,7 @@ readsym(Link *ctxt, Biobuf *f, char *pkg, char *pn)
static int ndup;
char *name;
Reloc *r;
- LSym *s, *dup;
+ LSym *s, *dup, *typ;
Pcln *pc;
Auto *a;
@@ -527,6 +562,7 @@ readsym(Link *ctxt, Biobuf *f, char *pkg, char *pn)
if(v != 0 && v != 1)
sysfatal("invalid symbol version %d", v);
dupok = rdint(f);
+ dupok &= 1;
size = rdint(f);
if(v != 0)
@@ -550,7 +586,11 @@ readsym(Link *ctxt, Biobuf *f, char *pkg, char *pn)
s->type = t;
if(s->size < size)
s->size = size;
- s->gotype = rdsym(ctxt, f, pkg);
+ typ = rdsym(ctxt, f, pkg);
+ if(typ != nil) // if bss sym defined multiple times, take type from any one def
+ s->gotype = typ;
+ if(dup != nil && typ != nil)
+ dup->gotype = typ;
rddata(f, &s->p, &s->np);
s->maxp = s->np;
n = rdint(f);
@@ -581,7 +621,9 @@ readsym(Link *ctxt, Biobuf *f, char *pkg, char *pn)
s->args = rdint(f);
s->locals = rdint(f);
s->nosplit = rdint(f);
- s->leaf = rdint(f);
+ v = rdint(f);
+ s->leaf = v&1;
+ s->cfunc = v&2;
n = rdint(f);
for(i=0; i<n; i++) {
a = emallocz(sizeof *a);
@@ -637,6 +679,8 @@ readsym(Link *ctxt, Biobuf *f, char *pkg, char *pn)
Bprint(ctxt->bso, "t=%d ", s->type);
if(s->dupok)
Bprint(ctxt->bso, "dupok ");
+ if(s->cfunc)
+ Bprint(ctxt->bso, "cfunc ");
if(s->nosplit)
Bprint(ctxt->bso, "nosplit ");
Bprint(ctxt->bso, "size=%lld value=%lld", (vlong)s->size, (vlong)s->value);
diff --git a/src/liblink/pcln.c b/src/liblink/pcln.c
index 4b2b85543..f0ee1dc67 100644
--- a/src/liblink/pcln.c
+++ b/src/liblink/pcln.c
@@ -279,7 +279,7 @@ linkpcln(Link *ctxt, LSym *cursym)
}
// pcdata.
for(i=0; i<npcdata; i++) {
- if(!(havepc[i/32]>>(i%32))&1)
+ if(((havepc[i/32]>>(i%32))&1) == 0)
continue;
funcpctab(ctxt, &pcln->pcdata[i], cursym, "pctopcdata", pctopcdata, (void*)(uintptr)i);
}
diff --git a/src/liblink/sym.c b/src/liblink/sym.c
index cba50e9c7..bd8551846 100644
--- a/src/liblink/sym.c
+++ b/src/liblink/sym.c
@@ -44,19 +44,20 @@ static struct {
char *name;
int val;
} headers[] = {
- "darwin", Hdarwin,
- "dragonfly", Hdragonfly,
- "elf", Helf,
- "freebsd", Hfreebsd,
- "linux", Hlinux,
- "nacl", Hnacl,
- "netbsd", Hnetbsd,
- "openbsd", Hopenbsd,
- "plan9", Hplan9,
- "solaris", Hsolaris,
- "windows", Hwindows,
- "windowsgui", Hwindows,
- 0, 0
+ {"android", Hlinux},
+ {"darwin", Hdarwin},
+ {"dragonfly", Hdragonfly},
+ {"elf", Helf},
+ {"freebsd", Hfreebsd},
+ {"linux", Hlinux},
+ {"nacl", Hnacl},
+ {"netbsd", Hnetbsd},
+ {"openbsd", Hopenbsd},
+ {"plan9", Hplan9},
+ {"solaris", Hsolaris},
+ {"windows", Hwindows},
+ {"windowsgui", Hwindows},
+ {0, 0},
};
int
@@ -90,7 +91,7 @@ linknew(LinkArch *arch)
char *p;
char buf[1024];
- nuxiinit();
+ nuxiinit(arch);
ctxt = emallocz(sizeof *ctxt);
ctxt->arch = arch;
@@ -127,8 +128,6 @@ linknew(LinkArch *arch)
default:
sysfatal("unknown thread-local storage offset for %s", headstr(ctxt->headtype));
case Hplan9:
- ctxt->tlsoffset = -2*ctxt->arch->ptrsize;
- break;
case Hwindows:
break;
case Hlinux:
@@ -155,13 +154,16 @@ linknew(LinkArch *arch)
case '8':
ctxt->tlsoffset = -8;
break;
+ case '5':
+ ctxt->tlsoffset = 0;
+ break;
}
break;
case Hdarwin:
/*
* OS X system constants - offset from 0(GS) to our TLS.
- * Explained in ../../pkg/runtime/cgo/gcc_darwin_*.c.
+ * Explained in ../../runtime/cgo/gcc_darwin_*.c.
*/
switch(ctxt->arch->thechar) {
default:
@@ -192,19 +194,14 @@ LSym*
linknewsym(Link *ctxt, char *symb, int v)
{
LSym *s;
- int l;
- l = strlen(symb) + 1;
s = malloc(sizeof(*s));
memset(s, 0, sizeof(*s));
s->dynid = -1;
s->plt = -1;
s->got = -1;
- s->name = malloc(l + 1);
- memmove(s->name, symb, l);
- s->name[l] = '\0';
-
+ s->name = estrdup(symb);
s->type = 0;
s->version = v;
s->value = 0;