Skip to content

Commit

Permalink
Implement fnclex
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Jun 13, 2020
1 parent 60ec47a commit 7c91012
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions emu/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
case 0xd975: TRACE("fscale"); FSCALE(); break;
case 0xd976: TRACE("fsin"); FSIN(); break;
case 0xd977: TRACE("fcos"); FCOS(); break;
case 0xdb42: TRACE("fnclex"); FCLEX(); break;
case 0xde31: TRACE("fcompp"); FCOM(); FPOP; FPOP; break;
case 0xdf40: TRACE("fnstsw ax"); FSTSW(reg_a); break;
default: TRACE("undefined"); UNDEFINED;
Expand Down
4 changes: 4 additions & 0 deletions emu/fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,7 @@ void fpu_restore32(struct cpu_state *cpu, struct fpu_state32 *state) {
for (int i = 0; i < 8; i++)
memcpy(&ST(i), state->regs[i], 10);
}

void fpu_clex(struct cpu_state *cpu) {
cpu->pe = cpu->ue = cpu->oe = cpu->ze = cpu->de = cpu->ie = cpu->es = cpu->sf = cpu->b = 0;
}
1 change: 1 addition & 0 deletions emu/fpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,6 @@ void fpu_stenv32(struct cpu_state *cpu, struct fpu_env32 *env);
void fpu_ldenv32(struct cpu_state *cpu, struct fpu_env32 *env);
void fpu_save32(struct cpu_state *cpu, struct fpu_state32 *state);
void fpu_restore32(struct cpu_state *cpu, struct fpu_state32 *state);
void fpu_clex(struct cpu_state *cpu);

#endif
1 change: 1 addition & 0 deletions jit/gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ void helper_rdtsc(struct cpu_state *cpu);
#define FLDENV(val,z) h_write(fpu_ldenv, z)
#define FSAVE(val,z) h_write(fpu_save, z)
#define FRESTORE(val,z) h_write(fpu_restore, z)
#define FCLEX() h(fpu_clex)
#define FPOP h(fpu_pop)
#define FINCSTP() h(fpu_incstp)
#define FADD(src, dst) hhh(fpu_add, src, dst)
Expand Down

0 comments on commit 7c91012

Please sign in to comment.