Fix bugs and have emulator emulate itself

This commit is contained in:
Justine Tunney 2020-08-31 05:17:31 -07:00
parent 5aabacb361
commit bd29223891
111 changed files with 1283 additions and 2073 deletions

View file

@ -34,6 +34,7 @@
//
#include "libc/alg/alg.h"
#include "libc/assert.h"
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/conv/conv.h"
#include "libc/limits.h"

View file

@ -364,6 +364,9 @@ struct XedOperands { /*
uint8_t opcode;
uint8_t srm : 3;
};
uint8_t map : 4; // enum XedIldMap
uint8_t rep : 2; // 0, 2 (0xf2 repnz), 3 (0xf3 rep/repe)
uint8_t hint : 2; // static branch prediction
union {
uint8_t sib;
struct {
@ -380,12 +383,9 @@ struct XedOperands { /*
uint8_t mod : 2;
};
};
uint8_t map : 4; // enum XedIldMap
uint8_t hint : 2; // static branch prediction
uint8_t seg_ovd : 3; // XED_SEG_xx
uint8_t error : 5; // enum XedError
uint8_t mode : 3; // real,legacy,long
uint8_t rep : 2; // 0, 2 (0xf2 repnz), 3 (0xf3 rep/repe)
bool lock : 1; // prefix
bool imm_signed : 1; // internal
int64_t disp; // displacement(%xxx) sign-extended

View file

@ -5,6 +5,7 @@
Use of this source code is governed by the BSD-style licenses that can
be found in the third_party/zlib/LICENSE file.
*/
#include "libc/bits/bits.h"
#include "libc/dce.h"
#include "libc/macros.h"
#include "libc/mem/mem.h"
@ -223,7 +224,7 @@ static inline Pos insert_string_sse(struct DeflateState *const s,
Pos ret;
unsigned *ip, val, h = 0;
ip = (unsigned *)&s->window[str];
val = read32le(ip); /* XXX: val = *ip; */
val = READ32LE(ip); /* XXX: val = *ip; */
if (s->level >= 6) val &= 0xFFFFFF;
asm("crc32\t%1,%0" : "+r"(h) : "r"(val));
ret = s->head[h & s->hash_mask];