diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-09-07 22:13:10 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-09-07 22:19:13 -0700 |
commit | e07a3f2886b117970b3cd58f7cd6806cbfe5cc4a (patch) | |
tree | 6fcddb741f3b15eaa7892b5ce0468a6f3695005a /subx/031check_operands.cc | |
parent | 608a7fa8d0faf9a3e3d182d9eabe969804443aab (diff) | |
download | mu-e07a3f2886b117970b3cd58f7cd6806cbfe5cc4a.tar.gz |
4537
Streamline the factorial function; we don't need to save a stack variable into a register before operating on it. All instructions can take a stack variable directly. In the process we found two bugs: a) Opcode f7 was not implemented correctly. It was internally consistent but I'd never validated it against a natively running program. Turns out it encodes multiple instructions, not just 'not'. b) The way we look up imm32 operands was sometimes reading them before disp8/disp32 operands.
Diffstat (limited to 'subx/031check_operands.cc')
-rw-r--r-- | subx/031check_operands.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/subx/031check_operands.cc b/subx/031check_operands.cc index 12013287..934b1022 100644 --- a/subx/031check_operands.cc +++ b/subx/031check_operands.cc @@ -183,8 +183,6 @@ void init_permitted_operands() { // or put(Permitted_operands, "09", 0x01); put(Permitted_operands, "0b", 0x01); - // complement - put(Permitted_operands, "f7", 0x01); // xor put(Permitted_operands, "31", 0x01); put(Permitted_operands, "33", 0x01); @@ -204,6 +202,7 @@ void init_permitted_operands() { //// Class O: op, ModR/M and subop (not r32) // imm32 imm8 disp32 |disp16 disp8 subop modrm // 0 0 0 |0 0 1 1 + put(Permitted_operands, "f7", 0x03); // test/not/mul/div put(Permitted_operands, "ff", 0x03); // jump/push/call //// Class N: op, ModR/M and imm32 |