Changeset c0699467 in mainline for kernel/arch/mips32


Ignore:
Timestamp:
2011-08-09T18:08:23Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b538ca5c
Parents:
3666d386
Message:

do not provide general access to kernel headers from uspace, only allow specific headers to be accessed or shared
externalize headers which serve as kernel/uspace API/ABI into a special tree

Location:
kernel/arch/mips32
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/include/context_offset.h

    r3666d386 rc0699467  
    6363#ifdef __ASM__
    6464
     65#ifdef KERNEL
     66
    6567#include <arch/asm/regname.h>
    6668
    67 # ctx: address of the structure with saved context
     69#else /* KERNEL */
     70
     71#include <libarch/regname.h>
     72
     73#endif /* KERNEL */
     74
     75/* ctx: address of the structure with saved context */
    6876.macro CONTEXT_SAVE_ARCH_CORE ctx:req
    69         sw $s0,OFFSET_S0(\ctx)
    70         sw $s1,OFFSET_S1(\ctx)
    71         sw $s2,OFFSET_S2(\ctx)
    72         sw $s3,OFFSET_S3(\ctx)
    73         sw $s4,OFFSET_S4(\ctx)
    74         sw $s5,OFFSET_S5(\ctx)
    75         sw $s6,OFFSET_S6(\ctx)
    76         sw $s7,OFFSET_S7(\ctx)
    77         sw $s8,OFFSET_S8(\ctx)
    78         sw $gp,OFFSET_GP(\ctx)
    79 
     77        sw $s0, OFFSET_S0(\ctx)
     78        sw $s1, OFFSET_S1(\ctx)
     79        sw $s2, OFFSET_S2(\ctx)
     80        sw $s3, OFFSET_S3(\ctx)
     81        sw $s4, OFFSET_S4(\ctx)
     82        sw $s5, OFFSET_S5(\ctx)
     83        sw $s6, OFFSET_S6(\ctx)
     84        sw $s7, OFFSET_S7(\ctx)
     85        sw $s8, OFFSET_S8(\ctx)
     86        sw $gp, OFFSET_GP(\ctx)
     87       
    8088#ifndef KERNEL
    81         sw $k1,OFFSET_TLS(\ctx)
    82 
     89        sw $k1, OFFSET_TLS(\ctx)
     90       
    8391#ifdef CONFIG_FPU
    84         mfc1 $t0,$20
     92        mfc1 $t0, $20
    8593        sw $t0, OFFSET_F20(\ctx)
    86 
    87         mfc1 $t0,$21
     94       
     95        mfc1 $t0, $21
    8896        sw $t0, OFFSET_F21(\ctx)
    89 
    90         mfc1 $t0,$22
     97       
     98        mfc1 $t0, $22
    9199        sw $t0, OFFSET_F22(\ctx)
    92 
    93         mfc1 $t0,$23
     100       
     101        mfc1 $t0, $23
    94102        sw $t0, OFFSET_F23(\ctx)
    95 
    96         mfc1 $t0,$24
     103       
     104        mfc1 $t0, $24
    97105        sw $t0, OFFSET_F24(\ctx)
    98 
    99         mfc1 $t0,$25
     106       
     107        mfc1 $t0, $25
    100108        sw $t0, OFFSET_F25(\ctx)
    101 
    102         mfc1 $t0,$26
     109       
     110        mfc1 $t0, $26
    103111        sw $t0, OFFSET_F26(\ctx)
    104 
    105         mfc1 $t0,$27
     112       
     113        mfc1 $t0, $27
    106114        sw $t0, OFFSET_F27(\ctx)
    107 
    108         mfc1 $t0,$28
     115       
     116        mfc1 $t0, $28
    109117        sw $t0, OFFSET_F28(\ctx)
    110 
    111         mfc1 $t0,$29
     118       
     119        mfc1 $t0, $29
    112120        sw $t0, OFFSET_F29(\ctx)
    113121       
    114         mfc1 $t0,$30
     122        mfc1 $t0, $30
    115123        sw $t0, OFFSET_F30(\ctx)
    116124#endif /* CONFIG_FPU */
    117125#endif /* KERNEL */
    118 
    119         sw $ra,OFFSET_PC(\ctx)
    120         sw $sp,OFFSET_SP(\ctx)
     126       
     127        sw $ra, OFFSET_PC(\ctx)
     128        sw $sp, OFFSET_SP(\ctx)
    121129.endm
    122130
    123 # ctx: address of the structure with saved context
     131/* ctx: address of the structure with saved context */
    124132.macro CONTEXT_RESTORE_ARCH_CORE ctx:req
    125         lw $s0,OFFSET_S0(\ctx)
    126         lw $s1,OFFSET_S1(\ctx)
    127         lw $s2,OFFSET_S2(\ctx)
    128         lw $s3,OFFSET_S3(\ctx)
    129         lw $s4,OFFSET_S4(\ctx)
    130         lw $s5,OFFSET_S5(\ctx)
    131         lw $s6,OFFSET_S6(\ctx)
    132         lw $s7,OFFSET_S7(\ctx)
    133         lw $s8,OFFSET_S8(\ctx)
    134         lw $gp,OFFSET_GP(\ctx)
     133        lw $s0, OFFSET_S0(\ctx)
     134        lw $s1, OFFSET_S1(\ctx)
     135        lw $s2, OFFSET_S2(\ctx)
     136        lw $s3, OFFSET_S3(\ctx)
     137        lw $s4, OFFSET_S4(\ctx)
     138        lw $s5, OFFSET_S5(\ctx)
     139        lw $s6, OFFSET_S6(\ctx)
     140        lw $s7, OFFSET_S7(\ctx)
     141        lw $s8, OFFSET_S8(\ctx)
     142        lw $gp, OFFSET_GP(\ctx)
    135143#ifndef KERNEL
    136         lw $k1,OFFSET_TLS(\ctx)
    137 
     144        lw $k1, OFFSET_TLS(\ctx)
     145       
    138146#ifdef CONFIG_FPU
    139147        lw $t0, OFFSET_F20(\ctx)
    140         mtc1 $t0,$20
    141 
     148        mtc1 $t0, $20
     149       
    142150        lw $t0, OFFSET_F21(\ctx)
    143         mtc1 $t0,$21
    144 
     151        mtc1 $t0, $21
     152       
    145153        lw $t0, OFFSET_F22(\ctx)
    146         mtc1 $t0,$22
    147 
     154        mtc1 $t0, $22
     155       
    148156        lw $t0, OFFSET_F23(\ctx)
    149         mtc1 $t0,$23
    150 
     157        mtc1 $t0, $23
     158       
    151159        lw $t0, OFFSET_F24(\ctx)
    152         mtc1 $t0,$24
    153 
     160        mtc1 $t0, $24
     161       
    154162        lw $t0, OFFSET_F25(\ctx)
    155         mtc1 $t0,$25
    156 
     163        mtc1 $t0, $25
     164       
    157165        lw $t0, OFFSET_F26(\ctx)
    158         mtc1 $t0,$26
    159 
     166        mtc1 $t0, $26
     167       
    160168        lw $t0, OFFSET_F27(\ctx)
    161         mtc1 $t0,$27
    162 
     169        mtc1 $t0, $27
     170       
    163171        lw $t0, OFFSET_F28(\ctx)
    164         mtc1 $t0,$28
    165 
     172        mtc1 $t0, $28
     173       
    166174        lw $t0, OFFSET_F29(\ctx)
    167         mtc1 $t0,$29
    168 
     175        mtc1 $t0, $29
     176       
    169177        lw $t0, OFFSET_F30(\ctx)
    170         mtc1 $t0,$30
     178        mtc1 $t0, $30
    171179#endif /* CONFIG_FPU */
    172180#endif /* KERNEL */
    173 
    174         lw $ra,OFFSET_PC(\ctx)
    175         lw $sp,OFFSET_SP(\ctx)
     181       
     182        lw $ra, OFFSET_PC(\ctx)
     183        lw $sp, OFFSET_SP(\ctx)
    176184.endm
    177185
    178 #endif
    179 
     186#endif /* __ASM__ */
    180187
    181188#endif
  • kernel/arch/mips32/include/cp0.h

    r3666d386 rc0699467  
    3636#define KERN_mips32_CP0_H_
    3737
    38 #ifdef KERNEL
    39 #include <typedefs.h>
    40 #else
    41 #include <sys/types.h>
    42 #endif
    43 
    4438#define cp0_status_ie_enabled_bit     (1 << 0)
    4539#define cp0_status_exl_exception_bit  (1 << 1)
     
    4943#define cp0_status_fpu_bit            (1 << 29)
    5044
    51 #define cp0_status_im_shift             8
    52 #define cp0_status_im_mask              0xff00
     45#define cp0_status_im_shift  8
     46#define cp0_status_im_mask   0xff00
    5347
    54 #define cp0_cause_excno(cause) ((cause >> 2) & 0x1f)
    55 #define cp0_cause_coperr(cause) ((cause >> 28) & 0x3)
     48#define cp0_cause_excno(cause)   ((cause >> 2) & 0x1f)
     49#define cp0_cause_coperr(cause)  ((cause >> 28) & 0x3)
    5650
    57 #define fpu_cop_id 1
     51#define fpu_cop_id  1
    5852
    5953/*
    6054 * Magic value for use in msim.
    6155 */
    62 #define cp0_compare_value               100000
     56#define cp0_compare_value  100000
    6357
    64 #define cp0_mask_all_int() cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask))
    65 #define cp0_unmask_all_int() cp0_status_write(cp0_status_read() | cp0_status_im_mask)
    66 #define cp0_mask_int(it) cp0_status_write(cp0_status_read() & ~(1 << (cp0_status_im_shift + (it))))
    67 #define cp0_unmask_int(it) cp0_status_write(cp0_status_read() | (1 << (cp0_status_im_shift + (it))))
     58#define cp0_mask_all_int() \
     59        cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask))
    6860
    69 #define GEN_READ_CP0(nm,reg) static inline uint32_t cp0_ ##nm##_read(void) \
    70   { \
    71       uint32_t retval; \
    72       asm volatile ("mfc0 %0, $" #reg : "=r"(retval)); \
    73       return retval; \
    74   }
     61#define cp0_unmask_all_int() \
     62        cp0_status_write(cp0_status_read() | cp0_status_im_mask)
    7563
    76 #define GEN_WRITE_CP0(nm,reg) static inline void cp0_ ##nm##_write(uint32_t val) \
    77  { \
    78     asm volatile ("mtc0 %0, $" #reg : : "r"(val) ); \
    79  }
     64#define cp0_mask_int(it) \
     65        cp0_status_write(cp0_status_read() & ~(1 << (cp0_status_im_shift + (it))))
     66
     67#define cp0_unmask_int(it) \
     68        cp0_status_write(cp0_status_read() | (1 << (cp0_status_im_shift + (it))))
     69
     70#define GEN_READ_CP0(nm, reg) \
     71        static inline uint32_t cp0_ ##nm##_read(void) \
     72        { \
     73                uint32_t retval; \
     74                \
     75                asm volatile ( \
     76                        "mfc0 %0, $" #reg \
     77                        : "=r"(retval) \
     78                ); \
     79                \
     80                return retval; \
     81        }
     82
     83#define GEN_WRITE_CP0(nm, reg) \
     84        static inline void cp0_ ##nm##_write(uint32_t val) \
     85        { \
     86                asm volatile ( \
     87                        "mtc0 %0, $" #reg \
     88                        :: "r"(val) \
     89                ); \
     90        }
    8091
    8192GEN_READ_CP0(index, 0);
  • kernel/arch/mips32/include/istate.h

    r3666d386 rc0699467  
    3636#define KERN_mips32_ISTATE_H_
    3737
     38#include <trace.h>
     39
     40#ifdef KERNEL
     41
    3842#include <arch/cp0.h>
    3943
    40 #ifdef KERNEL
    41 #include <typedefs.h>
    42 #include <trace.h>
    43 #else
    44 #include <sys/types.h>
    45 #define NO_TRACE
    46 #endif
     44#else /* KERNEL */
     45
     46#include <libarch/cp0.h>
     47
     48#endif /* KERNEL */
    4749
    4850typedef struct istate {
  • kernel/arch/mips32/include/mm/frame.h

    r3666d386 rc0699467  
    3939#define FRAME_SIZE   (1 << FRAME_WIDTH)
    4040
    41 #ifdef KERNEL
    4241#ifndef __ASM__
    4342
     
    4645
    4746#endif /* __ASM__ */
    48 #endif /* KERNEL */
    4947
    5048#endif
  • kernel/arch/mips32/include/mm/page.h

    r3666d386 rc0699467  
    4949#       define PA2KA(x) ((x) + 0x80000000)
    5050#endif
    51 
    52 #ifdef KERNEL
    5351
    5452/*
     
    188186#endif /* __ASM__ */
    189187
    190 #endif /* KERNEL */
    191 
    192188#endif
    193189
  • kernel/arch/mips32/src/mips32.c

    r3666d386 rc0699467  
    4141#include <memstr.h>
    4242#include <proc/thread.h>
    43 #include <proc/uarg.h>
     43#include <abi/proc/uarg.h>
    4444#include <print.h>
    4545#include <console/console.h>
     
    5252#include <arch/debugger.h>
    5353#include <genarch/fb/fb.h>
    54 #include <genarch/fb/visuals.h>
     54#include <abi/fb/visuals.h>
    5555#include <genarch/drivers/dsrln/dsrlnin.h>
    5656#include <genarch/drivers/dsrln/dsrlnout.h>
Note: See TracChangeset for help on using the changeset viewer.