1#include <cstdint>
2
3int main() {
4 constexpr uint32_t eax = 0x05060708;
5 constexpr uint32_t ebx = 0x15161718;
6 constexpr uint32_t ecx = 0x25262728;
7 constexpr uint32_t edx = 0x35363738;
8 constexpr uint32_t esp = 0x45464748;
9 constexpr uint32_t ebp = 0x55565758;
10 constexpr uint32_t esi = 0x65666768;
11 constexpr uint32_t edi = 0x75767778;
12
13 asm volatile(
14 // save esp & ebp
15 "movd %%esp, %%mm0\n\t"
16 "movd %%ebp, %%mm1\n\t"
17 "\n\t"
18 "movl %4, %%esp\n\t"
19 "movl %5, %%ebp\n\t"
20 "\n\t"
21 "int3\n\t"
22 "\n\t"
23 // restore esp & ebp
24 "movd %%mm0, %%esp\n\t"
25 "movd %%mm1, %%ebp\n\t"
26 :
27 : "a"(eax), "b"(ebx), "c"(ecx), "d"(edx), "i"(esp), "i"(ebp), "S"(esi),
28 "D"(edi)
29 : "%mm0", "%mm1"
30 );
31
32 return 0;
33}
34

source code of lldb/test/Shell/Register/Inputs/x86-gp-read.cpp