Changeset 9314ee1 in mainline


Ignore:
Timestamp:
2006-09-01T17:00:18Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
002e613
Parents:
6767c1d
Message:

sparc64 work.
Kernel syscall support.
Modify the preemptive_handler for the use by syscalls.

Location:
kernel
Files:
3 added
3 edited

Legend:

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

    r6767c1d r9314ee1  
    100100        arch/$(ARCH)/src/trap/exception.c \
    101101        arch/$(ARCH)/src/trap/interrupt.c \
     102        arch/$(ARCH)/src/trap/syscall.c \
    102103        arch/$(ARCH)/src/ddi/ddi.c \
    103104        arch/$(ARCH)/src/drivers/tick.c \
  • kernel/arch/sparc64/src/trap/trap_table.S

    r6767c1d r9314ee1  
    4040#include <arch/trap/interrupt.h>
    4141#include <arch/trap/exception.h>
     42#include <arch/trap/syscall.h>
    4243#include <arch/trap/mmu.h>
    4344#include <arch/mm/mmu.h>
     
    230231        FILL_NORMAL_HANDLER_USERSPACE
    231232
     233/* TT = 0x100, TL = 0, trap_instruction_0 */
     234.org trap_table + TT_TRAP_INSTRUCTION(0)*ENTRY_SIZE
     235.global trap_instruction_0
     236trap_instruction_0:
     237        TRAP_INSTRUCTION 0
     238
     239/* TT = 0x101, TL = 0, trap_instruction_1 */
     240.org trap_table + TT_TRAP_INSTRUCTION(1)*ENTRY_SIZE
     241.global trap_instruction_1
     242trap_instruction_1:
     243        TRAP_INSTRUCTION 1
     244
     245/* TT = 0x102, TL = 0, trap_instruction_2 */
     246.org trap_table + TT_TRAP_INSTRUCTION(2)*ENTRY_SIZE
     247.global trap_instruction_2
     248trap_instruction_2:
     249        TRAP_INSTRUCTION 2
     250
     251/* TT = 0x103, TL = 0, trap_instruction_3 */
     252.org trap_table + TT_TRAP_INSTRUCTION(3)*ENTRY_SIZE
     253.global trap_instruction_3
     254trap_instruction_3:
     255        TRAP_INSTRUCTION 3
     256
     257/* TT = 0x104, TL = 0, trap_instruction_4 */
     258.org trap_table + TT_TRAP_INSTRUCTION(4)*ENTRY_SIZE
     259.global trap_instruction_4
     260trap_instruction_4:
     261        TRAP_INSTRUCTION 4
     262
     263/* TT = 0x105, TL = 0, trap_instruction_5 */
     264.org trap_table + TT_TRAP_INSTRUCTION(5)*ENTRY_SIZE
     265.global trap_instruction_5
     266trap_instruction_5:
     267        TRAP_INSTRUCTION 5
     268
     269/* TT = 0x106, TL = 0, trap_instruction_6 */
     270.org trap_table + TT_TRAP_INSTRUCTION(6)*ENTRY_SIZE
     271.global trap_instruction_6
     272trap_instruction_6:
     273        TRAP_INSTRUCTION 6
     274
     275/* TT = 0x107, TL = 0, trap_instruction_7 */
     276.org trap_table + TT_TRAP_INSTRUCTION(7)*ENTRY_SIZE
     277.global trap_instruction_7
     278trap_instruction_7:
     279        TRAP_INSTRUCTION 7
     280
     281/* TT = 0x108, TL = 0, trap_instruction_8 */
     282.org trap_table + TT_TRAP_INSTRUCTION(8)*ENTRY_SIZE
     283.global trap_instruction_8
     284trap_instruction_8:
     285        TRAP_INSTRUCTION 8
     286
     287/* TT = 0x109, TL = 0, trap_instruction_9 */
     288.org trap_table + TT_TRAP_INSTRUCTION(9)*ENTRY_SIZE
     289.global trap_instruction_9
     290trap_instruction_9:
     291        TRAP_INSTRUCTION 9
     292
     293/* TT = 0x10a, TL = 0, trap_instruction_10 */
     294.org trap_table + TT_TRAP_INSTRUCTION(10)*ENTRY_SIZE
     295.global trap_instruction_10
     296trap_instruction_10:
     297        TRAP_INSTRUCTION 10
     298
     299/* TT = 0x10b, TL = 0, trap_instruction_11 */
     300.org trap_table + TT_TRAP_INSTRUCTION(11)*ENTRY_SIZE
     301.global trap_instruction_11
     302trap_instruction_11:
     303        TRAP_INSTRUCTION 11
     304
     305/* TT = 0x10c, TL = 0, trap_instruction_12 */
     306.org trap_table + TT_TRAP_INSTRUCTION(12)*ENTRY_SIZE
     307.global trap_instruction_12
     308trap_instruction_12:
     309        TRAP_INSTRUCTION 12
     310
     311/* TT = 0x10d, TL = 0, trap_instruction_13 */
     312.org trap_table + TT_TRAP_INSTRUCTION(13)*ENTRY_SIZE
     313.global trap_instruction_13
     314trap_instruction_13:
     315        TRAP_INSTRUCTION 13
     316
     317/* TT = 0x10e, TL = 0, trap_instruction_14 */
     318.org trap_table + TT_TRAP_INSTRUCTION(14)*ENTRY_SIZE
     319.global trap_instruction_14
     320trap_instruction_14:
     321        TRAP_INSTRUCTION 14
     322
     323/* TT = 0x10f, TL = 0, trap_instruction_15 */
     324.org trap_table + TT_TRAP_INSTRUCTION(15)*ENTRY_SIZE
     325.global trap_instruction_15
     326trap_instruction_15:
     327        TRAP_INSTRUCTION 15
     328
     329/* TT = 0x110, TL = 0, trap_instruction_16 */
     330.org trap_table + TT_TRAP_INSTRUCTION(16)*ENTRY_SIZE
     331.global trap_instruction_16
     332trap_instruction_16:
     333        TRAP_INSTRUCTION 16
     334
     335/* TT = 0x111, TL = 0, trap_instruction_17 */
     336.org trap_table + TT_TRAP_INSTRUCTION(17)*ENTRY_SIZE
     337.global trap_instruction_17
     338trap_instruction_17:
     339        TRAP_INSTRUCTION 17
     340
     341/* TT = 0x112, TL = 0, trap_instruction_18 */
     342.org trap_table + TT_TRAP_INSTRUCTION(18)*ENTRY_SIZE
     343.global trap_instruction_18
     344trap_instruction_18:
     345        TRAP_INSTRUCTION 18
     346
     347/* TT = 0x113, TL = 0, trap_instruction_19 */
     348.org trap_table + TT_TRAP_INSTRUCTION(19)*ENTRY_SIZE
     349.global trap_instruction_19
     350trap_instruction_19:
     351        TRAP_INSTRUCTION 19
     352
     353/* TT = 0x114, TL = 0, trap_instruction_20 */
     354.org trap_table + TT_TRAP_INSTRUCTION(20)*ENTRY_SIZE
     355.global trap_instruction_20
     356trap_instruction_20:
     357        TRAP_INSTRUCTION 20
     358
     359/* TT = 0x115, TL = 0, trap_instruction_21 */
     360.org trap_table + TT_TRAP_INSTRUCTION(21)*ENTRY_SIZE
     361.global trap_instruction_21
     362trap_instruction_21:
     363        TRAP_INSTRUCTION 21
     364
     365/* TT = 0x116, TL = 0, trap_instruction_22 */
     366.org trap_table + TT_TRAP_INSTRUCTION(22)*ENTRY_SIZE
     367.global trap_instruction_22
     368trap_instruction_22:
     369        TRAP_INSTRUCTION 22
     370
     371/* TT = 0x117, TL = 0, trap_instruction_23 */
     372.org trap_table + TT_TRAP_INSTRUCTION(23)*ENTRY_SIZE
     373.global trap_instruction_23
     374trap_instruction_23:
     375        TRAP_INSTRUCTION 23
     376
     377/* TT = 0x118, TL = 0, trap_instruction_24 */
     378.org trap_table + TT_TRAP_INSTRUCTION(24)*ENTRY_SIZE
     379.global trap_instruction_24
     380trap_instruction_24:
     381        TRAP_INSTRUCTION 24
     382
     383/* TT = 0x119, TL = 0, trap_instruction_25 */
     384.org trap_table + TT_TRAP_INSTRUCTION(25)*ENTRY_SIZE
     385.global trap_instruction_25
     386trap_instruction_25:
     387        TRAP_INSTRUCTION 25
     388
     389/* TT = 0x11a, TL = 0, trap_instruction_26 */
     390.org trap_table + TT_TRAP_INSTRUCTION(26)*ENTRY_SIZE
     391.global trap_instruction_26
     392trap_instruction_26:
     393        TRAP_INSTRUCTION 26
     394
     395/* TT = 0x11b, TL = 0, trap_instruction_27 */
     396.org trap_table + TT_TRAP_INSTRUCTION(27)*ENTRY_SIZE
     397.global trap_instruction_27
     398trap_instruction_27:
     399        TRAP_INSTRUCTION 27
     400
     401/* TT = 0x11c, TL = 0, trap_instruction_28 */
     402.org trap_table + TT_TRAP_INSTRUCTION(28)*ENTRY_SIZE
     403.global trap_instruction_28
     404trap_instruction_28:
     405        TRAP_INSTRUCTION 28
     406
     407/* TT = 0x11d, TL = 0, trap_instruction_29 */
     408.org trap_table + TT_TRAP_INSTRUCTION(29)*ENTRY_SIZE
     409.global trap_instruction_29
     410trap_instruction_29:
     411        TRAP_INSTRUCTION 29
     412
     413/* TT = 0x11e, TL = 0, trap_instruction_30 */
     414.org trap_table + TT_TRAP_INSTRUCTION(30)*ENTRY_SIZE
     415.global trap_instruction_30
     416trap_instruction_30:
     417        TRAP_INSTRUCTION 30
     418
     419/* TT = 0x11f, TL = 0, trap_instruction_31 */
     420.org trap_table + TT_TRAP_INSTRUCTION(31)*ENTRY_SIZE
     421.global trap_instruction_31
     422trap_instruction_31:
     423        TRAP_INSTRUCTION 31
     424
    232425/*
    233426 * Handlers for TL>0.
     
    306499        FILL_NORMAL_HANDLER_KERNEL
    307500
     501#define NOT(x)  ((x) == 0)
    308502
    309503/* Preemptible trap handler for TL=1.
     
    324518 *      %g7             Pre-set as address of the userspace window buffer.
    325519 */
    326 .global preemptible_handler
    327 preemptible_handler:
     520.macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall
     521.if NOT(\is_syscall)
    328522        rdpr %tstate, %g3
    329523        andcc %g3, TSTATE_PRIV_BIT, %g0         ! if this trap came from the privileged mode...
    330524        bnz 0f                                  ! ...skip setting of kernel stack and primary context
    331525        nop
    332 
     526.endif
    333527        /*
    334528         * Normal window spills will go to the userspace window buffer.
     
    342536         */
    343537        save %g6, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp
     538
     539.if \is_syscall
     540        /*
     541         * Copy arguments for the syscall to the new window.
     542         */
     543        mov %i0, %o2
     544        mov %i1, %o3
     545        mov %i2, %o4
     546        mov %i3, %o5
     547.endif
    344548
    345549        /*
     
    360564        flush %l0
    361565
     566.if NOT(\is_syscall)
    362567        ba 1f
    363568        nop
     
    371576         */
    3725771:
    373        
     578.endif
    374579        /*
    375580         * Other window spills will go to the userspace window buffer
     
    409614        call %l0
    410615        add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1
     616
     617.if \is_syscall
     618        /*
     619         * Copy the value returned by the syscall.
     620         */
     621        mov %o0, %i0
     622.endif
    411623
    412624        RESTORE_GLOBALS
     
    489701         */
    4907020:
     703.if NOT(\is_syscall)
    491704        rdpr %tstate, %g1
    492705        andcc %g1, TSTATE_PRIV_BIT, %g0         ! if we are not returning to userspace...,
    493706        bnz 1f                                  ! ...skip restoring userspace windows
    494707        nop
     708.endif
    495709
    496710        /*
     
    5737871:
    574788        restore
     789
     790.if \is_syscall
     791        done
     792.else
    575793        retry
     794.endif
    576795
    577796        /*
     
    606825        wrpr %g1, 0, %cwp                       ! CWP--
    607826       
     827.if \is_syscall
     828        done
     829.else
    608830        retry
     831.endif
     832
     833.endm
     834
     835.global preemptible_handler
     836preemptible_handler:
     837        PREEMPTIBLE_HANDLER_TEMPLATE 0
     838
     839.global trap_instruction_handler
     840trap_instruction_handler:
     841        PREEMPTIBLE_HANDLER_TEMPLATE 1
  • kernel/generic/src/syscall/syscall.c

    r6767c1d r9314ee1  
    2727 */
    2828
    29  /** @addtogroup generic
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    160160};
    161161
    162  /** @}
     162/** @}
    163163 */
    164 
Note: See TracChangeset for help on using the changeset viewer.