Changeset 32e8cd1 in mainline for kernel/arch/sparc32/include


Ignore:
Timestamp:
2013-12-28T17:16:44Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c1023bcb
Parents:
f6f22cdb
Message:

code revision
coding style fixes
removal of debugging printouts and other temporary stuff

Location:
kernel/arch/sparc32/include/arch
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc32/include/arch/ambapp.h

    rf6f22cdb r32e8cd1  
    3636#define KERN_sparc32_AMBAPP_H_
    3737
    38 typedef struct
    39 {
     38typedef struct {
    4039        /* Primary serial port location */
    4140        uintptr_t uart_base;
  • kernel/arch/sparc32/include/arch/arch.h

    rf6f22cdb r32e8cd1  
    4242#include <arch/istate.h>
    4343
    44 #define NWINDOWS        8
     44#define NWINDOWS  8
    4545
    4646/* ASI assignments: */
    47 #define ASI_CACHEMISS   0x01
    48 #define ASI_CACHECTRL   0x02
    49 #define ASI_MMUCACHE    0x10
    50 #define ASI_MMUREGS     0x19
    51 #define ASI_MMUBYPASS   0x1c
    52 #define ASI_MMUFLUSH    0x18
     47#define ASI_CACHEMISS  0x01
     48#define ASI_CACHECTRL  0x02
     49#define ASI_MMUCACHE   0x10
     50#define ASI_MMUREGS    0x19
     51#define ASI_MMUBYPASS  0x1c
     52#define ASI_MMUFLUSH   0x18
    5353
    5454#define TASKMAP_MAX_RECORDS  32
    5555#define CPUMAP_MAX_RECORDS   32
    5656
    57 #define BOOTINFO_TASK_NAME_BUFLEN 32
     57#define BOOTINFO_TASK_NAME_BUFLEN  32
    5858
    5959typedef struct {
     
    7575} bootinfo_t;
    7676
    77 extern void arch_pre_main(void *unused, bootinfo_t *bootinfo);
    78 extern void write_to_invalid(uint32_t l0, uint32_t l1, uint32_t l2);
    79 extern void read_from_invalid(uint32_t *l0, uint32_t *l1, uint32_t *l2);
    80 extern void preemptible_save_uspace(uintptr_t sp, istate_t *istate);
    81 extern void preemptible_restore_uspace(uintptr_t sp, istate_t *istate);
     77extern void arch_pre_main(void *, bootinfo_t *);
     78extern void write_to_invalid(uint32_t, uint32_t, uint32_t);
     79extern void read_from_invalid(uint32_t *, uint32_t *, uint32_t *);
     80extern void preemptible_save_uspace(uintptr_t, istate_t *);
     81extern void preemptible_restore_uspace(uintptr_t, istate_t *);
    8282extern void flush_windows(void);
    8383
  • kernel/arch/sparc32/include/arch/asm.h

    rf6f22cdb r32e8cd1  
    4343NO_TRACE static inline void asm_delay_loop(uint32_t usec)
    4444{
     45        // FIXME TODO
    4546}
    4647
    4748NO_TRACE static inline __attribute__((noreturn)) void cpu_halt(void)
    4849{
    49         /* On real hardware this should stop processing further
    50            instructions on the CPU (and possibly putting it into
    51            low-power mode) without any possibility of exitting
    52            this function. */
    53        
     50        // FIXME TODO
    5451        while (true);
    5552}
     
    5754NO_TRACE static inline void cpu_sleep(void)
    5855{
    59         /* On real hardware this should put the CPU into low-power
    60            mode. However, the CPU is free to continue processing
    61            futher instructions any time. The CPU also wakes up
    62            upon an interrupt. */
     56        // FIXME TODO
    6357}
    6458
     
    6862}
    6963
    70 /** Word to port
    71  *
    72  * Output word to port
    73  *
    74  * @param port Port to write to
    75  * @param val Value to write
    76  *
    77  */
    7864NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
    7965{
     
    8167}
    8268
    83 /** Double word to port
    84  *
    85  * Output double word to port
    86  *
    87  * @param port Port to write to
    88  * @param val Value to write
    89  *
    90  */
    9169NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
    9270{
     
    9472}
    9573
    96 /** Byte from port
    97  *
    98  * Get byte from port
    99  *
    100  * @param port Port to read from
    101  * @return Value read
    102  *
    103  */
    10474NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
    10575{
     
    10777}
    10878
    109 /** Word from port
    110  *
    111  * Get word from port
    112  *
    113  * @param port Port to read from
    114  * @return Value read
    115  *
    116  */
    11779NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
    11880{
     
    12082}
    12183
    122 /** Double word from port
    123  *
    124  * Get double word from port
    125  *
    126  * @param port Port to read from
    127  * @return Value read
    128  *
    129  */
    13084NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
    13185{
     
    13387}
    13488
    135 NO_TRACE static inline uint32_t psr_read()
     89NO_TRACE static inline uint32_t psr_read(void)
    13690{
    13791        uint32_t v;
    138 
     92       
    13993        asm volatile (
    14094                "mov %%psr, %[v]\n"
    14195                : [v] "=r" (v)
    14296        );
    143 
    144         return v;
    145 }
    146 
    147 NO_TRACE static inline uint32_t wim_read()
     97       
     98        return v;
     99}
     100
     101NO_TRACE static inline uint32_t wim_read(void)
    148102{
    149103        uint32_t v;
    150 
     104       
    151105        asm volatile (
    152106                "mov %%wim, %[v]\n"
    153107                : [v] "=r" (v)
    154108        );
    155 
    156         return v;
    157 }
    158 
    159 NO_TRACE static inline uint32_t asi_u32_read(int asi, uintptr_t va)
     109       
     110        return v;
     111}
     112
     113NO_TRACE static inline uint32_t asi_u32_read(unsigned int asi, uintptr_t va)
    160114{
    161115        uint32_t v;
    162 
     116       
    163117        asm volatile (
    164118                "lda [%[va]] %[asi], %[v]\n"
    165119                : [v] "=r" (v)
    166120                : [va] "r" (va),
    167                   [asi] "i" ((unsigned int) asi)
    168         );
    169        
    170         return v;
    171 }
    172 
    173 NO_TRACE static inline void asi_u32_write(int asi, uintptr_t va, uint32_t v)
     121                  [asi] "i" (asi)
     122        );
     123       
     124        return v;
     125}
     126
     127NO_TRACE static inline void asi_u32_write(unsigned int asi, uintptr_t va,
     128    uint32_t v)
    174129{
    175130        asm volatile (
     
    177132                :: [v] "r" (v),
    178133                   [va] "r" (va),
    179                    [asi] "i" ((unsigned int) asi)
     134                   [asi] "i" (asi)
    180135                : "memory"
    181136        );
     
    200155NO_TRACE static inline ipl_t interrupts_enable(void)
    201156{
     157        psr_reg_t psr;
     158        psr.value = psr_read();
     159       
    202160        ipl_t pil;
    203 
    204         psr_reg_t psr;
    205         psr.value = psr_read();
    206161        pil = psr.pil;
    207         psr.pil = 0xf;
     162       
     163        psr.pil = 0x0f;
    208164        psr_write(psr.value);
    209 
     165       
    210166        return pil;
    211167}
     
    213169NO_TRACE static inline ipl_t interrupts_disable(void)
    214170{
     171        psr_reg_t psr;
     172        psr.value = psr_read();
     173       
    215174        ipl_t pil;
    216 
    217         psr_reg_t psr;
    218         psr.value = psr_read();
    219175        pil = psr.pil;
     176       
    220177        psr.pil = 0;
    221178        psr_write(psr.value);
    222 
     179       
    223180        return pil;
    224181}
  • kernel/arch/sparc32/include/arch/atomic.h

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32le
     29/** @addtogroup sparc32
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_ATOMIC_H_
    36 #define KERN_abs32le_ATOMIC_H_
     35#ifndef KERN_sparc32_ATOMIC_H_
     36#define KERN_sparc32_ATOMIC_H_
    3737
    3838#include <typedefs.h>
     
    4747    REQUIRES(val->count < ATOMIC_COUNT_MAX)
    4848{
    49         /* On real hardware the increment has to be done
    50            as an atomic action. */
    51        
     49        // FIXME TODO
    5250        val->count++;
    5351}
     
    5856    REQUIRES(val->count > ATOMIC_COUNT_MIN)
    5957{
    60         /* On real hardware the decrement has to be done
    61            as an atomic action. */
    62        
     58        // FIXME TODO
    6359        val->count--;
    6460}
     
    6965    REQUIRES(val->count < ATOMIC_COUNT_MAX)
    7066{
    71         /* On real hardware both the storing of the previous
    72            value and the increment have to be done as a single
    73            atomic action. */
     67        // FIXME TODO
    7468       
    7569        atomic_count_t prev = val->count;
     
    8478    REQUIRES(val->count > ATOMIC_COUNT_MIN)
    8579{
    86         /* On real hardware both the storing of the previous
    87            value and the decrement have to be done as a single
    88            atomic action. */
     80        // FIXME TODO
    8981       
    9082        atomic_count_t prev = val->count;
     
    10193    REQUIRES_EXTENT_MUTABLE(val)
    10294{
    103         /* On real hardware the retrieving of the original
    104            value and storing 1 have to be done as a single
    105            atomic action. */
     95        // FIXME TODO
    10696       
    10797        atomic_count_t prev = val->count;
     
    114104    REQUIRES_EXTENT_MUTABLE(val)
    115105{
     106        // FIXME TODO
     107       
    116108        do {
    117109                while (val->count);
  • kernel/arch/sparc32/include/arch/barrier.h

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32le
     29/** @addtogroup sparc32
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_BARRIER_H_
    36 #define KERN_abs32le_BARRIER_H_
     35#ifndef KERN_sparc32_BARRIER_H_
     36#define KERN_sparc32_BARRIER_H_
    3737
    38 /*
    39  * Provisions are made to prevent compiler from reordering instructions itself.
    40  */
     38// FIXME TODO
    4139
    4240#define CS_ENTER_BARRIER()
  • kernel/arch/sparc32/include/arch/context.h

    rf6f22cdb r32e8cd1  
    5656 */
    5757typedef struct {
    58         uintptr_t sp;           /* %o6 */
    59         uintptr_t pc;           /* %o7 */
     58        uintptr_t sp;  /* %o6 */
     59        uintptr_t pc;  /* %o7 */
    6060        uint32_t i0;
    6161        uint32_t i1;
     
    6464        uint32_t i4;
    6565        uint32_t i5;
    66         uintptr_t fp;           /* %i6 */
     66        uintptr_t fp;  /* %i6 */
    6767        uintptr_t i7;
    6868        uint32_t l0;
  • kernel/arch/sparc32/include/arch/context_offset.h

    rf6f22cdb r32e8cd1  
    3131#define KERN_sparc32_CONTEXT_OFFSET_H_
    3232
    33 #define OFFSET_SP       0
    34 #define OFFSET_PC       4
    35 #define OFFSET_I0       8
    36 #define OFFSET_I1       12
    37 #define OFFSET_I2       16
    38 #define OFFSET_I3       20
    39 #define OFFSET_I4       24
    40 #define OFFSET_I5       28
    41 #define OFFSET_FP       32
    42 #define OFFSET_I7       36
    43 #define OFFSET_L0       40
    44 #define OFFSET_L1       44
    45 #define OFFSET_L2       48
    46 #define OFFSET_L3       52
    47 #define OFFSET_L4       56
    48 #define OFFSET_L5       60
    49 #define OFFSET_L6       64
    50 #define OFFSET_L7       68
     33#define OFFSET_SP  0
     34#define OFFSET_PC  4
     35#define OFFSET_I0  8
     36#define OFFSET_I1  12
     37#define OFFSET_I2  16
     38#define OFFSET_I3  20
     39#define OFFSET_I4  24
     40#define OFFSET_I5  28
     41#define OFFSET_FP  32
     42#define OFFSET_I7  36
     43#define OFFSET_L0  40
     44#define OFFSET_L1  44
     45#define OFFSET_L2  48
     46#define OFFSET_L3  52
     47#define OFFSET_L4  56
     48#define OFFSET_L5  60
     49#define OFFSET_L6  64
     50#define OFFSET_L7  68
    5151
    5252#ifndef KERNEL
    53 # define OFFSET_TP      72
     53
     54#define OFFSET_TP  72
     55
    5456#endif
     57
    5558#ifdef __ASM__
    5659
  • kernel/arch/sparc32/include/arch/cpu.h

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32le
     29/** @addtogroup sparc32
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_CPU_H_
    36 #define KERN_abs32le_CPU_H_
     35#ifndef KERN_sparc32_CPU_H_
     36#define KERN_sparc32_CPU_H_
    3737
    38 /*
    39  * On real hardware this structure stores
    40  * information specific to the current
    41  * CPU model.
    42  */
    4338typedef struct {
    4439} cpu_arch_t;
  • kernel/arch/sparc32/include/arch/cycle.h

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32le
     29/** @addtogroup sparc32
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_CYCLE_H_
    36 #define KERN_abs32le_CYCLE_H_
     35#ifndef KERN_sparc32_CYCLE_H_
     36#define KERN_sparc32_CYCLE_H_
    3737
    3838#include <trace.h>
     
    4040NO_TRACE static inline uint64_t get_cycle(void)
    4141{
     42        // FIXME TODO
    4243        return 0;
    4344}
  • kernel/arch/sparc32/include/arch/exception.h

    rf6f22cdb r32e8cd1  
    3838#define KERN_sparc32_EXCEPTION_H_
    3939
    40 #define TT_INSTRUCTION_ACCESS_EXCEPTION         0x01
    41 #define TT_INSTRUCTION_ACCESS_MMU_MISS          0x3c
    42 #define TT_INSTRUCTION_ACCESS_ERROR             0x21
    43 #define TT_ILLEGAL_INSTRUCTION                  0x02
    44 #define TT_PRIVILEGED_INSTRUCTION               0x03
    45 #define TT_FP_DISABLED                          0x08
    46 #define TT_DIVISION_BY_ZERO                     0x2a
    47 #define TT_DATA_ACCESS_EXCEPTION                0x09
    48 #define TT_DATA_ACCESS_MMU_MISS                 0x2c
    49 #define TT_DATA_ACCESS_ERROR                    0x29
    50 #define TT_MEM_ADDRESS_NOT_ALIGNED              0x07
     40#define TT_INSTRUCTION_ACCESS_EXCEPTION  0x01
     41#define TT_ILLEGAL_INSTRUCTION           0x02
     42#define TT_PRIVILEGED_INSTRUCTION        0x03
     43#define TT_MEM_ADDRESS_NOT_ALIGNED       0x07
     44#define TT_FP_DISABLED                   0x08
     45#define TT_DATA_ACCESS_EXCEPTION         0x09
     46#define TT_INSTRUCTION_ACCESS_ERROR      0x21
     47#define TT_DATA_ACCESS_ERROR             0x29
     48#define TT_DIVISION_BY_ZERO              0x2a
     49#define TT_DATA_ACCESS_MMU_MISS          0x2c
     50#define TT_INSTRUCTION_ACCESS_MMU_MISS   0x3c
    5151
    5252#ifndef __ASM__
    5353
    54 /*#include <arch/interrupt.h>*/
     54extern void instruction_access_exception(int, istate_t *);
     55extern void instruction_access_error(int, istate_t *);
     56extern void illegal_instruction(int, istate_t *);
     57extern void privileged_instruction(int, istate_t *);
     58extern void fp_disabled(int, istate_t *);
     59extern void fp_exception(int, istate_t *);
     60extern void tag_overflow(int, istate_t *);
     61extern void division_by_zero(int, istate_t *);
     62extern void data_access_exception(int, istate_t *);
     63extern void data_access_error(int, istate_t *);
     64extern void data_access_mmu_miss(int, istate_t *);
     65extern void data_store_error(int, istate_t *);
     66extern void mem_address_not_aligned(int, istate_t *);
    5567
    56 extern void instruction_access_exception(int n, istate_t *istate);
    57 extern void instruction_access_error(int n, istate_t *istate);
    58 extern void illegal_instruction(int n, istate_t *istate);
    59 extern void privileged_instruction(int n, istate_t *istate);
    60 extern void fp_disabled(int n, istate_t *istate);
    61 extern void fp_exception(int n, istate_t *istate);
    62 extern void tag_overflow(int n, istate_t *istate);
    63 extern void division_by_zero(int n, istate_t *istate);
    64 extern void data_access_exception(int n, istate_t *istate);
    65 extern void data_access_error(int n, istate_t *istate);
    66 extern void data_access_mmu_miss(int n, istate_t *istate);
    67 extern void data_store_error(int n, istate_t *istate);
    68 extern void mem_address_not_aligned(int n, istate_t *istate);
    69 extern sysarg_t syscall(sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id);
    70 extern void irq_exception(unsigned int nr, istate_t *istate);
     68extern sysarg_t syscall(sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     69    sysarg_t, sysarg_t);
     70extern void irq_exception(unsigned int, istate_t *);
    7171
    7272#endif /* !__ASM__ */
  • kernel/arch/sparc32/include/arch/faddr.h

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32le
     29/** @addtogroup sparc32
    3030 * @{
    3131 */
  • kernel/arch/sparc32/include/arch/fpu_context.h

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32le
     29/** @addtogroup sparc32
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_FPU_CONTEXT_H_
    36 #define KERN_abs32le_FPU_CONTEXT_H_
     35#ifndef KERN_sparc32_FPU_CONTEXT_H_
     36#define KERN_sparc32_FPU_CONTEXT_H_
    3737
    3838#include <typedefs.h>
     
    4040#define FPU_CONTEXT_ALIGN  16
    4141
    42 /*
    43  * On real hardware this stores the FPU registers
    44  * which are part of the CPU context.
    45  */
    4642typedef struct {
    4743} fpu_context_t;
  • kernel/arch/sparc32/include/arch/interrupt.h

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32leinterrupt
     29/** @addtogroup sparc32interrupt
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_INTERRUPT_H_
    36 #define KERN_abs32le_INTERRUPT_H_
     35#ifndef KERN_sparc32_INTERRUPT_H_
     36#define KERN_sparc32_INTERRUPT_H_
    3737
    3838#include <typedefs.h>
  • kernel/arch/sparc32/include/arch/istate.h

    rf6f22cdb r32e8cd1  
    4949#endif /* KERNEL */
    5050
    51 /*
    52  * On real hardware this stores the registers which
    53  * need to be preserved during interupts.
    54  */
    5551typedef struct istate {
    5652        uintptr_t pstate;
     
    6359    REQUIRES_EXTENT_MUTABLE(istate)
    6460{
    65         /* On real hardware this checks whether the interrupted
    66            context originated from user space. */
    67 
    6861        return !(istate->pc & UINT32_C(0x80000000));
    6962}
     
    7366    WRITES(&istate->ip)
    7467{
    75         /* On real hardware this sets the instruction pointer. */
    76        
    7768        istate->pc = retaddr;
    7869}
     
    8172    REQUIRES_EXTENT_MUTABLE(istate)
    8273{
    83         /* On real hardware this returns the instruction pointer. */
    84        
    8574        return istate->pc;
    8675}
     
    8978    REQUIRES_EXTENT_MUTABLE(istate)
    9079{
    91         /* On real hardware this returns the frame pointer. */
    92        
    93         return 0;//istate->fp;
     80        return 0;
    9481}
    9582
  • kernel/arch/sparc32/include/arch/machine/leon3/leon3.h

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup sparc32leon3 LEON3
    30  *  @brief LEON3 System-on-chip.
    31  *  @ingroup arm32
     29/** @addtogroup sparc32leon3
     30 * @brief LEON3 System-on-chip.
     31 * @ingroup sparc32
    3232 * @{
    3333 */
    3434
    35 #ifndef KERN_sparc32_leon3_H_
    36 #define KERN_sparc32_leon3_H_
     35#ifndef KERN_sparc32_LEON3_H_
     36#define KERN_sparc32_LEON3_H_
    3737
    3838#include <arch/machine_func.h>
    3939
     40#define LEON3_SDRAM_START  0x40000000
     41#define LEON3_IRQ_COUNT    15
     42
    4043extern struct sparc_machine_ops leon3_machine_ops;
    41 
    42 #define LEON3_SDRAM_START 0x40000000
    43 #define LEON3_IRQ_COUNT 15
    4444
    4545#endif
  • kernel/arch/sparc32/include/arch/machine_func.h

    rf6f22cdb r32e8cd1  
    3232 */
    3333/** @file
    34  *  @brief Declarations of machine specific functions.
     34 * @brief Declarations of machine specific functions.
    3535 *
    36  *  These functions enable to differentiate more kinds of ARM emulators
    37  *  or CPUs. It's the same concept as "arch" functions on the architecture
    38  *  level.
     36 * These functions enable to differentiate more kinds of SPARC emulators
     37 * or CPUs. It is the same concept as "arch" functions on the architecture
     38 * level.
    3939 */
    4040
     
    6666extern void machine_ops_init(void);
    6767
    68 /** Maps HW devices to the kernel address space using #hw_map. */
     68/** Map HW devices to the kernel address space using #hw_map. */
    6969extern void machine_init(bootinfo_t *);
    7070
    71 
    72 /** Starts timer. */
     71/** Start timer. */
    7372extern void machine_timer_irq_start(void);
    7473
    75 
    76 /** Halts CPU. */
     74/** Halt CPU. */
    7775extern void machine_cpu_halt(void);
    7876
    7977/** Get extents of available memory.
    8078 *
    81  * @param start         Place to store memory start address.
    82  * @param size          Place to store memory size.
     79 * @param start Place to store memory start address.
     80 * @param size  Place to store memory size.
    8381 */
    8482extern void machine_get_memory_extents(uintptr_t *start, size_t *size);
     
    9189extern void machine_irq_exception(unsigned int exc_no, istate_t *istate);
    9290
    93 
    94 /*
    95  * Machine specific frame initialization
    96  */
     91/** Machine specific frame initialization */
    9792extern void machine_frame_init(void);
    9893
    99 /*
    100  * configure the serial line output device.
    101  */
     94/* Configure the serial line output device. */
    10295extern void machine_output_init(void);
    10396
    104 /*
    105  * configure the serial line input device.
    106  */
     97/** Configure the serial line input device. */
    10798extern void machine_input_init(void);
    10899
    109100extern size_t machine_get_irq_count(void);
    110101
    111 extern const char * machine_get_platform_name(void);
     102extern const char *machine_get_platform_name(void);
    112103
    113104#endif
  • kernel/arch/sparc32/include/arch/mm/as.h

    rf6f22cdb r32e8cd1  
    5555#define as_invalidate_translation_cache(as, page, cnt)
    5656
    57 uintptr_t as_context_table;
     57extern uintptr_t as_context_table;
    5858
    5959extern void as_arch_init(void);
  • kernel/arch/sparc32/include/arch/mm/frame.h

    rf6f22cdb r32e8cd1  
    3333 */
    3434
    35 #ifndef KERN_abs32le_FRAME_H_
    36 #define KERN_abs32le_FRAME_H_
     35#ifndef KERN_sparc32_FRAME_H_
     36#define KERN_sparc32_FRAME_H_
    3737
    3838#define FRAME_WIDTH  12  /* 4K */
     
    4141#include <typedefs.h>
    4242
    43 #define PHYSMEM_START_ADDR      0x40000000
     43#define PHYSMEM_START_ADDR  0x40000000
    4444
    45 #define BOOT_PT_ADDRESS         0x40008000
    46 #define BOOT_PT_START_FRAME     (BOOT_PT_ADDRESS >> FRAME_WIDTH)
    47 #define BOOT_PT_SIZE_FRAMES     1
     45#define BOOT_PT_ADDRESS      0x40008000
     46#define BOOT_PT_START_FRAME  (BOOT_PT_ADDRESS >> FRAME_WIDTH)
     47#define BOOT_PT_SIZE_FRAMES  1
    4848
    4949extern void frame_low_arch_init(void);
  • kernel/arch/sparc32/include/arch/mm/km.h

    rf6f22cdb r32e8cd1  
    3838#include <typedefs.h>
    3939
    40 #define KM_SPARC32_IDENTITY_START       UINT32_C(0x80000000)
    41 #define KM_SPARC32_IDENTITY_SIZE        UINT32_C(0x70000000)
     40#define KM_SPARC32_IDENTITY_START  UINT32_C(0x80000000)
     41#define KM_SPARC32_IDENTITY_SIZE   UINT32_C(0x70000000)
    4242
    43 #define KM_SPARC32_NON_IDENTITY_START   UINT32_C(0xf0000000)
    44 #define KM_SPARC32_NON_IDENTITY_SIZE    UINT32_C(0xff00000)
     43#define KM_SPARC32_NON_IDENTITY_START  UINT32_C(0xf0000000)
     44#define KM_SPARC32_NON_IDENTITY_SIZE   UINT32_C(0xff00000)
    4545
    4646extern void km_identity_arch_init(void);
  • kernel/arch/sparc32/include/arch/mm/page.h

    rf6f22cdb r32e8cd1  
    4848#define PA2KA(x)  (((uintptr_t) (x)) + UINT32_C(0x40000000))
    4949
    50 #define PTE_ET_INVALID          0
    51 #define PTE_ET_DESCRIPTOR       1
    52 #define PTE_ET_ENTRY            2
    53 
    54 #define PTE_ACC_USER_RO_KERNEL_RO       0
    55 #define PTE_ACC_USER_RW_KERNEL_RW       1
    56 #define PTE_ACC_USER_RX_KERNEL_RX       2
    57 #define PTE_ACC_USER_RWX_KERNEL_RWX     3
    58 #define PTE_ACC_USER_XO_KERNEL_XO       4
    59 #define PTE_ACC_USER_RO_KERNEL_RW       5
    60 #define PTE_ACC_USER_NO_KERNEL_RX       6
    61 #define PTE_ACC_USER_NO_KERNEL_RWX      7
     50#define PTE_ET_INVALID     0
     51#define PTE_ET_DESCRIPTOR  1
     52#define PTE_ET_ENTRY       2
     53
     54#define PTE_ACC_USER_RO_KERNEL_RO    0
     55#define PTE_ACC_USER_RW_KERNEL_RW    1
     56#define PTE_ACC_USER_RX_KERNEL_RX    2
     57#define PTE_ACC_USER_RWX_KERNEL_RWX  3
     58#define PTE_ACC_USER_XO_KERNEL_XO    4
     59#define PTE_ACC_USER_RO_KERNEL_RW    5
     60#define PTE_ACC_USER_NO_KERNEL_RX    6
     61#define PTE_ACC_USER_NO_KERNEL_RWX   7
    6262
    6363/* Number of entries in each level. */
     
    143143/** Page Table Descriptor. */
    144144typedef struct {
    145         unsigned int table_pointer: 30;
    146         unsigned int et: 2;
     145        unsigned int table_pointer : 30;
     146        unsigned int et : 2;
    147147} __attribute__((packed)) ptd_t;
    148148
    149149/** Page Table Entry. */
    150150typedef struct {
    151         unsigned int frame_address: 24;
    152         unsigned int cacheable: 1;
    153         unsigned int modified: 1;
    154         unsigned int referenced: 1;
    155         unsigned int acc: 3;
    156         unsigned int et: 2;
     151        unsigned int frame_address : 24;
     152        unsigned int cacheable : 1;
     153        unsigned int modified : 1;
     154        unsigned int referenced : 1;
     155        unsigned int acc : 3;
     156        unsigned int et : 2;
    157157} __attribute__((packed)) pte_t;
    158158
     
    163163NO_TRACE static inline bool pte_is_writeable(pte_t *pt)
    164164{
    165         return (
    166                 pt->acc == PTE_ACC_USER_RW_KERNEL_RW ||
    167                 pt->acc == PTE_ACC_USER_RWX_KERNEL_RWX ||
    168                 pt->acc == PTE_ACC_USER_RO_KERNEL_RW ||
    169                 pt->acc == PTE_ACC_USER_NO_KERNEL_RWX
    170         );
     165        return ((pt->acc == PTE_ACC_USER_RW_KERNEL_RW) ||
     166            (pt->acc == PTE_ACC_USER_RWX_KERNEL_RWX) ||
     167            (pt->acc == PTE_ACC_USER_RO_KERNEL_RW) ||
     168            (pt->acc == PTE_ACC_USER_NO_KERNEL_RWX));
    171169}
    172170
    173171NO_TRACE static inline bool pte_is_executable(pte_t *pt)
    174172{
    175         return (
    176                 pt->acc != PTE_ACC_USER_RO_KERNEL_RO &&
    177                 pt->acc != PTE_ACC_USER_RW_KERNEL_RW &&
    178                 pt->acc != PTE_ACC_USER_RO_KERNEL_RW
    179         );
     173        return ((pt->acc != PTE_ACC_USER_RO_KERNEL_RO) &&
     174            (pt->acc != PTE_ACC_USER_RW_KERNEL_RW) &&
     175            (pt->acc != PTE_ACC_USER_RO_KERNEL_RW));
    180176}
    181177
     
    184180{
    185181        pte_t *p = &pt[i];
    186 
    187         bool notpresent = p->et == 0;
    188 
    189         return (
    190                 (p->cacheable << PAGE_CACHEABLE_SHIFT) |
    191                 (notpresent << PAGE_PRESENT_SHIFT) |
    192                 ((p->acc != PTE_ACC_USER_NO_KERNEL_RX && p->acc != PTE_ACC_USER_NO_KERNEL_RWX) << PAGE_USER_SHIFT) |
    193                 (1 << PAGE_READ_SHIFT) |
    194                 ((
    195                         p->acc == PTE_ACC_USER_RW_KERNEL_RW ||
    196                         p->acc == PTE_ACC_USER_RWX_KERNEL_RWX ||
    197                         p->acc == PTE_ACC_USER_RO_KERNEL_RW ||
    198                         p->acc == PTE_ACC_USER_NO_KERNEL_RWX
    199                 ) << PAGE_WRITE_SHIFT) |
    200                 ((
    201                         p->acc != PTE_ACC_USER_RO_KERNEL_RO &&
    202                         p->acc != PTE_ACC_USER_RW_KERNEL_RW &&
    203                         p->acc != PTE_ACC_USER_RO_KERNEL_RW
    204                 ) << PAGE_EXEC_SHIFT) |
    205                 (1 << PAGE_GLOBAL_SHIFT)
    206         );
     182       
     183        bool notpresent = (p->et == 0);
     184       
     185        return ((p->cacheable << PAGE_CACHEABLE_SHIFT) |
     186            (notpresent << PAGE_PRESENT_SHIFT) |
     187            (((p->acc != PTE_ACC_USER_NO_KERNEL_RX) &&
     188            (p->acc != PTE_ACC_USER_NO_KERNEL_RWX)) << PAGE_USER_SHIFT) |
     189            (1 << PAGE_READ_SHIFT) |
     190            (((p->acc == PTE_ACC_USER_RW_KERNEL_RW) ||
     191            (p->acc == PTE_ACC_USER_RWX_KERNEL_RWX) ||
     192            (p->acc == PTE_ACC_USER_RO_KERNEL_RW) ||
     193            (p->acc == PTE_ACC_USER_NO_KERNEL_RWX)) << PAGE_WRITE_SHIFT) |
     194            (((p->acc != PTE_ACC_USER_RO_KERNEL_RO) &&
     195            (p->acc != PTE_ACC_USER_RW_KERNEL_RW) &&
     196            (p->acc != PTE_ACC_USER_RO_KERNEL_RW)) << PAGE_EXEC_SHIFT) |
     197            (1 << PAGE_GLOBAL_SHIFT));
    207198}
    208199
     
    213204        pte_t *p = &pt[i];
    214205       
    215         p->et = (flags & PAGE_NOT_PRESENT)
    216                 ? PTE_ET_INVALID
    217                 : PTE_ET_DESCRIPTOR;
     206        p->et = (flags & PAGE_NOT_PRESENT) ?
     207            PTE_ET_INVALID : PTE_ET_DESCRIPTOR;
    218208}
    219209
     
    223213{
    224214        pte_t *p = &pt[i];
    225 
     215       
    226216        p->et = PTE_ET_ENTRY;
    227217        p->acc = PTE_ACC_USER_NO_KERNEL_RWX;
     
    240230                }
    241231        }
    242 
     232       
    243233        if (flags & PAGE_NOT_PRESENT)
    244234                p->et = PTE_ET_INVALID;
    245 
     235       
    246236        p->cacheable = (flags & PAGE_CACHEABLE) != 0;
    247237}
     
    252242{
    253243        pte_t *p = &pt[i];
    254 
     244       
    255245        p->et = PTE_ET_DESCRIPTOR;
    256246}
     
    261251{
    262252        pte_t *p = &pt[i];
    263 
     253       
    264254        p->et = PTE_ET_ENTRY;
    265255}
  • kernel/arch/sparc32/include/arch/mm/page_fault.h

    rf6f22cdb r32e8cd1  
    5050typedef struct {
    5151        unsigned int : 14;
    52         unsigned int ebe: 8;
    53         unsigned int l: 2;
    54         unsigned int at: 3;
    55         unsigned int ft: 3;
    56         unsigned int fav: 1;
    57         unsigned int ow: 1;
     52        unsigned int ebe : 8;
     53        unsigned int l : 2;
     54        unsigned int at : 3;
     55        unsigned int ft : 3;
     56        unsigned int fav : 1;
     57        unsigned int ow : 1;
    5858} __attribute__((packed)) mmu_fault_status_t;
    5959
  • kernel/arch/sparc32/include/arch/mm/tlb.h

    rf6f22cdb r32e8cd1  
    3636#define KERN_sparc32_TLB_H_
    3737
    38 #define MMU_CONTROL             0x000
    39 #define MMU_CONTEXT_TABLE       0x100
    40 #define MMU_CONTEXT             0x200
    41 #define MMU_FAULT_STATUS        0x300
    42 #define MMU_FAULT_ADDRESS       0x400
     38#define MMU_CONTROL        0x000
     39#define MMU_CONTEXT_TABLE  0x100
     40#define MMU_CONTEXT        0x200
     41#define MMU_FAULT_STATUS   0x300
     42#define MMU_FAULT_ADDRESS  0x400
    4343
    4444#endif
  • kernel/arch/sparc32/include/arch/proc/task.h

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32leproc
     29/** @addtogroup sparc32proc
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_TASK_H_
    36 #define KERN_abs32le_TASK_H_
     35#ifndef KERN_sparc32_TASK_H_
     36#define KERN_sparc32_TASK_H_
    3737
    3838#include <typedefs.h>
    3939#include <adt/bitmap.h>
    4040
    41 /*
    42  * On real hardware this structure stores task information
    43  * specific to the architecture.
    44  */
    4541typedef struct {
    4642} task_arch_t;
  • kernel/arch/sparc32/include/arch/register.h

    rf6f22cdb r32e8cd1  
    4242        uint32_t value;
    4343        struct {
    44                 unsigned int impl: 4;
    45                 unsigned int ver: 4;
    46                 unsigned int icc: 4;
     44                unsigned int impl : 4;
     45                unsigned int ver : 4;
     46                unsigned int icc : 4;
    4747                unsigned int : 6;
    48                 unsigned int ec: 1;
    49                 unsigned int ef: 1;
    50                 unsigned int pil: 4;
    51                 unsigned int s: 1;
    52                 unsigned int ps: 1;
    53                 unsigned int et: 1;
    54                 unsigned int cwp: 5;
    55         } __attribute__ ((packed));
     48                unsigned int ec : 1;
     49                unsigned int ef : 1;
     50                unsigned int pil : 4;
     51                unsigned int s : 1;
     52                unsigned int ps : 1;
     53                unsigned int et : 1;
     54                unsigned int cwp : 5;
     55        } __attribute__((packed));
    5656} psr_reg_t;
    5757
  • kernel/arch/sparc32/include/arch/regwin.h

    rf6f22cdb r32e8cd1  
    4242#include <align.h>
    4343
    44 #define UWB_ALIGNMENT   1024
     44/* Window Save Area offsets. */
     45#define L0_OFFSET  0
     46#define L1_OFFSET  4
     47#define L2_OFFSET  8
     48#define L3_OFFSET  12
     49#define L4_OFFSET  16
     50#define L5_OFFSET  20
     51#define L6_OFFSET  24
     52#define L7_OFFSET  28
     53#define I0_OFFSET  32
     54#define I1_OFFSET  36
     55#define I2_OFFSET  40
     56#define I3_OFFSET  44
     57#define I4_OFFSET  48
     58#define I5_OFFSET  52
     59#define I6_OFFSET  56
     60#define I7_OFFSET  60
    4561
    46 /* Window Save Area offsets. */
    47 #define L0_OFFSET       0
    48 #define L1_OFFSET       4
    49 #define L2_OFFSET       8
    50 #define L3_OFFSET       12
    51 #define L4_OFFSET       16
    52 #define L5_OFFSET       20
    53 #define L6_OFFSET       24
    54 #define L7_OFFSET       28
    55 #define I0_OFFSET       32
    56 #define I1_OFFSET       36
    57 #define I2_OFFSET       40
    58 #define I3_OFFSET       44
    59 #define I4_OFFSET       48
    60 #define I5_OFFSET       52
    61 #define I6_OFFSET       56
    62 #define I7_OFFSET       60
    63 
    64 /* Uspace Window Buffer constants. */
    65 #define UWB_SIZE        ((NWINDOWS - 1) * STACK_WINDOW_SAVE_AREA_SIZE)
    66 #define UWB_ALIGNMENT   1024
    67 #define UWB_ASIZE       ALIGN_UP(UWB_SIZE, UWB_ALIGNMENT)
     62/* User space Window Buffer constants. */
     63#define UWB_SIZE       ((NWINDOWS - 1) * STACK_WINDOW_SAVE_AREA_SIZE)
     64#define UWB_ALIGNMENT  1024
     65#define UWB_ASIZE      ALIGN_UP(UWB_SIZE, UWB_ALIGNMENT)
    6866
    6967#endif
  • kernel/arch/sparc32/include/arch/stack.h

    rf6f22cdb r32e8cd1  
    3939#include <config.h>
    4040
    41 #define MEM_STACK_SIZE  STACK_SIZE
     41#define MEM_STACK_SIZE  STACK_SIZE
    4242
    43 #define STACK_ITEM_SIZE                 4
    44 
    45 /** According to SPARC Compliance Definition, every stack frame is 16-byte aligned. */
    46 #define STACK_ALIGNMENT                 8
     43#define STACK_ITEM_SIZE  4
     44#define STACK_ALIGNMENT  8
    4745
    4846/**
    4947 * 16-extended-word save area for %i[0-7] and %l[0-7] registers.
    5048 */
    51 #define STACK_WINDOW_SAVE_AREA_SIZE     (16 * STACK_ITEM_SIZE)
     49#define STACK_WINDOW_SAVE_AREA_SIZE  (16 * STACK_ITEM_SIZE)
    5250
    5351/**
    5452 * Six extended words for first six arguments.
    5553 */
    56 #define STACK_ARG_SAVE_AREA_SIZE        (6 * STACK_ITEM_SIZE)
     54#define STACK_ARG_SAVE_AREA_SIZE  (6 * STACK_ITEM_SIZE)
    5755
    58 /*
     56/**
    5957 * Offsets of arguments on stack.
    6058 */
    61 #define STACK_ARG0                      0
    62 #define STACK_ARG1                      4
    63 #define STACK_ARG2                      8
    64 #define STACK_ARG3                      12
    65 #define STACK_ARG4                      16
    66 #define STACK_ARG5                      20
    67 #define STACK_ARG6                      24
     59#define STACK_ARG0  0
     60#define STACK_ARG1  4
     61#define STACK_ARG2  8
     62#define STACK_ARG3  12
     63#define STACK_ARG4  16
     64#define STACK_ARG5  20
     65#define STACK_ARG6  24
    6866
    6967#endif
  • kernel/arch/sparc32/include/arch/trap.h

    rf6f22cdb r32e8cd1  
    3636#define KERN_sparc32_TRAP_H_
    3737
    38 #define TRAP_ENTRY_SIZE         16
    39 #define TRAP_TABLE_COUNT        256
    40 #define TRAP_TABLE_SIZE         (TRAP_ENTRY_SIZE * TRAP_TABLE_COUNT)
     38#define TRAP_ENTRY_SIZE   16
     39#define TRAP_TABLE_COUNT  256
     40#define TRAP_TABLE_SIZE   (TRAP_ENTRY_SIZE * TRAP_TABLE_COUNT)
    4141
    4242#ifndef __ASM__
     43
    4344extern void *trap_table;
     45
    4446#endif
    4547
  • kernel/arch/sparc32/include/arch/types.h

    rf6f22cdb r32e8cd1  
    3333 */
    3434
    35 #ifndef KERN_sparc32le_TYPES_H_
    36 #define KERN_sparc32le_TYPES_H_
     35#ifndef KERN_sparc32_TYPES_H_
     36#define KERN_sparc32_TYPES_H_
    3737
    3838#define ATOMIC_COUNT_MIN  UINT32_MIN
Note: See TracChangeset for help on using the changeset viewer.