Date: Sun, 20 Dec 1998 14:01:50 -0500 (EST) From: Alfred Perlstein <bright@hotjobs.com> To: emulation@FreeBSD.ORG Cc: emulators@FreeBSD.ORG Subject: patch for doscmd for illegal lock prefix Message-ID: <Pine.BSF.4.05.9812201352440.6331-100000@bright.fx.genx.net>
next in thread | raw e-mail | index | archive | help
up until a certain stepping point the 'lock' prefix was legal to use on just about any instruction, however pentium and above severly restrict its use and generate illegal instruction traps. i'm unsure of the correctness of the following patch, so could someone please take a look at it? Anyone want to forward it to the authors? when an instruction with a 0xF0 prefix (lock) generates a sigILL to doscmd i patch the opcode to be 0x90 (nop) and retry. i could change IP but the effect is the same. and this fixes makes the trap go away if it's encountered in a loop. this doesn't exactly get my program to run, but it's a step further. this could also be done to remain more silent. /usr # diff -u src/usr.bin/doscmd/trap.c.orig src/usr.bin/doscmd/trap.c --- src/usr.bin/doscmd/trap.c.orig Sun Dec 20 13:14:54 1998 +++ src/usr.bin/doscmd/trap.c Sun Dec 20 13:47:47 1998 @@ -591,9 +591,20 @@ sigill(struct sigframe *sf) { regcontext_t *REGS = (regcontext_t *)(&sf->sf_sc); + u_char *addr; fprintf(stderr, "Signal %d from DOS program\n", sf->sf_signum); + + addr = (u_char *)N_GETPTR(R_CS, R_IP); + if( *addr == (u_char) 0xf0 ){ + dump_regs(REGS); + fprintf(stderr, "illegal lock prefix, retry with NOP.\n"); + *addr = (u_char) 0x90; + return; + } + dump_regs(REGS); + fatal("%04x:%04x Illegal instruction\n", R_CS, R_IP); } btw, it's a pleasure reading doscmd code, really nifty stuff. later on i get this: ax=3278 bx=0000 cx=ff05 dx=0306 si=3346 di=0296 sp=8581 bp=0001 cs=0000 ss=1fee ds=9e9e es=f000 ip=4b eflags=b0206 f1 74 07 70 00 0a 00 00 f1 4a 08 70 00 14 00 00 (bad) unsupported instruction *sigh* time to break out the i386 manuals :) Alfred Perlstein - Programmer, HotJobs Inc. - www.hotjobs.com -- There are operating systems, and then there's FreeBSD. -- http://www.freebsd.org/ 3.0-current To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9812201352440.6331-100000>