|
|
1.1 root 1: /* @(#)asm_linkage.h 1.1 86/02/03 SMI */
2:
3: /*
4: * Copyright (c) 1985 by Sun Microsystems, Inc.
5: */
6:
7: /*
8: * Entry macros for assembler subroutines.
9: */
10: #define IDENTITY(x) x
11: #define NAME(x) IDENTITY(_)x
12:
13: #ifdef GPROF
14: #define ENTRY(x) \
15: .globl NAME(x); \
16: NAME(x): \
17: link a6,#0; \
18: movl #1f,a0; \
19: jbsr mcount; \
20: unlk a6; \
21: .bss; \
22: .even; \
23: 1: .skip 4; \
24: .text
25:
26: #define ENTRY2(x,y) \
27: .globl NAME(x), NAME(y); \
28: NAME(x): ; \
29: NAME(y): \
30: link a6,#0; \
31: movl #1f,a0; \
32: jbsr mcount; \
33: unlk a6; \
34: .bss; \
35: .even; \
36: 1: .skip 4; \
37: .text
38:
39: /*
40: * CCENTRY is for cc known subroutines like ldivt which
41: * know and use a0, a1, d0 and d1. This means we have to
42: * save them.
43: */
44: #define CCENTRY(x) \
45: .globl x; \
46: x: \
47: link a6,#-16; \
48: moveml #0x0303,sp@; \
49: movl #1f,a0; \
50: jbsr mcount; \
51: moveml sp@,#0x0303; \
52: unlk a6; \
53: .bss; \
54: .even; \
55: 1: .skip 4; \
56: .text
57: #else GPROF
58: #define ENTRY(x) \
59: .globl NAME(x); \
60: NAME(x):
61:
62: #define ENTRY2(x,y) \
63: .globl NAME(x), NAME(y); \
64: NAME(x): \
65: NAME(y):
66:
67: #define CCENTRY(x) \
68: .globl x; \
69: x:
70: #endif GPROF
71:
72: /*
73: * Macro for autovectored interrupts.
74: */
75: #define IOINTR(LEVEL) \
76: moveml #0xE0E0,sp@- /* save regs we trash <d0,d1,d2,a0,a1,a2> */;\
77: movl sp,d2 /* save copy of previous sp */;\
78: cmpl #eintstack,sp /* on interrupt stack? */;\
79: jls 1f /* yes, skip */;\
80: lea eintstack,sp /* no, switch to interrupt stack */;\
81: 1: movl #_level/**/LEVEL/**/_vector,a2 /* get vector ptr */;\
82: 2: movl a2@+,a1 /* get routine address */;\
83: jsr a1@ /* go there */;\
84: tstl d0 /* success? */;\
85: beqs 2b /* no, try next one */;\
86: movl d2,sp /* restore stack pointer */;\
87: cmpl #0x80000000,d0 /* spurious? */;\
88: jeq rei_iop /* yes */;\
89: clrl _level/**/LEVEL/**/_spurious /* no, clr spurious cnt */;\
90: jra rei_iop
91:
92: /*
93: * Macro for vectored interrupts.
94: */
95: #define VECINTR(ifunc, cfunc, carg) \
96: .globl ifunc;\
97: ifunc:;\
98: moveml #0xE0C0,sp@- /* save regs we trash <d0,d1,d2,a0,a1> */;\
99: movl sp,d2 /* save copy of previous sp */;\
100: cmpl #eintstack,sp /* on interrupt stack? */;\
101: jls 1f /* yes, skip */;\
102: lea eintstack,sp /* no, switch to interrupt stack */;\
103: 1: movl carg,sp@- /* push arg to interrupt routine */;\
104: jsr cfunc /* go to it */;\
105: movl d2,sp /* restore stack pointer */;\
106: moveml sp@+,#0x0307 /* restore saved registers <a1,a0,d2,d1,d0> */;\
107: jra rei_io
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.