about summary refs log tree commit diff stats
path: root/subx/015immediate_addressing.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-12-28 21:26:42 -0800
committerKartik Agaram <vc@akkartik.com>2018-12-28 21:26:42 -0800
commit431627b242d7f5f2c6b6b13876a255526383f831 (patch)
tree129b8ec45102e0fa7b6352739f916f94959c887f /subx/015immediate_addressing.cc
parentc2532c2d100ea9cadb63ae506ce2cead753c2130 (diff)
downloadmu-431627b242d7f5f2c6b6b13876a255526383f831.tar.gz
4886
Diffstat (limited to 'subx/015immediate_addressing.cc')
-rw-r--r--subx/015immediate_addressing.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/subx/015immediate_addressing.cc b/subx/015immediate_addressing.cc
index ce4bc4db..55b4fa37 100644
--- a/subx/015immediate_addressing.cc
+++ b/subx/015immediate_addressing.cc
@@ -30,7 +30,7 @@ case 0x81: {  // combine imm32 with r/m32
     break;
   // End Op 81 Subops
   default:
-    cerr << "unrecognized sub-opcode after 81: " << NUM(subop) << '\n';
+    cerr << "unrecognized subop for opcode 81: " << NUM(subop) << '\n';
     exit(1);
   }
   break;
@@ -150,7 +150,7 @@ case 0xc1: {
   }
   // End Op c1 Subops
   default:
-    cerr << "unrecognized sub-opcode after c1: " << NUM(subop) << '\n';
+    cerr << "unrecognized subop for opcode c1: " << NUM(subop) << '\n';
     exit(1);
   }
   break;
@@ -614,6 +614,11 @@ put_new(Name, "c7", "copy imm32 to rm32 (mov)");
 case 0xc7: {  // copy imm32 to r32
   const uint8_t modrm = next();
   trace(90, "run") << "copy imm32 to r/m32" << end();
+  const uint8_t subop = (modrm>>3)&0x7;  // middle 3 'reg opcode' bits
+  if (subop != 0) {
+    cerr << "unrecognized subop for opcode c7: " << NUM(subop) << " (only 0/copy currently implemented)\n";
+    exit(1);
+  }
   int32_t* dest = effective_address(modrm);
   const int32_t src = next32();
   trace(90, "run") << "imm32 is 0x" << HEXWORD << src << end();