Skip to content

Commit

Permalink
Delete existing SSE code
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed May 20, 2019
1 parent 47ea1e8 commit f927039
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 103 deletions.
26 changes: 0 additions & 26 deletions emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,6 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
case 0x4f: TRACEI("cmovnle modrm, reg");
READMODRM; CMOVN(LE, modrm_val, modrm_reg,oz); break;

case 0x57: TRACEI("xorps modrm, reg");
READMODRM; XORP(modrm_val, modrm_reg); break;
case 0x73: TRACEI("psrlq imm8, reg");
// TODO I think this is actually a group
READMODRM; READIMM8; PSRLQ(imm, modrm_val); break;
case 0x76: TRACEI("pcmpeqd reg, modrm");
READMODRM; PCMPEQD(modrm_reg, modrm_val); break;
#if OP_SIZE == 16
case 0x7e: TRACEI("movd xmm, modrm32");
READMODRM; MOVD(modrm_reg, modrm_val); break;
#endif

case 0x80: TRACEI("jo rel\t");
READIMM; J_REL(O, imm); break;
case 0x81: TRACEI("jno rel\t");
Expand Down Expand Up @@ -259,15 +247,6 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
BSWAP(reg_di); break;
#endif

#if OP_SIZE == 16
case 0xd4: TRACEI("paddq modrm, reg");
READMODRM; PADD(modrm_val, modrm_reg); break;
case 0xd6: TRACEI("movq xmm, modrm");
READMODRM; MOVQ(modrm_reg, modrm_val); break;
#endif

case 0xfb: TRACEI("psubq modrm, reg");
READMODRM; PSUB(modrm_val, modrm_reg); break;
default: TRACEI("undefined");
UNDEFINED;
}
Expand Down Expand Up @@ -789,9 +768,6 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
case 0x0f:
READINSN;
switch (insn) {
case 0x2c: TRACEI("cvttsd2si modrm64, reg32");
READMODRM_MEM; // TODO xmm
CVTTSD2SI(mem_addr_real, modrm_reg); break;
case 0x18 ... 0x1f: TRACEI("rep nop modrm\t"); READMODRM; break;
default: TRACE("undefined"); UNDEFINED;
}
Expand All @@ -813,8 +789,6 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
// after a rep prefix, means we have sse/mmx insanity
READINSN;
switch (insn) {
case 0x7e: TRACEI("movq modrm, xmm");
READMODRM; MOVQ(modrm_val, modrm_reg); break;
case 0x18 ... 0x1f: TRACEI("repz nop modrm\t"); READMODRM; break;

// tzcnt is like bsf but the result when the input is zero is defined as the operand size
Expand Down
1 change: 0 additions & 1 deletion emu/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ static bool modrm_compute(struct cpu_state *cpu, struct tlb *tlb, addr_t *addr_o
#define ATOMIC_BTS BTS
#define ATOMIC_BTR BTR
#define ATOMIC_BTC BTC
#include "emu/interp/sse.h"
#include "emu/interp/fpu.h"

// ok now include the decoding function
Expand Down
54 changes: 0 additions & 54 deletions emu/interp/sse.h

This file was deleted.

10 changes: 0 additions & 10 deletions jit/gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,6 @@ void helper_rdtsc(struct cpu_state *cpu);
#define ATOMIC_BTS(bit, val,z) lo(atomic_bts, val, bit, z)
#define ATOMIC_BTR(bit, val,z) lo(atomic_btr, val, bit, z)

// sse
#define XORP(src, dst) UNDEFINED
#define PSRLQ(src, dst) UNDEFINED
#define PCMPEQD(src, dst) UNDEFINED
#define PADD(src, dst) UNDEFINED
#define PSUB(src, dst) UNDEFINED
#define MOVQ(src, dst) UNDEFINED
#define MOVD(src, dst) UNDEFINED
#define CVTTSD2SI(src, dst) UNDEFINED

// fpu
#define st_0 0
#define st_i modrm.rm_opcode
Expand Down
32 changes: 20 additions & 12 deletions kernel/user.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "kernel/calls.h"

int user_read_task(struct task *task, addr_t addr, void *buf, size_t count) {
static int __user_read_task(struct task *task, addr_t addr, void *buf, size_t count) {
char *cbuf = (char *) buf;
size_t i = 0;
while (i < count) {
Expand All @@ -12,11 +12,18 @@ int user_read_task(struct task *task, addr_t addr, void *buf, size_t count) {
return 0;
}

int user_read_task(struct task *task, addr_t addr, void *buf, size_t count) {
read_wrlock(&task->mem->lock);
int res = __user_read_task(task, addr, buf, count);
read_wrunlock(&task->mem->lock);
return res;
}

int user_read(addr_t addr, void *buf, size_t count) {
return user_read_task(current, addr, buf, count);
}

int user_write_task(struct task *task, addr_t addr, const void *buf, size_t count) {
static int __user_write_task(struct task *task, addr_t addr, const void *buf, size_t count) {
const char *cbuf = (const char *) buf;
size_t i = 0;
while (i < count) {
Expand All @@ -28,16 +35,21 @@ int user_write_task(struct task *task, addr_t addr, const void *buf, size_t coun
return 0;
}

int user_write_task(struct task *task, addr_t addr, const void *buf, size_t count) {
read_wrlock(&task->mem->lock);
int res = __user_write_task(task, addr, buf, count);
read_wrunlock(&task->mem->lock);
return res;
}

int user_write(addr_t addr, const void *buf, size_t count) {
return user_write_task(current, addr, buf, count);
}

int user_read_string(addr_t addr, char *buf, size_t max) {
if (addr == 0)
return 1;
size_t i = 0;
while (i < max) {
if (user_read(addr + i, &buf[i], sizeof(buf[i])))
if (__user_read_task(current, addr + i, &buf[i], sizeof(buf[i])))
return 1;
if (buf[i] == '\0')
break;
Expand All @@ -47,15 +59,11 @@ int user_read_string(addr_t addr, char *buf, size_t max) {
}

int user_write_string(addr_t addr, const char *buf) {
if (addr == 0)
return 1;
size_t i = 0;
while (buf[i] != '\0') {
if (user_write(addr + i, &buf[i], sizeof(buf[i])))
do {
if (__user_write_task(current, addr + i, &buf[i], sizeof(buf[i])))
return 1;
i++;
}
if (user_write(addr + i, &buf[i], sizeof(buf[i])))
return 1;
} while (buf[i - 1] != '\0');
return 0;
}

0 comments on commit f927039

Please sign in to comment.