forked from Imagelibrary/rtems
New files from Jiri Gaisler <jgais@ws.estec.esa.nl>.
This commit is contained in:
71
c/src/lib/libcpu/sparc/syscall/Makefile.in
Normal file
71
c/src/lib/libcpu/sparc/syscall/Makefile.in
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
top_builddir = ../../../../../..
|
||||||
|
subdir = c/src/lib/libcpu/sparc/syscall
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
|
||||||
|
RTEMS_ROOT = $(top_srcdir)/@RTEMS_TOPdir@
|
||||||
|
PROJECT_ROOT = @PROJECT_ROOT@
|
||||||
|
|
||||||
|
VPATH = @srcdir@
|
||||||
|
|
||||||
|
PGM=${ARCH}/syscall.rel
|
||||||
|
|
||||||
|
# C source names, if any, go here -- minus the .c
|
||||||
|
C_PIECES=
|
||||||
|
C_FILES=$(C_PIECES:%=%.c)
|
||||||
|
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
|
||||||
|
|
||||||
|
H_FILES=
|
||||||
|
|
||||||
|
# Assembly source names, if any, go here -- minus the .S
|
||||||
|
S_PIECES=syscall
|
||||||
|
S_FILES=$(S_PIECES:%=%.S)
|
||||||
|
S_O_FILES=$(S_FILES:%.S=${ARCH}/%.o)
|
||||||
|
|
||||||
|
SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
|
||||||
|
OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
|
||||||
|
|
||||||
|
include $(RTEMS_ROOT)/make/custom/${RTEMS_BSP}.cfg
|
||||||
|
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||||
|
|
||||||
|
#
|
||||||
|
# (OPTIONAL) Add local stuff here using +=
|
||||||
|
#
|
||||||
|
|
||||||
|
DEFINES +=
|
||||||
|
CPPFLAGS +=
|
||||||
|
CFLAGS += $(CFLAGS_OS_V)
|
||||||
|
|
||||||
|
LD_PATHS +=
|
||||||
|
LD_LIBS +=
|
||||||
|
LDFLAGS +=
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add your list of files to delete here. The config files
|
||||||
|
# already know how to delete some stuff, so you may want
|
||||||
|
# to just run 'make clean' first to see what gets missed.
|
||||||
|
# 'make clobber' already includes 'make clean'
|
||||||
|
#
|
||||||
|
|
||||||
|
CLEAN_ADDITIONS +=
|
||||||
|
CLOBBER_ADDITIONS +=
|
||||||
|
|
||||||
|
${PGM}: ${SRCS} ${OBJS}
|
||||||
|
$(make-rel)
|
||||||
|
|
||||||
|
all: ${ARCH} $(SRCS) $(PGM)
|
||||||
|
|
||||||
|
# the .rel file built here will be put into libbsp.a by
|
||||||
|
# libbsp/sparc/BSP/wrapup/Makefile
|
||||||
|
install: all
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
cd $(top_builddir) \
|
||||||
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
78
c/src/lib/libcpu/sparc/syscall/syscall.S
Normal file
78
c/src/lib/libcpu/sparc/syscall/syscall.S
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* systrap.S
|
||||||
|
*
|
||||||
|
* This file contains emulated system calls using software trap 0.
|
||||||
|
* The following calls are supported:
|
||||||
|
*
|
||||||
|
* + SYS_exit (halt)
|
||||||
|
* + SYS_irqdis (disable interrupts)
|
||||||
|
* + SYS_irqset (set interrupt level)
|
||||||
|
*
|
||||||
|
* COPYRIGHT:
|
||||||
|
*
|
||||||
|
* COPYRIGHT (c) 1995. European Space Agency.
|
||||||
|
*
|
||||||
|
* This terms of the RTEMS license apply to this file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <asm.h>
|
||||||
|
#include "syscall.h"
|
||||||
|
|
||||||
|
.seg "text"
|
||||||
|
/*
|
||||||
|
* system call
|
||||||
|
*
|
||||||
|
* On entry:
|
||||||
|
*
|
||||||
|
* l0 = psr (from trap table)
|
||||||
|
* l1 = pc
|
||||||
|
* l2 = npc
|
||||||
|
* g1 = system call id
|
||||||
|
*/
|
||||||
|
|
||||||
|
PUBLIC(syscall)
|
||||||
|
|
||||||
|
SYM(syscall):
|
||||||
|
|
||||||
|
subcc %g1, 2, %g0 ! syscall 2, disable interrupts
|
||||||
|
bne 3f
|
||||||
|
or %l0, 0x0f00, %l4 ! set PIL=15
|
||||||
|
mov %l4, %psr
|
||||||
|
or %l0, SPARC_PSR_ET_MASK, %i0 ! return old psr with ET=1
|
||||||
|
ba,a 9f
|
||||||
|
3:
|
||||||
|
subcc %g1, 3, %g0 ! syscall 3, enable interrupts
|
||||||
|
bne 1f
|
||||||
|
and %i0, SPARC_PSR_PIL_MASK, %l4
|
||||||
|
andn %l0, SPARC_PSR_PIL_MASK, %l5
|
||||||
|
or %l5, %l4, %l4
|
||||||
|
mov %l4, %psr
|
||||||
|
ba,a 9f
|
||||||
|
|
||||||
|
1:
|
||||||
|
ta 0 ! halt
|
||||||
|
9: ! leave
|
||||||
|
mov 0, %g1 ! clear %g1
|
||||||
|
jmpl %l2, %g0
|
||||||
|
rett %l2 + 4
|
||||||
|
|
||||||
|
PUBLIC(sparc_disable_interrupts)
|
||||||
|
|
||||||
|
SYM(sparc_disable_interrupts):
|
||||||
|
|
||||||
|
mov SYS_irqdis, %g1
|
||||||
|
ta 0
|
||||||
|
retl
|
||||||
|
nop
|
||||||
|
|
||||||
|
PUBLIC(sparc_enable_interrupts)
|
||||||
|
|
||||||
|
SYM(sparc_enable_interrupts):
|
||||||
|
|
||||||
|
mov SYS_irqen, %g1
|
||||||
|
ta 0
|
||||||
|
retl
|
||||||
|
nop
|
||||||
|
|
||||||
|
/* end of file */
|
||||||
4
c/src/lib/libcpu/sparc/syscall/syscall.h
Normal file
4
c/src/lib/libcpu/sparc/syscall/syscall.h
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
#define SYS_exit 1
|
||||||
|
#define SYS_irqdis 2
|
||||||
|
#define SYS_irqen 3
|
||||||
Reference in New Issue
Block a user