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
);
I don't know what's wrong here but it doesn't work.
If you're using gcc, you may need to specify volatile.
If you're using gcc, you may need to specify volatile.
If I change it to thread_local then try to re-compile, I get a linker error:
R_AARCH64_ADR_PREL_LO21 used with TLS symbol f
Do you know what syntax I use to access the thread_local variable from assembler? Will I need to write a separate function as follows?
Can anyone please help me understand this? And explore how I would go
about writing aarch64 to access a thread_local variable called 'f'?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 499 |
Nodes: | 16 (2 / 14) |
Uptime: | 31:03:52 |
Calls: | 9,832 |
Calls today: | 2 |
Files: | 13,761 |
Messages: | 6,192,554 |