home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,613 of 4,675   
   Thomas Koenig to Frederick Virchanza Gotham   
   Re: aarch64 (64-Bit ARM) - return by val   
   17 Jul 23 15:29:21   
   
   From: tkoenig@nospicedham.netcologne.de   
      
   Frederick Virchanza Gotham  schrieb:   
      
      
   > I want to try emulate this behaviour on aarch64 on Linux. When my assembler   
   function is entered, I want it to do two things:   
   > (1) Put the address of the indirect return object into the first parameter   
   register, i.e. move X8 to X0   
   > (2) Jump to a location specified by a global function pointer   
   >   
   > So here's how I think my assembler function should look:   
   >   
   >     __asm("Invoke:       \n"   
   >           " mov x0, x8   \n" // move return value address into 1st parameter   
   >           " mov x9, f    \n" // Load address of code into register   
   >           " br  x9       \n" // Jump to code   
   >     );   
      
   If you're using gcc, you may need to specify volatile.   
      
   Do you see the assembly in the generated *.s file?   
      
   > I don't know what's wrong here but it doesn't work.   
      
   So, you need to debug.  Some generic advice.   
      
   The best way is probably to the code with -S -fverbose-asm (NOT   
   with -g), then translate the code with "-g" and single-step (using   
   gdb and stepi) through your functions.   
      
   Hopefully, you'll see what is wrong then.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca