about summary refs log tree commit diff stats
path: root/subx/034compute_segment_address.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-11-24 20:53:32 -0800
committerKartik Agaram <vc@akkartik.com>2018-11-24 20:53:50 -0800
commit3c46d5a221542195aca58f8f7061f59cda479927 (patch)
tree95847d3f9449ca1c0f4e6329c309866155d4a17a /subx/034compute_segment_address.cc
parentba196240ff575d6226751f4373ae60eff3fba0bf (diff)
downloadmu-3c46d5a221542195aca58f8f7061f59cda479927.tar.gz
4771
I stopped handling disp16 at some point, and using instructions with such
an operand messes up segment alignment when generating ELF binaries.

I don't test my ELF generation. This is a sign that maybe I should start.
Diffstat (limited to 'subx/034compute_segment_address.cc')
-rw-r--r--subx/034compute_segment_address.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/subx/034compute_segment_address.cc b/subx/034compute_segment_address.cc
index cf5b789d..b6c191e4 100644
--- a/subx/034compute_segment_address.cc
+++ b/subx/034compute_segment_address.cc
@@ -119,6 +119,8 @@ uint32_t num_bytes(const line& inst) {
 int size_of(const word& w) {
   if (has_operand_metadata(w, "disp32") || has_operand_metadata(w, "imm32"))
     return 4;
+  else if (has_operand_metadata(w, "disp16"))
+    return 2;
   // End size_of(word w) Special-cases
   else
     return 1;