asm woes...

Era Scarecrow via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 31 13:16:38 PDT 2016


On Tuesday, 31 May 2016 at 18:52:16 UTC, Marco Leise wrote:
> The 'this' pointer is usually in some register already. On 
> Linux 32-bit for example it is in EAX, on Linux 64-bit is in 
> RDI.

  The AX register seems like a bad choice, since you require the 
AX/DX registers when you do multiplication and division (although 
all other registers are general purpose some instructions are 
still tied to specific registers). SI/DI are a much better choice.

> By the way, you are right that 32-bit does not have access to 
> 64-bit machine words (actually kind of obvious), but your idea 
> wasn't far fetched, since there is the X32 architecture at 
> least for Linux. It uses 64-bit machine words, but 32-bit 
> pointers and allows for compact and fast programs.

  As i recall the switch to use the larger registers is a simple 
switch per instruction, something like either 60h, 66h or 67h. I 
forget which one exactly, as i recall writing assembly programs 
using 16bit DOS but using 32bit registers using that trick (built 
into the assembler). Although to use the lower registers by 
themselves required the same switch, so...


More information about the Digitalmars-d-learn mailing list