!!!!!!!!!!!!!!!!!!!!!!!!!!! This is the issue !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SOM
2nd Update ******
Just look at the value passed into RAX!!!!!
The only difference is optimization.
It should point to the label!!!
2nd Update End ****
!!!!!!!!!!!!!!!!!!!!!!!!!!! This is the issue !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! EOM
Just looking at the address moved into rax, just example code of what has taken days to find.
Updated *****
I know my code is wrong, it is just example code, the issue is the value stored in rax, not the code, or the void proc.
It appears to be using the wrong address for rax.
End of Update ****
My work-around is going to be injecting values, which after testing also returns the incorrect address due to gcc optimization.
Here is the source:
Code: Select all
void tInterrupts::SetupInterruptCodes()
{
QWORD Addr = (QWORD)&&TSD_InterruptCode_Start;
asm volatile (" movq %0, %%rax" : : "r"(Addr));
asm volatile (" retq");
TSD_InterruptCode_Start:
asm volatile ("TSD_InterruptCode:");
asm volatile (" movq %rax, -0x108(%rsp)");
}
Code: Select all
00000000003074de <_ZN6Kernel11tInterrupts19SetupInterruptCodesEv>:
3074de: 55 push rbp
3074df: 48 89 e5 mov rbp,rsp
3074e2: 48 83 ec 10 sub rsp,0x10
3074e6: 48 c7 45 f8 f6 74 30 mov QWORD PTR [rbp-0x8],0x3074f6
3074ed: 00
3074ee: 48 8b 45 f8 mov rax,QWORD PTR [rbp-0x8]
3074f2: 48 89 c0 mov rax,rax
3074f5: c3 ret
00000000003074f6 <TSD_InterruptCode>:
3074f6: 48 89 84 24 f8 fe ff mov QWORD PTR [rsp-0x108],rax
3074fd: ff
3074fe: c9 leave
3074ff: c3 ret
Code: Select all
000000000031a960 <_ZN6Kernel11tInterrupts19SetupInterruptCodesEv>:
31a960: 48 b8 60 a9 31 00 00 movabs rax,0x31a960
31a967: 00 00 00
31a96a: 48 89 c0 mov rax,rax
31a96d: c3 ret
000000000031a96e <TSD_InterruptCode>:
31a96e: 48 89 84 24 f8 fe ff mov QWORD PTR [rsp-0x108],rax
31a975: ff
31a976: c3 ret
31a977: 90 nop
31a978: 0f 1f 84 00 00 00 00 nop DWORD PTR [rax+rax*1+0x0]
31a97f: 00