3 .globl sparc64_of_client_interface, client_tba
7 * SAVE_WINDOW_STATE and RESTORE_WINDOW_STATE are used to ensure
8 * that the CPU window state is preserved across CIF calls. This is
9 * to workaround a *BSD restriction that window fill/spill traps must
10 * be minimised during trap table takeover, and likely emulates the
27 .register %g2, #scratch
28 .register %g3, #scratch
29 .register %g6, #scratch
30 .register %g7, #scratch
32 make some more space on stack since linux kernel only provides 128 bytes
33 without memory to spill registers (used by gcc in -O0 mode)
36 sparc64_of_client_interface:
38 /* Save globals on callers stack */
41 stx %g1, [%sp + 2047 + 192]
42 stx %g2, [%sp + 2047 + 200]
43 stx %g3, [%sp + 2047 + 208]
44 stx %g4, [%sp + 2047 + 216]
45 stx %g5, [%sp + 2047 + 224]
46 stx %g6, [%sp + 2047 + 232]
47 stx %g7, [%sp + 2047 + 240]
49 /* Save client trap table */
50 setx client_tba, %g6, %g7
54 /* Save existing stack */
55 setx client_stack, %g6, %g7
59 setx _fcstack_ptr, %g6, %g7
61 add %g1, -CONTEXT_STATE_SIZE, %g1
64 SAVE_CPU_WINDOW_STATE(cif)
66 /* Move to OpenBIOS context stack */
67 setx _fcstack_ptr, %g6, %g7
69 setx CONTEXT_STACK_SIZE, %g4, %g5
73 setx - 2047 - 192, %g6, %g7
77 /* Call client inteface */
78 call of_client_interface
82 setx _fcstack_ptr, %g6, %g7
84 setx CONTEXT_STACK_SIZE, %g4, %g5
91 RESTORE_CPU_WINDOW_STATE(cif)
93 add %g1, CONTEXT_STATE_SIZE, %g1
94 setx _fcstack_ptr, %g6, %g7
98 setx client_stack, %g6, %g7
101 /* Restore client trap table */
102 setx client_tba, %g6, %g7
106 /* Restore globals */
107 ldx [%sp + 2047 + 192], %g1
108 ldx [%sp + 2047 + 200], %g2
109 ldx [%sp + 2047 + 208], %g3
110 ldx [%sp + 2047 + 216], %g4
111 ldx [%sp + 2047 + 224], %g5
112 ldx [%sp + 2047 + 232], %g6
113 ldx [%sp + 2047 + 240], %g7