4.115
Last change
on this file since 434e7f7 was
434e7f7,
checked in by Daniel Hellstrom <daniel@…>, on 05/23/14 at 13:52:15
|
SPARC: syscall code clean-up and minor optimizations
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[f421132] | 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) |
---|
[359e537] | 10 | * |
---|
[f421132] | 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 | |
---|
[173fd7c] | 19 | #include <rtems/asm.h> |
---|
[f421132] | 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 | |
---|
| 36 | SYM(syscall): |
---|
| 37 | |
---|
| 38 | subcc %g1, 2, %g0 ! syscall 2, disable interrupts |
---|
| 39 | bne 3f |
---|
[434e7f7] | 40 | subcc %g1, 3, %g0 ! syscall 3, enable interrupts |
---|
[f421132] | 41 | or %l0, 0x0f00, %l4 ! set PIL=15 |
---|
[434e7f7] | 42 | ba 9f |
---|
| 43 | or %l0, SPARC_PSR_ET_MASK, %i0 ! return old psr with ET=1 |
---|
[f421132] | 44 | 3: |
---|
| 45 | bne 1f |
---|
[434e7f7] | 46 | and %i0, SPARC_PSR_PIL_MASK, %l4 |
---|
[f421132] | 47 | andn %l0, SPARC_PSR_PIL_MASK, %l5 |
---|
| 48 | or %l5, %l4, %l4 |
---|
| 49 | 9: ! leave |
---|
[434e7f7] | 50 | mov %l4, %psr ! Update PSR according to Syscall 2 or 3 |
---|
[359e537] | 51 | mov 0, %g1 ! clear %g1 |
---|
[434e7f7] | 52 | jmpl %l2, %g0 |
---|
| 53 | rett %l2 + 4 |
---|
| 54 | 1: |
---|
| 55 | ta 0 ! syscall 1 (not 2 or 3), halt |
---|
[f421132] | 56 | |
---|
| 57 | PUBLIC(sparc_disable_interrupts) |
---|
| 58 | |
---|
| 59 | SYM(sparc_disable_interrupts): |
---|
| 60 | |
---|
| 61 | mov SYS_irqdis, %g1 |
---|
| 62 | retl |
---|
[434e7f7] | 63 | ta 0 |
---|
[f421132] | 64 | |
---|
| 65 | PUBLIC(sparc_enable_interrupts) |
---|
| 66 | |
---|
| 67 | SYM(sparc_enable_interrupts): |
---|
| 68 | |
---|
| 69 | mov SYS_irqen, %g1 |
---|
| 70 | retl |
---|
[434e7f7] | 71 | ta 0 |
---|
[f421132] | 72 | |
---|
| 73 | /* end of file */ |
---|
Note: See
TracBrowser
for help on using the repository browser.