|
|
1.1 root 1: .data
2: .asciz "@(#)setjmp.s 1.1 86/02/03 Copyr 1984 Sun Micro"
3: .even
4: .text
5:
6: | Copyright (c) 1984 by Sun Microsystems, Inc.
7:
8: #include "../machine/asm_linkage.h"
9:
10: | Longjmp and setjmp implement non-local gotos
11: | using state vectors of type label_t (13 longs).
12: | Registers saved are the PC, d2-d7, and a2-a7.
13: SAVREGS = 0xFCFC
14:
15: ENTRY(setjmp)
16: movl sp@(4),a1 | get label_t address
17: moveml #SAVREGS,a1@(4) | save data/address regs
18: movl sp@,a1@ | save PC of caller
19: clrl d0 | return zero
20: rts
21:
22: ENTRY(longjmp)
23: movl sp@(4),a1 | get label_t address
24: moveml a1@(4),#SAVREGS | restore data/address regs
25: | Note: we just changed stacks
26: movl a1@,sp@ | restore PC
27: movl #1,d0 | return one
28: rts
29:
30: | syscall_setjmp just saves a6 and sp
31: | it is called from syscall, where speed is important
32:
33: ENTRY(syscall_setjmp)
34: movl sp@(4),a1 | get label_t address
35: movl a6,a1@(4+(10*4)) | save a6
36: movl sp,a1@(4+(11*4)) | save sp
37: movl sp@,a1@ | save PC of caller
38: clrl d0 | return zero
39: rts
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.