diff options
author | Freya Murphy <freya@freyacat.org> | 2024-09-12 08:37:46 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-09-12 08:37:46 -0400 |
commit | 0c8ad22d45ea74b1687cc3b6f452c5a0939873a5 (patch) | |
tree | 8ab44b1048e73f52ee9e597f85fff38e277801b9 /include/mips.h | |
parent | add ascii and asciiz directives, fix symtab bug (diff) | |
download | mips-0c8ad22d45ea74b1687cc3b6f452c5a0939873a5.tar.gz mips-0c8ad22d45ea74b1687cc3b6f452c5a0939873a5.tar.bz2 mips-0c8ad22d45ea74b1687cc3b6f452c5a0939873a5.zip |
big endian
Diffstat (limited to 'include/mips.h')
-rw-r--r-- | include/mips.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/include/mips.h b/include/mips.h index 1233693..ff043cd 100644 --- a/include/mips.h +++ b/include/mips.h @@ -159,6 +159,14 @@ struct mips_instruction_branch_data { uint32_t op : 6; } __attribute__((packed)); +union mips_instruction_data { + uint32_t raw; + struct mips_instruction_r_data R; + struct mips_instruction_i_data I; + struct mips_instruction_j_data J; + struct mips_instruction_branch_data B; +} __attribute__((packed)); + /* mips instruction information */ struct mips_instruction { // metadata @@ -167,13 +175,7 @@ struct mips_instruction { const char *name; // data - union { - uint32_t data; - struct mips_instruction_r_data R_data; - struct mips_instruction_i_data I_data; - struct mips_instruction_j_data J_data; - struct mips_instruction_branch_data B_data; - } __attribute__((packed)); + union mips_instruction_data data; }; @@ -182,7 +184,7 @@ struct mips_instruction { MIPS_INS_ ##ins, \ MIPS_FORMAT_ ##format, \ #ins, \ - .format##_data = { __VA_ARGS__ } \ + .data = { .format = { __VA_ARGS__ } } \ }, \ static const struct mips_instruction mips_instructions[] = { |