From: Robert Pengelly Date: Sat, 24 Oct 2026 04:13:15 +0000 (+0100) Subject: Fix 32-bit TEST instructions and DOOM memory allocation hang X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=057e763e4407a6ee028c22c7588c80eb6e3f5d40;p=dosemu.git Fix 32-bit TEST instructions and DOOM memory allocation hang --- diff --git a/cpu.c b/cpu.c index e407da4..d6cca02 100644 --- a/cpu.c +++ b/cpu.c @@ -4339,10 +4339,12 @@ fetch_instruction: OperandRef rm = decode_rm_operand (cpu, modrm); - uint16_t val1 = operand_read16 (cpu, &rm); - uint16_t val2 = cpu->regs[reg & 7]; + if (cpu->has_operand_override) { + and32 (cpu, operand_read32 (cpu, &rm), get_reg32 (cpu, reg)); + } else { + and16 (cpu, operand_read16 (cpu, &rm), cpu->regs[reg]); + } - and16 (cpu, val1, val2); break; } @@ -5030,11 +5032,14 @@ fetch_instruction: } - case 0xA9: { /* TEST AX, imm16 */ + case 0xA9: { /* TEST AX/EAX, imm16/32 */ - uint16_t imm16 = fetch16 (cpu); + if (cpu->has_operand_override) { + and32 (cpu, get_reg32 (cpu, REG_AX), fetch32 (cpu)); + } else { + and16 (cpu, cpu->regs[REG_AX], fetch16 (cpu)); + } - and16 (cpu, cpu->regs[REG_AX], imm16); break; }