github.com/usbarmory/GoTEE@v0.0.0-20240405084336-c52770d9fcdb/monitor/go_asm_riscv64.h (about)

     1  // RISC-V processor support
     2  // https://github.com/usbarmory/tamago
     3  //
     4  // Copyright 2022 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in Go LICENSE file.
     7  
     8  #define t0 5
     9  #define t1 6
    10  
    11  #define satp     0x180
    12  #define mstatus  0x300
    13  #define mscratch 0x340
    14  #define mepc     0x341
    15  #define mcause   0x342
    16  
    17  #define CSRW(RS,CSR) WORD $(0x1073 + RS<<15 + CSR<<20)
    18  #define CSRR(CSR,RD) WORD $(0x2073 + RD<<7 + CSR<<20)
    19  #define CSRS(RS,CSR) WORD $(0x2073 + RS<<15 + CSR<<20)
    20  #define CSRC(RS,CSR) WORD $(0x3073 + RS<<15 + CSR<<20)
    21  #define CSRRW(RS,CSR,RD) WORD $(0x1073 + RD<<7 + RS<<15 + CSR<<20)
    22  
    23  #define MRET  WORD $0x30200073