[AD] Allegro x86 assembly - use of segment registers, prefixes |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I know this isn't a major issue, but I didn't consider any of the other lists
more appropriate for this, so I am submitting this here.
I have done a good deal of assembly code. I was browsing through some of the
Allegro x86 assembly recently, and noticed that it uses 16-bit segment
register transfers (ex: movw %es,%cx) and 16-bit segment register stack
operations (ex: pushw %ds).
I do not know of any GOOD reason to use these in 32-bit code, except to
preserve the high word of a 32-bit general regiser (only for segreg->general
reg mov like the one listed above). All of them are prefixed, which make
pairing, prefetching, and decoding more difficult, and often cause cycles to
be wasted.
Worst of all, 16-bit stack operations will misalign the stack, and if an
interrupt handler comes in and is handled at the user privilege level (3)
(using the user stack) while the stack is misaligned, all stack references
will have misalignment penalties (unless the alignment is corrected by the
handler).
Thank you for your time,
C