- pre3:
[davej-history.git] / arch / alpha / kernel / entry.S
blob5035d2ca38d5fa9463c3b046725efc92f4383b12
1 /*
2  * alpha/entry.S
3  *
4  * kernel entry-points
5  */
7 #include <linux/config.h>
8 #include <asm/system.h>
9 #include <asm/cache.h>
11 #define SIGCHLD 20
13 #define NR_SYSCALLS 377
16  * These offsets must match with alpha_mv in <asm/machvec.h>.
17  */
18 #define HAE_CACHE       0
19 #define HAE_REG         8
22  * stack offsets
23  */
24 #define SP_OFF          184
26 #define SWITCH_STACK_SIZE 320
29  * task structure offsets
30  */
31 #define TASK_STATE              0
32 #define TASK_FLAGS              8
33 #define TASK_SIGPENDING         16
34 #define TASK_ADDR_LIMIT         24      
35 #define TASK_EXEC_DOMAIN        32
36 #define TASK_NEED_RESCHED       40
37 #define TASK_PTRACE             48
38 #define TASK_PROCESSOR          100
41  * task flags (must match include/linux/sched.h):
42  */
43 #define PT_PTRACED      0x00000001
45 #define CLONE_VM        0x00000100 
48  * This defines the normal kernel pt-regs layout.
49  *
50  * regs 9-15 preserved by C code
51  * regs 16-18 saved by PAL-code
52  * regs 29-30 saved and set up by PAL-code
53  * JRP - Save regs 16-18 in a special area of the stack, so that
54  * the palcode-provided values are available to the signal handler.
55  */
57 #define SAVE_ALL                        \
58         subq    $30,184,$30;            \
59         stq     $0,0($30);              \
60         stq     $1,8($30);              \
61         stq     $2,16($30);             \
62         stq     $3,24($30);             \
63         stq     $4,32($30);             \
64         stq     $28,144($30);           \
65         lda     $2,alpha_mv;            \
66         stq     $5,40($30);             \
67         stq     $6,48($30);             \
68         stq     $7,56($30);             \
69         stq     $8,64($30);             \
70         stq     $19,72($30);            \
71         stq     $20,80($30);            \
72         stq     $21,88($30);            \
73         ldq     $2,HAE_CACHE($2);       \
74         stq     $22,96($30);            \
75         stq     $23,104($30);           \
76         stq     $24,112($30);           \
77         stq     $25,120($30);           \
78         stq     $26,128($30);           \
79         stq     $27,136($30);           \
80         stq     $2,152($30);            \
81         stq     $16,160($30);           \
82         stq     $17,168($30);           \
83         stq     $18,176($30)
85 #define RESTORE_ALL                     \
86         lda     $19,alpha_mv;           \
87         ldq     $0,0($30);              \
88         ldq     $1,8($30);              \
89         ldq     $2,16($30);             \
90         ldq     $3,24($30);             \
91         ldq     $21,152($30);           \
92         ldq     $20,HAE_CACHE($19);     \
93         ldq     $4,32($30);             \
94         ldq     $5,40($30);             \
95         ldq     $6,48($30);             \
96         ldq     $7,56($30);             \
97         subq    $20,$21,$20;            \
98         ldq     $8,64($30);             \
99         beq     $20,99f;                \
100         ldq     $20,HAE_REG($19);       \
101         addq    $31,7,$16;              \
102         call_pal PAL_swpipl;            \
103         stq     $21,HAE_CACHE($19);     \
104         stq     $21,0($20);             \
105         mov     $0,$16;                 \
106         call_pal PAL_swpipl;            \
107         ldq     $0,0($30);              \
108         ldq     $1,8($30);              \
109 99:;                                    \
110         ldq     $19,72($30);            \
111         ldq     $20,80($30);            \
112         ldq     $21,88($30);            \
113         ldq     $22,96($30);            \
114         ldq     $23,104($30);           \
115         ldq     $24,112($30);           \
116         ldq     $25,120($30);           \
117         ldq     $26,128($30);           \
118         ldq     $27,136($30);           \
119         ldq     $28,144($30);           \
120         addq    $30,184,$30
122 .text
123 .set noat
124 #if defined(__linux__) && !defined(__ELF__)
125   .set singlegp
126 #endif
128 .align 3
129 .globl  entInt
130 .ent    entInt
131 entInt:
132         SAVE_ALL
133         lda     $8,0x3fff
134         lda     $26,ret_from_sys_call
135         bic     $30,$8,$8
136         jsr     $31,do_entInt
137 .end entInt
139 .align 3
140 .globl  entMM
141 .ent    entMM
142 entMM:
143         SAVE_ALL
144 /* save $9 - $15 so the inline exception code can manipulate them.  */
145         subq    $30,56,$30
146         stq     $9,0($30)
147         stq     $10,8($30)
148         stq     $11,16($30)
149         stq     $12,24($30)
150         stq     $13,32($30)
151         stq     $14,40($30)
152         stq     $15,48($30)
153         addq    $30,56,$19
154 /* handle the fault */
155         lda     $8,0x3fff
156         bic     $30,$8,$8
157         jsr     $26,do_page_fault
158 /* reload the registers after the exception code played.  */
159         ldq     $9,0($30)
160         ldq     $10,8($30)
161         ldq     $11,16($30)
162         ldq     $12,24($30)
163         ldq     $13,32($30)
164         ldq     $14,40($30)
165         ldq     $15,48($30)
166         addq    $30,56,$30
167 /* finish up the syscall as normal.  */
168         br      ret_from_sys_call
169 .end entMM
171 .align 3
172 .globl  entArith
173 .ent    entArith
174 entArith:
175         SAVE_ALL
176         lda     $8,0x3fff
177         lda     $26,ret_from_sys_call
178         bic     $30,$8,$8
179         jsr     $31,do_entArith
180 .end entArith
182 .align 3
183 .globl  entIF
184 .ent    entIF
185 entIF:
186         SAVE_ALL
187         lda     $8,0x3fff
188         lda     $26,ret_from_sys_call
189         bic     $30,$8,$8
190         jsr     $31,do_entIF
191 .end entIF
193 .align 3
194 .globl  entDbg
195 .ent    entDbg
196 entDbg:
197         SAVE_ALL
198         lda     $8,0x3fff
199         lda     $26,ret_from_sys_call
200         bic     $30,$8,$8
201         jsr     $31,do_entDbg
202 .end entDbg
206  * Fork() is one of the special system calls: it needs to
207  * save the callee-saved regs so that the regs can be found
208  * for the new process.. We save them in the "context switch"
209  * stack format (see arch/alpha/kernel/process.c).
211  * Also, for the kernel fork, we need to fake the system call
212  * stack buildup, as we can't do system calls from kernel space.
213  */
214 .align 3
215 .ent    kernel_clone
216 kernel_clone:
217         .frame $30, 0, $26
218         .prologue 0
219         subq    $30,6*8,$30
220         stq     $31,0($30)
221         stq     $26,8($30)
222         stq     $29,16($30)
223         stq     $16,24($30)
224         stq     $17,32($30)
225         stq     $18,40($30)
226         bis     $31,2,$0        /* Register v0: syscall nr for fork() */
227         SAVE_ALL
228         bsr     $26,sys_clone
229         stq     $0,0($30)
230         br      ret_from_sys_call
231 .end    kernel_clone
234  * kernel_thread(fn, arg, clone_flags)
235  */
236 .align 3
237 .globl  kernel_thread
238 .ent    kernel_thread
239 kernel_thread:
240         ldgp    $29,0($27)      /* we can be called from a module */
241         .frame $30, 4*8, $26
242         subq    $30,4*8,$30
243         stq     $10,16($30)
244         stq     $9,8($30)
245         lda     $0,CLONE_VM
246         stq     $26,0($30)
247         .prologue 1
248         mov     $16,$9          /* save fn */           
249         mov     $17,$10         /* save arg */
250         or      $18,$0,$16      /* shuffle flags to front; add CLONE_VM.  */
251         bsr     $26,kernel_clone
252         bne     $20,1f          /* $20 is non-zero in child */
253         ldq     $26,0($30)
254         ldq     $9,8($30)
255         ldq     $10,16($30)
256         addq    $30,4*8,$30
257         ret     $31,($26),1
258 /* this is in child: look out as we don't have any stack here.. */
259 1:      mov     $9,$27          /* get fn */
260         lda     $8,0x3fff
261         mov     $10,$16         /* get arg */
262         bic     $30,$8,$8       /* get current */
263         jsr     $26,($27)
264         ldgp    $29,0($26)
265         mov     $0,$16
266         mov     $31,$26
267         jsr     $31,sys_exit
268 .end    kernel_thread
271  * __kernel_execve(path, argv, envp, regs)
272  */
273 .align 3
274 .globl  __kernel_execve
275 .ent    __kernel_execve
276 __kernel_execve:
277         ldgp    $29,0($27)      /* we can be called from modules.  */
278         subq    $30,16,$30
279         .frame  $30,16,$26,0
280         stq     $26,0($30)
281         stq     $19,8($30)
282         .prologue 1
283         jsr     $26,do_execve
284         bne     $0,1f           /* error! */
285         ldq     $30,8($30)
286         br      $31,ret_from_sys_call
287 1:      ldq     $26,0($30)
288         addq    $30,16,$30
289         ret
290 .end    __kernel_execve
292 .align 3
293 .ent    do_switch_stack
294 do_switch_stack:
295         lda     $30,-SWITCH_STACK_SIZE($30)
296         stq     $9,0($30)
297         stq     $10,8($30)
298         stq     $11,16($30)
299         stq     $12,24($30)
300         stq     $13,32($30)
301         stq     $14,40($30)
302         stq     $15,48($30)
303         stq     $26,56($30)
304         stt     $f0,64($30)
305         stt     $f1,72($30)
306         stt     $f2,80($30)
307         stt     $f3,88($30)
308         stt     $f4,96($30)
309         stt     $f5,104($30)
310         stt     $f6,112($30)
311         stt     $f7,120($30)
312         stt     $f8,128($30)
313         stt     $f9,136($30)
314         stt     $f10,144($30)
315         stt     $f11,152($30)
316         stt     $f12,160($30)
317         stt     $f13,168($30)
318         stt     $f14,176($30)
319         stt     $f15,184($30)
320         stt     $f16,192($30)
321         stt     $f17,200($30)
322         stt     $f18,208($30)
323         stt     $f19,216($30)
324         stt     $f20,224($30)
325         stt     $f21,232($30)
326         stt     $f22,240($30)
327         stt     $f23,248($30)
328         stt     $f24,256($30)
329         stt     $f25,264($30)
330         stt     $f26,272($30)
331         stt     $f27,280($30)
332         mf_fpcr $f0             # get fpcr
333         stt     $f28,288($30)
334         stt     $f29,296($30)
335         stt     $f30,304($30)
336         stt     $f0,312($30)    # save fpcr in slot of $f31
337         ldt     $f0,64($30)     # dont let "do_switch_stack" change fp state.
338         ret     $31,($1),1
339 .end do_switch_stack
341 .align 3
342 .ent    undo_switch_stack
343 undo_switch_stack:
344         ldq     $9,0($30)
345         ldq     $10,8($30)
346         ldq     $11,16($30)
347         ldq     $12,24($30)
348         ldq     $13,32($30)
349         ldq     $14,40($30)
350         ldq     $15,48($30)
351         ldq     $26,56($30)
352         ldt     $f30,312($30)   # get saved fpcr
353         ldt     $f0,64($30)
354         ldt     $f1,72($30)
355         ldt     $f2,80($30)
356         ldt     $f3,88($30)
357         mt_fpcr $f30            # install saved fpcr
358         ldt     $f4,96($30)
359         ldt     $f5,104($30)
360         ldt     $f6,112($30)
361         ldt     $f7,120($30)
362         ldt     $f8,128($30)
363         ldt     $f9,136($30)
364         ldt     $f10,144($30)
365         ldt     $f11,152($30)
366         ldt     $f12,160($30)
367         ldt     $f13,168($30)
368         ldt     $f14,176($30)
369         ldt     $f15,184($30)
370         ldt     $f16,192($30)
371         ldt     $f17,200($30)
372         ldt     $f18,208($30)
373         ldt     $f19,216($30)
374         ldt     $f20,224($30)
375         ldt     $f21,232($30)
376         ldt     $f22,240($30)
377         ldt     $f23,248($30)
378         ldt     $f24,256($30)
379         ldt     $f25,264($30)
380         ldt     $f26,272($30)
381         ldt     $f27,280($30)
382         ldt     $f28,288($30)
383         ldt     $f29,296($30)
384         ldt     $f30,304($30)
385         lda     $30,SWITCH_STACK_SIZE($30)
386         ret     $31,($1),1
387 .end undo_switch_stack
389 .align 3
390 .globl  entUna
391 .ent    entUna
392 entUna:
393         lda     $30,-256($30)
394         stq     $0,0($30)
395         ldq     $0,256($30)     /* get PS */
396         stq     $1,8($30)
397         stq     $2,16($30)
398         stq     $3,24($30)
399         and     $0,8,$0         /* user mode? */
400         stq     $4,32($30)
401         bne     $0,entUnaUser   /* yup -> do user-level unaligned fault */
402         stq     $5,40($30)
403         stq     $6,48($30)
404         stq     $7,56($30)
405         stq     $8,64($30)
406         stq     $9,72($30)
407         stq     $10,80($30)
408         stq     $11,88($30)
409         stq     $12,96($30)
410         stq     $13,104($30)
411         stq     $14,112($30)
412         stq     $15,120($30)
413         /* 16-18 PAL-saved */
414         stq     $19,152($30)
415         stq     $20,160($30)
416         stq     $21,168($30)
417         stq     $22,176($30)
418         stq     $23,184($30)
419         stq     $24,192($30)
420         stq     $25,200($30)
421         stq     $26,208($30)
422         stq     $27,216($30)
423         stq     $28,224($30)
424         stq     $29,232($30)
425         lda     $8,0x3fff
426         stq     $31,248($30)
427         bic     $30,$8,$8
428         jsr     $26,do_entUna
429         ldq     $0,0($30)
430         ldq     $1,8($30)
431         ldq     $2,16($30)
432         ldq     $3,24($30)
433         ldq     $4,32($30)
434         ldq     $5,40($30)
435         ldq     $6,48($30)
436         ldq     $7,56($30)
437         ldq     $8,64($30)
438         ldq     $9,72($30)
439         ldq     $10,80($30)
440         ldq     $11,88($30)
441         ldq     $12,96($30)
442         ldq     $13,104($30)
443         ldq     $14,112($30)
444         ldq     $15,120($30)
445         /* 16-18 PAL-saved */
446         ldq     $19,152($30)
447         ldq     $20,160($30)
448         ldq     $21,168($30)
449         ldq     $22,176($30)
450         ldq     $23,184($30)
451         ldq     $24,192($30)
452         ldq     $25,200($30)
453         ldq     $26,208($30)
454         ldq     $27,216($30)
455         ldq     $28,224($30)
456         ldq     $29,232($30)
457         lda     $30,256($30)
458         call_pal PAL_rti
459 .end entUna
461 .align 3
462 .ent    entUnaUser
463 entUnaUser:
464         ldq     $0,0($30)       /* restore original $0 */
465         lda     $30,256($30)    /* pop entUna's stack frame */
466         SAVE_ALL                /* setup normal kernel stack */
467         lda     $30,-56($30)
468         stq     $9,0($30)
469         stq     $10,8($30)
470         stq     $11,16($30)
471         stq     $12,24($30)
472         stq     $13,32($30)
473         stq     $14,40($30)
474         stq     $15,48($30)
475         lda     $8,0x3fff
476         addq    $30,56,$19
477         bic     $30,$8,$8
478         jsr     $26,do_entUnaUser
479         ldq     $9,0($30)
480         ldq     $10,8($30)
481         ldq     $11,16($30)
482         ldq     $12,24($30)
483         ldq     $13,32($30)
484         ldq     $14,40($30)
485         ldq     $15,48($30)
486         lda     $30,56($30)
487         br      ret_from_sys_call
488 .end    entUnaUser
491  * A fork is the same as clone(SIGCHLD, 0);
492  */
493 .align 3
494 .globl  sys_fork
495 .ent    sys_fork
496 sys_fork:
497         bsr     $1,do_switch_stack
498         bis     $31,SIGCHLD,$16
499         mov     $31,$17
500         mov     $30,$18
501         jsr     $26,alpha_clone
502         bsr     $1,undo_switch_stack
503         ret     $31,($26),1
504 .end    sys_fork
506 .align 3
507 .globl  sys_clone
508 .ent    sys_clone
509 sys_clone:
510         bsr     $1,do_switch_stack
511         /* arg1 and arg2 come from the user */
512         mov     $30,$18
513         jsr     $26,alpha_clone
514         bsr     $1,undo_switch_stack
515         ret     $31,($26),1
516 .end    sys_clone
518 .align 3
519 .globl  sys_vfork
520 .ent    sys_vfork
521 sys_vfork:
522         bsr     $1,do_switch_stack
523         mov     $30,$16
524         jsr     $26,alpha_vfork
525         bsr     $1,undo_switch_stack
526         ret     $31,($26),1
527 .end    sys_vfork
529 .align 3
530 .globl  alpha_switch_to
531 .ent    alpha_switch_to
532 alpha_switch_to:
533         .prologue 0
534         bsr     $1,do_switch_stack
535         call_pal PAL_swpctx
536         unop
537         bsr     $1,undo_switch_stack
538         mov     $17,$0
539         ret     $31,($26),1
540 .end alpha_switch_to
543  * Oh, well.. Disassembling OSF/1 binaries to find out how the
544  * system calls work isn't much fun.
546  * entSys is special in that the PAL-code doesn't save a0-a2, so
547  * we start off by doing that by hand.
548  */
549 .align 3
550 .globl  entSys
551 .globl  ret_from_sys_call
552 .ent    entSys
553 entSys:
554         SAVE_ALL
555         lda     $8,0x3fff
556         bic     $30,$8,$8
557         lda     $4,NR_SYSCALLS($31)
558         stq     $16,SP_OFF+24($30)
559         lda     $5,sys_call_table
560         lda     $27,sys_ni_syscall
561         cmpult  $0,$4,$4
562         ldq     $3,TASK_PTRACE($8)
563         stq     $17,SP_OFF+32($30)
564         s8addq  $0,$5,$5
565         and     $3,PT_PTRACED,$3
566         stq     $18,SP_OFF+40($30)
567         bne     $3,strace
568         beq     $4,1f
569         ldq     $27,0($5)
570 1:      jsr     $26,($27),alpha_ni_syscall
571         ldgp    $29,0($26)
572         blt     $0,syscall_error        /* the call failed */
573         stq     $0,0($30)
574         stq     $31,72($30)             /* a3=0 => no error */
576 .align 3
577 ret_from_sys_call:
578         cmovne  $26,0,$19               /* $19 = 0 => non-restartable */
579         ldl     $3,TASK_PROCESSOR($8)
580         lda     $4,irq_stat             /* softirq_active */
581         sll     $3,L1_CACHE_SHIFT,$3
582         addq    $3,$4,$4
583         ldq     $4,0($4)                /* softirq_active[32] + softirq_mask[32] */
584         sll     $4,32,$3
585         and     $4,$3,$4
586         bne     $4,handle_softirq
587 ret_from_softirq:
588         ldq     $0,SP_OFF($30)
589         and     $0,8,$0
590         beq     $0,restore_all
591 ret_from_reschedule:
592         ldq     $2,TASK_NEED_RESCHED($8)
593         lda     $4,init_task_union
594         bne     $2,reschedule
595         xor     $4,$8,$4
596         ldl     $5,TASK_SIGPENDING($8)
597         beq     $4,restore_all
598         bne     $5,signal_return
599 restore_all:
600         RESTORE_ALL
601         call_pal PAL_rti
604 /* PTRACE syscall handler */
605 .align 3
606 strace:
607         /* set up signal stack, call syscall_trace */
608         bsr     $1,do_switch_stack
609         jsr     $26,syscall_trace
610         bsr     $1,undo_switch_stack
612         /* get the system call number and the arguments back.. */
613         ldq     $0,0($30)
614         ldq     $16,SP_OFF+24($30)
615         ldq     $17,SP_OFF+32($30)
616         ldq     $18,SP_OFF+40($30)
617         ldq     $19,72($30)
618         ldq     $20,80($30)
619         ldq     $21,88($30)
621         /* get the system call pointer.. */
622         lda     $1,NR_SYSCALLS($31)
623         lda     $2,sys_call_table
624         lda     $27,alpha_ni_syscall
625         cmpult  $0,$1,$1
626         s8addq  $0,$2,$2
627         beq     $1,1f
628         ldq     $27,0($2)
629 1:      jsr     $26,($27),sys_gettimeofday
630         ldgp    $29,0($26)
632         /* check return.. */
633         blt     $0,strace_error /* the call failed */
634         stq     $31,72($30)             /* a3=0 => no error */
635 strace_success:
636         stq     $0,0($30)               /* save return value */
638         bsr     $1,do_switch_stack
639         jsr     $26,syscall_trace
640         bsr     $1,undo_switch_stack
641         br      $31,ret_from_sys_call
643         .align  3
644 strace_error:
645         ldq     $19,0($30)      /* old syscall nr (zero if success) */
646         beq     $19,strace_success
647         ldq     $20,72($30)     /* .. and this a3 */
649         subq    $31,$0,$0       /* with error in v0 */
650         addq    $31,1,$1        /* set a3 for errno return */
651         stq     $0,0($30)
652         stq     $1,72($30)      /* a3 for return */
654         bsr     $1,do_switch_stack
655         mov     $19,$9          /* save old syscall number */
656         mov     $20,$10         /* save old a3 */
657         jsr     $26,syscall_trace
658         mov     $9,$19
659         mov     $10,$20
660         bsr     $1,undo_switch_stack
662         mov     $31,$26         /* tell "ret_from_sys_call" we can restart */
663         br      ret_from_sys_call
665         .align 3
666 handle_softirq:
667         subq    $30,16,$30
668         stq     $19,0($30)      /* save syscall nr */
669         stq     $20,8($30)      /* and error indication (a3) */
670         jsr     $26,do_softirq
671         ldq     $19,0($30)
672         ldq     $20,8($30)
673         addq    $30,16,$30
674         br      ret_from_softirq
675         
676         .align 3
677 syscall_error:
678         /*
679          * Some system calls (e.g., ptrace) can return arbitrary
680          * values which might normally be mistaken as error numbers.
681          * Those functions must zero $0 (v0) directly in the stack
682          * frame to indicate that a negative return value wasn't an
683          * error number..
684          */
685         ldq     $19,0($30)      /* old syscall nr (zero if success) */
686         beq     $19,ret_success
688         ldq     $20,72($30)     /* .. and this a3 */
689         subq    $31,$0,$0       /* with error in v0 */
690         addq    $31,1,$1        /* set a3 for errno return */
691         stq     $0,0($30)
692         mov     $31,$26         /* tell "ret_from_sys_call" we can restart */
693         stq     $1,72($30)      /* a3 for return */
694         br      ret_from_sys_call
696 ret_success:
697         stq     $0,0($30)
698         stq     $31,72($30)     /* a3=0 => no error */
699         br      ret_from_sys_call
701 .align 3
702 signal_return:
703         mov     $30,$17
704         br      $1,do_switch_stack
705         mov     $30,$18
706         mov     $31,$16
707         jsr     $26,do_signal
708         bsr     $1,undo_switch_stack
709         br      restore_all
710 .end entSys
712 #ifdef CONFIG_SMP
713         .globl  ret_from_smp_fork
714 .align 3
715 .ent ret_from_smp_fork
716 ret_from_smp_fork:
717         lda     $26,ret_from_sys_call
718         mov     $17,$16
719         jsr     $31,schedule_tail
720 .end ret_from_smp_fork
721 #endif /* CONFIG_SMP */
723 .align 3
724 .ent reschedule
725 reschedule:
726         subq    $30,16,$30
727         stq     $19,0($30)      /* save syscall nr */
728         stq     $20,8($30)      /* and error indication (a3) */
729         jsr     $26,schedule
730         ldq     $19,0($30)
731         ldq     $20,8($30)
732         addq    $30,16,$30
733         br      ret_from_reschedule
734 .end reschedule
736 .align 3
737 .ent sys_sigreturn
738 sys_sigreturn:
739         mov     $30,$17
740         lda     $18,-SWITCH_STACK_SIZE($30)
741         lda     $30,-SWITCH_STACK_SIZE($30)
742         jsr     $26,do_sigreturn
743         br      $1,undo_switch_stack
744         br      ret_from_sys_call
745 .end sys_sigreturn
747 .align 3
748 .ent sys_rt_sigreturn
749 sys_rt_sigreturn:
750         mov     $30,$17
751         lda     $18,-SWITCH_STACK_SIZE($30)
752         lda     $30,-SWITCH_STACK_SIZE($30)
753         jsr     $26,do_rt_sigreturn
754         br      $1,undo_switch_stack
755         br      ret_from_sys_call
756 .end sys_rt_sigreturn
758 .align 3
759 .ent sys_sigsuspend
760 sys_sigsuspend:
761         mov     $30,$17
762         br      $1,do_switch_stack
763         mov     $30,$18
764         jsr     $26,do_sigsuspend
765         lda     $30,SWITCH_STACK_SIZE($30)
766         br      ret_from_sys_call
767 .end sys_sigsuspend
769 .align 3
770 .ent sys_rt_sigsuspend
771 sys_rt_sigsuspend:
772         mov     $30,$18
773         br      $1,do_switch_stack
774         mov     $30,$19
775         jsr     $26,do_rt_sigsuspend
776         lda     $30,SWITCH_STACK_SIZE($30)
777         br      ret_from_sys_call
778 .end sys_rt_sigsuspend
780         .data
781         .align 3
782         .globl sys_call_table
783 sys_call_table:
784         .quad alpha_ni_syscall                  /* 0 */
785         .quad sys_exit
786         .quad sys_fork
787         .quad sys_read
788         .quad sys_write
789         .quad alpha_ni_syscall                  /* 5 */
790         .quad sys_close
791         .quad osf_wait4
792         .quad alpha_ni_syscall
793         .quad sys_link
794         .quad sys_unlink                        /* 10 */
795         .quad alpha_ni_syscall
796         .quad sys_chdir
797         .quad sys_fchdir
798         .quad sys_mknod
799         .quad sys_chmod                         /* 15 */
800         .quad sys_chown
801         .quad osf_brk
802         .quad alpha_ni_syscall
803         .quad sys_lseek
804         .quad sys_getxpid                       /* 20 */
805         .quad osf_mount
806         .quad sys_umount
807         .quad sys_setuid
808         .quad sys_getxuid
809         .quad alpha_ni_syscall                  /* 25 */
810         .quad sys_ptrace
811         .quad alpha_ni_syscall
812         .quad alpha_ni_syscall
813         .quad alpha_ni_syscall
814         .quad alpha_ni_syscall                  /* 30 */
815         .quad alpha_ni_syscall
816         .quad alpha_ni_syscall
817         .quad sys_access
818         .quad alpha_ni_syscall
819         .quad alpha_ni_syscall                  /* 35 */
820         .quad sys_sync
821         .quad sys_kill
822         .quad alpha_ni_syscall
823         .quad sys_setpgid
824         .quad alpha_ni_syscall                  /* 40 */
825         .quad sys_dup
826         .quad sys_pipe
827         .quad osf_set_program_attributes
828         .quad alpha_ni_syscall
829         .quad sys_open                          /* 45 */
830         .quad alpha_ni_syscall
831         .quad sys_getxgid
832         .quad osf_sigprocmask
833         .quad alpha_ni_syscall
834         .quad alpha_ni_syscall                  /* 50 */
835         .quad sys_acct
836         .quad sys_sigpending
837         .quad alpha_ni_syscall
838         .quad sys_ioctl
839         .quad alpha_ni_syscall                  /* 55 */
840         .quad alpha_ni_syscall
841         .quad sys_symlink
842         .quad sys_readlink
843         .quad sys_execve
844         .quad sys_umask                         /* 60 */
845         .quad sys_chroot
846         .quad alpha_ni_syscall
847         .quad sys_getpgrp
848         .quad sys_getpagesize
849         .quad alpha_ni_syscall                  /* 65 */
850         .quad sys_vfork
851         .quad sys_newstat
852         .quad sys_newlstat
853         .quad alpha_ni_syscall
854         .quad alpha_ni_syscall                  /* 70 */
855         .quad osf_mmap
856         .quad alpha_ni_syscall
857         .quad sys_munmap
858         .quad sys_mprotect
859         .quad sys_madvise                       /* 75 */
860         .quad sys_vhangup
861         .quad alpha_ni_syscall
862         .quad alpha_ni_syscall
863         .quad sys_getgroups
864         /* map BSD's setpgrp to sys_setpgid for binary compatibility: */
865         .quad sys_setgroups                     /* 80 */
866         .quad alpha_ni_syscall
867         .quad sys_setpgid
868         .quad osf_setitimer
869         .quad alpha_ni_syscall
870         .quad alpha_ni_syscall                  /* 85 */
871         .quad osf_getitimer
872         .quad sys_gethostname
873         .quad sys_sethostname
874         .quad sys_getdtablesize
875         .quad sys_dup2                          /* 90 */
876         .quad sys_newfstat
877         .quad sys_fcntl
878         .quad osf_select
879         .quad sys_poll
880         .quad sys_fsync                         /* 95 */
881         .quad sys_setpriority
882         .quad sys_socket
883         .quad sys_connect
884         .quad sys_accept
885         .quad osf_getpriority                   /* 100 */
886         .quad sys_send
887         .quad sys_recv
888         .quad sys_sigreturn
889         .quad sys_bind
890         .quad sys_setsockopt                    /* 105 */
891         .quad sys_listen
892         .quad alpha_ni_syscall
893         .quad alpha_ni_syscall
894         .quad alpha_ni_syscall
895         .quad alpha_ni_syscall                  /* 110 */
896         .quad sys_sigsuspend
897         .quad osf_sigstack
898         .quad sys_recvmsg
899         .quad sys_sendmsg
900         .quad alpha_ni_syscall                  /* 115 */
901         .quad osf_gettimeofday
902         .quad osf_getrusage
903         .quad sys_getsockopt
904         .quad alpha_ni_syscall
905         .quad sys_readv                         /* 120 */
906         .quad sys_writev
907         .quad osf_settimeofday
908         .quad sys_fchown
909         .quad sys_fchmod
910         .quad sys_recvfrom                      /* 125 */
911         .quad sys_setreuid
912         .quad sys_setregid
913         .quad sys_rename
914         .quad sys_truncate
915         .quad sys_ftruncate                     /* 130 */
916         .quad sys_flock
917         .quad sys_setgid
918         .quad sys_sendto
919         .quad sys_shutdown
920         .quad sys_socketpair                    /* 135 */
921         .quad sys_mkdir
922         .quad sys_rmdir
923         .quad osf_utimes
924         .quad alpha_ni_syscall
925         .quad alpha_ni_syscall                  /* 140 */
926         .quad sys_getpeername
927         .quad alpha_ni_syscall
928         .quad alpha_ni_syscall
929         .quad sys_getrlimit
930         .quad sys_setrlimit                     /* 145 */
931         .quad alpha_ni_syscall
932         .quad sys_setsid
933         .quad sys_quotactl
934         .quad alpha_ni_syscall
935         .quad sys_getsockname                   /* 150 */
936         .quad alpha_ni_syscall
937         .quad alpha_ni_syscall
938         .quad alpha_ni_syscall
939         .quad alpha_ni_syscall
940         .quad alpha_ni_syscall                  /* 155 */
941         .quad osf_sigaction
942         .quad alpha_ni_syscall
943         .quad alpha_ni_syscall
944         .quad osf_getdirentries
945         .quad osf_statfs                        /* 160 */
946         .quad osf_fstatfs
947         .quad alpha_ni_syscall
948         .quad alpha_ni_syscall
949         .quad alpha_ni_syscall
950         .quad osf_getdomainname                 /* 165 */
951         .quad sys_setdomainname
952         .quad alpha_ni_syscall
953         .quad alpha_ni_syscall
954         .quad alpha_ni_syscall
955         .quad alpha_ni_syscall                  /* 170 */
956         .quad alpha_ni_syscall
957         .quad alpha_ni_syscall
958         .quad alpha_ni_syscall
959         .quad alpha_ni_syscall
960         .quad alpha_ni_syscall                  /* 175 */
961         .quad alpha_ni_syscall
962         .quad alpha_ni_syscall
963         .quad alpha_ni_syscall
964         .quad alpha_ni_syscall
965         .quad alpha_ni_syscall                  /* 180 */
966         .quad alpha_ni_syscall
967         .quad alpha_ni_syscall
968         .quad alpha_ni_syscall
969         .quad alpha_ni_syscall
970         .quad alpha_ni_syscall                  /* 185 */
971         .quad alpha_ni_syscall
972         .quad alpha_ni_syscall
973         .quad alpha_ni_syscall
974         .quad alpha_ni_syscall
975         .quad alpha_ni_syscall                  /* 190 */
976         .quad alpha_ni_syscall
977         .quad alpha_ni_syscall
978         .quad alpha_ni_syscall
979         .quad alpha_ni_syscall
980         .quad alpha_ni_syscall                  /* 195 */
981         .quad alpha_ni_syscall
982         .quad alpha_ni_syscall
983         .quad alpha_ni_syscall
984         .quad osf_swapon
985         .quad sys_msgctl                        /* 200 */
986         .quad sys_msgget
987         .quad sys_msgrcv
988         .quad sys_msgsnd
989         .quad sys_semctl
990         .quad sys_semget                        /* 205 */
991         .quad sys_semop
992         .quad osf_utsname
993         .quad sys_lchown
994         .quad osf_shmat
995         .quad sys_shmctl                        /* 210 */
996         .quad sys_shmdt
997         .quad sys_shmget
998         .quad alpha_ni_syscall
999         .quad alpha_ni_syscall
1000         .quad alpha_ni_syscall                  /* 215 */
1001         .quad alpha_ni_syscall
1002         .quad sys_msync
1003         .quad alpha_ni_syscall
1004         .quad alpha_ni_syscall
1005         .quad alpha_ni_syscall                  /* 220 */
1006         .quad alpha_ni_syscall
1007         .quad alpha_ni_syscall
1008         .quad alpha_ni_syscall
1009         .quad alpha_ni_syscall
1010         .quad alpha_ni_syscall                  /* 225 */
1011         .quad alpha_ni_syscall
1012         .quad alpha_ni_syscall
1013         .quad alpha_ni_syscall
1014         .quad alpha_ni_syscall
1015         .quad alpha_ni_syscall                  /* 230 */
1016         .quad alpha_ni_syscall
1017         .quad alpha_ni_syscall
1018         .quad sys_getpgid
1019         .quad sys_getsid
1020         .quad sys_sigaltstack                   /* 235 */
1021         .quad alpha_ni_syscall
1022         .quad alpha_ni_syscall
1023         .quad alpha_ni_syscall
1024         .quad alpha_ni_syscall
1025         .quad alpha_ni_syscall                  /* 240 */
1026         .quad osf_sysinfo
1027         .quad alpha_ni_syscall
1028         .quad alpha_ni_syscall
1029         .quad osf_proplist_syscall
1030         .quad alpha_ni_syscall                  /* 245 */
1031         .quad alpha_ni_syscall
1032         .quad alpha_ni_syscall
1033         .quad alpha_ni_syscall
1034         .quad alpha_ni_syscall
1035         .quad alpha_ni_syscall                  /* 250 */
1036         .quad osf_usleep_thread
1037         .quad alpha_ni_syscall
1038         .quad alpha_ni_syscall
1039         .quad sys_sysfs
1040         .quad alpha_ni_syscall                  /* 255 */
1041         .quad osf_getsysinfo
1042         .quad osf_setsysinfo
1043         .quad alpha_ni_syscall
1044         .quad alpha_ni_syscall
1045         .quad alpha_ni_syscall                  /* 260 */
1046         .quad alpha_ni_syscall
1047         .quad alpha_ni_syscall
1048         .quad alpha_ni_syscall
1049         .quad alpha_ni_syscall
1050         .quad alpha_ni_syscall                  /* 265 */
1051         .quad alpha_ni_syscall
1052         .quad alpha_ni_syscall
1053         .quad alpha_ni_syscall
1054         .quad alpha_ni_syscall
1055         .quad alpha_ni_syscall                  /* 270 */
1056         .quad alpha_ni_syscall
1057         .quad alpha_ni_syscall
1058         .quad alpha_ni_syscall
1059         .quad alpha_ni_syscall
1060         .quad alpha_ni_syscall                  /* 275 */
1061         .quad alpha_ni_syscall
1062         .quad alpha_ni_syscall
1063         .quad alpha_ni_syscall
1064         .quad alpha_ni_syscall
1065         .quad alpha_ni_syscall                  /* 280 */
1066         .quad alpha_ni_syscall
1067         .quad alpha_ni_syscall
1068         .quad alpha_ni_syscall
1069         .quad alpha_ni_syscall
1070         .quad alpha_ni_syscall                  /* 285 */
1071         .quad alpha_ni_syscall
1072         .quad alpha_ni_syscall
1073         .quad alpha_ni_syscall
1074         .quad alpha_ni_syscall
1075         .quad alpha_ni_syscall                  /* 290 */
1076         .quad alpha_ni_syscall
1077         .quad alpha_ni_syscall
1078         .quad alpha_ni_syscall
1079         .quad alpha_ni_syscall
1080         .quad alpha_ni_syscall                  /* 295 */
1081         .quad alpha_ni_syscall
1082         .quad alpha_ni_syscall
1083         .quad alpha_ni_syscall
1084         .quad alpha_ni_syscall
1085 /* linux-specific system calls start at 300 */
1086         .quad sys_bdflush                       /* 300 */
1087         .quad sys_sethae
1088         .quad sys_mount
1089         .quad sys_old_adjtimex
1090         .quad sys_swapoff
1091         .quad sys_getdents                      /* 305 */
1092         .quad alpha_create_module
1093         .quad sys_init_module
1094         .quad sys_delete_module
1095         .quad sys_get_kernel_syms
1096         .quad sys_syslog                        /* 310 */
1097         .quad sys_reboot
1098         .quad sys_clone
1099         .quad sys_uselib
1100         .quad sys_mlock
1101         .quad sys_munlock                       /* 315 */
1102         .quad sys_mlockall
1103         .quad sys_munlockall
1104         .quad sys_sysinfo
1105         .quad sys_sysctl
1106         .quad sys_ni_syscall                    /* 320 */
1107         .quad sys_oldumount
1108         .quad sys_swapon
1109         .quad sys_times
1110         .quad sys_personality
1111         .quad sys_setfsuid                      /* 325 */
1112         .quad sys_setfsgid
1113         .quad sys_ustat
1114         .quad sys_statfs
1115         .quad sys_fstatfs
1116         .quad sys_sched_setparam                /* 330 */
1117         .quad sys_sched_getparam
1118         .quad sys_sched_setscheduler
1119         .quad sys_sched_getscheduler
1120         .quad sys_sched_yield
1121         .quad sys_sched_get_priority_max        /* 335 */
1122         .quad sys_sched_get_priority_min
1123         .quad sys_sched_rr_get_interval
1124         .quad sys_ni_syscall                    /* sys_afs_syscall */
1125         .quad sys_newuname
1126         .quad sys_nanosleep                     /* 340 */
1127         .quad sys_mremap
1128         .quad sys_nfsservctl
1129         .quad sys_setresuid
1130         .quad sys_getresuid
1131         .quad sys_pciconfig_read                /* 345 */
1132         .quad sys_pciconfig_write
1133         .quad sys_query_module
1134         .quad sys_prctl
1135         .quad sys_pread
1136         .quad sys_pwrite                        /* 350 */
1137         .quad sys_rt_sigreturn
1138         .quad sys_rt_sigaction
1139         .quad sys_rt_sigprocmask
1140         .quad sys_rt_sigpending
1141         .quad sys_rt_sigtimedwait               /* 355 */
1142         .quad sys_rt_sigqueueinfo
1143         .quad sys_rt_sigsuspend
1144         .quad sys_select
1145         .quad sys_gettimeofday
1146         .quad sys_settimeofday                  /* 360 */
1147         .quad sys_getitimer
1148         .quad sys_setitimer
1149         .quad sys_utimes
1150         .quad sys_getrusage
1151         .quad sys_wait4                         /* 365 */
1152         .quad sys_adjtimex
1153         .quad sys_getcwd
1154         .quad sys_capget
1155         .quad sys_capset
1156         .quad sys_sendfile                      /* 370 */
1157         .quad sys_setresgid
1158         .quad sys_getresgid
1159         .quad sys_ni_syscall                    /* sys_dipc */
1160         .quad sys_pivot_root
1161         .quad sys_mincore                       /* 375 */
1162         .quad sys_pciconfig_iobase
1163         .quad sys_getdents64