1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-24 10:31:15 +00:00

Updated Internal Encoding of x86 Encodings (markdown)

Thomas Harte 2023-10-02 13:26:42 -04:00
parent f145c280ae
commit f368df3740

@ -29,4 +29,12 @@ Therefore each decoded instruction is:
* between 4 and 10 bytes for 16-bit decodings; and
* between 4 and 16 bytes for 32-bit decodings.
`sizeof(Instruction)` is therefore either `10` or `16`; it provides `packing_size` to give the size in bytes that are actually in use. `Instruction` is plain-old-data with a trivial destructor so it is safe to place them into memory such that instruction n+1 is placed at the address of instruction n + its `packing_size()`. Extension words therefore need be paid for only when required.
`sizeof(Instruction)` is therefore either `10` or `16`; it provides `packing_size` to give the size in bytes that are actually in use. `Instruction` is plain-old-data with a trivial destructor so it is safe to place them into memory such that instruction n+1 is placed at the address of instruction n + its `packing_size()`. Extension words therefore need be paid for only when required.
### Future Notes
If instruction length in bytes turns out to be less helpful than originally expected, it might be worth dropping it entirely and moving repetition or segment override into the instruction. Segment override in particular might avoid some conditionality in execution of cached instructions, where the process for indirections is currently:
* use override if specified;
* otherwise check for an indirect source and, if one is present, see whether it has a base that implies a default segment;
* otherwise use DS.