unix: Add asm statements needed to read registers with clang. Code generated by gcc 4.9.0 is unchanged (same statements, different order).

Both are inefficient, saving unmodified registers on the stack.
This commit is contained in:
Antonin ENFRUN 2014-05-12 00:24:41 +02:00
parent 1b901c320b
commit ceac71f1f5
1 changed files with 6 additions and 0 deletions

View File

@ -43,11 +43,17 @@ typedef machine_uint_t regs_t[6];
void gc_helper_get_regs(regs_t arr) {
register long rbx asm ("rbx");
asm("" : "=r"(rbx));
register long rbp asm ("rbp");
asm("" : "=r"(rbp));
register long r12 asm ("r12");
asm("" : "=r"(r12));
register long r13 asm ("r13");
asm("" : "=r"(r13));
register long r14 asm ("r14");
asm("" : "=r"(r14));
register long r15 asm ("r15");
asm("" : "=r"(r15));
arr[0] = rbx;
arr[1] = rbp;
arr[2] = r12;