Skip to content

Commit

Permalink
Removed load/store_reg functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ergo720 committed Aug 8, 2024
1 parent a0b273a commit d3b3486
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 49 deletions.
48 changes: 2 additions & 46 deletions lib86cpu/core/emitter/x64/jit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,15 @@ static_assert((LOCAL_VARS_off(0) & 15) == 0); // must be 16 byte aligned so that
#define LD_R8H(dst, reg_offset) MOV(dst, MEMD8(RCX, reg_offset + 1))
#define LD_R16(dst, reg_offset) MOV(dst, MEMD16(RCX, reg_offset))
#define LD_R32(dst, reg_offset) MOV(dst, MEMD32(RCX, reg_offset))
#define LD_REG_val(dst, reg_offset, size) load_reg(dst, reg_offset, size)
#define LD_REG_val(dst, reg_offset, size) MOV(dst, MEMD(RCX, reg_offset, size))
#define LD_SEG(dst, seg_offset) MOV(dst, MEMD16(RCX, seg_offset))
#define LD_SEG_BASE(dst, seg_offset) MOV(dst, MEMD32(RCX, seg_offset + seg_base_offset))
#define LD_SEG_LIMIT(dst, seg_offset) MOV(dst, MEMD32(RCX, seg_offset + seg_limit_offset))
#define ST_R8L(reg_offset, src) MOV(MEMD8(RCX, reg_offset), src)
#define ST_R8H(reg_offset, src) MOV(MEMD8(RCX, reg_offset + 1), src)
#define ST_R16(reg_offset, src) MOV(MEMD16(RCX, reg_offset), src)
#define ST_R32(reg_offset, src) MOV(MEMD32(RCX, reg_offset), src)
#define ST_REG_val(val, reg_offset, size) store_reg(val, reg_offset, size)
#define ST_REG_val(val, reg_offset, size) MOV(MEMD(RCX, reg_offset, size), val)
#define ST_SEG(seg_offset, val) MOV(MEMD16(RCX, seg_offset), val)
#define ST_SEG_BASE(seg_offset, val) MOV(MEMD32(RCX, seg_offset + seg_base_offset), val)
#define ST_SEG_LIMIT(seg_offset, val) MOV(MEMD32(RCX, seg_offset + seg_limit_offset), val)
Expand Down Expand Up @@ -1833,50 +1833,6 @@ lc86_jit::ld_pf(x86::Gp dst, x86::Gp res, x86::Gp aux)
MOVZX(dst, MEMS8(dst.r64(), res.r64(), 0));
}

void
lc86_jit::load_reg(x86::Gp dst, size_t reg_offset, size_t size)
{
switch (size)
{
case SIZE8:
MOV(dst, MEMD8(RCX, reg_offset));
break;

case SIZE16:
MOV(dst, MEMD16(RCX, reg_offset));
break;

case SIZE32:
MOV(dst, MEMD32(RCX, reg_offset));
break;

default:
LIB86CPU_ABORT();
}
}

template<typename T>
void lc86_jit::store_reg(T val, size_t reg_offset, size_t size)
{
switch (size)
{
case SIZE8:
MOV(MEMD8(RCX, reg_offset), val);
break;

case SIZE16:
MOV(MEMD16(RCX, reg_offset), val);
break;

case SIZE32:
MOV(MEMD32(RCX, reg_offset), val);
break;

default:
LIB86CPU_ABORT();
}
}

void
lc86_jit::load_mem(uint8_t size, uint8_t is_priv)
{
Expand Down
3 changes: 0 additions & 3 deletions lib86cpu/core/emitter/x64/jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ class lc86_jit : public Target {
void ld_of(x86::Gp dst, x86::Gp aux);
void ld_sf(x86::Gp res_dst, x86::Gp aux);
void ld_pf(x86::Gp dst, x86::Gp res, x86::Gp aux);
void load_reg(x86::Gp dst, size_t reg_offset, size_t size);
template<typename T>
void store_reg(T val, size_t reg_offset, size_t size);
void load_mem(uint8_t size, uint8_t is_priv);
template<typename T, bool dont_write = false>
void store_mem(T val, uint8_t size, uint8_t is_priv);
Expand Down

0 comments on commit d3b3486

Please sign in to comment.