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)   
|