1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2025-01-22 16:20:29 +01:00

(CALL_NEXT): New macro.

(save_static_to_fpreg): New function.

(Logical change 1.171)
This commit is contained in:
hp.com!davidm 2004-02-19 01:32:27 +00:00
parent a2b6982cfd
commit c5b3064c05

View file

@ -25,6 +25,23 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
.text
#define CALL_NEXT(gp_save_reg) \
ld8 r2 = [in0], 8;; /* read the next function pointer */ \
ld8 r3 = [r2], 8;; /* read the function's entry-point */ \
ld8 r2 = [r2];; /* read the function's gp */ \
mov b6 = r3; \
mov gp_save_reg = gp; \
mov out0 = in0; \
mov out1 = in1; \
mov gp = r2; \
br.call.sptk.many rp = b6;; \
mov gp = gp_save_reg
/* Save r4-r7 into stacked registers, load them up with the
values passed via the pointer in in1 and then call the
function passed via the pointer in in0. */
.global save_static_to_stacked
.proc save_static_to_stacked
save_static_to_stacked:
@ -56,19 +73,7 @@ save_static_to_stacked:
(p8) ld8.s r6 = [r0]
(p9) ld8.s r7 = [r0]
ld8 r2 = [in0], 8 // read the next function pointer
;;
ld8 r3 = [r2], 8 // read the function's entry-point
;;
ld8 r2 = [r2] // read the function's gp
;;
mov b6 = r3
mov loc6 = gp
mov out0 = in0
mov out1 = in1
mov gp = r2
br.call.sptk.many rp = b6;;
mov gp = loc6
CALL_NEXT(loc6)
mov r4 = loc2
mov r5 = loc3
@ -79,3 +84,38 @@ save_static_to_stacked:
mov rp = loc1
br.ret.sptk.many rp
.endp save_static_to_stacked
/* Save f2 to the memory stack, save r4 to f2, then load
r4 with the value passed via in1 and call the function
passed via in0. */
.global save_static_to_fpreg
.proc save_static_to_fpreg
save_static_to_fpreg:
.prologue
.regstk 2, 3, 2, 0
.save ar.pfs, loc0
alloc loc0 = ar.pfs, 2, 3, 2, 0
.save rp, loc1
mov loc1 = rp
.fframe 16
.spillpsp f2, 16
stf.spill [sp] = f2, -16
.spillreg r4, f2
setf.sig f2 = r4
.body
ld8 r4 = [in1], 8;;
tbit.nz p6, p0 = r4, 0;;
(p6) ld8.s r4 = [r0]
CALL_NEXT(loc2)
getf.sig r4 = f2 // restore r4
ldf.fill f2 = [sp], 16 // restore r2
mov ar.pfs = loc0
mov rp = loc1
br.ret.sptk.many rp
.endp save_static_to_fpreg