aboutsummaryrefslogtreecommitdiff
path: root/pk/riscv-pk.S
blob: 6b917873458d8e5acb592411acacbd8be393d72b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "pcr.h"
#include "pk.h"

.section .text,"ax",@progbits
.globl __start
.ent __start
__start:

  lui $sp, %hi(stack_top)
  add $sp, $sp, %lo(stack_top)

  lui $t0, %hi(trap_entry)
  add $t0, $t0, %lo(trap_entry)
  mtpcr $t0, ASM_CR(PCR_EVEC)

  mtpcr $x0, ASM_CR(PCR_COUNT)
  li    $t0, TIMER_PERIOD
  mtpcr $t0, ASM_CR(PCR_COMPARE)

  li $t0, SR_S | SR_PS | SR_ET | SR_EC | SR_SX
  or $t1, $t0, SR_EF | SR_EV
  mtpcr $t1, ASM_CR(PCR_SR)
  mfpcr $t1, ASM_CR(PCR_SR)
  mtpcr $t0, ASM_CR(PCR_SR)
  
  and $t2, $t1, SR_EF
  lui $t0, %hi(have_fp)
  sw  $t2, %lo(have_fp)($t0)
  
  and $t2, $t1, SR_EV
  lui $t0, %hi(have_vector)
  sw  $t2, %lo(have_vector)($t0)

  lui $t0, %hi(boot)
  jalr.j $t0, %lo(boot)
  #j boot

.end __start