From 2812f2f8a553fcf53579ff23cbc820705b865a8a Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sat, 28 Sep 2013 03:15:48 +0000 Subject: [PATCH] [SOFT386] Disallow direct writing to CS. Changing CS must be done with a far jump. svn path=/branches/ntvdm/; revision=60399 --- lib/soft386/opcodes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/soft386/opcodes.c b/lib/soft386/opcodes.c index f55ffc62562..6e3d91be5fb 100644 --- a/lib/soft386/opcodes.c +++ b/lib/soft386/opcodes.c @@ -4210,7 +4210,8 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeMovLoadSeg) return FALSE; } - if (ModRegRm.Register >= SOFT386_NUM_SEG_REGS) + if ((ModRegRm.Register >= SOFT386_NUM_SEG_REGS) + || ((SOFT386_SEG_REGS)ModRegRm.Register == SOFT386_REG_CS)) { /* Invalid */ Soft386Exception(State, SOFT386_EXCEPTION_UD);