Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/riscv64/src/asm.S

    r0a78e4f r8b6aa39  
    2929#include <abi/asmtool.h>
    3030#include <arch/arch.h>
    31 #include <arch/mm.h>
    32 
    33 #define MCOUNTEREN_CY_MASK  0x00000001
    34 #define MCOUNTEREN_TM_MASK  0x00000002
    35 #define MCOUNTEREN_IR_MASK  0x00000004
    36 
    37 #define MSTATUS_MPP_MASK        0x00001800
    38 #define MSTATUS_MPP_USER        0x00000000
    39 #define MSTATUS_MPP_SUPERVISOR  0x00000800
    40 #define MSTATUS_MPP_MACHINE     0x00001800
    41 
    42 #define MSTATUS_SUM_MASK        0x00040000
    43 
    44 #define SATP_PFN_MASK  0x00000fffffffffff
    45 
    46 #define SATP_MODE_MASK  0xf000000000000000
    47 #define SATP_MODE_BARE  0x0000000000000000
    48 #define SATP_MODE_SV39  0x8000000000000000
    49 #define SATP_MODE_SV48  0x9000000000000000
    5031
    5132.section BOOTSTRAP
     
    9576
    9677FUNCTION_BEGIN(jump_to_kernel)
    97         /* Enable performance counters access in supervisor mode */
    98         csrsi mcounteren, MCOUNTEREN_CY_MASK | MCOUNTEREN_TM_MASK | MCOUNTEREN_IR_MASK
    99        
    100         /* Setup SV48 paging for supervisor mode */
    101         la t0, ptl_0
    102         srli t0, t0, 12
    103        
    104         li t1, SATP_PFN_MASK
    105         and t0, t0, t1
    106        
    107         li t1, SATP_MODE_SV48
    108         or t0, t0, t1
    109        
    110         csrw sptbr, t0
    111        
    112         /* Jump to supervisor mode */
    113         csrr t0, mstatus
    114        
    115         li t1, ~MSTATUS_MPP_MASK
    116         and t0, t0, t1
    117        
    118         /*
    119          * TODO: Enable running with Supervisor User Mode
    120          * access disabled.
    121          */
    122         li t1, MSTATUS_MPP_SUPERVISOR | MSTATUS_SUM_MASK
    123         or t0, t0, t1
    124        
    125         csrw mstatus, t0
    126        
    127         li ra, PA2KA(BOOT_OFFSET)
    128         csrw mepc, ra
    129        
    130         mret
     78        j halt
    13179FUNCTION_END(jump_to_kernel)
    13280
     
    14088SYMBOL(boot_stack)
    14189        .space BOOT_STACK_SIZE
    142 
    143 .section .pt, "aw", @progbits
    144 
    145 .align PAGE_WIDTH
    146 SYMBOL(ptl_0)
    147         .fill 256, 8, 0
    148         /* Identity mapping for [0; 512G) */
    149         .quad 0 + (PTL_DIRTY | PTL_ACCESSED | PTL_EXECUTABLE | PTL_WRITABLE | PTL_READABLE | PTL_VALID)
    150         .fill 255, 8, 0
Note: See TracChangeset for help on using the changeset viewer.