Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2609 → Rev 2610

/trunk/kernel/arch/sparc64/include/syscall.h
File deleted
/trunk/kernel/arch/sparc64/include/stack.h
46,10 → 46,26
#define STACK_WINDOW_SAVE_AREA_SIZE (16 * STACK_ITEM_SIZE)
 
/**
* Six extended words for first six arguments.
*/
#define STACK_ARG_SAVE_AREA_SIZE (6 * STACK_ITEM_SIZE)
 
/**
* By convention, the actual top of the stack is %sp + STACK_BIAS.
*/
#define STACK_BIAS 2047
 
/*
* Offsets of arguments on stack.
*/
#define STACK_ARG0 0
#define STACK_ARG1 8
#define STACK_ARG2 16
#define STACK_ARG3 24
#define STACK_ARG4 32
#define STACK_ARG5 40
#define STACK_ARG6 48
 
#endif
 
/** @}
/trunk/kernel/arch/sparc64/include/trap/syscall.h
45,10 → 45,8
#ifdef __ASM__
 
.macro TRAP_INSTRUCTION n
mov TT_TRAP_INSTRUCTION(\n), %g2
sethi %hi(syscall), %g1
ba trap_instruction_handler
or %g1, %lo(syscall), %g1
mov TT_TRAP_INSTRUCTION(\n) - TT_TRAP_INSTRUCTION(0), %g2
.endm
 
#endif /* __ASM__ */
/trunk/kernel/arch/sparc64/include/trap/trap_table.h
77,22 → 77,26
.endm
 
/*
* The following needs to be in sync with the
* definition of the istate structure.
* The following needs to be in sync with the definition of the istate
* structure. The one STACK_ITEM_SIZE is counted for space holding the 7th
* argument to syscall_handler (i.e. syscall number) and the other
* STACK_ITEM_SIZE is counted because of the required alignment.
*/
#define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE (STACK_WINDOW_SAVE_AREA_SIZE+(12*8))
#define SAVED_TSTATE -(1*8)
#define SAVED_TPC -(2*8)
#define SAVED_TNPC -(3*8) /* <-- istate_t begins here */
#define SAVED_Y -(4*8)
#define SAVED_I0 -(5*8)
#define SAVED_I1 -(6*8)
#define SAVED_I2 -(7*8)
#define SAVED_I3 -(8*8)
#define SAVED_I4 -(9*8)
#define SAVED_I5 -(10*8)
#define SAVED_I6 -(11*8)
#define SAVED_I7 -(12*8)
#define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE \
(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE + \
(2 * STACK_ITEM_SIZE) + (12 * 8))
#define SAVED_TSTATE -(1 * 8)
#define SAVED_TPC -(2 * 8)
#define SAVED_TNPC -(3 * 8) /* <-- istate_t begins here */
#define SAVED_Y -(4 * 8)
#define SAVED_I0 -(5 * 8)
#define SAVED_I1 -(6 * 8)
#define SAVED_I2 -(7 * 8)
#define SAVED_I3 -(8 * 8)
#define SAVED_I4 -(9 * 8)
#define SAVED_I5 -(10 * 8)
#define SAVED_I6 -(11 * 8)
#define SAVED_I7 -(12 * 8)
 
.macro PREEMPTIBLE_HANDLER f
sethi %hi(\f), %g1
/trunk/kernel/arch/sparc64/Makefile.inc
99,7 → 99,6
arch/$(ARCH)/src/trap/trap.c \
arch/$(ARCH)/src/trap/exception.c \
arch/$(ARCH)/src/trap/interrupt.c \
arch/$(ARCH)/src/trap/syscall.c \
arch/$(ARCH)/src/ddi/ddi.c \
arch/$(ARCH)/src/drivers/tick.c \
arch/$(ARCH)/src/drivers/kbd.c \
/trunk/kernel/arch/sparc64/src/trap/syscall.c
File deleted
/trunk/kernel/arch/sparc64/src/trap/trap_table.S
643,7 → 643,7
* TL4: hardware or software failure
*
* Input registers:
* %g1 Address of function to call.
* %g1 Address of function to call if this is not a syscall.
* %g2 First argument for the function.
* %g6 Pre-set as kernel stack base if trap from userspace.
* %g7 Pre-set as address of the userspace window buffer.
697,10 → 697,12
/*
* Copy arguments for the syscall to the new window.
*/
mov %i0, %o2
mov %i1, %o3
mov %i2, %o4
mov %i3, %o5
mov %i0, %o0
mov %i1, %o1
mov %i2, %o2
mov %i3, %o3
mov %i4, %o4
mov %i5, %o5
.endif
 
/*
740,7 → 742,12
* Copy arguments.
*/
mov %g1, %l0
.if NOT(\is_syscall)
mov %g2, %o0
.else
! store the syscall number on the stack as 7th argument
stx %g2, [%sp + STACK_WINDOW_SAVE_AREA_SIZE + STACK_BIAS + STACK_ARG6]
.endif
 
/*
* Save TSTATE, TPC and TNPC aside.
767,17 → 774,19
wrpr %g0, PSTATE_PRIV_BIT | PSTATE_PEF_BIT, %pstate
SAVE_GLOBALS
.if NOT(\is_syscall)
/*
* Call the higher-level handler and pass istate as second parameter.
*/
call %l0
add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1
 
.if \is_syscall
.else
/*
* Copy the value returned by the syscall.
* Call the higher-level syscall handler.
*/
mov %o0, %i0
call syscall_handler
nop
mov %o0, %i0 ! copy the value returned by the syscall
.endif
 
RESTORE_GLOBALS
/trunk/uspace/lib/libc/arch/sparc64/include/syscall.h
39,17 → 39,21
#include <kernel/syscall/syscall.h>
 
static inline sysarg_t
__syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3, const sysarg_t p4, const syscall_t id)
__syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3,
const sysarg_t p4, const sysarg_t p5, const sysarg_t p6, const syscall_t id)
{
register uint64_t a1 asm("o0") = p1;
register uint64_t a2 asm("o1") = p2;
register uint64_t a3 asm("o2") = p3;
register uint64_t a4 asm("o3") = p4;
register uint64_t a5 asm("o4") = p5;
register uint64_t a6 asm("o5") = p6;
 
asm volatile (
"ta %5\n"
"ta %7\n"
: "=r" (a1)
: "r" (a1), "r" (a2), "r" (a3), "r" (a4), "i" (id)
: "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6),
"i" (id)
: "memory"
);