2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
14 # Process assembly language assist for HP 9000 series 300s.
32 /* Stuff to allow saving/restoring registers */
34 set REGS,0x3ffe # d1-d7 & a0-a5
37 # savecontext(f, area1, newsp)
38 # int (*f)(); struct savearea *area1; char *newsp;
41 /* Stack offsets of arguments */
48 mov.b &1,_PRE_Block # Dont allow any interrupt finagling
49 link %a6,&-(NREGS*4) # Save frame pointer & ...
50 # ... allocate space for nregs registers
54 mov.l area1(%a6),%a0 # a0 = base of savearea
55 mov.l %sp,topstack(%a0) # area->topstack = sp
56 mov.l newsp(%a6),%d0 # Get new sp
57 beq.b l1 # If newsp == 0, no stack switch
58 mov.l %d0,%sp # Switch to new stack
60 mov.l f(%a6),%a0 # a0 = f
63 /* It is impossible to be here, so abort() */
69 # struct savearea *area2;
72 /* Stack offset of argument */
78 mov.l area2(%a6),%a0 # Base of savearea
79 mov.l topstack(%a0),%sp # Restore sp
80 /* Restore registers */
84 mov.l %sp,%a6 # Argghh...be careful here
87 rts # Return to previous process
93 ; savecontext(f, area1, newsp)
95 ; struct savearea *area1;
101 ; Callinfo sets up register saves using the ENTRY_GR
102 ; and ENTRY_FR parameters. ENTRY_FR=21 is only valid
103 ; for PA 1.1. (How to deal with this for 800?)
105 .CALLINFO CALLER,FRAME=0,SAVE_RP,ENTRY_GR=18,ENTRY_FR=21
106 ; The ENTER statement generates register saves and
110 LDI 1,%r31 ; Store a (char) 1 in
111 ADDIL LR'PRE_Block-$global$,%r27 ; global variable
112 STB %r31,RR'PRE_Block-$global$(0,%r1) ; PRE_Block.
114 COPY %r26,%r22 ; Copy arg0 (f) to dyncall's input register.
116 COMIB,= 0,%r24,L$0001 ; Compare arg2 (newsp) to 0. Execute the
117 ; next instruction regardless of value.
118 STWS %r30,0(0,%r25) ; Store the stack pointer in the first
119 ; element (0th offset) of arg1 (area1).
120 COPY %r24,%r30 ; Move arg2 (newsp) into the stack ptr.
124 BL $$dyncall,%r31 ; Dynamic call using pointer in r22.
128 BL abort,%r2 ; Can't get here, so abort.
134 ; struct savearea *area2;
138 .CALLINFO CALLER,FRAME=0,SAVE_RP,ENTRY_GR=18,ENTRY_FR=21
139 ; No ENTRY is used since this is a magic routine.
140 ADDIL LR'PRE_Block-$global$,%r27 ; PRE_Block = 0
141 STB %r0,RR'PRE_Block-$global$(0,%r1)
143 LDWS 0(0,%r26),%r30 ; Load the stack pointer from area2
147 .EXPORT savecontext,ENTRY
148 .EXPORT returnto,ENTRY
149 .IMPORT $global$,DATA
150 .IMPORT PRE_Block,DATA
151 .IMPORT $$dyncall,MILLICODE
155 #endif /* hp9000s300 */
156 #endif /* AFS_HPUX_ENV */