aboutsummaryrefslogtreecommitdiff
path: root/isa/rv64mi/ipi.S
blob: 71783107e250478b817b99b5a815a580f5a108c1 (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
# See LICENSE for license details.

#*****************************************************************************
# ipi.S
#-----------------------------------------------------------------------------
#
# Test interprocessor interrupts.
#

#include "riscv_test.h"
#include "test_macros.h"

RVTEST_RV64M
RVTEST_CODE_BEGIN

  # enable interrupts
  csrs mstatus, MSTATUS_MIE
  csrs mie, MIP_MSIP

  # get a unique core id
  la a0, coreid
  li a1, 1
  amoadd.w a2, a1, (a0)
  
  # for now, only run this on core 0
  1:li a3, 1
  bgeu a2, a3, 1b
  
  # send a self-IPI
  csrwi mipi, 1
  1: j 1b

mtvec_handler:
  bnez a2, fail
  RVTEST_PASS

  TEST_PASSFAIL

RVTEST_CODE_END

  .data
RVTEST_DATA_BEGIN

  TEST_DATA

coreid: .word 0
foo: .word 0

RVTEST_DATA_END