mirror of
https://github.com/ptitSeb/box64.git
synced 2024-11-23 06:30:22 +00:00
Fixes (#1659)
* Replaced some tabs with spaces * Fixed some signedness warnings * Added more debug info * Fixed an improper alignment * [WRAPPEDWAYLAND] Added return statements to wrappers * [EMU] [AVX] Fixed some issues * [ARM DYNAREC] Fixed some minor warnings * [ARM DYNAREC] Removed unused macro arguments * [EMU] Fixed a noisy warning * [ARM DYNAREC] Removed "empty body" warnings * [EMU] Fixed an opcode in dynarec, non-cosim builds * [LA64 DYNAREC] Minor warning fixes * [LA64 DYNAREC] Fixed empty body warnings * [LA64 DYNAREC] Added parenthesis around assignments in if statements * [LA64 DYNAREC] Fixed missing parenthesis in macro definitions * [RV64 DYNAREC] Fixed minor warnings * [RV64 DYNAREC] Fixed wrong/missing parentheses * [WRAPPER] Fixed the WaylandClient callback signatures
This commit is contained in:
parent
fdc7e9d1e4
commit
605d5a29c0
22
src/core.c
22
src/core.c
@ -488,13 +488,13 @@ HWCAP2_AFP
|
||||
return;
|
||||
}
|
||||
|
||||
if (la64_lbt = (cpucfg2 >> 18) & 0b1)
|
||||
if ((la64_lbt = (cpucfg2 >> 18) & 0b1))
|
||||
printf_log(LOG_INFO, " LBT_X86");
|
||||
if (la64_lam_bh = (cpucfg2 >> 27) & 0b1)
|
||||
if ((la64_lam_bh = (cpucfg2 >> 27) & 0b1))
|
||||
printf_log(LOG_INFO, " LAM_BH");
|
||||
if (la64_lamcas = (cpucfg2 >> 28) & 0b1)
|
||||
if ((la64_lamcas = (cpucfg2 >> 28) & 0b1))
|
||||
printf_log(LOG_INFO, " LAMCAS");
|
||||
if (la64_scq = (cpucfg2 >> 30) & 0b1)
|
||||
if ((la64_scq = (cpucfg2 >> 30) & 0b1))
|
||||
printf_log(LOG_INFO, " SCQ");
|
||||
}
|
||||
#elif defined(RV64)
|
||||
@ -1278,7 +1278,7 @@ void AddNewLibs(const char* list)
|
||||
}
|
||||
|
||||
void PrintFlags() {
|
||||
printf("Environment Variables:\n");
|
||||
printf("Environment Variables:\n");
|
||||
printf(" BOX64_PATH is the box64 version of PATH (default is '.:bin')\n");
|
||||
printf(" BOX64_LD_LIBRARY_PATH is the box64 version LD_LIBRARY_PATH (default is '.:lib:lib64')\n");
|
||||
printf(" BOX64_LOG with 0/1/2/3 or NONE/INFO/DEBUG/DUMP to set the printed debug info (level 3 is level 2 + BOX64_DUMP)\n");
|
||||
@ -1412,31 +1412,31 @@ void LoadEnvVars(box64context_t *context)
|
||||
if (strcmp(getenv("BOX64_SSE_FLUSHTO0"), "1")==0) {
|
||||
box64_sse_flushto0 = 1;
|
||||
printf_log(LOG_INFO, "BOX64: Direct apply of SSE Flush to 0 flag\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(getenv("BOX64_X87_NO80BITS")) {
|
||||
if (strcmp(getenv("BOX64_X87_NO80BITS"), "1")==0) {
|
||||
box64_x87_no80bits = 1;
|
||||
printf_log(LOG_INFO, "BOX64: All 80bits x87 long double will be handle as double\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(getenv("BOX64_SYNC_ROUNDING")) {
|
||||
if (strcmp(getenv("BOX64_SYNC_ROUNDING"), "1")==0) {
|
||||
box64_sync_rounding = 1;
|
||||
printf_log(LOG_INFO, "BOX64: Rouding mode with be synced with fesetround/fegetround\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(getenv("BOX64_PREFER_WRAPPED")) {
|
||||
if (strcmp(getenv("BOX64_PREFER_WRAPPED"), "1")==0) {
|
||||
box64_prefer_wrapped = 1;
|
||||
printf_log(LOG_INFO, "BOX64: Prefering Wrapped libs\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(getenv("BOX64_PREFER_EMULATED")) {
|
||||
if (strcmp(getenv("BOX64_PREFER_EMULATED"), "1")==0) {
|
||||
box64_prefer_emulated = 1;
|
||||
printf_log(LOG_INFO, "BOX64: Prefering Emulated libs\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(getenv("BOX64_NOSIGSEGV")) {
|
||||
@ -1684,7 +1684,7 @@ static void load_rcfiles()
|
||||
char* rcpath = getenv("BOX64_RCFILE");
|
||||
|
||||
if(rcpath && FileExist(rcpath, IS_FILE))
|
||||
LoadRCFile(rcpath);
|
||||
LoadRCFile(rcpath);
|
||||
#ifndef TERMUX
|
||||
else if(FileExist("/etc/box64.box64rc", IS_FILE))
|
||||
LoadRCFile("/etc/box64.box64rc");
|
||||
|
@ -8,16 +8,16 @@
|
||||
/*
|
||||
ARM64 Linux Call Convention
|
||||
|
||||
SP The Stack Pointer.
|
||||
r30 LR The Link Register.
|
||||
r29 FP The Frame Pointer
|
||||
r19…r28 Callee-saved registers
|
||||
r18 The Platform Register, if needed; otherwise a temporary register. See notes.
|
||||
r17 IP1 The second intra-procedure-call temporary register (can be used by call veneers and PLT code); at other times may be used as a temporary register.
|
||||
r16 IP0 The first intra-procedure-call scratch register (can be used by call veneers and PLT code); at other times may be used as a temporary register.
|
||||
r9…r15 Temporary registers
|
||||
r8 Indirect result location register
|
||||
r0…r7 Parameter/result registers
|
||||
SP The Stack Pointer.
|
||||
r30 LR The Link Register.
|
||||
r29 FP The Frame Pointer
|
||||
r19…r28 Callee-saved registers
|
||||
r18 The Platform Register, if needed; otherwise a temporary register. See notes.
|
||||
r17 IP1 The second intra-procedure-call temporary register (can be used by call veneers and PLT code); at other times may be used as a temporary register.
|
||||
r16 IP0 The first intra-procedure-call scratch register (can be used by call veneers and PLT code); at other times may be used as a temporary register.
|
||||
r9…r15 Temporary registers
|
||||
r8 Indirect result location register
|
||||
r0…r7 Parameter/result registers
|
||||
|
||||
For SIMD:
|
||||
The first eight registers, v0-v7, are used to pass argument values into a subroutine and to return result values from a function.
|
||||
@ -817,9 +817,9 @@ int convert_bitmask(uint64_t bitmask);
|
||||
#define MSR_fpsr(Rt) EMIT(MRS_gen(0, 1, 3, 4, 4, 1, Rt))
|
||||
// mrs x0, cntvct_el0 op0=0b11 op1=0b011 CRn=0b1110 CRm=0b0000 op2=0b010
|
||||
#define MRS_cntvct_el0(Rt) EMIT(MRS_gen(1, 1, 0b011, 0b1110, 0b0000, 0b010, Rt))
|
||||
// mrs x0, cntpctss_el0 op0=0b11 op1=0b011 CRn=0b1110 CRm=0b0000 op2=0b101
|
||||
// mrs x0, cntpctss_el0 op0=0b11 op1=0b011 CRn=0b1110 CRm=0b0000 op2=0b101
|
||||
#define MRS_cntpctss_el0(Rt) EMIT(MRS_gen(1, 1, 0b011, 0b1110, 0b0000, 0b101, Rt))
|
||||
// mrs rt, rndr op0=0b11 op1=0b011 CRn=0b0010 CRm=0b0100 op2=0b000
|
||||
// mrs rt, rndr op0=0b11 op1=0b011 CRn=0b0010 CRm=0b0100 op2=0b000
|
||||
#define MRS_rndr(Rt) EMIT(MRS_gen(1, 1, 0b011, 0b0010, 0b0100, 0b000, Rt))
|
||||
// NEON Saturation Bit
|
||||
#define FPSR_QC 27
|
||||
@ -1725,8 +1725,8 @@ int convert_bitmask(uint64_t bitmask);
|
||||
#define VCHIQQ_64(Rd, Rn, Rm) EMIT(CMG_vector(1, 1, 0b11, 0, Rm, Rn, Rd))
|
||||
|
||||
// Less Than 0
|
||||
#define CMLT_0_vector(Q, size, Rn, Rd) ((Q)<<30 | 0b01110<<24 | (size)<<22 | 0b10000<<17 | 0b01010<<12 | 0b10<<10 | (Rn)<<5 | (Rd))
|
||||
#define CMLT_0_8(Rd, Rn) EMIT(CMLT_0_vector(0, 0b00, Rn, Rd))
|
||||
#define CMLT_0_vector(Q, size, Rn, Rd) ((Q)<<30 | 0b01110<<24 | (size)<<22 | 0b10000<<17 | 0b01010<<12 | 0b10<<10 | (Rn)<<5 | (Rd))
|
||||
#define CMLT_0_8(Rd, Rn) EMIT(CMLT_0_vector(0, 0b00, Rn, Rd))
|
||||
#define CMLT_0_16(Rd, Rn) EMIT(CMLT_0_vector(0, 0b01, Rn, Rd))
|
||||
#define CMLT_0_32(Rd, Rn) EMIT(CMLT_0_vector(0, 0b10, Rn, Rd))
|
||||
#define CMLTQ_0_8(Rd, Rn) EMIT(CMLT_0_vector(1, 0b00, Rn, Rd))
|
||||
|
@ -760,7 +760,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
|
||||
} else {
|
||||
INST_NAME("BOUND Gd, Ed");
|
||||
nextop = F8;
|
||||
FAKEED(0);
|
||||
FAKEED;
|
||||
}
|
||||
break;
|
||||
case 0x63:
|
||||
|
@ -2515,7 +2515,7 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n
|
||||
}
|
||||
MOV32w(x4, 1);
|
||||
BFIxw(ed, x4, u8, 1);
|
||||
EWBACK(x1);
|
||||
EWBACK;
|
||||
break;
|
||||
case 6:
|
||||
INST_NAME("BTR Ew, Ib");
|
||||
@ -2528,7 +2528,7 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n
|
||||
BFXILxw(xFlags, ed, u8, 1); // inject 1 bit from u8 to F_CF (i.e. pos 0)
|
||||
}
|
||||
BFCxw(ed, u8, 1);
|
||||
EWBACK(x1);
|
||||
EWBACK;
|
||||
break;
|
||||
case 7:
|
||||
INST_NAME("BTC Ew, Ib");
|
||||
@ -2542,7 +2542,7 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n
|
||||
}
|
||||
MOV32w(x4, 1);
|
||||
EORxw_REG_LSL(ed, ed, x4, u8);
|
||||
EWBACK(x1);
|
||||
EWBACK;
|
||||
break;
|
||||
default:
|
||||
DEFAULT;
|
||||
|
@ -998,7 +998,7 @@ void x87_do_push_empty(dynarec_arm_t* dyn, int ninst, int s1)
|
||||
dyn->abort = 1;
|
||||
}
|
||||
}
|
||||
void static internal_x87_dopop(dynarec_arm_t* dyn)
|
||||
static void internal_x87_dopop(dynarec_arm_t* dyn)
|
||||
{
|
||||
for(int i=0; i<8; ++i)
|
||||
if(dyn->n.x87cache[i]!=-1) {
|
||||
@ -1009,7 +1009,7 @@ void static internal_x87_dopop(dynarec_arm_t* dyn)
|
||||
}
|
||||
}
|
||||
}
|
||||
int static internal_x87_dofree(dynarec_arm_t* dyn)
|
||||
static int internal_x87_dofree(dynarec_arm_t* dyn)
|
||||
{
|
||||
if(dyn->n.tags&0b11) {
|
||||
MESSAGE(LOG_DUMP, "\t--------x87 FREED ST0, poping 1 more\n");
|
||||
@ -1761,8 +1761,8 @@ static void sse_reflectcache(dynarec_arm_t* dyn, int ninst, int s1)
|
||||
}
|
||||
}
|
||||
for(int i=0; i<32; ++i)
|
||||
if(dyn->n.neoncache[i].t == NEON_CACHE_YMMW)
|
||||
VSTR128_U12(i, xEmu, offsetof(x64emu_t, ymm[dyn->n.neoncache[i].n]));
|
||||
if(dyn->n.neoncache[i].t == NEON_CACHE_YMMW)
|
||||
VSTR128_U12(i, xEmu, offsetof(x64emu_t, ymm[dyn->n.neoncache[i].n]));
|
||||
}
|
||||
|
||||
void sse_reflect_reg(dynarec_arm_t* dyn, int ninst, int a)
|
||||
@ -2663,4 +2663,4 @@ int fpu_get_reg_ymm(dynarec_arm_t* dyn, int ninst, int t, int ymm, int k1, int k
|
||||
#endif
|
||||
printf_log(LOG_NONE, "BOX64 Dynarec: Error, unable to free a reg for YMM %d at inst=%d on pass %d\n", ymm, ninst, STEP);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -1035,7 +1035,7 @@
|
||||
#define SET_DFOK() dyn->f.dfnone = 1; dyn->f.dfnone_here=1
|
||||
|
||||
#ifndef MAYSETFLAGS
|
||||
#define MAYSETFLAGS()
|
||||
#define MAYSETFLAGS() do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef READFLAGS
|
||||
|
@ -5,7 +5,7 @@
|
||||
dyn->insts[ninst].x64.addr = addr; \
|
||||
if(ninst) dyn->insts[ninst-1].x64.size = dyn->insts[ninst].x64.addr - dyn->insts[ninst-1].x64.addr
|
||||
|
||||
#define MESSAGE(A, ...)
|
||||
#define MESSAGE(A, ...) do {} while (0)
|
||||
#define MAYSETFLAGS() dyn->insts[ninst].x64.may_set = 1
|
||||
#define READFLAGS(A) \
|
||||
dyn->insts[ninst].x64.use_flags = A; dyn->f.dfnone = 1;\
|
||||
|
@ -1,7 +1,7 @@
|
||||
#define INIT
|
||||
#define FINI
|
||||
#define MESSAGE(A, ...)
|
||||
#define EMIT(A)
|
||||
#define MESSAGE(A, ...) do {} while (0)
|
||||
#define EMIT(A) do {} while (0)
|
||||
#define NEW_INST \
|
||||
dyn->insts[ninst].f_entry = dyn->f; \
|
||||
dyn->n.combined1 = dyn->n.combined2 = 0;\
|
||||
|
@ -5,7 +5,7 @@
|
||||
dyn->insts_size += 1+((dyn->insts[ninst].x64.size>(dyn->insts[ninst].size/4))?dyn->insts[ninst].x64.size:(dyn->insts[ninst].size/4))/15; \
|
||||
}
|
||||
|
||||
#define MESSAGE(A, ...)
|
||||
#define MESSAGE(A, ...) do {} while (0)
|
||||
#define EMIT(A) do{dyn->insts[ninst].size+=4; dyn->native_size+=4;}while(0)
|
||||
#define NEW_INST \
|
||||
if(ninst) { \
|
||||
@ -16,4 +16,4 @@
|
||||
#define INST_EPILOG dyn->insts[ninst].epilog = dyn->native_size;
|
||||
#define INST_NAME(name)
|
||||
#define TABLE64(A, V) {Table64(dyn, (V), 2); EMIT(0);}
|
||||
#define FTABLE64(A, V) {mmx87_regs_t v = {.d = V}; Table64(dyn, v.q, 2); EMIT(0);}
|
||||
#define FTABLE64(A, V) {mmx87_regs_t v = {.d = V}; Table64(dyn, v.q, 2); EMIT(0);}
|
||||
|
@ -31,9 +31,9 @@ uint32_t X31_hash_code(void* addr, int len)
|
||||
{
|
||||
if(!len) return 0;
|
||||
uint8_t* p = (uint8_t*)addr;
|
||||
int32_t h = *p;
|
||||
for (--len, ++p; len; --len, ++p) h = (h << 5) - h + (int32_t)*p;
|
||||
return (uint32_t)h;
|
||||
int32_t h = *p;
|
||||
for (--len, ++p; len; --len, ++p) h = (h << 5) - h + (int32_t)*p;
|
||||
return (uint32_t)h;
|
||||
}
|
||||
|
||||
dynablock_t* InvalidDynablock(dynablock_t* db, int need_lock)
|
||||
@ -48,7 +48,7 @@ dynablock_t* InvalidDynablock(dynablock_t* db, int need_lock)
|
||||
mutex_lock(&my_context->mutex_dyndump);
|
||||
db->done = 0;
|
||||
db->gone = 1;
|
||||
int db_size = db->x64_size;
|
||||
uintptr_t db_size = db->x64_size;
|
||||
if(db_size && my_context) {
|
||||
uint32_t n = rb_get(my_context->db_sizes, db_size);
|
||||
if(n>1)
|
||||
@ -94,7 +94,7 @@ void FreeDynablock(dynablock_t* db, int need_lock)
|
||||
dynarec_log(LOG_DEBUG, " -- FreeDyrecMap(%p, %d)\n", db->actual_block, db->size);
|
||||
db->done = 0;
|
||||
db->gone = 1;
|
||||
int db_size = db->x64_size;
|
||||
uintptr_t db_size = db->x64_size;
|
||||
if(db_size && my_context) {
|
||||
uint32_t n = rb_get(my_context->db_sizes, db_size);
|
||||
if(n>1)
|
||||
|
@ -268,23 +268,23 @@ void native_fprem1(x64emu_t* emu)
|
||||
|
||||
static uint8_t ff_mult(uint8_t a, uint8_t b)
|
||||
{
|
||||
int retval = 0;
|
||||
int retval = 0;
|
||||
|
||||
for(int i = 0; i < 8; i++) {
|
||||
if((b & 1) == 1)
|
||||
retval ^= a;
|
||||
for(int i = 0; i < 8; i++) {
|
||||
if((b & 1) == 1)
|
||||
retval ^= a;
|
||||
|
||||
if((a & 0x80)) {
|
||||
a <<= 1;
|
||||
a ^= 0x1b;
|
||||
} else {
|
||||
a <<= 1;
|
||||
}
|
||||
if((a & 0x80)) {
|
||||
a <<= 1;
|
||||
a ^= 0x1b;
|
||||
} else {
|
||||
a <<= 1;
|
||||
}
|
||||
|
||||
b >>= 1;
|
||||
}
|
||||
b >>= 1;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void native_aesimc(x64emu_t* emu, int xmm)
|
||||
|
@ -264,7 +264,7 @@ uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr, int alternate, int
|
||||
reset_n = get_first_jump(dyn, next);
|
||||
}
|
||||
if(box64_dynarec_dump) dynarec_log(LOG_NONE, "Extend block %p, %s%p -> %p (ninst=%d, jump from %d)\n", dyn, dyn->insts[ninst].x64.has_callret?"(opt. call) ":"", (void*)addr, (void*)next, ninst+1, dyn->insts[ninst].x64.has_callret?ninst:reset_n);
|
||||
} else if(next && (next-addr)<box64_dynarec_forward && (getProtection(next)&PROT_READ)/*box64_dynarec_bigblock>=stopblock*/) {
|
||||
} else if(next && (int)(next-addr)<box64_dynarec_forward && (getProtection(next)&PROT_READ)/*box64_dynarec_bigblock>=stopblock*/) {
|
||||
if(!((box64_dynarec_bigblock<stopblock) && !isJumpTableDefault64((void*)next))) {
|
||||
if(dyn->forward) {
|
||||
if(next<dyn->forward_to)
|
||||
|
@ -144,7 +144,9 @@ void emit_add32c(dynarec_la64_t* dyn, int ninst, rex_t rex, int s1, int64_t c, i
|
||||
IFX(X_PEND | X_AF | X_CF | X_OF)
|
||||
{
|
||||
MOV64xw(s2, c);
|
||||
} else if (la64_lbt) MOV64xw(s2, c);
|
||||
} else if (la64_lbt) {
|
||||
MOV64xw(s2, c);
|
||||
}
|
||||
IFX(X_PEND)
|
||||
{
|
||||
SDxw(s1, xEmu, offsetof(x64emu_t, op1));
|
||||
@ -1602,4 +1604,4 @@ void emit_neg16(dynarec_la64_t* dyn, int ninst, int s1, int s2, int s3)
|
||||
IFXA (X_ALL, la64_lbt) {
|
||||
SPILL_EFLAGS();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -353,12 +353,14 @@ uintptr_t dynarec64_F0(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
|
||||
emit_or32c(dyn, ninst, rex, ed, i64, x3, x4);
|
||||
} else {
|
||||
addr = geted(dyn, addr, ninst, nextop, &wback, x2, x1, &fixedaddress, rex, LOCK_LOCK, 0, (opcode == 0x81) ? 4 : 1);
|
||||
if (opcode == 0x81)
|
||||
if (opcode == 0x81) {
|
||||
i64 = F32S;
|
||||
else
|
||||
} else {
|
||||
i64 = F8S;
|
||||
if (i64 <= -2048 || i64 > 2048)
|
||||
}
|
||||
if (i64 <= -2048 || i64 > 2048) {
|
||||
MOV64xw(x3, i64);
|
||||
}
|
||||
MARKLOCK;
|
||||
LLxw(x1, wback, 0);
|
||||
if (i64 >= -2048 && i64 < 2048) {
|
||||
|
@ -621,7 +621,7 @@
|
||||
ANDI(scratch1, scratch2, 0x80); \
|
||||
} else { \
|
||||
SRLI_D(scratch1, scratch2, (width)-1); \
|
||||
if (width != 64) ANDI(scratch1, scratch1, 1); \
|
||||
if ((width) != 64) ANDI(scratch1, scratch1, 1); \
|
||||
} \
|
||||
BEQZ(scratch1, 8); \
|
||||
ORI(xFlags, xFlags, 1 << F_CF); \
|
||||
@ -639,7 +639,7 @@
|
||||
}
|
||||
|
||||
#ifndef MAYSETFLAGS
|
||||
#define MAYSETFLAGS()
|
||||
#define MAYSETFLAGS() do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef READFLAGS
|
||||
@ -1149,4 +1149,4 @@ uintptr_t dynarec64_F20F(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int
|
||||
|
||||
#define PURGE_YMM() /* TODO */
|
||||
|
||||
#endif //__DYNAREC_LA64_HELPER_H__
|
||||
#endif //__DYNAREC_LA64_HELPER_H__
|
||||
|
@ -4,7 +4,7 @@
|
||||
dyn->insts[ninst].x64.addr = addr; \
|
||||
if (ninst) dyn->insts[ninst - 1].x64.size = dyn->insts[ninst].x64.addr - dyn->insts[ninst - 1].x64.addr
|
||||
|
||||
#define MESSAGE(A, ...)
|
||||
#define MESSAGE(A, ...) do {} while (0)
|
||||
#define MAYSETFLAGS() dyn->insts[ninst].x64.may_set = 1
|
||||
#define READFLAGS(A) \
|
||||
dyn->insts[ninst].x64.use_flags = A; \
|
||||
|
@ -1,7 +1,7 @@
|
||||
#define INIT
|
||||
#define FINI
|
||||
#define MESSAGE(A, ...)
|
||||
#define EMIT(A)
|
||||
#define MESSAGE(A, ...) do {} while (0)
|
||||
#define EMIT(A) do {} while (0)
|
||||
#define NEW_INST \
|
||||
dyn->insts[ninst].f_entry = dyn->f; \
|
||||
dyn->lsx.combined1 = dyn->lsx.combined2 = 0; \
|
||||
|
@ -5,7 +5,7 @@
|
||||
dyn->insts_size += 1 + ((dyn->insts[ninst].x64.size > (dyn->insts[ninst].size / 4)) ? dyn->insts[ninst].x64.size : (dyn->insts[ninst].size / 4)) / 15; \
|
||||
}
|
||||
|
||||
#define MESSAGE(A, ...)
|
||||
#define MESSAGE(A, ...) do {} while (0)
|
||||
#define EMIT(A) \
|
||||
do { \
|
||||
dyn->insts[ninst].size += 4; \
|
||||
|
@ -482,19 +482,19 @@ f24-f31 fs0-fs7 Static registers Callee
|
||||
// bstr32[msbw:lsbw] = GR[rj][msbw-lsbw:0]
|
||||
// bstr32[lsbw-1:0] = GR[rd][lsbw-1:0]
|
||||
// GR[rd] = SignExtend(bstr32[31:0], GRLEN)
|
||||
#define BSTRINS_W(rd, rj, msbw5, lsbw5) EMIT(type_2RI12(0b0000000001, 0b100000000000 | (msbw5 & 0x1F) << 6 | (lsbw5 & 0x1F), rj, rd))
|
||||
#define BSTRINS_W(rd, rj, msbw5, lsbw5) EMIT(type_2RI12(0b0000000001, 0b100000000000 | ((msbw5) & 0x1F) << 6 | ((lsbw5) & 0x1F), rj, rd))
|
||||
|
||||
// GR[rd][63:msbd+1] = GR[rd][63:msbd+1]
|
||||
// GR[rd][msbd:lsbd] = GR[rj][msbd-lsbd:0]
|
||||
// GR[rd][lsbd-1:0] = GR[rd][lsbd-1:0]
|
||||
#define BSTRINS_D(rd, rj, msbd6, lsbd6) EMIT(type_2RI12(0b0000000010, (msbd6 & 0x3F) << 6 | (lsbd6 & 0x3F), rj, rd))
|
||||
#define BSTRINS_D(rd, rj, msbd6, lsbd6) EMIT(type_2RI12(0b0000000010, ((msbd6) & 0x3F) << 6 | ((lsbd6) & 0x3F), rj, rd))
|
||||
|
||||
// bstr32[31:0] = ZeroExtend(GR[rj][msbw:lsbw], 32)
|
||||
// GR[rd] = SignExtend(bstr32[31:0], GRLEN)
|
||||
#define BSTRPICK_W(rd, rj, msbw5, lsbw5) EMIT(type_2RI12(0b0000000001, 0b100000100000 | (msbw5 & 0x1F) << 6 | (lsbw5 & 0x1F), rj, rd))
|
||||
#define BSTRPICK_W(rd, rj, msbw5, lsbw5) EMIT(type_2RI12(0b0000000001, 0b100000100000 | ((msbw5) & 0x1F) << 6 | ((lsbw5) & 0x1F), rj, rd))
|
||||
|
||||
// GR[rd] = ZeroExtend(GR[rj][msbd:lsbd], 64)
|
||||
#define BSTRPICK_D(rd, rj, msbd6, lsbd6) EMIT(type_2RI12(0b0000000011, (msbd6 & 0x3F) << 6 | (lsbd6 & 0x3F), rj, rd))
|
||||
#define BSTRPICK_D(rd, rj, msbd6, lsbd6) EMIT(type_2RI12(0b0000000011, ((msbd6) & 0x3F) << 6 | ((lsbd6) & 0x3F), rj, rd))
|
||||
|
||||
// ZERO the upper part
|
||||
#define ZEROUP(rd) BSTRINS_D(rd, xZR, 63, 32);
|
||||
|
@ -12,7 +12,7 @@ static const char* Vt[] = { "vra0", "vra1", "vra2", "vra3", "vra4", "vra5", "vra
|
||||
|
||||
typedef struct la64_print_s {
|
||||
int d, j, k, a;
|
||||
int i, u;
|
||||
uint64_t i, u;
|
||||
} la64_print_t;
|
||||
|
||||
int isMask(uint32_t opcode, const char* mask, la64_print_t *a)
|
||||
@ -44,7 +44,7 @@ int isMask(uint32_t opcode, const char* mask, la64_print_t *a)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int64_t signExtend(uint32_t val, int sz)
|
||||
int64_t signExtend(uint64_t val, int sz)
|
||||
{
|
||||
int64_t ret = val;
|
||||
if((val>>(sz-1))&1)
|
||||
@ -80,39 +80,39 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000001010iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "ADDI.W", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "ADDI.W", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000001011iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "ADDI.D", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "ADDI.D", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000100iiiiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "ADDU16I.D", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "ADDU16I.D", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000000010iikkkkkjjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %s, %d", "ALSL.W", Xt[Rd], Xt[Rj], Xt[Rk], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %s, %lu", "ALSL.W", Xt[Rd], Xt[Rj], Xt[Rk], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000000011iikkkkkjjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %s, %d", "ALSL.WU", Xt[Rd], Xt[Rj], Xt[Rk], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %s, %lu", "ALSL.WU", Xt[Rd], Xt[Rj], Xt[Rk], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000010110iikkkkkjjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %s, %d", "ALSL.D", Xt[Rd], Xt[Rj], Xt[Rk], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %s, %lu", "ALSL.D", Xt[Rd], Xt[Rj], Xt[Rk], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0001010iiiiiiiiiiiiiiiiiiiiddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%x", "LU12I.W", Xt[Rd], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "LU12I.W", Xt[Rd], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0001011iiiiiiiiiiiiiiiiiiiiddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "LU32I.D", Xt[Rd], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "LU32I.D", Xt[Rd], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000001100iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LU52I.D", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu", "LU52I.D", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000000100100kkkkkjjjjjddddd", &a)) {
|
||||
@ -124,47 +124,47 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000001000iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "SLTI", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "SLTI", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000001001iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u", "SLTI", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "SLTI", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0001100iiiiiiiiiiiiiiiiiiiiddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "PCADDI", Xt[Rd], signExtend(imm << 2, 22));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "PCADDI", Xt[Rd], (uint64_t)signExtend(imm << 2, 22));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0001101iiiiiiiiiiiiiiiiiiiiddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "PCALAU12I", Xt[Rd], signExtend(imm << 12, 32));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "PCALAU12I", Xt[Rd], (uint64_t)signExtend(imm << 12, 32));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0001110iiiiiiiiiiiiiiiiiiiiddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "PCADDU12I", Xt[Rd], signExtend(imm << 12, 32));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "PCADDU12I", Xt[Rd], (uint64_t)signExtend(imm << 12, 32));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0001111iiiiiiiiiiiiiiiiiiiiddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "PCADDU18I", Xt[Rd], signExtend(imm << 18, 38));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "PCADDU18I", Xt[Rd], (uint64_t)signExtend(imm << 18, 38));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00100000iiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LL.W", Xt[Rd], Xt[Rj], signExtend(imm << 2, 16));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "LL.W", Xt[Rd], Xt[Rj], signExtend(imm << 2, 16));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00100001iiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "SC.W", Xt[Rd], Xt[Rj], signExtend(imm << 2, 16));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "SC.W", Xt[Rd], Xt[Rj], signExtend(imm << 2, 16));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00100010iiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LL.D", Xt[Rd], Xt[Rj], signExtend(imm << 2, 16));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "LL.D", Xt[Rd], Xt[Rj], signExtend(imm << 2, 16));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00100011iiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "SC.D", Xt[Rd], Xt[Rj], signExtend(imm << 2, 16));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "SC.D", Xt[Rd], Xt[Rj], signExtend(imm << 2, 16));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00111000011100100iiiiiiiiiiiiiii", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %d", "DBAR", imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %lu", "DBAR", imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000000101001kkkkkjjjjjddddd", &a)) {
|
||||
@ -196,15 +196,15 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000001101iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "ANDI", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "ANDI", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000001110iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "ORI", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "ORI", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000001111iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "XORI", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "XORI", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000000101110kkkkkjjjjjddddd", &a)) {
|
||||
@ -240,35 +240,35 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001000001iiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u", "SLLI.D", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu", "SLLI.D", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001000101iiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u", "SRLI.D", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu", "SRLI.D", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001001001iiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u", "SRAI.D", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu", "SRAI.D", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001001101iiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u", "ROTRI.D", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu", "ROTRI.D", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010000001iiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u", "SLLI.W", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu", "SLLI.W", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010001001iiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u", "SRLI.W", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu", "SRLI.W", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010010001iiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u", "SRAI.W", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu", "SRAI.W", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010011001iiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u", "ROTRI.W", Xt[Rd], Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu", "ROTRI.W", Xt[Rd], Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000000111000kkkkkjjjjjddddd", &a)) {
|
||||
@ -336,19 +336,19 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000011uuuuu0iiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u, %u", "BSTRINS.W", Xt[Rd], Xt[Rj], imm_up, imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu, %lu", "BSTRINS.W", Xt[Rd], Xt[Rj], imm_up, imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000010uuuuuuiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u, %u", "BSTRINS.D", Xt[Rd], Xt[Rj], imm_up, imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu, %lu", "BSTRINS.D", Xt[Rd], Xt[Rj], imm_up, imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000011uuuuu1iiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u, %u", "BSTRPICK.W", Xt[Rd], Xt[Rj], imm_up, imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu, %lu", "BSTRPICK.W", Xt[Rd], Xt[Rj], imm_up, imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000011uuuuuuiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %u, %u", "BSTRPICK.D", Xt[Rd], Xt[Rj], imm_up, imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %lu, %lu", "BSTRPICK.D", Xt[Rd], Xt[Rj], imm_up, imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000000000000000100jjjjjddddd", &a)) {
|
||||
@ -432,35 +432,35 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "010110iiiiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "BEQ", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "BEQ", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "010111iiiiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "BNE", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "BNE", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "011000iiiiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "BLT", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "BLT", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "011001iiiiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "BGE", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "BGE", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "011010iiiiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "BLTU", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "BLTU", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "011011iiiiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "BGEU", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "BGEU", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "010000iiiiiiiiiiiiiiiijjjjjuuuuu", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "BEQZ", Xt[Rj], signExtend(imm + (imm_up << 16) << 2, 23));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %ld", "BEQZ", Xt[Rj], signExtend((imm + (imm_up << 16)) << 2, 23));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "010001iiiiiiiiiiiiiiiijjjjjuuuuu", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "BNEZ", Xt[Rj], signExtend(imm + (imm_up << 16) << 2, 23));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %ld", "BNEZ", Xt[Rj], signExtend((imm + (imm_up << 16)) << 2, 23));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0100110000000000000000jjjjj00000", &a)) {
|
||||
@ -468,55 +468,55 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "010011iiiiiiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "JIRL", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "JIRL", Xt[Rd], Xt[Rj], signExtend(imm << 2, 18));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "010100iiiiiiiiiiiiiiiiiiiiiiiiii", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s 0x%x", "B", (((imm & 0x3FF) << 16) | ((uint32_t)imm >> 10)) << 6 >> 4);
|
||||
snprintf(buff, sizeof(buff), "%-15s 0x%lx", "B", (((imm & 0x3FF) << 16) | (imm >> 10)) << 6 >> 4);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010100000iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LD.B", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "LD.B", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010100001iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LD.H", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "LD.H", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010100010iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LD.W", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "LD.W", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010100011iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LD.D", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "LD.D", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010101000iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LD.BU", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "LD.BU", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010101001iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LD.HU", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "LD.HU", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010101010iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "LD.WU", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "LD.WU", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010100100iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "ST.B", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "ST.B", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010100101iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "ST.H", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "ST.H", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010100110iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "ST.W", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "ST.W", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010100111iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "ST.D", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "ST.D", Xt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00111000000000000kkkkkjjjjjddddd", &a)) {
|
||||
@ -564,19 +564,19 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010101110iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "FLD.D", Ft[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "FLD.D", Ft[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010101100iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "FLD.S", Ft[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "FLD.S", Ft[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010101111iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "FST.D", Ft[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "FST.D", Ft[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010101101iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "FST.S", Ft[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "FST.S", Ft[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000001000000001kkkkkjjjjjddddd", &a)) {
|
||||
@ -2124,44 +2124,44 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "01110011100100iiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "VSHUF4I.B", Vt[Rd], Vt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "VSHUF4I.B", Vt[Rd], Vt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "01110011100101iiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "VSHUF4I.H", Vt[Rd], Vt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "VSHUF4I.H", Vt[Rd], Vt[Rj], imm);
|
||||
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "01110011100110iiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "VSHUF4I.W", Vt[Rd], Vt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "VSHUF4I.W", Vt[Rd], Vt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "01110011100111iiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "VSHUF4I.D", Vt[Rd], Vt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "VSHUF4I.D", Vt[Rd], Vt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "01110011100000iiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "VEXTRINS.D", Vt[Rd], Vt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "VEXTRINS.D", Vt[Rd], Vt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "01110011100001iiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "VEXTRINS.W", Vt[Rd], Vt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "VEXTRINS.W", Vt[Rd], Vt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "01110011100010iiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "VEXTRINS.H", Vt[Rd], Vt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "VEXTRINS.H", Vt[Rd], Vt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "01110011100011iiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%x", "VEXTRINS.B", Vt[Rd], Vt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, 0x%lx", "VEXTRINS.B", Vt[Rd], Vt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010110000iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "VLD", Vt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "VLD", Vt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0010110001iiiiiiiiiiiijjjjjddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %d", "VST", Vt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %s, %ld", "VST", Vt[Rd], Xt[Rj], signExtend(imm, 12));
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000000000001000000000101000", &a)) {
|
||||
@ -2181,7 +2181,7 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000000000001110000iii00000", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %d", "X64SETTOP", imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %lu", "X64SETTOP", imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000000000001110100000ddddd", &a)) {
|
||||
@ -2189,15 +2189,15 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010111iiiiiiii00000ddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%x", "X64GETEFLAGS", Xt[Rd], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "X64GETEFLAGS", Xt[Rd], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010111iiiiiiii00001ddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%x", "X64SETEFLAGS", Xt[Rd], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "X64SETEFLAGS", Xt[Rd], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000011011010iiii00000ddddd", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%x", "X64SETJ", Xt[Rd], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, 0x%lx", "X64SETJ", Xt[Rd], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000000000000100000jjjjj00000", &a)) {
|
||||
@ -2505,118 +2505,118 @@ const char* la64_print(uint32_t opcode, uintptr_t addr)
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010100001iiijjjjj00000", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SLLI.B", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SLLI.B", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010100001iiijjjjj00100", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SRLI.B", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SRLI.B", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010100001iiijjjjj01000", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SRAI.B", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SRAI.B", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010100001iiijjjjj01100", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64ROTRI.B", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64ROTRI.B", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010100001iiijjjjj10000", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64RCRI.B", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64RCRI.B", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010100001iiijjjjj10100", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64ROTLI.B", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64ROTLI.B", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010100001iiijjjjj11000", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64RCLI.B", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64RCLI.B", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000101010001iiiijjjjj00001", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SLLI.H", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SLLI.H", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000101010001iiiijjjjj00101", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SRLI.H", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SRLI.H", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000101010001iiiijjjjj01001", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SRAI.H", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SRAI.H", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000101010001iiiijjjjj01101", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64ROTRI.H", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64ROTRI.H", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000101010001iiiijjjjj10001", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64RCRI.H", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64RCRI.H", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000101010001iiiijjjjj10101", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64ROTLI.H", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64ROTLI.H", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "000000000101010001iiiijjjjj11001", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64RCLI.H", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64RCLI.H", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010101001iiiiijjjjj00010", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SLLI.W", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SLLI.W", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010101001iiiiijjjjj00110", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SRLI.W", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SRLI.W", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010101001iiiiijjjjj01010", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SRAI.W", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SRAI.W", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010101001iiiiijjjjj01110", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64ROTRI.W", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64ROTRI.W", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010101001iiiiijjjjj10010", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64RCRI.W", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64RCRI.W", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010101001iiiiijjjjj10110", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64ROTLI.W", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64ROTLI.W", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "00000000010101001iiiiijjjjj11010", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64RCLI.W", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64RCLI.W", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010101iiiiiijjjjj00011", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SLLI.D", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SLLI.D", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010101iiiiiijjjjj00111", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SRLI.D", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SRLI.D", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010101iiiiiijjjjj01011", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64SRAI.D", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64SRAI.D", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010101iiiiiijjjjj01111", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64ROTRI.D", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64ROTRI.D", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010101iiiiiijjjjj10011", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64RCRI.D", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64RCRI.D", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010101iiiiiijjjjj10111", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64ROTLI.D", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64ROTLI.D", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
if (isMask(opcode, "0000000001010101iiiiiijjjjj11011", &a)) {
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %d", "X64RCLI.D", Xt[Rj], imm);
|
||||
snprintf(buff, sizeof(buff), "%-15s %s, %lu", "X64RCLI.D", Xt[Rj], imm);
|
||||
return buff;
|
||||
}
|
||||
|
||||
snprintf(buff, sizeof(buff), "%08X ???", __builtin_bswap32(opcode));
|
||||
return buff;
|
||||
}
|
||||
}
|
||||
|
@ -1273,7 +1273,7 @@ uintptr_t dynarec64_660F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
|
||||
GETGX();
|
||||
GETED(1);
|
||||
u8 = F8;
|
||||
SB(ed, gback, gdoffset + u8 & 0xF);
|
||||
SB(ed, gback, gdoffset + (u8 & 0xF));
|
||||
break;
|
||||
case 0x21:
|
||||
INST_NAME("INSERTPS GX, EX, Ib");
|
||||
|
@ -954,7 +954,7 @@ void x87_do_push_empty(dynarec_rv64_t* dyn, int ninst, int s1)
|
||||
if(s1)
|
||||
x87_stackcount(dyn, ninst, s1);
|
||||
}
|
||||
void static internal_x87_dopop(dynarec_rv64_t* dyn)
|
||||
static void internal_x87_dopop(dynarec_rv64_t* dyn)
|
||||
{
|
||||
for(int i=0; i<8; ++i)
|
||||
if(dyn->e.x87cache[i]!=-1) {
|
||||
@ -965,7 +965,7 @@ void static internal_x87_dopop(dynarec_rv64_t* dyn)
|
||||
}
|
||||
}
|
||||
}
|
||||
int static internal_x87_dofree(dynarec_rv64_t* dyn)
|
||||
static int internal_x87_dofree(dynarec_rv64_t* dyn)
|
||||
{
|
||||
if(dyn->e.tags&0b11) {
|
||||
MESSAGE(LOG_DUMP, "\t--------x87 FREED ST0, poping 1 more\n");
|
||||
@ -2361,8 +2361,8 @@ void rv64_move32(dynarec_rv64_t* dyn, int ninst, int reg, int32_t val, int zerou
|
||||
src = reg;
|
||||
}
|
||||
if (lo12 || !hi20) ADDIW(reg, src, lo12);
|
||||
if((zeroup && ((hi20&0x80000) || (!hi20 && (lo12&0x800)))
|
||||
|| (!zeroup && !(val&0x80000000) && ((hi20&0x80000) || (!hi20 && (lo12&0x800)))))) {
|
||||
if((zeroup && ((hi20&0x80000) || (!hi20 && (lo12&0x800))))
|
||||
|| (!zeroup && !(val&0x80000000) && ((hi20&0x80000) || (!hi20 && (lo12&0x800))))) {
|
||||
ZEROUP(reg);
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +392,7 @@
|
||||
ANDI(gd, gb1, 0xff);
|
||||
|
||||
// Write gb (gd) back to original register / memory, using s1 as scratch
|
||||
#define GBBACK(s1) \
|
||||
#define GBBACK(s1) do { \
|
||||
if (gb2) { \
|
||||
MOV64x(s1, 0xffffffffffff00ffLL); \
|
||||
AND(gb1, gb1, s1); \
|
||||
@ -401,7 +401,7 @@
|
||||
} else { \
|
||||
ANDI(gb1, gb1, ~0xff); \
|
||||
OR(gb1, gb1, gd); \
|
||||
}
|
||||
} } while (0)
|
||||
|
||||
// Write eb (ed) back to original register / memory, using s1 as scratch
|
||||
#define EBBACK(s1, c) \
|
||||
@ -876,7 +876,7 @@
|
||||
ANDI(scratch1, scratch2, 0x80); \
|
||||
} else { \
|
||||
SRLI(scratch1, scratch2, (width)-1); \
|
||||
if (width != 64) ANDI(scratch1, scratch1, 1); \
|
||||
if ((width) != 64) ANDI(scratch1, scratch1, 1); \
|
||||
} \
|
||||
BEQZ(scratch1, 8); \
|
||||
ORI(xFlags, xFlags, 1 << F_CF); \
|
||||
@ -940,7 +940,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef MAYSETFLAGS
|
||||
#define MAYSETFLAGS()
|
||||
#define MAYSETFLAGS() do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef READFLAGS
|
||||
|
@ -5,7 +5,7 @@
|
||||
dyn->insts[ninst].x64.addr = addr; \
|
||||
if(ninst) dyn->insts[ninst-1].x64.size = dyn->insts[ninst].x64.addr - dyn->insts[ninst-1].x64.addr
|
||||
|
||||
#define MESSAGE(A, ...)
|
||||
#define MESSAGE(A, ...) do {} while (0)
|
||||
#define MAYSETFLAGS() dyn->insts[ninst].x64.may_set = 1
|
||||
#define READFLAGS(A) \
|
||||
dyn->insts[ninst].x64.use_flags = A; dyn->f.dfnone = 1;\
|
||||
|
@ -1,7 +1,7 @@
|
||||
#define INIT
|
||||
#define FINI
|
||||
#define MESSAGE(A, ...)
|
||||
#define EMIT(A)
|
||||
#define MESSAGE(A, ...) do {} while (0)
|
||||
#define EMIT(A) do {} while (0)
|
||||
#define NEW_INST \
|
||||
dyn->insts[ninst].f_entry = dyn->f; \
|
||||
dyn->e.combined1 = dyn->e.combined2 = 0;\
|
||||
|
@ -5,7 +5,7 @@
|
||||
dyn->insts_size += 1+((dyn->insts[ninst].x64.size>(dyn->insts[ninst].size/4))?dyn->insts[ninst].x64.size:(dyn->insts[ninst].size/4))/15; \
|
||||
}
|
||||
|
||||
#define MESSAGE(A, ...)
|
||||
#define MESSAGE(A, ...) do {} while (0)
|
||||
#define EMIT(A) do {dyn->insts[ninst].size+=4; dyn->native_size+=4;}while(0)
|
||||
#define NEW_INST \
|
||||
if(ninst) { \
|
||||
@ -16,4 +16,4 @@
|
||||
#define INST_EPILOG dyn->insts[ninst].epilog = dyn->native_size;
|
||||
#define INST_NAME(name)
|
||||
#define TABLE64(A, V) {Table64(dyn, (V), 2); EMIT(0); EMIT(0);}
|
||||
#define FTABLE64(A, V) {mmx87_regs_t v = {.d = V}; Table64(dyn, v.q, 2); EMIT(0); EMIT(0);}
|
||||
#define FTABLE64(A, V) {mmx87_regs_t v = {.d = V}; Table64(dyn, v.q, 2); EMIT(0); EMIT(0);}
|
||||
|
@ -112,18 +112,18 @@ f28–31 ft8–11 FP temporaries Caller
|
||||
// MOV64x/MOV32w is quite complex, so use a function for this
|
||||
#define MOV64x(A, B) rv64_move64(dyn, ninst, A, B)
|
||||
#define MOV32w(A, B) rv64_move32(dyn, ninst, A, B, 1)
|
||||
#define MOV64xw(A, B) \
|
||||
#define MOV64xw(A, B) do { \
|
||||
if (rex.w) { \
|
||||
MOV64x(A, B); \
|
||||
} else { \
|
||||
MOV32w(A, B); \
|
||||
}
|
||||
#define MOV64z(A, B) \
|
||||
} } while (0)
|
||||
#define MOV64z(A, B) do { \
|
||||
if (rex.is32bits) { \
|
||||
MOV32w(A, B); \
|
||||
} else { \
|
||||
MOV64x(A, B); \
|
||||
}
|
||||
} } while (0)
|
||||
|
||||
// ZERO the upper part
|
||||
#define ZEROUP(r) AND(r, r, xMASK)
|
||||
@ -225,19 +225,19 @@ f28–31 ft8–11 FP temporaries Caller
|
||||
// rd = rs1 (pseudo instruction)
|
||||
#define MV(rd, rs1) ADDI(rd, rs1, 0)
|
||||
// rd = rs1 (pseudo instruction)
|
||||
#define MVxw(rd, rs1) \
|
||||
#define MVxw(rd, rs1) do { \
|
||||
if (rex.w) { \
|
||||
MV(rd, rs1); \
|
||||
} else { \
|
||||
AND(rd, rs1, xMASK); \
|
||||
}
|
||||
} } while (0)
|
||||
// rd = rs1 (pseudo instruction)
|
||||
#define MVz(rd, rs1) \
|
||||
#define MVz(rd, rs1) do { \
|
||||
if (rex.is32bits) { \
|
||||
AND(rd, rs1, xMASK); \
|
||||
} else { \
|
||||
MV(rd, rs1); \
|
||||
}
|
||||
} } while (0)
|
||||
// rd = !rs1
|
||||
#define NOT(rd, rs1) XORI(rd, rs1, -1)
|
||||
// rd = -rs1
|
||||
@ -344,10 +344,10 @@ f28–31 ft8–11 FP temporaries Caller
|
||||
// 4-bytes[rs1+imm12] = rs2
|
||||
#define SW(rs2, rs1, imm12) EMIT(S_type(imm12, rs2, rs1, 0b010, 0b0100011))
|
||||
|
||||
#define PUSH1(reg) \
|
||||
do { \
|
||||
SD(reg, xRSP, -8); \
|
||||
SUBI(xRSP, xRSP, 8); \
|
||||
#define PUSH1(reg) \
|
||||
do { \
|
||||
SD(reg, xRSP, 0xFF8); \
|
||||
SUBI(xRSP, xRSP, 8); \
|
||||
} while (0)
|
||||
#define POP1(reg) \
|
||||
do { \
|
||||
@ -356,7 +356,7 @@ f28–31 ft8–11 FP temporaries Caller
|
||||
} while (0)
|
||||
#define PUSH1_32(reg) \
|
||||
do { \
|
||||
SW(reg, xRSP, -4); \
|
||||
SW(reg, xRSP, 0xFFC); \
|
||||
SUBIW(xRSP, xRSP, 4); \
|
||||
} while (0)
|
||||
#define POP1_32(reg) \
|
||||
@ -378,10 +378,10 @@ f28–31 ft8–11 FP temporaries Caller
|
||||
PUSH1(reg); \
|
||||
}
|
||||
|
||||
#define PUSH1_16(reg) \
|
||||
do { \
|
||||
SH(reg, xRSP, -2); \
|
||||
SUBI(xRSP, xRSP, 2); \
|
||||
#define PUSH1_16(reg) \
|
||||
do { \
|
||||
SH(reg, xRSP, 0xFFE); \
|
||||
SUBI(xRSP, xRSP, 2); \
|
||||
} while (0)
|
||||
|
||||
#define POP1_16(reg) \
|
||||
@ -452,60 +452,60 @@ f28–31 ft8–11 FP temporaries Caller
|
||||
// rd = rs1>>rs2 arithmetic
|
||||
#define SRAW(rd, rs1, rs2) EMIT(R_type(0b0100000, rs2, rs1, 0b101, rd, 0b0111011))
|
||||
|
||||
#define SLLxw(rd, rs1, rs2) \
|
||||
if (rex.w) { \
|
||||
SLL(rd, rs1, rs2); \
|
||||
} else { \
|
||||
SLLW(rd, rs1, rs2); \
|
||||
ZEROUP(rd); \
|
||||
}
|
||||
#define SLLxw(rd, rs1, rs2) do { \
|
||||
if (rex.w) { \
|
||||
SLL(rd, rs1, rs2); \
|
||||
} else { \
|
||||
SLLW(rd, rs1, rs2); \
|
||||
ZEROUP(rd); \
|
||||
} } while (0)
|
||||
|
||||
#define SRLxw(rd, rs1, rs2) \
|
||||
if (rex.w) { \
|
||||
SRL(rd, rs1, rs2); \
|
||||
} else { \
|
||||
SRLW(rd, rs1, rs2); \
|
||||
ZEROUP(rd); \
|
||||
}
|
||||
#define SRLxw(rd, rs1, rs2) do { \
|
||||
if (rex.w) { \
|
||||
SRL(rd, rs1, rs2); \
|
||||
} else { \
|
||||
SRLW(rd, rs1, rs2); \
|
||||
ZEROUP(rd); \
|
||||
} } while (0)
|
||||
|
||||
#define SRAxw(rd, rs1, rs2) \
|
||||
if (rex.w) { \
|
||||
SRA(rd, rs1, rs2); \
|
||||
} else { \
|
||||
SRAW(rd, rs1, rs2); \
|
||||
ZEROUP(rd); \
|
||||
}
|
||||
#define SRAxw(rd, rs1, rs2) do { \
|
||||
if (rex.w) { \
|
||||
SRA(rd, rs1, rs2); \
|
||||
} else { \
|
||||
SRAW(rd, rs1, rs2); \
|
||||
ZEROUP(rd); \
|
||||
} } while (0)
|
||||
|
||||
// Shift Left Immediate, 32-bit, sign-extended
|
||||
#define SLLIW(rd, rs1, imm5) EMIT(I_type(imm5, rs1, 0b001, rd, 0b0011011))
|
||||
// Shift Left Immediate
|
||||
#define SLLIxw(rd, rs1, imm) \
|
||||
if (rex.w) { \
|
||||
SLLI(rd, rs1, imm); \
|
||||
} else { \
|
||||
SLLIW(rd, rs1, imm); \
|
||||
ZEROUP(rd); \
|
||||
}
|
||||
#define SLLIxw(rd, rs1, imm) do { \
|
||||
if (rex.w) { \
|
||||
SLLI(rd, rs1, imm); \
|
||||
} else { \
|
||||
SLLIW(rd, rs1, imm); \
|
||||
ZEROUP(rd); \
|
||||
} } while (0)
|
||||
// Shift Right Logical Immediate, 32-bit, sign-extended
|
||||
#define SRLIW(rd, rs1, imm5) EMIT(I_type(imm5, rs1, 0b101, rd, 0b0011011))
|
||||
// Shift Right Logical Immediate
|
||||
#define SRLIxw(rd, rs1, imm) \
|
||||
#define SRLIxw(rd, rs1, imm) do { \
|
||||
if (rex.w) { \
|
||||
SRLI(rd, rs1, imm); \
|
||||
} else { \
|
||||
SRLIW(rd, rs1, imm); \
|
||||
if ((imm) == 0) ZEROUP(rd); \
|
||||
}
|
||||
} } while (0)
|
||||
// Shift Right Arithmetic Immediate, 32-bit, sign-extended
|
||||
#define SRAIW(rd, rs1, imm5) EMIT(I_type((imm5) | (0b0100000 << 5), rs1, 0b101, rd, 0b0011011))
|
||||
// Shift Right Arithmetic Immediate
|
||||
#define SRAIxw(rd, rs1, imm) \
|
||||
if (rex.w) { \
|
||||
SRAI(rd, rs1, imm); \
|
||||
} else { \
|
||||
SRAIW(rd, rs1, imm); \
|
||||
ZEROUP(rd); \
|
||||
}
|
||||
#define SRAIxw(rd, rs1, imm) do { \
|
||||
if (rex.w) { \
|
||||
SRAI(rd, rs1, imm); \
|
||||
} else { \
|
||||
SRAIW(rd, rs1, imm); \
|
||||
ZEROUP(rd); \
|
||||
} } while (0)
|
||||
|
||||
#define CSRRW(rd, rs1, csr) EMIT(I_type(csr, rs1, 0b001, rd, 0b1110011))
|
||||
#define CSRRS(rd, rs1, csr) EMIT(I_type(csr, rs1, 0b010, rd, 0b1110011))
|
||||
@ -1243,58 +1243,58 @@ f28–31 ft8–11 FP temporaries Caller
|
||||
#define VLM_V(vd, rs1) EMIT(I_type(0b000000101011, rs1, 0b000, vd, 0b0000111)) // 000000101011.....000.....0000111
|
||||
#define VSM_V(vs3, rs1) EMIT(I_type(0b000000101011, rs1, 0b000, vs3, 0b0100111)) // 000000101011.....000.....0100111
|
||||
|
||||
#define VLE8_V(vd, rs1, vm, nf) EMIT(I_type((nf << 9) | (vm << 5), rs1, 0b000, vd, 0b0000111)) // ...000.00000.....000.....0000111
|
||||
#define VLE16_V(vd, rs1, vm, nf) EMIT(I_type((nf << 9) | (vm << 5), rs1, 0b101, vd, 0b0000111)) // ...000.00000.....101.....0000111
|
||||
#define VLE32_V(vd, rs1, vm, nf) EMIT(I_type((nf << 9) | (vm << 5), rs1, 0b110, vd, 0b0000111)) // ...000.00000.....110.....0000111
|
||||
#define VLE64_V(vd, rs1, vm, nf) EMIT(I_type((nf << 9) | (vm << 5), rs1, 0b111, vd, 0b0000111)) // ...000.00000.....111.....0000111
|
||||
#define VSE8_V(vs3, rs1, vm, nf) EMIT(I_type((nf << 9) | (vm << 5), rs1, 0b000, vs3, 0b0100111)) // ...000.00000.....000.....0100111
|
||||
#define VSE16_V(vs3, rs1, vm, nf) EMIT(I_type((nf << 9) | (vm << 5), rs1, 0b101, vs3, 0b0100111)) // ...000.00000.....101.....0100111
|
||||
#define VSE32_V(vs3, rs1, vm, nf) EMIT(I_type((nf << 9) | (vm << 5), rs1, 0b110, vs3, 0b0100111)) // ...000.00000.....110.....0100111
|
||||
#define VSE64_V(vs3, rs1, vm, nf) EMIT(I_type((nf << 9) | (vm << 5), rs1, 0b111, vs3, 0b0100111)) // ...000.00000.....111.....0100111
|
||||
#define VLE8_V(vd, rs1, vm, nf) EMIT(I_type(((nf) << 9) | (vm << 5), rs1, 0b000, vd, 0b0000111)) // ...000.00000.....000.....0000111
|
||||
#define VLE16_V(vd, rs1, vm, nf) EMIT(I_type(((nf) << 9) | (vm << 5), rs1, 0b101, vd, 0b0000111)) // ...000.00000.....101.....0000111
|
||||
#define VLE32_V(vd, rs1, vm, nf) EMIT(I_type(((nf) << 9) | (vm << 5), rs1, 0b110, vd, 0b0000111)) // ...000.00000.....110.....0000111
|
||||
#define VLE64_V(vd, rs1, vm, nf) EMIT(I_type(((nf) << 9) | (vm << 5), rs1, 0b111, vd, 0b0000111)) // ...000.00000.....111.....0000111
|
||||
#define VSE8_V(vs3, rs1, vm, nf) EMIT(I_type(((nf) << 9) | (vm << 5), rs1, 0b000, vs3, 0b0100111)) // ...000.00000.....000.....0100111
|
||||
#define VSE16_V(vs3, rs1, vm, nf) EMIT(I_type(((nf) << 9) | (vm << 5), rs1, 0b101, vs3, 0b0100111)) // ...000.00000.....101.....0100111
|
||||
#define VSE32_V(vs3, rs1, vm, nf) EMIT(I_type(((nf) << 9) | (vm << 5), rs1, 0b110, vs3, 0b0100111)) // ...000.00000.....110.....0100111
|
||||
#define VSE64_V(vs3, rs1, vm, nf) EMIT(I_type(((nf) << 9) | (vm << 5), rs1, 0b111, vs3, 0b0100111)) // ...000.00000.....111.....0100111
|
||||
|
||||
// Vector Indexed-Unordered Instructions (including segment part)
|
||||
// https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#76-vector-indexed-instructions
|
||||
|
||||
#define VLUXEI8_V(vd, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0010, vs2, rs1, 0b000, vd, 0b0000111)) // ...001...........000.....0000111
|
||||
#define VLUXEI16_V(vd, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0010, vs2, rs1, 0b101, vd, 0b0000111)) // ...001...........101.....0000111
|
||||
#define VLUXEI32_V(vd, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0010, vs2, rs1, 0b110, vd, 0b0000111)) // ...001...........110.....0000111
|
||||
#define VLUXEI64_V(vd, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0010, vs2, rs1, 0b111, vd, 0b0000111)) // ...001...........111.....0000111
|
||||
#define VSUXEI8_V(vs3, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0010, vs2, rs1, 0b000, vs3, 0b0100111)) // ...001...........000.....0100111
|
||||
#define VSUXEI16_V(vs3, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0010, vs2, rs1, 0b101, vs3, 0b0100111)) // ...001...........101.....0100111
|
||||
#define VSUXEI32_V(vs3, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0010, vs2, rs1, 0b110, vs3, 0b0100111)) // ...001...........110.....0100111
|
||||
#define VSUXEI64_V(vs3, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0010, vs2, rs1, 0b111, vs3, 0b0100111)) // ...001...........111.....0100111
|
||||
#define VLUXEI8_V(vd, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0010, vs2, rs1, 0b000, vd, 0b0000111)) // ...001...........000.....0000111
|
||||
#define VLUXEI16_V(vd, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0010, vs2, rs1, 0b101, vd, 0b0000111)) // ...001...........101.....0000111
|
||||
#define VLUXEI32_V(vd, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0010, vs2, rs1, 0b110, vd, 0b0000111)) // ...001...........110.....0000111
|
||||
#define VLUXEI64_V(vd, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0010, vs2, rs1, 0b111, vd, 0b0000111)) // ...001...........111.....0000111
|
||||
#define VSUXEI8_V(vs3, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0010, vs2, rs1, 0b000, vs3, 0b0100111)) // ...001...........000.....0100111
|
||||
#define VSUXEI16_V(vs3, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0010, vs2, rs1, 0b101, vs3, 0b0100111)) // ...001...........101.....0100111
|
||||
#define VSUXEI32_V(vs3, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0010, vs2, rs1, 0b110, vs3, 0b0100111)) // ...001...........110.....0100111
|
||||
#define VSUXEI64_V(vs3, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0010, vs2, rs1, 0b111, vs3, 0b0100111)) // ...001...........111.....0100111
|
||||
|
||||
// Vector Strided Instructions (including segment part)
|
||||
// https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#75-vector-strided-instructions
|
||||
|
||||
#define VLSE8_V(vd, rs1, rs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0100, rs2, rs1, 0b000, vd, 0b0000111)) // ...010...........000.....0000111
|
||||
#define VLSE16_V(vd, rs1, rs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0100, rs2, rs1, 0b101, vd, 0b0000111)) // ...010...........101.....0000111
|
||||
#define VLSE32_V(vd, rs1, rs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0100, rs2, rs1, 0b110, vd, 0b0000111)) // ...010...........110.....0000111
|
||||
#define VLSE64_V(vd, rs1, rs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0100, rs2, rs1, 0b111, vd, 0b0000111)) // ...010...........111.....0000111
|
||||
#define VSSE8_V(vs3, rs1, rs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0100, rs2, rs1, 0b000, vs3, 0b0100111)) // ...010...........000.....0100111
|
||||
#define VSSE16_V(vs3, rs1, rs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0100, rs2, rs1, 0b101, vs3, 0b0100111)) // ...010...........101.....0100111
|
||||
#define VSSE32_V(vs3, rs1, rs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0100, rs2, rs1, 0b110, vs3, 0b0100111)) // ...010...........110.....0100111
|
||||
#define VSSE64_V(vs3, rs1, rs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0100, rs2, rs1, 0b111, vs3, 0b0100111)) // ...010...........111.....0100111
|
||||
#define VLSE8_V(vd, rs1, rs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0100, rs2, rs1, 0b000, vd, 0b0000111)) // ...010...........000.....0000111
|
||||
#define VLSE16_V(vd, rs1, rs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0100, rs2, rs1, 0b101, vd, 0b0000111)) // ...010...........101.....0000111
|
||||
#define VLSE32_V(vd, rs1, rs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0100, rs2, rs1, 0b110, vd, 0b0000111)) // ...010...........110.....0000111
|
||||
#define VLSE64_V(vd, rs1, rs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0100, rs2, rs1, 0b111, vd, 0b0000111)) // ...010...........111.....0000111
|
||||
#define VSSE8_V(vs3, rs1, rs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0100, rs2, rs1, 0b000, vs3, 0b0100111)) // ...010...........000.....0100111
|
||||
#define VSSE16_V(vs3, rs1, rs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0100, rs2, rs1, 0b101, vs3, 0b0100111)) // ...010...........101.....0100111
|
||||
#define VSSE32_V(vs3, rs1, rs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0100, rs2, rs1, 0b110, vs3, 0b0100111)) // ...010...........110.....0100111
|
||||
#define VSSE64_V(vs3, rs1, rs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0100, rs2, rs1, 0b111, vs3, 0b0100111)) // ...010...........111.....0100111
|
||||
|
||||
// Vector Indexed-Ordered Instructions (including segment part)
|
||||
// https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#76-vector-indexed-instructions
|
||||
|
||||
#define VLOXEI8_V(vd, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0110, vs2, rs1, 0b000, vd, 0b0000111)) // ...011...........000.....0000111
|
||||
#define VLOXEI16_V(vd, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0110, vs2, rs1, 0b101, vd, 0b0000111)) // ...011...........101.....0000111
|
||||
#define VLOXEI32_V(vd, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0110, vs2, rs1, 0b110, vd, 0b0000111)) // ...011...........110.....0000111
|
||||
#define VLOXEI64_V(vd, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0110, vs2, rs1, 0b111, vd, 0b0000111)) // ...011...........111.....0000111
|
||||
#define VSOXEI8_V(vs3, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0110, vs2, rs1, 0b000, vs3, 0b0100111)) // ...011...........000.....0100111
|
||||
#define VSOXEI16_V(vs3, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0110, vs2, rs1, 0b101, vs3, 0b0100111)) // ...011...........101.....0100111
|
||||
#define VSOXEI32_V(vs3, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0110, vs2, rs1, 0b110, vs3, 0b0100111)) // ...011...........110.....0100111
|
||||
#define VSOXEI64_V(vs3, rs1, vs2, vm, nf) EMIT(R_type((nf << 4) | (vm) | 0b0110, vs2, rs1, 0b111, vs3, 0b0100111)) // ...011...........111.....0100111
|
||||
#define VLOXEI8_V(vd, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0110, vs2, rs1, 0b000, vd, 0b0000111)) // ...011...........000.....0000111
|
||||
#define VLOXEI16_V(vd, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0110, vs2, rs1, 0b101, vd, 0b0000111)) // ...011...........101.....0000111
|
||||
#define VLOXEI32_V(vd, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0110, vs2, rs1, 0b110, vd, 0b0000111)) // ...011...........110.....0000111
|
||||
#define VLOXEI64_V(vd, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0110, vs2, rs1, 0b111, vd, 0b0000111)) // ...011...........111.....0000111
|
||||
#define VSOXEI8_V(vs3, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0110, vs2, rs1, 0b000, vs3, 0b0100111)) // ...011...........000.....0100111
|
||||
#define VSOXEI16_V(vs3, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0110, vs2, rs1, 0b101, vs3, 0b0100111)) // ...011...........101.....0100111
|
||||
#define VSOXEI32_V(vs3, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0110, vs2, rs1, 0b110, vs3, 0b0100111)) // ...011...........110.....0100111
|
||||
#define VSOXEI64_V(vs3, rs1, vs2, vm, nf) EMIT(R_type(((nf) << 4) | (vm) | 0b0110, vs2, rs1, 0b111, vs3, 0b0100111)) // ...011...........111.....0100111
|
||||
|
||||
// Unit-stride F31..29=0ault-Only-First Loads
|
||||
// https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#77-unit-stride-fault-only-first-loads
|
||||
|
||||
#define VLE8FF_V(vd, rs1, vm, nf) EMIT(R_type((nf << 4) | (vm), 0b10000, rs1, 0b000, vd, 0b0000111)) // ...000.10000.....000.....0000111
|
||||
#define VLE16FF_V(vd, rs1, vm, nf) EMIT(R_type((nf << 4) | (vm), 0b10000, rs1, 0b101, vd, 0b0000111)) // ...000.10000.....101.....0000111
|
||||
#define VLE32FF_V(vd, rs1, vm, nf) EMIT(R_type((nf << 4) | (vm), 0b10000, rs1, 0b110, vd, 0b0000111)) // ...000.10000.....110.....0000111
|
||||
#define VLE64FF_V(vd, rs1, vm, nf) EMIT(R_type((nf << 4) | (vm), 0b10000, rs1, 0b111, vd, 0b0000111)) // ...000.10000.....111.....0000111
|
||||
#define VLE8FF_V(vd, rs1, vm, nf) EMIT(R_type(((nf) << 4) | (vm), 0b10000, rs1, 0b000, vd, 0b0000111)) // ...000.10000.....000.....0000111
|
||||
#define VLE16FF_V(vd, rs1, vm, nf) EMIT(R_type(((nf) << 4) | (vm), 0b10000, rs1, 0b101, vd, 0b0000111)) // ...000.10000.....101.....0000111
|
||||
#define VLE32FF_V(vd, rs1, vm, nf) EMIT(R_type(((nf) << 4) | (vm), 0b10000, rs1, 0b110, vd, 0b0000111)) // ...000.10000.....110.....0000111
|
||||
#define VLE64FF_V(vd, rs1, vm, nf) EMIT(R_type(((nf) << 4) | (vm), 0b10000, rs1, 0b111, vd, 0b0000111)) // ...000.10000.....111.....0000111
|
||||
|
||||
// Vector Load/Store Whole Registers
|
||||
// https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#79-vector-loadstore-whole-register-instructions
|
||||
|
@ -325,7 +325,7 @@ Elf64_Sym* ElfSymTabLookup(elfheader_t* h, const char* symname)
|
||||
{
|
||||
if(!h->SymTab)
|
||||
return 0;
|
||||
for(int i=0; i<h->numSymTab; ++i) {
|
||||
for(size_t i=0; i<h->numSymTab; ++i) {
|
||||
Elf64_Sym* sym = &h->SymTab[i];
|
||||
int type = ELF64_ST_TYPE(sym->st_info);
|
||||
if(type==STT_FUNC || type==STT_TLS || type==STT_OBJECT) {
|
||||
@ -341,7 +341,7 @@ Elf64_Sym* ElfDynSymLookup(elfheader_t* h, const char* symname)
|
||||
{
|
||||
if(!h->DynSym)
|
||||
return 0;
|
||||
for(int i=0; i<h->numDynSym; ++i) {
|
||||
for(size_t i=0; i<h->numDynSym; ++i) {
|
||||
Elf64_Sym* sym = &h->DynSym[i];
|
||||
int type = ELF64_ST_TYPE(sym->st_info);
|
||||
if(type==STT_FUNC || type==STT_TLS || type==STT_OBJECT) {
|
||||
|
@ -296,7 +296,7 @@ int AllocLoadElfMemory(box64context_t* context, elfheader_t* head, int mainbin)
|
||||
ssize_t new_size = asize + (paddr-new_addr); // so need new_size to compensate
|
||||
while(getProtection(new_addr) && (new_size>0)) {// but then, there might be some overlap
|
||||
uintptr_t diff = ALIGN(new_addr+1) - new_addr; // next page
|
||||
if(diff<new_size)
|
||||
if(diff<(size_t)new_size)
|
||||
new_size -= diff;
|
||||
else
|
||||
new_size = 0;
|
||||
@ -941,7 +941,7 @@ uintptr_t GetLastByte(elfheader_t* h)
|
||||
}
|
||||
|
||||
#ifndef STB_GNU_UNIQUE
|
||||
#define STB_GNU_UNIQUE 10
|
||||
#define STB_GNU_UNIQUE 10
|
||||
#endif
|
||||
|
||||
void checkHookedSymbols(elfheader_t* h); // in mallochook.c
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define PN_XNUM (0xffff)
|
||||
#endif
|
||||
#ifndef DT_GNU_HASH
|
||||
#define DT_GNU_HASH 0x6ffffef5
|
||||
#define DT_GNU_HASH 0x6ffffef5
|
||||
#endif
|
||||
|
||||
int LoadSH(FILE *f, Elf64_Shdr *s, void** SH, const char* name, uint32_t type)
|
||||
@ -405,4 +405,4 @@ const char* BindSym(int bind)
|
||||
static char tmp[50];
|
||||
sprintf(tmp, "??? 0x%x", bind);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ typedef struct cleanup_s {
|
||||
|
||||
static uint32_t x86emu_parity_tab[8] =
|
||||
{
|
||||
0x96696996,
|
||||
0x69969669,
|
||||
0x69969669,
|
||||
0x96696996,
|
||||
0x69969669,
|
||||
0x96696996,
|
||||
0x96696996,
|
||||
0x69969669,
|
||||
0x96696996,
|
||||
0x69969669,
|
||||
0x69969669,
|
||||
0x96696996,
|
||||
0x69969669,
|
||||
0x96696996,
|
||||
0x96696996,
|
||||
0x69969669,
|
||||
};
|
||||
|
||||
static void internalX64Setup(x64emu_t* emu, box64context_t *context, uintptr_t start, uintptr_t stack, int stacksize, int ownstack)
|
||||
@ -219,20 +219,20 @@ void FreeX64EmuFromStack(x64emu_t **emu)
|
||||
|
||||
void CloneEmu(x64emu_t *newemu, const x64emu_t* emu)
|
||||
{
|
||||
memcpy(newemu->regs, emu->regs, sizeof(emu->regs));
|
||||
memcpy(newemu->regs, emu->regs, sizeof(emu->regs));
|
||||
memcpy(&newemu->ip, &emu->ip, sizeof(emu->ip));
|
||||
memcpy(&newemu->eflags, &emu->eflags, sizeof(emu->eflags));
|
||||
memcpy(&newemu->eflags, &emu->eflags, sizeof(emu->eflags));
|
||||
newemu->old_ip = emu->old_ip;
|
||||
memcpy(newemu->segs, emu->segs, sizeof(emu->segs));
|
||||
memset(newemu->segs_serial, 0, sizeof(newemu->segs_serial));
|
||||
memcpy(newemu->x87, emu->x87, sizeof(emu->x87));
|
||||
memcpy(newemu->mmx, emu->mmx, sizeof(emu->mmx));
|
||||
memcpy(newemu->x87, emu->x87, sizeof(emu->x87));
|
||||
memcpy(newemu->mmx, emu->mmx, sizeof(emu->mmx));
|
||||
memcpy(newemu->fpu_ld, emu->fpu_ld, sizeof(emu->fpu_ld));
|
||||
memcpy(newemu->fpu_ll, emu->fpu_ll, sizeof(emu->fpu_ll));
|
||||
newemu->fpu_tags = emu->fpu_tags;
|
||||
newemu->cw = emu->cw;
|
||||
newemu->sw = emu->sw;
|
||||
newemu->top = emu->top;
|
||||
newemu->cw = emu->cw;
|
||||
newemu->sw = emu->sw;
|
||||
newemu->top = emu->top;
|
||||
newemu->fpu_stack = emu->fpu_stack;
|
||||
memcpy(newemu->xmm, emu->xmm, sizeof(emu->xmm));
|
||||
memcpy(newemu->ymm, emu->ymm, sizeof(emu->ymm));
|
||||
@ -254,23 +254,23 @@ void CloneEmu(x64emu_t *newemu, const x64emu_t* emu)
|
||||
|
||||
void CopyEmu(x64emu_t *newemu, const x64emu_t* emu)
|
||||
{
|
||||
memcpy(newemu->regs, emu->regs, sizeof(emu->regs));
|
||||
memcpy(newemu->regs, emu->regs, sizeof(emu->regs));
|
||||
memcpy(&newemu->ip, &emu->ip, sizeof(emu->ip));
|
||||
memcpy(&newemu->eflags, &emu->eflags, sizeof(emu->eflags));
|
||||
memcpy(&newemu->eflags, &emu->eflags, sizeof(emu->eflags));
|
||||
newemu->old_ip = emu->old_ip;
|
||||
memcpy(newemu->segs, emu->segs, sizeof(emu->segs));
|
||||
memcpy(newemu->segs_serial, emu->segs_serial, sizeof(emu->segs_serial));
|
||||
memcpy(newemu->segs_offs, emu->segs_offs, sizeof(emu->segs_offs));
|
||||
memcpy(newemu->x87, emu->x87, sizeof(emu->x87));
|
||||
memcpy(newemu->mmx, emu->mmx, sizeof(emu->mmx));
|
||||
memcpy(newemu->x87, emu->x87, sizeof(emu->x87));
|
||||
memcpy(newemu->mmx, emu->mmx, sizeof(emu->mmx));
|
||||
memcpy(newemu->xmm, emu->xmm, sizeof(emu->xmm));
|
||||
memcpy(newemu->ymm, emu->ymm, sizeof(emu->ymm));
|
||||
memcpy(newemu->fpu_ld, emu->fpu_ld, sizeof(emu->fpu_ld));
|
||||
memcpy(newemu->fpu_ll, emu->fpu_ll, sizeof(emu->fpu_ll));
|
||||
newemu->fpu_tags = emu->fpu_tags;
|
||||
newemu->cw = emu->cw;
|
||||
newemu->sw = emu->sw;
|
||||
newemu->top = emu->top;
|
||||
newemu->cw = emu->cw;
|
||||
newemu->sw = emu->sw;
|
||||
newemu->top = emu->top;
|
||||
newemu->fpu_stack = emu->fpu_stack;
|
||||
newemu->df = emu->df;
|
||||
newemu->df_sav = emu->df_sav;
|
||||
@ -623,10 +623,9 @@ static inline uint64_t readCycleCounter()
|
||||
static inline uint64_t readFreq()
|
||||
{
|
||||
static size_t val = -1;
|
||||
if (val != -1) return val;
|
||||
|
||||
val = readBinarySizeFromFile("/sys/firmware/devicetree/base/cpus/timebase-frequency");
|
||||
if (val != -1) return val;
|
||||
if (val != (size_t)-1) return val;
|
||||
|
||||
// fallback to rdtime + sleep
|
||||
struct timespec ts;
|
||||
|
@ -58,19 +58,19 @@ typedef struct emu_flags_s {
|
||||
|
||||
typedef struct x64emu_s {
|
||||
// cpu
|
||||
reg64_t regs[16];
|
||||
x64flags_t eflags;
|
||||
reg64_t regs[16];
|
||||
x64flags_t eflags;
|
||||
reg64_t ip;
|
||||
// sse
|
||||
sse_regs_t xmm[16];
|
||||
sse_regs_t ymm[16];
|
||||
// fpu / mmx
|
||||
mmx87_regs_t x87[8];
|
||||
mmx87_regs_t mmx[8];
|
||||
x87flags_t sw;
|
||||
uint32_t top; // top is part of sw, but it's faster to have it separately
|
||||
mmx87_regs_t x87[8];
|
||||
mmx87_regs_t mmx[8];
|
||||
x87flags_t sw;
|
||||
uint32_t top; // top is part of sw, but it's faster to have it separately
|
||||
int fpu_stack;
|
||||
x87control_t cw;
|
||||
x87control_t cw;
|
||||
uint16_t dummy_cw; // align...
|
||||
mmxcontrol_t mxcsr;
|
||||
#ifdef RV64 // it would be better to use a dedicated register for this like arm64 xSavedSP, but we're running of of free registers.
|
||||
|
@ -65,10 +65,10 @@ int Run(x64emu_t *emu, int step)
|
||||
//ref opcode: http://ref.x64asm.net/geek32.html#xA1
|
||||
printf_log(LOG_DEBUG, "Run X86 (%p), RIP=%p, Stack=%p is32bits=%d\n", emu, (void*)addr, (void*)R_RSP, is32bits);
|
||||
|
||||
x64emurun:
|
||||
#ifdef TEST_INTERPRETER
|
||||
test->memsize = 0;
|
||||
#else
|
||||
x64emurun:
|
||||
while(1)
|
||||
#endif
|
||||
{
|
||||
@ -275,7 +275,7 @@ x64emurun:
|
||||
goto fini;
|
||||
}
|
||||
break;
|
||||
case 0x2E: /* segments are ignored */
|
||||
case 0x2E: /* segments are ignored */
|
||||
case 0x26:
|
||||
case 0x36: /* SS: (ignored) */
|
||||
break;
|
||||
|
@ -26,23 +26,23 @@
|
||||
|
||||
static uint8_t ff_mult(uint8_t a, uint8_t b)
|
||||
{
|
||||
int retval = 0;
|
||||
int retval = 0;
|
||||
|
||||
for(int i = 0; i < 8; i++) {
|
||||
if((b & 1) == 1)
|
||||
retval ^= a;
|
||||
for(int i = 0; i < 8; i++) {
|
||||
if((b & 1) == 1)
|
||||
retval ^= a;
|
||||
|
||||
if((a & 0x80)) {
|
||||
a <<= 1;
|
||||
a ^= 0x1b;
|
||||
} else {
|
||||
a <<= 1;
|
||||
}
|
||||
if((a & 0x80)) {
|
||||
a <<= 1;
|
||||
a ^= 0x1b;
|
||||
} else {
|
||||
a <<= 1;
|
||||
}
|
||||
|
||||
b >>= 1;
|
||||
}
|
||||
b >>= 1;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef TEST_INTERPRETER
|
||||
@ -816,7 +816,7 @@ uintptr_t Run660F(x64emu_t *emu, rex_t rex, uintptr_t addr)
|
||||
nextop = F8;
|
||||
GETED(0);
|
||||
GETGD;
|
||||
CHECK_FLAGS(emu);
|
||||
CHECK_FLAGS(emu);
|
||||
if(rex.w) {
|
||||
if (ACCESS_FLAG(F_CF)) {
|
||||
tmp64u = 1 + (GD->q[0] & 0xFFFFFFFF) + (ED->q[0] & 0xFFFFFFFF);
|
||||
@ -834,7 +834,7 @@ uintptr_t Run660F(x64emu_t *emu, rex_t rex, uintptr_t addr)
|
||||
GD->q[0] = 1LL + GD->dword[0] + ED->dword[0];
|
||||
else
|
||||
GD->q[0] = (uint64_t)GD->dword[0] + ED->dword[0];
|
||||
CONDITIONAL_SET_FLAG(GD->q[0] & 0x100000000LL, F_CF);
|
||||
CONDITIONAL_SET_FLAG(GD->q[0] & 0x100000000LL, F_CF);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -139,6 +139,7 @@ uintptr_t Run66F0(x64emu_t *emu, rex_t rex, uintptr_t addr)
|
||||
GETEW(0); \
|
||||
GETGW; \
|
||||
GW->word[0] = OP##16(emu, GW->word[0], EW->word[0]); \
|
||||
break; \
|
||||
case B+5: \
|
||||
R_AX = OP##16(emu, R_AX, F16); \
|
||||
break;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "bridge.h"
|
||||
|
||||
#define PARITY(x) (((emu->x64emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0)
|
||||
#define XOR2(x) (((x) ^ ((x)>>1)) & 0x1)
|
||||
#define XOR2(x) (((x) ^ ((x)>>1)) & 0x1)
|
||||
|
||||
#ifdef ANDROID
|
||||
void EXPORT my___libc_init(x64emu_t* emu, void* raw_args , void (*onexit)(void) , int (*main)(int, char**, char**), void const * const structors )
|
||||
@ -865,29 +865,29 @@ void UpdateFlags(x64emu_t *emu)
|
||||
CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
|
||||
break;
|
||||
case d_cmp32:
|
||||
CONDITIONAL_SET_FLAG(emu->res.u32 & 0x80000000, F_SF);
|
||||
CONDITIONAL_SET_FLAG(!emu->res.u32, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u32 & 0xff), F_PF);
|
||||
bc = (emu->res.u32 & (~emu->op1.u32 | emu->op2.u32)) | (~emu->op1.u32 & emu->op2.u32);
|
||||
CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
|
||||
CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
|
||||
CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u32 & 0x80000000, F_SF);
|
||||
CONDITIONAL_SET_FLAG(!emu->res.u32, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u32 & 0xff), F_PF);
|
||||
bc = (emu->res.u32 & (~emu->op1.u32 | emu->op2.u32)) | (~emu->op1.u32 & emu->op2.u32);
|
||||
CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
|
||||
CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
|
||||
CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
|
||||
break;
|
||||
case d_cmp64:
|
||||
CONDITIONAL_SET_FLAG(emu->res.u64 & 0x8000000000000000LL, F_SF);
|
||||
CONDITIONAL_SET_FLAG(!emu->res.u64, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u64 & 0xff), F_PF);
|
||||
bc = (emu->res.u64 & (~emu->op1.u64 | emu->op2.u64)) | (~emu->op1.u64 & emu->op2.u64);
|
||||
CONDITIONAL_SET_FLAG(bc & 0x8000000000000000LL, F_CF);
|
||||
CONDITIONAL_SET_FLAG(XOR2(bc >> 62), F_OF);
|
||||
CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u64 & 0x8000000000000000LL, F_SF);
|
||||
CONDITIONAL_SET_FLAG(!emu->res.u64, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u64 & 0xff), F_PF);
|
||||
bc = (emu->res.u64 & (~emu->op1.u64 | emu->op2.u64)) | (~emu->op1.u64 & emu->op2.u64);
|
||||
CONDITIONAL_SET_FLAG(bc & 0x8000000000000000LL, F_CF);
|
||||
CONDITIONAL_SET_FLAG(XOR2(bc >> 62), F_OF);
|
||||
CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
|
||||
break;
|
||||
case d_tst8:
|
||||
CLEAR_FLAG(F_OF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u8 & 0x80, F_SF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u8 == 0, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u8 & 0xff), F_PF);
|
||||
CLEAR_FLAG(F_CF);
|
||||
CLEAR_FLAG(F_OF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u8 & 0x80, F_SF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u8 == 0, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u8 & 0xff), F_PF);
|
||||
CLEAR_FLAG(F_CF);
|
||||
break;
|
||||
case d_tst16:
|
||||
CLEAR_FLAG(F_OF);
|
||||
@ -897,18 +897,18 @@ void UpdateFlags(x64emu_t *emu)
|
||||
CLEAR_FLAG(F_CF);
|
||||
break;
|
||||
case d_tst32:
|
||||
CLEAR_FLAG(F_OF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u32 & 0x80000000, F_SF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u32 == 0, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u32 & 0xff), F_PF);
|
||||
CLEAR_FLAG(F_CF);
|
||||
CLEAR_FLAG(F_OF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u32 & 0x80000000, F_SF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u32 == 0, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u32 & 0xff), F_PF);
|
||||
CLEAR_FLAG(F_CF);
|
||||
break;
|
||||
case d_tst64:
|
||||
CLEAR_FLAG(F_OF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u64 & 0x8000000000000000LL, F_SF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u64 == 0, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u64 & 0xff), F_PF);
|
||||
CLEAR_FLAG(F_CF);
|
||||
CLEAR_FLAG(F_OF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u64 & 0x8000000000000000LL, F_SF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u64 == 0, F_ZF);
|
||||
CONDITIONAL_SET_FLAG(PARITY(emu->res.u64 & 0xff), F_PF);
|
||||
CLEAR_FLAG(F_CF);
|
||||
break;
|
||||
case d_adc8:
|
||||
CONDITIONAL_SET_FLAG(emu->res.u16 & 0x100, F_CF);
|
||||
@ -1007,25 +1007,25 @@ void UpdateFlags(x64emu_t *emu)
|
||||
if(emu->op2.u8 == 1) {
|
||||
CONDITIONAL_SET_FLAG((emu->res.u8 + (emu->res.u8 >> 7)) & 1, F_OF);
|
||||
}
|
||||
CONDITIONAL_SET_FLAG(emu->res.u8 & 0x1, F_CF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u8 & 0x1, F_CF);
|
||||
break;
|
||||
case d_rol16:
|
||||
if(emu->op2.u16 == 1) {
|
||||
CONDITIONAL_SET_FLAG((emu->res.u16 + (emu->res.u16 >> 15)) & 1, F_OF);
|
||||
}
|
||||
CONDITIONAL_SET_FLAG(emu->res.u16 & 0x1, F_CF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u16 & 0x1, F_CF);
|
||||
break;
|
||||
case d_rol32:
|
||||
if(emu->op2.u32 == 1) {
|
||||
CONDITIONAL_SET_FLAG((emu->res.u32 + (emu->res.u32 >> 31)) & 1, F_OF);
|
||||
}
|
||||
CONDITIONAL_SET_FLAG(emu->res.u32 & 0x1, F_CF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u32 & 0x1, F_CF);
|
||||
break;
|
||||
case d_rol64:
|
||||
if(emu->op2.u64 == 1) {
|
||||
CONDITIONAL_SET_FLAG((emu->res.u64 + (emu->res.u64 >> 63)) & 1, F_OF);
|
||||
}
|
||||
CONDITIONAL_SET_FLAG(emu->res.u64 & 0x1, F_CF);
|
||||
CONDITIONAL_SET_FLAG(emu->res.u64 & 0x1, F_CF);
|
||||
break;
|
||||
case d_ror8:
|
||||
if(emu->op2.u8 == 1) {
|
||||
|
@ -145,11 +145,11 @@ uintptr_t RunAVX_0F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
|
||||
tmp32u = VD->byte[0]; // start
|
||||
if(rex.w) {
|
||||
GD->q[0] = ED->q[0];
|
||||
if(tmp32u<64) GD->q[0] &= ~((-1LL<<tmp32u));
|
||||
if(tmp32u<64) GD->q[0] &= ~((((uint64_t)-1)<<tmp32u));
|
||||
CONDITIONAL_SET_FLAG((tmp32u>63), F_CF);
|
||||
} else {
|
||||
GD->q[0] = ED->dword[0];
|
||||
if(tmp32u<32) GD->dword[0] &= ~((-1<<tmp32u));
|
||||
if(tmp32u<32) GD->dword[0] &= ~((((uint64_t)-1)<<tmp32u));
|
||||
CONDITIONAL_SET_FLAG((tmp32u>31), F_CF);
|
||||
}
|
||||
CONDITIONAL_SET_FLAG(rex.w?(GD->q[0]==0):(GD->dword[0]==0), F_ZF);
|
||||
|
@ -963,7 +963,7 @@ uintptr_t RunAVX_660F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
|
||||
switch((nextop>>3)&7) {
|
||||
case 2: /* VPSRLQ Vx, Ex, Ib */
|
||||
tmp8u = F8;
|
||||
if(tmp8u>63) VX->u128;
|
||||
if(tmp8u>63) VX->u128 = 0;
|
||||
else
|
||||
{VX->q[0] = EX->q[0] >> tmp8u; VX->q[1] = EX->q[1] >> tmp8u;}
|
||||
if(vex.l) {
|
||||
|
@ -32,23 +32,23 @@
|
||||
|
||||
static uint8_t ff_mult(uint8_t a, uint8_t b)
|
||||
{
|
||||
int retval = 0;
|
||||
int retval = 0;
|
||||
|
||||
for(int i = 0; i < 8; i++) {
|
||||
if((b & 1) == 1)
|
||||
retval ^= a;
|
||||
for(int i = 0; i < 8; i++) {
|
||||
if((b & 1) == 1)
|
||||
retval ^= a;
|
||||
|
||||
if((a & 0x80)) {
|
||||
a <<= 1;
|
||||
a ^= 0x1b;
|
||||
} else {
|
||||
a <<= 1;
|
||||
}
|
||||
if((a & 0x80)) {
|
||||
a <<= 1;
|
||||
a ^= 0x1b;
|
||||
} else {
|
||||
a <<= 1;
|
||||
}
|
||||
|
||||
b >>= 1;
|
||||
}
|
||||
b >>= 1;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef TEST_INTERPRETER
|
||||
|
@ -527,7 +527,7 @@ uintptr_t RunAVX_660F3A(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
|
||||
tmp8u = F8;
|
||||
if(tmp8u&1) {
|
||||
GY->u128 = EX->u128;
|
||||
if(GX!=VX);
|
||||
if(GX!=VX)
|
||||
GX->u128 = VX->u128;
|
||||
} else {
|
||||
GX->u128 = EX->u128;
|
||||
@ -625,7 +625,7 @@ uintptr_t RunAVX_660F3A(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
|
||||
tmp8u = F8;
|
||||
if(tmp8u&1) {
|
||||
GY->u128 = EX->u128;
|
||||
if(GX!=VX);
|
||||
if(GX!=VX)
|
||||
GX->u128 = VX->u128;
|
||||
} else {
|
||||
GX->u128 = EX->u128;
|
||||
|
@ -70,14 +70,14 @@ uintptr_t RunAVX_F30F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step)
|
||||
for(int i=0; i<64; ++i)
|
||||
if(ED->q[0]&(1LL<<i))
|
||||
tmp64u |= ((VD->q[0]>>i)&1LL)<<(u8++);
|
||||
GD->q[0] = tmp64u;
|
||||
GD->q[0] = tmp64u;
|
||||
} else {
|
||||
tmp32u = 0;
|
||||
u8 = 0;
|
||||
for(int i=0; i<32; ++i)
|
||||
if(ED->dword[0]&(1<<i))
|
||||
tmp32u |= ((VD->dword[0]>>i)&1)<<(u8++);
|
||||
GD->q[0] = tmp32u;
|
||||
GD->q[0] = tmp32u;
|
||||
}
|
||||
break;
|
||||
case 0xF7: /* SARX Gd, Ed, Vd */
|
||||
|
@ -963,8 +963,8 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
|
||||
case 0: if(((uintptr_t)ED)&3) {
|
||||
// unaligned case
|
||||
do { tmp32u2 = native_lock_read_b(ED); tmp32u2=ED->dword[0]; tmp32u2 = add32(emu, tmp32u2, tmp64u);} while(native_lock_write_b(ED, tmp32u2)); ED->dword[0]=tmp32u2; break;
|
||||
} else
|
||||
do { tmp32u2 = native_lock_read_d(ED); tmp32u2 = add32(emu, tmp32u2, tmp64u);} while(native_lock_write_d(ED, tmp32u2)); break;
|
||||
} else {
|
||||
do { tmp32u2 = native_lock_read_d(ED); tmp32u2 = add32(emu, tmp32u2, tmp64u);} while(native_lock_write_d(ED, tmp32u2)); break; }
|
||||
case 1: do { tmp32u2 = native_lock_read_d(ED); tmp32u2 = or32(emu, tmp32u2, tmp64u);} while(native_lock_write_d(ED, tmp32u2)); break;
|
||||
case 2: do { tmp32u2 = native_lock_read_d(ED); tmp32u2 = adc32(emu, tmp32u2, tmp64u);} while(native_lock_write_d(ED, tmp32u2)); break;
|
||||
case 3: do { tmp32u2 = native_lock_read_d(ED); tmp32u2 = sbb32(emu, tmp32u2, tmp64u);} while(native_lock_write_d(ED, tmp32u2)); break;
|
||||
@ -972,8 +972,8 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
|
||||
case 5: if(((uintptr_t)ED)&3) {
|
||||
// unaligned case
|
||||
do { tmp32u2 = native_lock_read_b(ED); tmp32u2=ED->dword[0]; tmp32u2 = sub32(emu, tmp32u2, tmp64u);} while(native_lock_write_b(ED, tmp32u2)); ED->dword[0]=tmp32u2; break;
|
||||
} else
|
||||
do { tmp32u2 = native_lock_read_d(ED); tmp32u2 = sub32(emu, tmp32u2, tmp64u);} while(native_lock_write_d(ED, tmp32u2)); break;
|
||||
} else {
|
||||
do { tmp32u2 = native_lock_read_d(ED); tmp32u2 = sub32(emu, tmp32u2, tmp64u);} while(native_lock_write_d(ED, tmp32u2)); break; }
|
||||
case 6: do { tmp32u2 = native_lock_read_d(ED); tmp32u2 = xor32(emu, tmp32u2, tmp64u);} while(native_lock_write_d(ED, tmp32u2)); break;
|
||||
case 7: cmp32(emu, ED->dword[0], tmp64u); break;
|
||||
}
|
||||
|
@ -367,23 +367,23 @@ typedef struct old_utsname_s {
|
||||
} old_utsname_t;
|
||||
|
||||
//struct x86_pt_regs {
|
||||
// long ebx;
|
||||
// long ecx;
|
||||
// long edx;
|
||||
// long esi;
|
||||
// long edi;
|
||||
// long ebp;
|
||||
// long eax;
|
||||
// int xds;
|
||||
// int xes;
|
||||
// int xfs;
|
||||
// int xgs;
|
||||
// long orig_eax;
|
||||
// long eip;
|
||||
// int xcs;
|
||||
// long eflags;
|
||||
// long esp;
|
||||
// int xss;
|
||||
// long ebx;
|
||||
// long ecx;
|
||||
// long edx;
|
||||
// long esi;
|
||||
// long edi;
|
||||
// long ebp;
|
||||
// long eax;
|
||||
// int xds;
|
||||
// int xes;
|
||||
// int xfs;
|
||||
// int xgs;
|
||||
// long orig_eax;
|
||||
// long eip;
|
||||
// int xcs;
|
||||
// long eflags;
|
||||
// long esp;
|
||||
// int xss;
|
||||
//};
|
||||
|
||||
static int clone_fn(void* arg)
|
||||
@ -657,11 +657,11 @@ void EXPORT x64Syscall(x64emu_t *emu)
|
||||
break;
|
||||
#endif
|
||||
#ifndef __NR_rename
|
||||
case 82: // sys_rename
|
||||
S_RAX = rename((void*)R_RDI, (void*)R_RSI);
|
||||
case 82: // sys_rename
|
||||
S_RAX = rename((void*)R_RDI, (void*)R_RSI);
|
||||
if(S_RAX==-1)
|
||||
S_RAX = -errno;
|
||||
break;
|
||||
break;
|
||||
#endif
|
||||
#ifndef __NR_mkdir
|
||||
case 83: // sys_mkdir
|
||||
|
@ -55,7 +55,7 @@ void x64test_check(x64emu_t* ref, uintptr_t ip)
|
||||
printf_log(LOG_NONE, "RIP: %016zx | %016zx\n", ip, emu->ip.q[0]);
|
||||
}
|
||||
// flags are volatile, so don't test them
|
||||
//memcpy(&ref->eflags, &emu->eflags, sizeof(emu->eflags));
|
||||
//memcpy(&ref->eflags, &emu->eflags, sizeof(emu->eflags));
|
||||
if(memcmp(ref->segs, emu->segs, sizeof(emu->segs))) {
|
||||
static const char* segname[] = {"ES", "CS", "SS", "DS", "FS", "GS"};
|
||||
BANNER;
|
||||
@ -73,7 +73,7 @@ void x64test_check(x64emu_t* ref, uintptr_t ip)
|
||||
BANNER;
|
||||
printf_log(LOG_NONE, "X87 STACK: %d | %d\n", ref->fpu_stack, emu->fpu_stack);
|
||||
}
|
||||
if(ref->fpu_stack && memcmp(ref->x87, emu->x87, sizeof(emu->x87))) {
|
||||
if(ref->fpu_stack && memcmp(ref->x87, emu->x87, sizeof(emu->x87))) {
|
||||
// need to check each regs, unused one might have different left over value
|
||||
for(int i=0; i<ref->fpu_stack; ++i) {
|
||||
if(ref->x87[(ref->top+i)&7].d != emu->x87[(emu->top+i)&7].d) {
|
||||
@ -84,19 +84,19 @@ void x64test_check(x64emu_t* ref, uintptr_t ip)
|
||||
}
|
||||
//memcpy(ref->fpu_ld, emu->fpu_ld, sizeof(emu->fpu_ld));
|
||||
//memcpy(ref->fpu_ll, emu->fpu_ll, sizeof(emu->fpu_ll));
|
||||
if(ref->fpu_tags != emu->fpu_tags) {
|
||||
if(ref->fpu_tags != emu->fpu_tags) {
|
||||
BANNER;
|
||||
printf_log(LOG_NONE, "X87 TAGS: %x | %x\n", ref->fpu_tags, emu->fpu_tags);
|
||||
}
|
||||
if(ref->cw.x16 != emu->cw.x16) {
|
||||
if(ref->cw.x16 != emu->cw.x16) {
|
||||
BANNER;
|
||||
printf_log(LOG_NONE, "X87 CW: %x | %x\n", ref->cw.x16, emu->cw.x16);
|
||||
}
|
||||
if(ref->sw.x16 != emu->sw.x16) {
|
||||
if(ref->sw.x16 != emu->sw.x16) {
|
||||
BANNER;
|
||||
printf_log(LOG_NONE, "X87 SW: %x | %x\n", ref->sw.x16, emu->sw.x16);
|
||||
}
|
||||
if(memcmp(ref->mmx, emu->mmx, sizeof(emu->mmx))) {
|
||||
if(memcmp(ref->mmx, emu->mmx, sizeof(emu->mmx))) {
|
||||
BANNER;
|
||||
for(int i=0; i<8; ++i) {
|
||||
if(ref->mmx[i].q!=emu->mmx[i].q) {
|
||||
@ -183,4 +183,4 @@ void x64test_init()
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
|
||||
pthread_mutex_init(&mutex_global_test, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
}
|
||||
}
|
||||
|
@ -146,17 +146,17 @@ int my_arch_prctl(x64emu_t *emu, int code, void* addr)
|
||||
{
|
||||
printf_log(LOG_DEBUG, "%04d| arch_prctl(%s, %p) (RSP=%p, FS=0x%x, GS=0x%x)\n", GetTID(), arch_prctl_param(code), addr,(void*)R_RSP, emu->segs[_FS], emu->segs[_GS]);
|
||||
|
||||
#define ARCH_SET_GS 0x1001
|
||||
#define ARCH_SET_FS 0x1002
|
||||
#define ARCH_GET_FS 0x1003
|
||||
#define ARCH_GET_GS 0x1004
|
||||
#define ARCH_GET_CPUID 0x1011
|
||||
#define ARCH_SET_CPUID 0x1012
|
||||
#define ARCH_GET_XCOMP_SUPP 0x1021
|
||||
#define ARCH_GET_XCOMP_PERM 0x1022
|
||||
#define ARCH_REQ_XCOMP_PERM 0x1023
|
||||
#define ARCH_GET_XCOMP_GUEST_PERM 0x1024
|
||||
#define ARCH_REQ_XCOMP_GUEST_PERM 0x1025
|
||||
#define ARCH_SET_GS 0x1001
|
||||
#define ARCH_SET_FS 0x1002
|
||||
#define ARCH_GET_FS 0x1003
|
||||
#define ARCH_GET_GS 0x1004
|
||||
#define ARCH_GET_CPUID 0x1011
|
||||
#define ARCH_SET_CPUID 0x1012
|
||||
#define ARCH_GET_XCOMP_SUPP 0x1021
|
||||
#define ARCH_GET_XCOMP_PERM 0x1022
|
||||
#define ARCH_REQ_XCOMP_PERM 0x1023
|
||||
#define ARCH_GET_XCOMP_GUEST_PERM 0x1024
|
||||
#define ARCH_REQ_XCOMP_GUEST_PERM 0x1025
|
||||
int seg = 0;
|
||||
int idx = 0;
|
||||
errno = 0;
|
||||
|
@ -182,23 +182,23 @@ struct mmap_arg_struct {
|
||||
#undef st_mtime
|
||||
|
||||
struct x64_pt_regs {
|
||||
long ebx;
|
||||
long ecx;
|
||||
long edx;
|
||||
long esi;
|
||||
long edi;
|
||||
long ebp;
|
||||
long eax;
|
||||
int xds;
|
||||
int xes;
|
||||
int xfs;
|
||||
int xgs;
|
||||
long orig_eax;
|
||||
long eip;
|
||||
int xcs;
|
||||
long eflags;
|
||||
long esp;
|
||||
int xss;
|
||||
long ebx;
|
||||
long ecx;
|
||||
long edx;
|
||||
long esi;
|
||||
long edi;
|
||||
long ebp;
|
||||
long eax;
|
||||
int xds;
|
||||
int xes;
|
||||
int xfs;
|
||||
int xgs;
|
||||
long orig_eax;
|
||||
long eip;
|
||||
int xcs;
|
||||
long eflags;
|
||||
long esp;
|
||||
int xss;
|
||||
};
|
||||
|
||||
#ifndef __NR_olduname
|
||||
|
@ -85,22 +85,22 @@ void LD2D(void* ld, void* d)
|
||||
*(uint64_t*)d = *(uint64_t*)ld;
|
||||
return;
|
||||
}
|
||||
FPU_t result;
|
||||
FPU_t result;
|
||||
#pragma pack(push, 1)
|
||||
struct {
|
||||
FPU_t f;
|
||||
int16_t b;
|
||||
} val;
|
||||
struct {
|
||||
FPU_t f;
|
||||
int16_t b;
|
||||
} val;
|
||||
#pragma pack(pop)
|
||||
#if 1
|
||||
memcpy(&val, ld, 10);
|
||||
#else
|
||||
val.f.ud[0] = *(uint32_t*)ld;
|
||||
val.f.ud[0] = *(uint32_t*)ld;
|
||||
val.f.ud[1] = *(uint32_t*)(char*)(ld+4);
|
||||
val.b = *(int16_t*)((char*)ld+8);
|
||||
val.b = *(int16_t*)((char*)ld+8);
|
||||
#endif
|
||||
int32_t exp64 = (((uint32_t)(val.b&0x7fff) - BIAS80) + BIAS64);
|
||||
int32_t exp64final = exp64&0x7ff;
|
||||
int32_t exp64 = (((uint32_t)(val.b&0x7fff) - BIAS80) + BIAS64);
|
||||
int32_t exp64final = exp64&0x7ff;
|
||||
// do specific value first (0, infinite...)
|
||||
// bit 63 is "integer part"
|
||||
// bit 62 is sign
|
||||
@ -157,12 +157,12 @@ void LD2D(void* ld, void* d)
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t mant64 = (val.f.q >> 11) & 0xfffffffffffffL;
|
||||
uint32_t sign = (val.b&0x8000)?1:0;
|
||||
uint64_t mant64 = (val.f.q >> 11) & 0xfffffffffffffL;
|
||||
uint32_t sign = (val.b&0x8000)?1:0;
|
||||
result.q = mant64;
|
||||
result.ud[1] |= (sign <<31)|((exp64final&0x7ff) << 20);
|
||||
result.ud[1] |= (sign <<31)|((exp64final&0x7ff) << 20);
|
||||
|
||||
*(uint64_t*)d = result.q;
|
||||
*(uint64_t*)d = result.q;
|
||||
}
|
||||
|
||||
// double (64bits) -> long double (80bits)
|
||||
@ -173,10 +173,10 @@ void D2LD(void* d, void* ld)
|
||||
return;
|
||||
}
|
||||
#pragma pack(push, 1)
|
||||
struct {
|
||||
FPU_t f;
|
||||
int16_t b;
|
||||
} val;
|
||||
struct {
|
||||
FPU_t f;
|
||||
int16_t b;
|
||||
} val;
|
||||
#pragma pack(pop)
|
||||
FPU_t s;
|
||||
s.q = *(uint64_t*)d; // use memcpy to avoid risk of Bus Error?
|
||||
@ -192,11 +192,11 @@ void D2LD(void* d, void* ld)
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t sign80 = (s.ud[1]&0x80000000)?1:0;
|
||||
int32_t exp80 = s.ud[1]&0x7ff00000;
|
||||
int32_t exp80final = (exp80>>20);
|
||||
uint64_t mant80 = s.q&0x000fffffffffffffL;
|
||||
uint64_t mant80final = (mant80 << 11);
|
||||
int32_t sign80 = (s.ud[1]&0x80000000)?1:0;
|
||||
int32_t exp80 = s.ud[1]&0x7ff00000;
|
||||
int32_t exp80final = (exp80>>20);
|
||||
uint64_t mant80 = s.q&0x000fffffffffffffL;
|
||||
uint64_t mant80final = (mant80 << 11);
|
||||
if(exp80final==0x7ff) {
|
||||
// NaN and Infinite
|
||||
exp80final = 0x7fff;
|
||||
@ -216,8 +216,8 @@ void D2LD(void* d, void* ld)
|
||||
mant80final<<=one;
|
||||
}
|
||||
}
|
||||
val.b = ((int16_t)(sign80)<<15)| (int16_t)(exp80final);
|
||||
val.f.q = mant80final;
|
||||
val.b = ((int16_t)(sign80)<<15)| (int16_t)(exp80final);
|
||||
val.f.q = mant80final;
|
||||
memcpy(ld, &val, 10);
|
||||
/*memcpy(ld, &f.ll, 8);
|
||||
memcpy((char*)ld + 8, &val.b, 2);*/
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include "debug.h"
|
||||
typedef struct x64emu_s x64emu_t;
|
||||
|
||||
#define PI 3.14159265358979323846
|
||||
#define L2E 1.4426950408889634
|
||||
#define L2T 3.3219280948873623
|
||||
#define LN2 0.69314718055994531
|
||||
#define LG2 0.3010299956639812
|
||||
#define PI 3.14159265358979323846
|
||||
#define L2E 1.4426950408889634
|
||||
#define L2T 3.3219280948873623
|
||||
#define LN2 0.69314718055994531
|
||||
#define LG2 0.3010299956639812
|
||||
|
||||
#define TAGS_EMPTY 0b1111111111111111
|
||||
|
||||
|
@ -516,7 +516,7 @@ void UnalignStat64(const void* source, void* dest)
|
||||
struct stat *st = (struct stat*) source;
|
||||
|
||||
x64st->__pad0 = 0;
|
||||
memset(x64st->__glibc_reserved, 0, sizeof(x64st->__glibc_reserved));
|
||||
memset(x64st->__glibc_reserved, 0, sizeof(x64st->__glibc_reserved));
|
||||
x64st->st_dev = st->st_dev;
|
||||
x64st->st_ino = st->st_ino;
|
||||
x64st->st_mode = st->st_mode;
|
||||
|
@ -110,11 +110,11 @@ static void* reverse_freefunFct(library_t* lib, void* fct)
|
||||
#if 0
|
||||
struct i386_obstack
|
||||
{
|
||||
long chunk_size;
|
||||
long chunk_size;
|
||||
struct _obstack_chunk *chunk;
|
||||
char *object_base;
|
||||
char *next_free;
|
||||
char *chunk_limit;
|
||||
char *object_base;
|
||||
char *next_free;
|
||||
char *chunk_limit;
|
||||
union
|
||||
{
|
||||
uintptr_t tempint;
|
||||
|
@ -532,7 +532,7 @@ void adjustregs(x64emu_t* emu) {
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
dynarec_log(LOG_INFO, "Checking opcode: rex=%02hhx is32bits=%d, is66=%d %02hhX %02hhX %02hhX %02hhX\n", rex.rex, rex.is32bits, is66, mem[idx+0], mem[idx+1], mem[idx+2], mem[idx+3]);
|
||||
dynarec_log(LOG_INFO, "Checking opcode: rex=%02hhx is32bits=%d, rep=%d is66=%d %02hhX %02hhX %02hhX %02hhX\n", rex.rex, rex.is32bits, rep, is66, mem[idx+0], mem[idx+1], mem[idx+2], mem[idx+3]);
|
||||
#ifdef DYNAREC
|
||||
#ifdef ARM64
|
||||
if(mem[idx+0]==0xA4) {
|
||||
|
@ -278,12 +278,12 @@ extern size_t __strtoul_internal(void*, void*, int, int);
|
||||
extern uint64_t __strtoull_internal(void*, void*, int, int);
|
||||
extern size_t __strtoull_l(void*, void*, int, void*);
|
||||
extern size_t __strxfrm_l(void*, void*, size_t, size_t);
|
||||
//extern void svc_exit(void);
|
||||
//extern void svc_getreq(int);
|
||||
//extern void svc_getreq_common(int);
|
||||
//extern void svc_getreq_poll(struct pollfd *, int);
|
||||
//extern void svc_run(void);
|
||||
//extern void svc_unregister(u_long, u_long);
|
||||
//extern void svc_exit(void);
|
||||
//extern void svc_getreq(int);
|
||||
//extern void svc_getreq_common(int);
|
||||
//extern void svc_getreq_poll(struct pollfd *, int);
|
||||
//extern void svc_run(void);
|
||||
//extern void svc_unregister(u_long, u_long);
|
||||
//extern int __sysctl(void*, int, void*, void*, void*, size_t);
|
||||
//extern int sysctl(void*, int, void*, void*, void*, size_t);
|
||||
extern void thrd_exit(void*);
|
||||
@ -316,4 +316,4 @@ extern char *__xpg_basename(char *__path);
|
||||
//extern int xdr_void();
|
||||
void* dummy_pFLp(size_t a, void* b) {}
|
||||
void* dummy_pFpLLp(void* a, size_t b, size_t c, void* d) {}
|
||||
void* dummy__ZnwmSt11align_val_tRKSt9nothrow_t(size_t a, size_t b, void* c) {}
|
||||
void* dummy__ZnwmSt11align_val_tRKSt9nothrow_t(size_t a, size_t b, void* c) {}
|
||||
|
@ -99,7 +99,7 @@ uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N, const char*
|
||||
|
||||
mutex_lock(&my_context->mutex_bridge);
|
||||
b = bridge->last;
|
||||
if(b->sz == NBRICK) {
|
||||
if(b->sz == (int)NBRICK) {
|
||||
b->next = NewBrick(b->b);
|
||||
b = b->next;
|
||||
bridge->last = b;
|
||||
@ -202,7 +202,7 @@ uintptr_t AddVSyscall(bridge_t* bridge, int num)
|
||||
int sz = -1;
|
||||
mutex_lock(&my_context->mutex_bridge);
|
||||
b = bridge->last;
|
||||
if(b->sz == NBRICK) {
|
||||
if(b->sz == (int)NBRICK) {
|
||||
b->next = NewBrick(b->b);
|
||||
b = b->next;
|
||||
bridge->last = b;
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
int get_cpuMhz()
|
||||
{
|
||||
int MHz = 0;
|
||||
int MHz = 0;
|
||||
char *p = NULL;
|
||||
if((p=getenv("BOX64_CPUMHZ"))) {
|
||||
MHz = atoi(p);
|
||||
@ -69,11 +69,11 @@ int get_cpuMhz()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(!MHz)
|
||||
MHz = 1000; // default to 1Ghz...
|
||||
if(!MHz)
|
||||
MHz = 1000; // default to 1Ghz...
|
||||
sprintf(cpumhz, "%d", MHz);
|
||||
setenv("BOX64_CPUMHZ", cpumhz, 1); // set actual value
|
||||
return MHz;
|
||||
return MHz;
|
||||
}
|
||||
static int nCPU = 0;
|
||||
static double bogoMips = 100.;
|
||||
|
@ -166,9 +166,9 @@ static void* find_OnProcessingPassStartFunc_Fct(void* fct)
|
||||
}
|
||||
typedef struct my_FAudioEngineCallback_s
|
||||
{
|
||||
void* OnCriticalError;
|
||||
void* OnProcessingPassEnd;
|
||||
void* OnProcessingPassStart;
|
||||
void* OnCriticalError;
|
||||
void* OnProcessingPassEnd;
|
||||
void* OnProcessingPassStart;
|
||||
} my_FAudioEngineCallback_t;
|
||||
// OnBufferEndFunc ...
|
||||
#define GO(A) \
|
||||
@ -326,13 +326,13 @@ static void* find_OnVoiceProcessingPassStartFunc_Fct(void* fct)
|
||||
}
|
||||
typedef struct my_FAudioVoiceCallback_s
|
||||
{
|
||||
void* OnBufferEnd;
|
||||
void* OnBufferStart;
|
||||
void* OnLoopEnd;
|
||||
void* OnStreamEnd;
|
||||
void* OnVoiceError;
|
||||
void* OnVoiceProcessingPassEnd;
|
||||
void* OnVoiceProcessingPassStart;
|
||||
void* OnBufferEnd;
|
||||
void* OnBufferStart;
|
||||
void* OnLoopEnd;
|
||||
void* OnStreamEnd;
|
||||
void* OnVoiceError;
|
||||
void* OnVoiceProcessingPassEnd;
|
||||
void* OnVoiceProcessingPassStart;
|
||||
} my_FAudioVoiceCallback_t;
|
||||
// FAudioEngineCallEXT ...
|
||||
#define GO(A) \
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
const char* freetypeName =
|
||||
#ifdef ANDROID
|
||||
"libfreetype.so"
|
||||
"libfreetype.so"
|
||||
#else
|
||||
"libfreetype.so.6"
|
||||
#endif
|
||||
|
@ -2798,7 +2798,7 @@ EXPORT int my_readlinkat(x64emu_t* emu, int fd, void* path, void* buf, size_t bu
|
||||
return readlinkat(fd, path, buf, bufsize);
|
||||
}
|
||||
#ifndef MAP_FIXED_NOREPLACE
|
||||
#define MAP_FIXED_NOREPLACE 0x200000
|
||||
#define MAP_FIXED_NOREPLACE 0x200000
|
||||
#endif
|
||||
#ifndef MAP_32BIT
|
||||
#define MAP_32BIT 0x40
|
||||
@ -3174,9 +3174,9 @@ EXPORT int my_setrlimit(x64emu_t* emu, int ressource, const struct rlimit *rlim)
|
||||
|
||||
#if 0
|
||||
#ifdef PANDORA
|
||||
#define RENAME_NOREPLACE (1 << 0)
|
||||
#define RENAME_EXCHANGE (1 << 1)
|
||||
#define RENAME_WHITEOUT (1 << 2)
|
||||
#define RENAME_NOREPLACE (1 << 0)
|
||||
#define RENAME_EXCHANGE (1 << 1)
|
||||
#define RENAME_WHITEOUT (1 << 2)
|
||||
EXPORT int my_renameat2(int olddirfd, void* oldpath, int newdirfd, void* newpath, uint32_t flags)
|
||||
{
|
||||
// simulate that function, but
|
||||
@ -3209,8 +3209,8 @@ EXPORT int my_renameat2(int olddirfd, void* oldpath, int newdirfd, void* newpath
|
||||
#endif
|
||||
|
||||
#ifndef __NR_memfd_create
|
||||
#define MFD_CLOEXEC 0x0001U
|
||||
#define MFD_ALLOW_SEALING 0x0002U
|
||||
#define MFD_CLOEXEC 0x0001U
|
||||
#define MFD_ALLOW_SEALING 0x0002U
|
||||
EXPORT int my_memfd_create(x64emu_t* emu, void* name, uint32_t flags)
|
||||
{
|
||||
// try to simulate that function
|
||||
@ -3225,7 +3225,7 @@ EXPORT int my_memfd_create(x64emu_t* emu, void* name, uint32_t flags)
|
||||
#endif
|
||||
|
||||
#ifndef GRND_RANDOM
|
||||
#define GRND_RANDOM 0x0002
|
||||
#define GRND_RANDOM 0x0002
|
||||
#endif
|
||||
EXPORT int my_getentropy(x64emu_t* emu, void* buffer, size_t length)
|
||||
{
|
||||
|
@ -27,29 +27,29 @@ const char* libsmName = "libSM.so.6";
|
||||
|
||||
typedef struct my_SmcCallbacks_s {
|
||||
struct {
|
||||
void* callback;
|
||||
void* client_data;
|
||||
void* callback;
|
||||
void* client_data;
|
||||
} save_yourself;
|
||||
|
||||
struct {
|
||||
void* callback;
|
||||
void* client_data;
|
||||
void* callback;
|
||||
void* client_data;
|
||||
} die;
|
||||
|
||||
struct {
|
||||
void* callback;
|
||||
void* client_data;
|
||||
void* callback;
|
||||
void* client_data;
|
||||
} save_complete;
|
||||
|
||||
struct {
|
||||
void* callback;
|
||||
void* client_data;
|
||||
void* callback;
|
||||
void* client_data;
|
||||
} shutdown_cancelled;
|
||||
} my_SmcCallbacks_t;
|
||||
#define SmcSaveYourselfProcMask (1L << 0)
|
||||
#define SmcDieProcMask (1L << 1)
|
||||
#define SmcSaveCompleteProcMask (1L << 2)
|
||||
#define SmcShutdownCancelledProcMask (1L << 3)
|
||||
#define SmcSaveYourselfProcMask (1L << 0)
|
||||
#define SmcDieProcMask (1L << 1)
|
||||
#define SmcSaveCompleteProcMask (1L << 2)
|
||||
#define SmcShutdownCancelledProcMask (1L << 3)
|
||||
|
||||
static uintptr_t my_save_yourself_fct = 0;
|
||||
static void my_save_yourself(void* smcConn, void* clientData, int saveType, int shutdown, int interactStyle, int fast)
|
||||
|
@ -944,7 +944,7 @@ GO(XSetIconName, iFppp)
|
||||
GO(XSetIconSizes, iFpLpi)
|
||||
GOM(XSetICValues, pFEpV) // use vaarg
|
||||
//GO(_XSetImage,
|
||||
GOM(XSetIMValues, pFEpV) // use vaarg
|
||||
GOM(XSetIMValues, pFEpV) // use vaarg
|
||||
GO(XSetInputFocus, iFpLiL)
|
||||
GOM(XSetIOErrorHandler, pFEp)
|
||||
GO(_XSetLastRequestRead, uFpp)
|
||||
|
@ -26,30 +26,30 @@ const char* lzmaName = "liblzma.so.5";
|
||||
#include "wrappercallback.h"
|
||||
|
||||
typedef struct lzma_allocator_s {
|
||||
void *(*alloc)(void *opaque, size_t nmemb, size_t size);
|
||||
void (*free)(void *opaque, void *ptr);
|
||||
void *opaque;
|
||||
void *(*alloc)(void *opaque, size_t nmemb, size_t size);
|
||||
void (*free)(void *opaque, void *ptr);
|
||||
void *opaque;
|
||||
} lzma_allocator_t;
|
||||
|
||||
typedef struct lzma_stream_s {
|
||||
const uint8_t *next_in;
|
||||
size_t avail_in;
|
||||
uint64_t total_in;
|
||||
uint8_t *next_out;
|
||||
size_t avail_out;
|
||||
uint64_t total_out;
|
||||
lzma_allocator_t *allocator;
|
||||
void* internal;
|
||||
void *reserved_ptr1;
|
||||
void *reserved_ptr2;
|
||||
void *reserved_ptr3;
|
||||
void *reserved_ptr4;
|
||||
uint64_t reserved_int1;
|
||||
uint64_t reserved_int2;
|
||||
size_t reserved_int3;
|
||||
size_t reserved_int4;
|
||||
int reserved_enum1;
|
||||
int reserved_enum2;
|
||||
const uint8_t *next_in;
|
||||
size_t avail_in;
|
||||
uint64_t total_in;
|
||||
uint8_t *next_out;
|
||||
size_t avail_out;
|
||||
uint64_t total_out;
|
||||
lzma_allocator_t *allocator;
|
||||
void* internal;
|
||||
void *reserved_ptr1;
|
||||
void *reserved_ptr2;
|
||||
void *reserved_ptr3;
|
||||
void *reserved_ptr4;
|
||||
uint64_t reserved_int1;
|
||||
uint64_t reserved_int2;
|
||||
size_t reserved_int3;
|
||||
size_t reserved_int4;
|
||||
int reserved_enum1;
|
||||
int reserved_enum2;
|
||||
} lzma_stream_t;
|
||||
|
||||
#define SUPER() \
|
||||
|
@ -293,7 +293,7 @@ GO(pa_xrealloc, pFpL)
|
||||
GO(pa_xstrdup, pFp)
|
||||
GO(pa_xstrndup, pFpL)
|
||||
|
||||
GO(pa_stream_begin_write, iFppp) // 0.9.16+
|
||||
GO(pa_stream_begin_write, iFppp) // 0.9.16+
|
||||
GO(pa_stream_cancel_write, iFp) // 0.9.16+
|
||||
|
||||
GO(dummy_io_new, pFpiipp) // dumy function to create Wrapper
|
||||
|
@ -661,19 +661,19 @@ EXPORT void* my2_SDL_GL_GetProcAddress(x64emu_t* emu, void* name)
|
||||
return getGLProcAddress(emu, (glprocaddress_t)my->SDL_GL_GetProcAddress, rname);
|
||||
}
|
||||
|
||||
#define nb_once 16
|
||||
#define nb_once 16
|
||||
typedef void(*sdl2_tls_dtor)(void*);
|
||||
static uintptr_t dtor_emu[nb_once] = {0};
|
||||
static void tls_dtor_callback(int n, void* a)
|
||||
{
|
||||
if(dtor_emu[n]) {
|
||||
if(dtor_emu[n]) {
|
||||
RunFunctionFmt(dtor_emu[n], "p", a);
|
||||
}
|
||||
}
|
||||
}
|
||||
#define GO(N) \
|
||||
void tls_dtor_callback_##N(void* a) \
|
||||
{ \
|
||||
tls_dtor_callback(N, a); \
|
||||
tls_dtor_callback(N, a); \
|
||||
}
|
||||
|
||||
GO(0)
|
||||
@ -694,26 +694,26 @@ GO(14)
|
||||
GO(15)
|
||||
#undef GO
|
||||
static const sdl2_tls_dtor dtor_cb[nb_once] = {
|
||||
tls_dtor_callback_0, tls_dtor_callback_1, tls_dtor_callback_2, tls_dtor_callback_3
|
||||
,tls_dtor_callback_4, tls_dtor_callback_5, tls_dtor_callback_6, tls_dtor_callback_7
|
||||
,tls_dtor_callback_8, tls_dtor_callback_9, tls_dtor_callback_10,tls_dtor_callback_11
|
||||
,tls_dtor_callback_12,tls_dtor_callback_13,tls_dtor_callback_14,tls_dtor_callback_15
|
||||
tls_dtor_callback_0, tls_dtor_callback_1, tls_dtor_callback_2, tls_dtor_callback_3
|
||||
,tls_dtor_callback_4, tls_dtor_callback_5, tls_dtor_callback_6, tls_dtor_callback_7
|
||||
,tls_dtor_callback_8, tls_dtor_callback_9, tls_dtor_callback_10,tls_dtor_callback_11
|
||||
,tls_dtor_callback_12,tls_dtor_callback_13,tls_dtor_callback_14,tls_dtor_callback_15
|
||||
};
|
||||
EXPORT int64_t my2_SDL_TLSSet(x64emu_t* emu, uint64_t id, void* value, void* dtor)
|
||||
{
|
||||
if(!dtor)
|
||||
return my->SDL_TLSSet(id, value, NULL);
|
||||
int n = 0;
|
||||
while (n<nb_once) {
|
||||
if(!dtor_emu[n] || (dtor_emu[n])==((uintptr_t)dtor)) {
|
||||
dtor_emu[n] = (uintptr_t)dtor;
|
||||
return my->SDL_TLSSet(id, value, dtor_cb[n]);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
printf_log(LOG_NONE, "Error: SDL2 SDL_TLSSet with destructor: no more slot!\n");
|
||||
//emu->quit = 1;
|
||||
return -1;
|
||||
if(!dtor)
|
||||
return my->SDL_TLSSet(id, value, NULL);
|
||||
int n = 0;
|
||||
while (n<nb_once) {
|
||||
if(!dtor_emu[n] || (dtor_emu[n])==((uintptr_t)dtor)) {
|
||||
dtor_emu[n] = (uintptr_t)dtor;
|
||||
return my->SDL_TLSSet(id, value, dtor_cb[n]);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
printf_log(LOG_NONE, "Error: SDL2 SDL_TLSSet with destructor: no more slot!\n");
|
||||
//emu->quit = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
EXPORT void my2_SDL_AddEventWatch(x64emu_t* emu, void* p, void* userdata)
|
||||
|
@ -41,11 +41,11 @@ typedef struct my_wl_registry_listener_s {
|
||||
} my_wl_registry_listener_t;
|
||||
#define GO(A) \
|
||||
static my_wl_registry_listener_t* ref_wl_registry_listener_##A = NULL; \
|
||||
static void* my_wl_registry_listener_global_##A(void* a, void* b, uint32_t c, void* d, uint32_t e) \
|
||||
static void my_wl_registry_listener_global_##A(void* a, void* b, uint32_t c, void* d, uint32_t e) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_registry_listener_##A->global, "ppupu", a, b, c, d, e); \
|
||||
} \
|
||||
static void* my_wl_registry_listener_global_remove_##A(void* a, void* b, uint32_t c) \
|
||||
static void my_wl_registry_listener_global_remove_##A(void* a, void* b, uint32_t c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_registry_listener_##A->global_remove, "ppu", a, b, c); \
|
||||
} \
|
||||
@ -74,11 +74,11 @@ typedef struct my_xdg_surface_listener_s {
|
||||
} my_xdg_surface_listener_t;
|
||||
#define GO(A) \
|
||||
static my_xdg_surface_listener_t* ref_xdg_surface_listener_##A = NULL; \
|
||||
static void* my_xdg_surface_listener_configure_##A(void* a, void* b, int c, int d, void* e, uint32_t f) \
|
||||
static void my_xdg_surface_listener_configure_##A(void* a, void* b, int c, int d, void* e, uint32_t f) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_xdg_surface_listener_##A->configure, "ppiipu", a, b, c, d, e, f); \
|
||||
} \
|
||||
static void* my_xdg_surface_listener_close_##A(void* a, void* b) \
|
||||
static void my_xdg_surface_listener_close_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_xdg_surface_listener_##A->close, "pp", a, b); \
|
||||
} \
|
||||
@ -106,18 +106,18 @@ typedef struct my_xdg_toplevel_listener_s {
|
||||
uintptr_t close; //vFpp
|
||||
} my_xdg_toplevel_listener_t;
|
||||
#define GO(A) \
|
||||
static my_xdg_toplevel_listener_t* ref_xdg_toplevel_listener_##A = NULL; \
|
||||
static void* my_xdg_toplevel_listener_configure_##A(void* a, void* b, int c, int d, void* e) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_xdg_toplevel_listener_##A->configure, "ppiip", a, b, c, d, e); \
|
||||
} \
|
||||
static void* my_xdg_toplevel_listener_close_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_xdg_toplevel_listener_##A->close, "pp", a, b); \
|
||||
} \
|
||||
static my_xdg_toplevel_listener_t my_xdg_toplevel_listener_fct_##A = { \
|
||||
(uintptr_t)my_xdg_toplevel_listener_configure_##A, \
|
||||
(uintptr_t)my_xdg_toplevel_listener_close_##A \
|
||||
static my_xdg_toplevel_listener_t* ref_xdg_toplevel_listener_##A = NULL; \
|
||||
static void my_xdg_toplevel_listener_configure_##A(void* a, void* b, int c, int d, void* e) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_xdg_toplevel_listener_##A->configure, "ppiip", a, b, c, d, e); \
|
||||
} \
|
||||
static void my_xdg_toplevel_listener_close_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_xdg_toplevel_listener_##A->close, "pp", a, b); \
|
||||
} \
|
||||
static my_xdg_toplevel_listener_t my_xdg_toplevel_listener_fct_##A = { \
|
||||
(uintptr_t)my_xdg_toplevel_listener_configure_##A, \
|
||||
(uintptr_t)my_xdg_toplevel_listener_close_##A \
|
||||
};
|
||||
SUPER()
|
||||
#undef GO
|
||||
@ -138,13 +138,13 @@ typedef struct my_xdg_wm_base_listener_s {
|
||||
uintptr_t ping; //vFppu
|
||||
} my_xdg_wm_base_listener_t;
|
||||
#define GO(A) \
|
||||
static my_xdg_wm_base_listener_t* ref_xdg_wm_base_listener_##A = NULL; \
|
||||
static void* my_xdg_wm_base_listener_ping_##A(void* a, void* b, uint32_t c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_xdg_wm_base_listener_##A->ping, "ppu", a, b, c); \
|
||||
} \
|
||||
static my_xdg_wm_base_listener_t my_xdg_wm_base_listener_fct_##A = { \
|
||||
(uintptr_t)my_xdg_wm_base_listener_ping_##A, \
|
||||
static my_xdg_wm_base_listener_t* ref_xdg_wm_base_listener_##A = NULL; \
|
||||
static void my_xdg_wm_base_listener_ping_##A(void* a, void* b, uint32_t c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_xdg_wm_base_listener_##A->ping, "ppu", a, b, c); \
|
||||
} \
|
||||
static my_xdg_wm_base_listener_t my_xdg_wm_base_listener_fct_##A = { \
|
||||
(uintptr_t)my_xdg_wm_base_listener_ping_##A, \
|
||||
};
|
||||
SUPER()
|
||||
#undef GO
|
||||
@ -165,13 +165,13 @@ typedef struct my_wl_shm_listener_s {
|
||||
uintptr_t format; //vFppu
|
||||
} my_wl_shm_listener_t;
|
||||
#define GO(A) \
|
||||
static my_wl_shm_listener_t* ref_wl_shm_listener_##A = NULL; \
|
||||
static void* my_wl_shm_listener_format_##A(void* a, void* b, uint32_t c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_shm_listener_##A->format, "ppu", a, b, c); \
|
||||
} \
|
||||
static my_wl_shm_listener_t my_wl_shm_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_shm_listener_format_##A, \
|
||||
static my_wl_shm_listener_t* ref_wl_shm_listener_##A = NULL; \
|
||||
static void my_wl_shm_listener_format_##A(void* a, void* b, uint32_t c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_shm_listener_##A->format, "ppu", a, b, c); \
|
||||
} \
|
||||
static my_wl_shm_listener_t my_wl_shm_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_shm_listener_format_##A, \
|
||||
};
|
||||
SUPER()
|
||||
#undef GO
|
||||
@ -197,38 +197,38 @@ typedef struct my_wl_output_listener_s {
|
||||
uintptr_t description; //vFppp
|
||||
} my_wl_output_listener_t;
|
||||
#define GO(A) \
|
||||
static my_wl_output_listener_t* ref_wl_output_listener_##A = NULL; \
|
||||
static void* my_wl_output_listener_geometry_##A(void* a, void* b, int c, int d, int e, int f, int g, void* h, void* i, int j)\
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->geometry, "ppiiiiippi", a, b, c, d, e, f, g, h, i, j); \
|
||||
} \
|
||||
static void* my_wl_output_listener_mode_##A(void* a, void* b, uint32_t c, int d, int e, int f) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->mode, "ppuiii", a, b, c, d, e, f); \
|
||||
} \
|
||||
static void* my_wl_output_listener_done_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->done, "pp", a, b); \
|
||||
} \
|
||||
static void* my_wl_output_listener_scale_##A(void* a, void* b, int c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->scale, "ppi", a, b, c); \
|
||||
} \
|
||||
static void* my_wl_output_listener_name_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->name, "ppp", a, b, c); \
|
||||
} \
|
||||
static void* my_wl_output_listener_description_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->description, "ppp", a, b, c); \
|
||||
} \
|
||||
static my_wl_output_listener_t my_wl_output_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_output_listener_geometry_##A, \
|
||||
(uintptr_t)my_wl_output_listener_mode_##A, \
|
||||
(uintptr_t)my_wl_output_listener_done_##A, \
|
||||
(uintptr_t)my_wl_output_listener_scale_##A, \
|
||||
(uintptr_t)my_wl_output_listener_name_##A, \
|
||||
(uintptr_t)my_wl_output_listener_description_##A \
|
||||
static my_wl_output_listener_t* ref_wl_output_listener_##A = NULL; \
|
||||
static void my_wl_output_listener_geometry_##A(void* a, void* b, int c, int d, int e, int f, int g, void* h, void* i, int j) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->geometry, "ppiiiiippi", a, b, c, d, e, f, g, h, i, j); \
|
||||
} \
|
||||
static void my_wl_output_listener_mode_##A(void* a, void* b, uint32_t c, int d, int e, int f) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->mode, "ppuiii", a, b, c, d, e, f); \
|
||||
} \
|
||||
static void my_wl_output_listener_done_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->done, "pp", a, b); \
|
||||
} \
|
||||
static void my_wl_output_listener_scale_##A(void* a, void* b, int c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->scale, "ppi", a, b, c); \
|
||||
} \
|
||||
static void my_wl_output_listener_name_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->name, "ppp", a, b, c); \
|
||||
} \
|
||||
static void my_wl_output_listener_description_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_output_listener_##A->description, "ppp", a, b, c); \
|
||||
} \
|
||||
static my_wl_output_listener_t my_wl_output_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_output_listener_geometry_##A, \
|
||||
(uintptr_t)my_wl_output_listener_mode_##A, \
|
||||
(uintptr_t)my_wl_output_listener_done_##A, \
|
||||
(uintptr_t)my_wl_output_listener_scale_##A, \
|
||||
(uintptr_t)my_wl_output_listener_name_##A, \
|
||||
(uintptr_t)my_wl_output_listener_description_##A \
|
||||
};
|
||||
SUPER()
|
||||
#undef GO
|
||||
@ -250,18 +250,18 @@ typedef struct my_wl_seat_listener_s {
|
||||
uintptr_t name; //vFppp
|
||||
} my_wl_seat_listener_t;
|
||||
#define GO(A) \
|
||||
static my_wl_seat_listener_t* ref_wl_seat_listener_##A = NULL; \
|
||||
static void* my_wl_seat_listener_capabilities_##A(void* a, void* b, uint32_t c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_seat_listener_##A->capabilities, "ppu", a, b, c); \
|
||||
} \
|
||||
static void* my_wl_seat_listener_name_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_seat_listener_##A->name, "ppp", a, b, c); \
|
||||
} \
|
||||
static my_wl_seat_listener_t my_wl_seat_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_seat_listener_capabilities_##A, \
|
||||
(uintptr_t)my_wl_seat_listener_name_##A \
|
||||
static my_wl_seat_listener_t* ref_wl_seat_listener_##A = NULL; \
|
||||
static void my_wl_seat_listener_capabilities_##A(void* a, void* b, uint32_t c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_seat_listener_##A->capabilities, "ppu", a, b, c); \
|
||||
} \
|
||||
static void my_wl_seat_listener_name_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_seat_listener_##A->name, "ppp", a, b, c); \
|
||||
} \
|
||||
static my_wl_seat_listener_t my_wl_seat_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_seat_listener_capabilities_##A, \
|
||||
(uintptr_t)my_wl_seat_listener_name_##A \
|
||||
};
|
||||
SUPER()
|
||||
#undef GO
|
||||
@ -292,63 +292,63 @@ typedef struct my_wl_pointer_listener_s {
|
||||
uintptr_t axis_relative_direction; //vFppuu
|
||||
} my_wl_pointer_listener_t;
|
||||
#define GO(A) \
|
||||
static my_wl_pointer_listener_t* ref_wl_pointer_listener_##A = NULL; \
|
||||
static void* my_wl_pointer_listener_enter_##A(void* a, void* b, uint32_t c, void* d, int e, int f) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->enter, "ppupii", a, b, c, d, e, f); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_leave_##A(void* a, void* b, uint32_t c, void* d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->leave, "ppup", a, b, c, d); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_motion_##A(void* a, void* b, uint32_t c, int d, int e) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->motion, "ppuii", a, b, c, d, e); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_button_##A(void* a, void* b, uint32_t c, uint32_t d, uint32_t e, uint32_t f)\
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->button, "ppuuuu", a, b, c, d, e, f); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_axis_##A(void* a, void* b, uint32_t c, uint32_t d, int e) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis, "ppuui", a, b, c, d, e); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_frame_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->frame, "pp", a, b); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_axis_source_##A(void* a, void* b, uint32_t c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_source, "ppu", a, b, c); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_axis_stop_##A(void* a, void* b, uint32_t c, uint32_t d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_stop, "ppuu", a, b, c, d); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_axis_discrete_##A(void* a, void* b, uint32_t c, int d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_discrete, "ppui", a, b, c, d); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_axis_value120_##A(void* a, void* b, uint32_t c, int d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_value120, "ppui", a, b, c, d); \
|
||||
} \
|
||||
static void* my_wl_pointer_listener_axis_relative_direction_##A(void* a, void* b, uint32_t c, uint32_t d)\
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_relative_direction, "ppuu", a, b, c, d); \
|
||||
} \
|
||||
static my_wl_pointer_listener_t my_wl_pointer_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_pointer_listener_enter_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_leave_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_motion_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_button_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_frame_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_source_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_stop_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_discrete_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_value120_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_relative_direction_##A \
|
||||
static my_wl_pointer_listener_t* ref_wl_pointer_listener_##A = NULL; \
|
||||
static void my_wl_pointer_listener_enter_##A(void* a, void* b, uint32_t c, void* d, int e, int f) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->enter, "ppupii", a, b, c, d, e, f); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_leave_##A(void* a, void* b, uint32_t c, void* d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->leave, "ppup", a, b, c, d); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_motion_##A(void* a, void* b, uint32_t c, int d, int e) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->motion, "ppuii", a, b, c, d, e); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_button_##A(void* a, void* b, uint32_t c, uint32_t d, uint32_t e, uint32_t f) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->button, "ppuuuu", a, b, c, d, e, f); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_axis_##A(void* a, void* b, uint32_t c, uint32_t d, int e) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis, "ppuui", a, b, c, d, e); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_frame_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->frame, "pp", a, b); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_axis_source_##A(void* a, void* b, uint32_t c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_source, "ppu", a, b, c); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_axis_stop_##A(void* a, void* b, uint32_t c, uint32_t d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_stop, "ppuu", a, b, c, d); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_axis_discrete_##A(void* a, void* b, uint32_t c, int d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_discrete, "ppui", a, b, c, d); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_axis_value120_##A(void* a, void* b, uint32_t c, int d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_value120, "ppui", a, b, c, d); \
|
||||
} \
|
||||
static void my_wl_pointer_listener_axis_relative_direction_##A(void* a, void* b, uint32_t c, uint32_t d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_pointer_listener_##A->axis_relative_direction, "ppuu", a, b, c, d); \
|
||||
} \
|
||||
static my_wl_pointer_listener_t my_wl_pointer_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_pointer_listener_enter_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_leave_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_motion_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_button_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_frame_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_source_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_stop_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_discrete_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_value120_##A, \
|
||||
(uintptr_t)my_wl_pointer_listener_axis_relative_direction_##A \
|
||||
};
|
||||
SUPER()
|
||||
#undef GO
|
||||
@ -374,38 +374,38 @@ typedef struct my_wl_keyboard_listener_s {
|
||||
uintptr_t repeat_info; //vFppii
|
||||
} my_wl_keyboard_listener_t;
|
||||
#define GO(A) \
|
||||
static my_wl_keyboard_listener_t* ref_wl_keyboard_listener_##A = NULL; \
|
||||
static void* my_wl_keyboard_listener_keymap_##A(void* a, void* b, uint32_t c, int d, uint32_t e) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->keymap, "ppuiu", a, b, c, d, e); \
|
||||
} \
|
||||
static void* my_wl_keyboard_listener_enter_##A(void* a, void* b, uint32_t c, void* d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->enter, "ppup", a, b, c, d); \
|
||||
} \
|
||||
static void* my_wl_keyboard_listener_leave_##A(void* a, void* b, uint32_t c, void* d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->leave, "ppup", a, b, c, d); \
|
||||
} \
|
||||
static void* my_wl_keyboard_listener_key_##A(void* a, void* b, uint32_t c, uint32_t d, uint32_t e, uint32_t f, uint32_t g)\
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->key, "ppuuuuu", a, b, c, d, e, f, g); \
|
||||
} \
|
||||
static void* my_wl_keyboard_listener_modifiers_##A(void* a, void* b, uint32_t c, uint32_t d, uint32_t e, uint32_t f, uint32_t g)\
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->modifiers, "ppuuuuu", a, b, c, d, e, f, g); \
|
||||
} \
|
||||
static void* my_wl_keyboard_listener_repeat_info_##A(void* a, void* b, int c, int d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->repeat_info, "ppii", a, b, c, d); \
|
||||
} \
|
||||
static my_wl_keyboard_listener_t my_wl_keyboard_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_keyboard_listener_keymap_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_enter_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_leave_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_key_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_modifiers_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_repeat_info_##A \
|
||||
static my_wl_keyboard_listener_t* ref_wl_keyboard_listener_##A = NULL; \
|
||||
static void my_wl_keyboard_listener_keymap_##A(void* a, void* b, uint32_t c, int d, uint32_t e) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->keymap, "ppuiu", a, b, c, d, e); \
|
||||
} \
|
||||
static void my_wl_keyboard_listener_enter_##A(void* a, void* b, uint32_t c, void* d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->enter, "ppup", a, b, c, d); \
|
||||
} \
|
||||
static void my_wl_keyboard_listener_leave_##A(void* a, void* b, uint32_t c, void* d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->leave, "ppup", a, b, c, d); \
|
||||
} \
|
||||
static void my_wl_keyboard_listener_key_##A(void* a, void* b, uint32_t c, uint32_t d, uint32_t e, uint32_t f, uint32_t g) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->key, "ppuuuuu", a, b, c, d, e, f, g); \
|
||||
} \
|
||||
static void my_wl_keyboard_listener_modifiers_##A(void* a, void* b, uint32_t c, uint32_t d, uint32_t e, uint32_t f, uint32_t g) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->modifiers, "ppuuuuu", a, b, c, d, e, f, g); \
|
||||
} \
|
||||
static void my_wl_keyboard_listener_repeat_info_##A(void* a, void* b, int c, int d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_keyboard_listener_##A->repeat_info, "ppii", a, b, c, d); \
|
||||
} \
|
||||
static my_wl_keyboard_listener_t my_wl_keyboard_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_keyboard_listener_keymap_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_enter_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_leave_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_key_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_modifiers_##A, \
|
||||
(uintptr_t)my_wl_keyboard_listener_repeat_info_##A \
|
||||
};
|
||||
SUPER()
|
||||
#undef GO
|
||||
@ -426,13 +426,13 @@ typedef struct my_wl_buffer_listener_s {
|
||||
uintptr_t release; //vFpp
|
||||
} my_wl_buffer_listener_t;
|
||||
#define GO(A) \
|
||||
static my_wl_buffer_listener_t* ref_wl_buffer_listener_##A = NULL; \
|
||||
static void* my_wl_buffer_listener_release_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_buffer_listener_##A->release, "pp", a, b); \
|
||||
} \
|
||||
static my_wl_buffer_listener_t my_wl_buffer_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_buffer_listener_release_##A, \
|
||||
static my_wl_buffer_listener_t* ref_wl_buffer_listener_##A = NULL; \
|
||||
static void my_wl_buffer_listener_release_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_wl_buffer_listener_##A->release, "pp", a, b); \
|
||||
} \
|
||||
static my_wl_buffer_listener_t my_wl_buffer_listener_fct_##A = { \
|
||||
(uintptr_t)my_wl_buffer_listener_release_##A, \
|
||||
};
|
||||
SUPER()
|
||||
#undef GO
|
||||
@ -454,7 +454,7 @@ typedef struct my_zwp_relative_pointer_v1_listener_s {
|
||||
} my_zwp_relative_pointer_v1_listener_t;
|
||||
#define GO(A) \
|
||||
static my_zwp_relative_pointer_v1_listener_t* ref_zwp_relative_pointer_v1_listener_##A = NULL; \
|
||||
static void* my_zwp_relative_pointer_v1_listener_relative_motion_##A(void* a, void* b, uint32_t c, uint32_t d, int e, int f, int g, int h) \
|
||||
static void my_zwp_relative_pointer_v1_listener_relative_motion_##A(void* a, void* b, uint32_t c, uint32_t d, int e, int f, int g, int h) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zwp_relative_pointer_v1_listener_##A->relative_motion, "ppuuiiii", a, b, c, d, e, f, g, h); \
|
||||
} \
|
||||
@ -484,33 +484,33 @@ typedef struct my_zxdg_output_v1_listener_s {
|
||||
uintptr_t description; //vFppp
|
||||
} my_zxdg_output_v1_listener_t;
|
||||
#define GO(A) \
|
||||
static my_zxdg_output_v1_listener_t* ref_zxdg_output_v1_listener_##A = NULL; \
|
||||
static void* my_zxdg_output_v1_listener_logical_position_##A(void* a, void* b, int32_t c, int32_t d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->logical_position, "ppii", a, b, c, d); \
|
||||
} \
|
||||
static void* my_zxdg_output_v1_listener_logical_size_##A(void* a, void* b, int32_t c, int32_t d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->logical_size, "ppii", a, b, c, d); \
|
||||
} \
|
||||
static void* my_zxdg_output_v1_listener_done_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->done, "pp", a, b); \
|
||||
} \
|
||||
static void* my_zxdg_output_v1_listener_name_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->name, "ppp", a, b, c); \
|
||||
} \
|
||||
static void* my_zxdg_output_v1_listener_description_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->description, "ppp", a, b, c); \
|
||||
} \
|
||||
static my_zxdg_output_v1_listener_t my_zxdg_output_v1_listener_fct_##A = { \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_logical_position_##A, \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_logical_size_##A, \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_done_##A, \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_name_##A, \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_description_##A, \
|
||||
static my_zxdg_output_v1_listener_t* ref_zxdg_output_v1_listener_##A = NULL; \
|
||||
static void my_zxdg_output_v1_listener_logical_position_##A(void* a, void* b, int32_t c, int32_t d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->logical_position, "ppii", a, b, c, d); \
|
||||
} \
|
||||
static void my_zxdg_output_v1_listener_logical_size_##A(void* a, void* b, int32_t c, int32_t d) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->logical_size, "ppii", a, b, c, d); \
|
||||
} \
|
||||
static void my_zxdg_output_v1_listener_done_##A(void* a, void* b) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->done, "pp", a, b); \
|
||||
} \
|
||||
static void my_zxdg_output_v1_listener_name_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->name, "ppp", a, b, c); \
|
||||
} \
|
||||
static void my_zxdg_output_v1_listener_description_##A(void* a, void* b, void* c) \
|
||||
{ \
|
||||
RunFunctionFmt(ref_zxdg_output_v1_listener_##A->description, "ppp", a, b, c); \
|
||||
} \
|
||||
static my_zxdg_output_v1_listener_t my_zxdg_output_v1_listener_fct_##A = { \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_logical_position_##A, \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_logical_size_##A, \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_done_##A, \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_name_##A, \
|
||||
(uintptr_t)my_zxdg_output_v1_listener_description_##A, \
|
||||
};
|
||||
SUPER()
|
||||
#undef GO
|
||||
@ -562,4 +562,3 @@ EXPORT int my_wl_proxy_add_listener(x64emu_t* emu, void* proxy, void** l, void*
|
||||
}
|
||||
|
||||
#include "wrappedlib_init.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user