Changeset 741ade3f in mainline


Ignore:
Timestamp:
2006-03-21T22:45:32Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
45fb65c
Parents:
018d957e
Message:

Keep $K1 register for use as a thread local storage pointer on MIPS.

Location:
arch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/userspace.c

    r018d957e r741ade3f  
    4646        ipl = interrupts_disable();
    4747
     48        /* Clear CF,PF,AF,ZF,SF,DF,OF */
     49        ipl &= ~ (0xbc4);
     50
    4851        __asm__ volatile (""
    4952                          "pushq %0\n"
  • arch/mips32/include/context_offset.h

    r018d957e r741ade3f  
    4949#define EOFFSET_STATUS 0x7c
    5050#define EOFFSET_EPC    0x80
     51#define EOFFSET_K1     0x84
    5152#define REGISTER_SPACE 136
  • arch/mips32/include/exception.h

    r018d957e r741ade3f  
    9191        __u32 status; /* cp0_status */
    9292        __u32 epc; /* cp0_epc */
    93         __u32 padding; /* padding to align stack on 8 bytes boundary */
     93        __u32 k1; /* We use it as thread-local pointer */
    9494};
    9595
  • arch/mips32/src/start.S

    r018d957e r741ade3f  
    5050# We will change status: Disable ERL,EXL,UM,IE
    5151# These changes will be automatically reversed in REGISTER_LOAD
     52# SP is NOT saved as part of these registers
    5253.macro REGISTERS_STORE_AND_EXC_RESET r
    5354        sw $at,EOFFSET_AT(\r)
     
    8889        sw $gp,EOFFSET_GP(\r)
    8990        sw $ra,EOFFSET_RA(\r)
    90         sw $sp,EOFFSET_SP(\r)
     91        sw $k1,EOFFSET_K1(\r)
    9192
    9293        mfc0 $t0, $status
     
    144145        lw $gp,EOFFSET_GP(\r)
    145146        lw $ra,EOFFSET_RA(\r)
     147        lw $k1,EOFFSET_K1(\r)
    146148       
    147149        lw $at,EOFFSET_LO(\r)
     
    208210exception_handler:
    209211        KERNEL_STACK_TO_K0
    210        
    211         mfc0 $k1, $cause
    212212        sub $k0, REGISTER_SPACE
    213        
    214         sra $k1, $k1, 0x2     # cp0_exc_cause() part 1
    215         andi $k1, $k1, 0x1f   # cp0_exc_cause() part 2
    216         sub $k1, 8            # 8=SYSCALL
    217        
    218         beqz $k1, syscall_shortcut
    219         add $k1, 8            # Revert $k1 back to correct exc number
    220        
    221         REGISTERS_STORE_AND_EXC_RESET $k0
     213        sw $sp,EOFFSET_SP($k0)
    222214        move $sp, $k0
     215       
     216        mfc0 $k0, $cause
     217       
     218        sra $k0, $k0, 0x2     # cp0_exc_cause() part 1
     219        andi $k0, $k0, 0x1f   # cp0_exc_cause() part 2
     220        sub $k0, 8            # 8=SYSCALL
     221       
     222        beqz $k0, syscall_shortcut
     223        add $k0, 8            # Revert $k1 back to correct exc number
     224       
     225        REGISTERS_STORE_AND_EXC_RESET $sp
    223226       
    224227        move $a1, $sp
    225228        jal exc_dispatch      # exc_dispatch(excno, register_space)
    226         move $a0, $k1
     229        move $a0, $k0
    227230
    228231        REGISTERS_LOAD $sp
     
    232235# it seems that mips reserves some space on stack for varfuncs???
    233236#define SS_ARG4   16
    234 #define SS_SP     20
    235 #define SS_STATUS 24
    236 #define SS_EPC    28
     237#define SS_SP     EOFFSET_SP
     238#define SS_STATUS EOFFSET_STATUS
     239#define SS_EPC    EOFFSET_EPC
    237240syscall_shortcut:
    238241        # We have a lot of space on the stack, with free use
    239         sw $sp, SS_SP($k0)
    240         move $sp, $k0
    241 
    242242        mfc0 $t1, $epc
    243243        mfc0 $t0, $status
     
    277277        sub $k0, REGISTER_SPACE
    278278        REGISTERS_STORE_AND_EXC_RESET $k0
     279        sw $sp,EOFFSET_SP($k0)
    279280        add $sp, $k0, 0
    280281
     
    289290cache_error_handler:
    290291        KERNEL_STACK_TO_K0
    291         sub $sp, REGISTER_SPACE
    292         REGISTERS_STORE_AND_EXC_RESET $sp
     292        sub $k0, REGISTER_SPACE
     293        REGISTERS_STORE_AND_EXC_RESET $k0
     294        sw $sp,EOFFSET_SP($k0)
    293295        add $sp, $k0, 0
    294296
Note: See TracChangeset for help on using the changeset viewer.