Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 996df189 in mainline


Ignore:
Timestamp:
2014-08-28T18:16:13Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
ec07933
Parents:
6c1c1f7
Message:

Autogenerate mips32 istate_t and its offsets.

Files:
3 added
3 edited

Legend:

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

    r6c1c1f7 r996df189  
    8686endif
    8787
     88ARCH_AUTOGENS_AG = \
     89        arch/$(KARCH)/include/arch/istate_struct.ag
     90
  • kernel/arch/mips32/include/arch/istate.h

    r6c1c1f7 r996df189  
    4141
    4242#include <arch/cp0.h>
     43#include <arch/istate_struct.h>
    4344
    4445#else /* KERNEL */
    4546
    4647#include <libarch/cp0.h>
     48#include <libarch/istate_struct.h>
    4749
    4850#endif /* KERNEL */
    49 
    50 typedef struct istate {
    51         /*
    52          * The first seven registers are arranged so that the istate structure
    53          * can be used both for exception handlers and for the syscall handler.
    54          */
    55         uint32_t a0;    /* arg1 */
    56         uint32_t a1;    /* arg2 */
    57         uint32_t a2;    /* arg3 */
    58         uint32_t a3;    /* arg4 */
    59         uint32_t t0;    /* arg5 */
    60         uint32_t t1;    /* arg6 */
    61         uint32_t v0;    /* arg7 */
    62         uint32_t v1;
    63         uint32_t at;
    64         uint32_t t2;
    65         uint32_t t3;
    66         uint32_t t4;
    67         uint32_t t5;
    68         uint32_t t6;
    69         uint32_t t7;
    70         uint32_t s0;
    71         uint32_t s1;
    72         uint32_t s2;
    73         uint32_t s3;
    74         uint32_t s4;
    75         uint32_t s5;
    76         uint32_t s6;
    77         uint32_t s7;
    78         uint32_t t8;
    79         uint32_t t9;
    80         uint32_t kt0;
    81         uint32_t kt1;   /* We use it as thread-local pointer */
    82         uint32_t gp;
    83         uint32_t sp;
    84         uint32_t s8;
    85         uint32_t ra;
    86        
    87         uint32_t lo;
    88         uint32_t hi;
    89        
    90         uint32_t status;        /* cp0_status */
    91         uint32_t epc;           /* cp0_epc */
    92 
    93         uint32_t alignment;     /* to make sizeof(istate_t) a multiple of 8 */
    94 } istate_t;
    9551
    9652NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
  • kernel/arch/mips32/src/start.S

    r6c1c1f7 r996df189  
    3232#include <arch/context_offset.h>
    3333#include <arch/stack.h>
     34#include <arch/istate_struct.h>
    3435
    3536.text
     
    5152#define REG_SAVE_MASK 0x1f
    5253
    53 #define ISTATE_OFFSET_A0        0
    54 #define ISTATE_OFFSET_A1        4
    55 #define ISTATE_OFFSET_A2        8
    56 #define ISTATE_OFFSET_A3        12
    57 #define ISTATE_OFFSET_T0        16
    58 #define ISTATE_OFFSET_T1        20
    59 #define ISTATE_OFFSET_V0        24
    60 #define ISTATE_OFFSET_V1        28
    61 #define ISTATE_OFFSET_AT        32
    62 #define ISTATE_OFFSET_T2        36
    63 #define ISTATE_OFFSET_T3        40
    64 #define ISTATE_OFFSET_T4        44
    65 #define ISTATE_OFFSET_T5        48
    66 #define ISTATE_OFFSET_T6        52
    67 #define ISTATE_OFFSET_T7        56
    68 #define ISTATE_OFFSET_S0        60
    69 #define ISTATE_OFFSET_S1        64
    70 #define ISTATE_OFFSET_S2        68
    71 #define ISTATE_OFFSET_S3        72
    72 #define ISTATE_OFFSET_S4        76
    73 #define ISTATE_OFFSET_S5        80
    74 #define ISTATE_OFFSET_S6        84
    75 #define ISTATE_OFFSET_S7        88
    76 #define ISTATE_OFFSET_T8        92
    77 #define ISTATE_OFFSET_T9        96
    78 #define ISTATE_OFFSET_KT0       100
    79 #define ISTATE_OFFSET_KT1       104
    80 #define ISTATE_OFFSET_GP        108
    81 #define ISTATE_OFFSET_SP        112
    82 #define ISTATE_OFFSET_S8        116
    83 #define ISTATE_OFFSET_RA        120
    84 #define ISTATE_OFFSET_LO        124
    85 #define ISTATE_OFFSET_HI        128
    86 #define ISTATE_OFFSET_STATUS    132
    87 #define ISTATE_OFFSET_EPC       136
    88 #define ISTATE_OFFSET_ALIGNMENT 140
    89 
    90 #define ISTATE_SOFT_SIZE        144
    91 
    9254/*
    9355 * The fake ABI prologue is never executed and may not be part of the
     
    9759 */
    9860.macro FAKE_ABI_PROLOGUE
    99         sub $sp, ISTATE_SOFT_SIZE
     61        sub $sp, ISTATE_SIZE
    10062        sw $ra, ISTATE_OFFSET_EPC($sp)
    10163.endm
     
    265227        KERNEL_STACK_TO_K0
    266228       
    267         sub $k0, ISTATE_SOFT_SIZE
     229        sub $k0, ISTATE_SIZE
    268230        sw $sp, ISTATE_OFFSET_SP($k0)
    269231        move $sp, $k0
     
    355317tlb_refill_handler:
    356318        KERNEL_STACK_TO_K0
    357         sub $k0, ISTATE_SOFT_SIZE
     319        sub $k0, ISTATE_SIZE
    358320        REGISTERS_STORE_AND_EXC_RESET $k0
    359321        sw $sp, ISTATE_OFFSET_SP($k0)
     
    371333cache_error_handler:
    372334        KERNEL_STACK_TO_K0
    373         sub $k0, ISTATE_SOFT_SIZE
     335        sub $k0, ISTATE_SIZE
    374336        REGISTERS_STORE_AND_EXC_RESET $k0
    375337        sw $sp, ISTATE_OFFSET_SP($k0)
Note: See TracChangeset for help on using the changeset viewer.