Skip to content

Commit

Permalink
Add stub implementation for writes to fs
Browse files Browse the repository at this point in the history
This is "used" by sbcl.
saagarjha committed Jan 20, 2024
1 parent 8bc0bf0 commit 3db6477
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions emu/decode.h
Original file line number Diff line number Diff line change
@@ -804,14 +804,20 @@ __no_instrument DECODER_RET glue(DECODER_NAME, OP_SIZE)(DECODER_ARGS) {
case 0x8d: TRACEI("lea\t\t"); READMODRM_MEM;
MOV(addr, modrm_reg,oz); break;

// only gs is supported, and it does nothing
// see comment in sys/tls.c
// we only support fs and gs, and that too not very well.
// gs does nothing: see comment in sys/tls.c
// for fs, we discard writes. if anyone tries to read we trap
case 0x8c: TRACEI("mov seg, modrm\t"); READMODRM;
if (modrm.reg != reg_ebp) UNDEFINED;
if (modrm.reg != 5 /* gs */) UNDEFINED;
MOV(gs, modrm_val,16); break;
case 0x8e: TRACEI("mov modrm, seg\t"); READMODRM;
if (modrm.reg != reg_ebp) UNDEFINED;
MOV(modrm_val, gs,16); break;
if (modrm.reg == 5 /* gs */) {
MOV(modrm_val, gs,16); break;
} else if (modrm.reg == 4 /* fs */) {
break;
} else {
UNDEFINED;
}

case 0x8f: TRACEI("pop modrm");
READMODRM; POP(modrm_val,oz); break;

0 comments on commit 3db6477

Please sign in to comment.