aboutsummaryrefslogtreecommitdiff
path: root/pk/sbi_entry.S
blob: 33e998af983296903f780813f76c01ef4afcde4b (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "encoding.h"
#include "mcall.h"

   .section .sbi,"ax",@progbits
  .align RISCV_PGSHIFT
  .globl sbi_base
sbi_base:

  # TODO: figure out something better to do with this space.  It's not
  # protected from the OS, so beware.
  .skip RISCV_PGSIZE - 2048

  # hart_id
  .align 4
  li a0, MCALL_HART_ID
  mcall
  ret

  # num_harts
  .align 4
  lw a0, num_harts
  ret

  # query_memory
  .align 4
  j __sbi_query_memory

  # console_putchar
  .align 4
  mv a1, a0
  li a0, MCALL_CONSOLE_PUTCHAR
  mcall
  ret

  # send_device_request
  .align 4
  mv a1, a0
  li a0, MCALL_SEND_DEVICE_REQUEST
  mcall
  ret

  # receive_device_response
  .align 4
  mv a1, a0
  li a0, MCALL_RECEIVE_DEVICE_RESPONSE
  mcall
  ret

  # send ipi
  .align 4
  csrw send_ipi, a0
  ret

  # end of SBI trampolines

  .globl do_mcall
do_mcall:
  mcall
  ret

  .align RISCV_PGSHIFT