Changeset 05ae7081 in mainline


Ignore:
Timestamp:
2007-11-16T16:24:05Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9cc0d7c
Parents:
454889c
Message:

Support for six syscall arguments for sparc64.
There is a minor stability issue which needs to be fixed (kernel panics upon entering kconsole from the
console task).

Files:
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/Makefile.inc

    r454889c r05ae7081  
    100100        arch/$(ARCH)/src/trap/exception.c \
    101101        arch/$(ARCH)/src/trap/interrupt.c \
    102         arch/$(ARCH)/src/trap/syscall.c \
    103102        arch/$(ARCH)/src/ddi/ddi.c \
    104103        arch/$(ARCH)/src/drivers/tick.c \
  • kernel/arch/sparc64/include/stack.h

    r454889c r05ae7081  
    4747
    4848/**
     49 * Six extended words for first six arguments.
     50 */
     51#define STACK_ARG_SAVE_AREA_SIZE        (6 * STACK_ITEM_SIZE)
     52
     53/**
    4954 * By convention, the actual top of the stack is %sp + STACK_BIAS.
    5055 */
    5156#define STACK_BIAS            2047
     57
     58/*
     59 * Offsets of arguments on stack.
     60 */
     61#define STACK_ARG0                      0
     62#define STACK_ARG1                      8
     63#define STACK_ARG2                      16
     64#define STACK_ARG3                      24
     65#define STACK_ARG4                      32
     66#define STACK_ARG5                      40
     67#define STACK_ARG6                      48
    5268
    5369#endif
  • kernel/arch/sparc64/include/trap/syscall.h

    r454889c r05ae7081  
    4646
    4747.macro TRAP_INSTRUCTION n
    48         mov TT_TRAP_INSTRUCTION(\n), %g2
    49         sethi %hi(syscall), %g1
    5048        ba trap_instruction_handler
    51         or %g1, %lo(syscall), %g1
     49        mov TT_TRAP_INSTRUCTION(\n) - TT_TRAP_INSTRUCTION(0), %g2
    5250.endm
    5351
  • kernel/arch/sparc64/include/trap/trap_table.h

    r454889c r05ae7081  
    7878
    7979/*
    80  * The following needs to be in sync with the
    81  * definition of the istate structure.
     80 * The following needs to be in sync with the definition of the istate
     81 * structure. The one STACK_ITEM_SIZE is counted for space holding the 7th
     82 * argument to syscall_handler (i.e. syscall number) and the other
     83 * STACK_ITEM_SIZE is counted because of the required alignment.
    8284 */
    83 #define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE    (STACK_WINDOW_SAVE_AREA_SIZE+(12*8))
    84 #define SAVED_TSTATE    -(1*8)
    85 #define SAVED_TPC       -(2*8)
    86 #define SAVED_TNPC      -(3*8)          /* <-- istate_t begins here */
    87 #define SAVED_Y         -(4*8)
    88 #define SAVED_I0        -(5*8)
    89 #define SAVED_I1        -(6*8)
    90 #define SAVED_I2        -(7*8)
    91 #define SAVED_I3        -(8*8)
    92 #define SAVED_I4        -(9*8)
    93 #define SAVED_I5        -(10*8)
    94 #define SAVED_I6        -(11*8)
    95 #define SAVED_I7        -(12*8)
     85#define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE    \
     86    (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE + \
     87    (2 * STACK_ITEM_SIZE) + (12 * 8))
     88#define SAVED_TSTATE    -(1 * 8)
     89#define SAVED_TPC       -(2 * 8)
     90#define SAVED_TNPC      -(3 * 8)        /* <-- istate_t begins here */
     91#define SAVED_Y         -(4 * 8)
     92#define SAVED_I0        -(5 * 8)
     93#define SAVED_I1        -(6 * 8)
     94#define SAVED_I2        -(7 * 8)
     95#define SAVED_I3        -(8 * 8)
     96#define SAVED_I4        -(9 * 8)
     97#define SAVED_I5        -(10 * 8)
     98#define SAVED_I6        -(11 * 8)
     99#define SAVED_I7        -(12 * 8)
    96100
    97101.macro PREEMPTIBLE_HANDLER f
  • kernel/arch/sparc64/src/trap/trap_table.S

    r454889c r05ae7081  
    644644 *
    645645 * Input registers:
    646  *      %g1             Address of function to call.
     646 *      %g1             Address of function to call if this is not a syscall.
    647647 *      %g2             First argument for the function.
    648648 *      %g6             Pre-set as kernel stack base if trap from userspace.
     
    698698         * Copy arguments for the syscall to the new window.
    699699         */
    700         mov %i0, %o2
    701         mov %i1, %o3
    702         mov %i2, %o4
    703         mov %i3, %o5
     700        mov %i0, %o0
     701        mov %i1, %o1
     702        mov %i2, %o2
     703        mov %i3, %o3
     704        mov %i4, %o4
     705        mov %i5, %o5
    704706.endif
    705707
     
    741743         */
    742744        mov %g1, %l0
     745.if NOT(\is_syscall)
    743746        mov %g2, %o0
     747.else
     748        ! store the syscall number on the stack as 7th argument
     749        stx %g2, [%sp + STACK_WINDOW_SAVE_AREA_SIZE + STACK_BIAS + STACK_ARG6]
     750.endif
    744751
    745752        /*
     
    768775        SAVE_GLOBALS
    769776       
     777.if NOT(\is_syscall)
    770778        /*
    771779         * Call the higher-level handler and pass istate as second parameter.
     
    773781        call %l0
    774782        add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1
    775 
    776 .if \is_syscall
    777         /*
    778          * Copy the value returned by the syscall.
    779          */
    780         mov %o0, %i0
     783.else
     784        /*
     785         * Call the higher-level syscall handler.
     786         */
     787        call syscall_handler
     788        nop
     789        mov %o0, %i0                            ! copy the value returned by the syscall
    781790.endif
    782791
  • uspace/lib/libc/arch/sparc64/include/syscall.h

    r454889c r05ae7081  
    4040
    4141static inline sysarg_t
    42 __syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3, const sysarg_t p4, const syscall_t id)
     42__syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3,
     43    const sysarg_t p4, const sysarg_t p5, const sysarg_t p6, const syscall_t id)
    4344{
    4445        register uint64_t a1 asm("o0") = p1;
     
    4647        register uint64_t a3 asm("o2") = p3;
    4748        register uint64_t a4 asm("o3") = p4;
     49        register uint64_t a5 asm("o4") = p5;
     50        register uint64_t a6 asm("o5") = p6;
    4851
    4952        asm volatile (
    50                 "ta %5\n"
     53                "ta %7\n"
    5154                : "=r" (a1)
    52                 : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "i" (id)
     55                : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6),
     56                  "i" (id)
    5357                : "memory"
    5458        );
Note: See TracChangeset for help on using the changeset viewer.