comparison dyncallback/dyncall_callback_sparc32.s @ 157:49549739228c

- sparc callback asm and args code (still some stack alignment issues, currently) - doc improvements for sparc callconv
author cslag
date Wed, 28 Dec 2016 16:48:35 -0600
parents bbefb8b8e74c
children de5ed248757f
comparison
equal deleted inserted replaced
156:9e4f1355a388 157:49549739228c
27 $i0 -> thunk 27 $i0 -> thunk
28 $i0+24 -> cb handler 28 $i0+24 -> cb handler
29 $i0+28 -> userdata 29 $i0+28 -> userdata
30 */ 30 */
31 31
32 .text
32 .globl dcCallbackThunkEntry 33 .globl dcCallbackThunkEntry
34
35 /* Called by thunk - thunk stores pointer to DCCallback */
36 /* in %g1, and pointer to called function in %g2 */
33 dcCallbackThunkEntry: 37 dcCallbackThunkEntry:
34 jmpl %i7 + 8, %g0 /* Return from proc. */ 38
39 /* Prolog. */
40 /* Frame size of 80b comes from needing storage space for the following: */
41 /* DCargs(sparc_req_reg_save_area:64 + argptr:4) + pad:4 + retval:8 */
42 save %sp, -80, %sp
43
44 /* Spill register args. */
45 st %i0, [ %fp + 68 ] /* reg arg 0 */
46 st %i1, [ %fp + 72 ] /* reg arg 1 */
47 st %i2, [ %fp + 76 ] /* reg arg 2 */
48 st %i3, [ %fp + 80 ] /* reg arg 3 */
49 st %i4, [ %fp + 84 ] /* reg arg 4 */
50 st %i5, [ %fp + 88 ] /* reg arg 5 */
51 add %fp, 68, %l0
52 st %l0, [ %sp + 64 ] /* init arg_ptr */
53
54 /* Zero retval store (for data < word size). */
55 st %g0, [ %sp + 72 ]
56 st %g0, [ %sp + 76 ]
57
58 /* Prepare callback handler call. */
59 mov %g1, %o0 /* Param 0 = DCCallback*, %g1 holds ptr to thunk */
60 add %sp, 64, %o1 /* Param 1 = DCArgs* (ptr to struct with args ptr */
61 add %sp, 72, %o2 /* Param 2 = results ptr to 8b of local stack data */
62 ld [ %g1 + 28 ], %o3 /* Param 3 = userdata ptr */
63
64 ld [ %g1 + 24 ], %l0
65 call %l0
35 nop 66 nop
36 67
68 /* Put retval in %i0/%i1 (to be in caller's %o0/%o1), and %f0/%f1. */
69 ld [ %sp + 72 ], %i0
70 ld [ %sp + 76 ], %i1
71 ld [ %sp + 72 ], %f0
72 ld [ %sp + 76 ], %f1
73
74 /* Epilog. */
75 restore /* unshift reg window */
76 retl /* Return from proc. -- jmpl %i7 + 8, %g0 */
77 nop
78