mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 12:03:41 +01:00
(CALL_NEXT_PTR): Like CALL_NEXT(), except that the two argument
registers are passed via macro args. (CALL_NEXT): Define in terms of CALL_NEXT_PTR(). (rotate_regs): Fix it so it doesn't overwrite any local registers once they are rotated. Note: it's OK to write the output registers, since those are outside of the rotating partition. (Logical change 1.184)
This commit is contained in:
parent
d5dc7dc613
commit
96d2898321
1 changed files with 17 additions and 10 deletions
|
@ -25,18 +25,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
#define CALL_NEXT(gp_save_reg) \
|
#define CALL_NEXT_PTR(gp_save_reg, arg0, arg1) \
|
||||||
ld8 r2 = [in0], 8;; /* read the next function pointer */ \
|
ld8 r2 = [arg0], 8;; /* read the next function pointer */ \
|
||||||
ld8 r3 = [r2], 8;; /* read the function's entry-point */ \
|
ld8 r3 = [r2], 8;; /* read the function's entry-point */ \
|
||||||
ld8 r2 = [r2];; /* read the function's gp */ \
|
ld8 r2 = [r2];; /* read the function's gp */ \
|
||||||
mov b6 = r3; \
|
mov b6 = r3; \
|
||||||
mov gp_save_reg = gp; \
|
mov gp_save_reg = gp; \
|
||||||
mov out0 = in0; \
|
mov out0 = arg0; \
|
||||||
mov out1 = in1; \
|
mov out1 = arg1; \
|
||||||
mov gp = r2; \
|
mov gp = r2; \
|
||||||
br.call.sptk.many rp = b6;; \
|
br.call.sptk.many rp = b6;; \
|
||||||
mov gp = gp_save_reg
|
mov gp = gp_save_reg
|
||||||
|
|
||||||
|
#define CALL_NEXT(gp_save_reg) CALL_NEXT_PTR(gp_save_reg, in0, in1)
|
||||||
|
|
||||||
#define LOAD_VAL(reg) \
|
#define LOAD_VAL(reg) \
|
||||||
ld8 reg = [in1], 8;; \
|
ld8 reg = [in1], 8;; \
|
||||||
tbit.nz p15, p0 = reg, 0;; \
|
tbit.nz p15, p0 = reg, 0;; \
|
||||||
|
@ -250,6 +252,11 @@ save_static_to_scratch:
|
||||||
br.ret.sptk.many rp
|
br.ret.sptk.many rp
|
||||||
.endp save_static_to_scratch
|
.endp save_static_to_scratch
|
||||||
|
|
||||||
|
/* Rotate registers a bit in a vain attempt to sow some confusion.
|
||||||
|
Care must be taken not to write any rotating general register
|
||||||
|
after rotation, because we keep the preserved state
|
||||||
|
there... */
|
||||||
|
|
||||||
.global rotate_regs
|
.global rotate_regs
|
||||||
.proc rotate_regs
|
.proc rotate_regs
|
||||||
rotate_regs:
|
rotate_regs:
|
||||||
|
@ -263,19 +270,18 @@ rotate_regs:
|
||||||
mov loc2 = pr
|
mov loc2 = pr
|
||||||
.save ar.lc, loc3
|
.save ar.lc, loc3
|
||||||
mov loc3 = ar.lc
|
mov loc3 = ar.lc
|
||||||
|
.spillreg r4, loc4
|
||||||
mov r8 = in0
|
mov loc4 = r4
|
||||||
mov r9 = in1
|
|
||||||
|
|
||||||
ld8 r2 = [in1], 8;;
|
ld8 r2 = [in1], 8;;
|
||||||
|
mov r8 = in0
|
||||||
|
mov r9 = in1
|
||||||
and r2 = 127, r2;;
|
and r2 = 127, r2;;
|
||||||
mov ar.ec = 0
|
mov ar.ec = 0
|
||||||
mov ar.lc = r2;;
|
mov ar.lc = r2;;
|
||||||
1: br.ctop.dptk.few 1b;;
|
1: br.ctop.dptk.few 1b;;
|
||||||
|
|
||||||
mov in0 = r8
|
CALL_NEXT_PTR(r4, r8, r9)
|
||||||
mov in1 = r9;;
|
|
||||||
CALL_NEXT(loc4)
|
|
||||||
|
|
||||||
clrrrb
|
clrrrb
|
||||||
|
|
||||||
|
@ -283,6 +289,7 @@ rotate_regs:
|
||||||
mov rp = loc1
|
mov rp = loc1
|
||||||
mov pr = loc2, -1
|
mov pr = loc2, -1
|
||||||
mov ar.lc = loc3
|
mov ar.lc = loc3
|
||||||
|
mov r4 = loc4
|
||||||
br.ret.sptk.many rp
|
br.ret.sptk.many rp
|
||||||
|
|
||||||
.endp rotate_regs
|
.endp rotate_regs
|
||||||
|
|
Loading…
Reference in a new issue