ia64-test-nat-asm.S revision a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65
105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm/* libunwind - a platform-independent unwind library 205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm Copyright (C) 2004 Hewlett-Packard Co 305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm Contributed by David Mosberger-Tang <davidm@hpl.hp.com> 405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm 505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmThis file is part of libunwind. 605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm 705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmPermission is hereby granted, free of charge, to any person obtaining 805a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidma copy of this software and associated documentation files (the 905a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm"Software"), to deal in the Software without restriction, including 1005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmwithout limitation the rights to use, copy, modify, merge, publish, 1105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmdistribute, sublicense, and/or sell copies of the Software, and to 1205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmpermit persons to whom the Software is furnished to do so, subject to 1305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmthe following conditions: 1405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm 1505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmThe above copyright notice and this permission notice shall be 1605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmincluded in all copies or substantial portions of the Software. 1705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm 1805a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 1905a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 2105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 2205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 2305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 2405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 2505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm 2605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .text 2705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm 28c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm#define CALL_NEXT(gp_save_reg) \ 29c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm ld8 r2 = [in0], 8;; /* read the next function pointer */ \ 30c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm ld8 r3 = [r2], 8;; /* read the function's entry-point */ \ 31c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm ld8 r2 = [r2];; /* read the function's gp */ \ 32c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm mov b6 = r3; \ 33c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm mov gp_save_reg = gp; \ 34c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm mov out0 = in0; \ 35c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm mov out1 = in1; \ 36c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm mov gp = r2; \ 37c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm br.call.sptk.many rp = b6;; \ 38c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm mov gp = gp_save_reg 39c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 40a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm#define LOAD_VAL(reg) \ 41a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm ld8 reg = [in1], 8;; \ 42a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm tbit.nz p6, p0 = reg, 0;; \ 43a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm(p6) ld8.s reg = [r0] 44a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 45c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 46c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm /* Save r4-r7 into stacked registers, load them up with the 47c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm values passed via the pointer in in1 and then call the 48c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm function passed via the pointer in in0. */ 49c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 5005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .global save_static_to_stacked 5105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .proc save_static_to_stacked 5205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidmsave_static_to_stacked: 5305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .prologue 5405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .regstk 2, 7, 2, 0 5505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .save ar.pfs, loc0 5605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm alloc loc0 = ar.pfs, 2, 7, 2, 0 5705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .save rp, loc1 5805a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov loc1 = rp 5905a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .spillreg r4, loc2 6005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov loc2 = r4 6105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .spillreg r5, loc3 6205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov loc3 = r5 6305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .spillreg r6, loc4 6405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov loc4 = r6 6505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .spillreg r7, loc5 6605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov loc5 = r7 6705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .body 68a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm LOAD_VAL(r4) 69a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm LOAD_VAL(r5) 70a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm LOAD_VAL(r6) 71a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm LOAD_VAL(r7) 72c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm CALL_NEXT(loc6) 7305a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm 7405a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov r4 = loc2 7505a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov r5 = loc3 7605a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov r6 = loc4 7705a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov r7 = loc5 7805a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm 7905a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov ar.pfs = loc0 8005a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm mov rp = loc1 8105a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm br.ret.sptk.many rp 8205a9101485fd5a5c42c546cc720bc35fa4e3f06bmostang.com!davidm .endp save_static_to_stacked 83c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 84c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm /* Save f2 to the memory stack, save r4 to f2, then load 85c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm r4 with the value passed via in1 and call the function 86c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm passed via in0. */ 87c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 88a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .global save_static_to_fr 89a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .proc save_static_to_fr 90a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidmsave_static_to_fr: 91c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm .prologue 92c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm .regstk 2, 3, 2, 0 93c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm .save ar.pfs, loc0 94c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm alloc loc0 = ar.pfs, 2, 3, 2, 0 95c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm .save rp, loc1 96c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm mov loc1 = rp 97c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm .fframe 16 98c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm .spillpsp f2, 16 99c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm stf.spill [sp] = f2, -16 100c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm .spillreg r4, f2 101c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm setf.sig f2 = r4 102c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 103c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm .body 104c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 105c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm ld8 r4 = [in1], 8;; 106c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm tbit.nz p6, p0 = r4, 0;; 107c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm(p6) ld8.s r4 = [r0] 108c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 109c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm CALL_NEXT(loc2) 110c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 111c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm getf.sig r4 = f2 // restore r4 112a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .restore sp 113a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm add sp = 16, sp;; 114a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm ldf.fill f2 = [sp] // restore r2 115c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm 116c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm mov ar.pfs = loc0 117c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm mov rp = loc1 118c5b3064c05d9f77c43c86ae90cd0c0d4db9351d4hp.com!davidm br.ret.sptk.many rp 119a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .endp save_static_to_fr 120a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 121a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm /* If r4 is not a NaT, save b3 to a stacked register and 122a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm then save r4 in b3. The non-NaTness of r4 is saved in 123a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm p1. */ 124a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 125a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .global save_static_to_br 126a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .proc save_static_to_br 127a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidmsave_static_to_br: 128a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .prologue 129a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .regstk 2, 5, 2, 0 130a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .save ar.pfs, loc0 131a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm alloc loc0 = ar.pfs, 2, 5, 2, 0 132a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .save rp, loc1 133a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov loc1 = rp 134a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 135a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .save pr, loc2 136a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov loc2 = pr // save predicates 137a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 138a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .spillreg b3, loc3 139a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov loc3 = b3 140a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 141a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm tnat.z p1, p2 = r4;; 142a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .spillreg.p p1, r4, b3 143a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm(p1) mov b3 = r4 144a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 145a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .body 146a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 147a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm LOAD_VAL(r4) 148a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm CALL_NEXT(loc4) 149a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 150a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm(p1) mov r4 = b3 // restore r4 151a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 152a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov ar.pfs = loc0 153a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov rp = loc1 154a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov pr = loc2, -1 155a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov b3 = loc3 // restore b3 156a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm br.ret.sptk.many rp 157a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .endp save_static_to_br 158a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 159a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm /* Spill r4 into memory and then save r5 in r4. */ 160a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 161a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .global save_static_to_mem 162a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .proc save_static_to_mem 163a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidmsave_static_to_mem: 164a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .prologue 165a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .regstk 2, 4, 2, 0 166a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .save ar.pfs, loc0 167a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm alloc loc0 = ar.pfs, 2, 4, 2, 0 168a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .save rp, loc1 169a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov loc1 = rp 170a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .save ar.unat, loc2 171a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov loc2 = ar.unat 172a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 173a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .fframe 16 174a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .spillpsp r4, 16 175a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm st8.spill [sp] = r4, -16 176a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 177a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .spillreg r5, r4 178a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov r4 = r5 179a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 180a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .body 181a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 182a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm LOAD_VAL(r5) 183a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm CALL_NEXT(loc3) 184a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 185a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov r5 = r4 // restore r5 186a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .restore sp 187a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm add sp = 16, sp;; 188a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm ld8.fill r4 = [sp] // restore r4 189a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 190a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov ar.pfs = loc0 191a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov rp = loc1 192a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm mov ar.unat = loc2 // restore ar.unat 193a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm br.ret.sptk.many rp 194a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm 195a5ed5ae3b775b3455df47dc1ad29f2e66e58cb65mostang.com!davidm .endp save_static_to_mem 196