From d9823705c0b7fa043b201de38519ac2bd539c367 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 2 Oct 2016 18:21:51 -0400 Subject: [PATCH] Nop out the read of the FS register in EMX's syscall interface for now. Eventually, we'll maybe need to set the FS register to be a proper TIB pointer, but I'm mostly hoping that everything else was well-behaved enough to always use DosGetInfoBlocks() instead. Yeah, right. --- lx_loader.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lx_loader.c b/lx_loader.c index 031f60f..a6cb184 100644 --- a/lx_loader.c +++ b/lx_loader.c @@ -919,9 +919,17 @@ static LxModule *loadLxModule(const char *fname, uint8 *exe, uint32 exelen, int // !!! FIXME: hack to nop out some 16-bit code in emx.dll startup... if ((i == 1) && (strcmp(modname, "EMX") == 0)) { + // This is the 16-bit signal handler installer. nop it out. uint8 *ptr = ((uint8 *) retval->mmaps[1].addr) + 28596; for (uint32 i = 0; i < 37; i++) *(ptr++) = 0x90; // nop + + // This is a read of the FS register for the TIB, but we need to wire that up still. + ptr = ((uint8 *) retval->mmaps[1].addr) + 237; + *(ptr++) = 0x31; // xorl %esi,%esi ...makes next piece of code skip TIB stuff. + *(ptr++) = 0xf6; + for (uint32 i = 0; i < 14; i++) + *(ptr++) = 0x90; // nop }