source: rtems/c/src/lib/libcpu/sparc/syscall/syscall.S @ 434e7f7

4.115
Last change on this file since 434e7f7 was 434e7f7, checked in by Daniel Hellstrom <daniel@…>, on May 23, 2014 at 1:52:15 PM

SPARC: syscall code clean-up and minor optimizations

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  systrap.S
3 *
4 *  This file contains emulated system calls using software trap 0.
5 *  The following calls are supported:
6 *
7 *    + SYS_exit        (halt)
8 *    + SYS_irqdis      (disable interrupts)
9 *    + SYS_irqset      (set interrupt level)
10 *
11 *  COPYRIGHT:
12 *
13 *  COPYRIGHT (c) 1995. European Space Agency.
14 *
15 *  This terms of the RTEMS license apply to this file.
16 *
17 */
18
19#include <rtems/asm.h>
20#include "syscall.h"
21
22        .seg    "text"
23        /*
24         *  system call
25         *
26         *  On entry:
27         *
28         *    l0 = psr (from trap table)
29         *    l1 = pc
30         *    l2 = npc
31         *    g1 = system call id
32         */
33
34        PUBLIC(syscall)
35
36SYM(syscall):
37
38        subcc   %g1, 2, %g0             ! syscall 2, disable interrupts
39        bne     3f
40         subcc   %g1, 3, %g0            ! syscall 3, enable interrupts
41        or      %l0, 0x0f00, %l4        ! set PIL=15
42        ba      9f
43         or     %l0, SPARC_PSR_ET_MASK, %i0     ! return old psr with ET=1
443:
45        bne     1f
46         and    %i0, SPARC_PSR_PIL_MASK, %l4
47        andn    %l0, SPARC_PSR_PIL_MASK, %l5
48        or      %l5, %l4, %l4
499:                                      ! leave
50        mov     %l4, %psr               ! Update PSR according to Syscall 2 or 3
51        mov     0, %g1                  ! clear %g1
52        jmpl    %l2, %g0
53         rett    %l2 + 4
541:
55        ta      0                       ! syscall 1 (not 2 or 3), halt
56
57        PUBLIC(sparc_disable_interrupts)
58
59SYM(sparc_disable_interrupts):
60
61        mov     SYS_irqdis, %g1
62        retl
63         ta     0
64
65        PUBLIC(sparc_enable_interrupts)
66
67SYM(sparc_enable_interrupts):
68
69        mov     SYS_irqen, %g1
70        retl
71         ta     0
72
73/* end of file */
Note: See TracBrowser for help on using the repository browser.