libucontext/arch/riscv64/defs.h

56 lines
912 B
C
Raw Permalink Normal View History

2020-05-18 02:19:14 +00:00
#ifndef __ARCH_RISCV64_DEFS_H
#define __ARCH_RISCV64_DEFS_H
#define REG_SZ (8)
#define MCONTEXT_GREGS (176)
/* program counter is saved in x0 as well as x1, similar to mips */
#ifndef REG_PC
#define REG_PC (0)
#endif
#ifndef REG_RA
#define REG_RA (1)
#endif
#ifndef REG_SP
2020-05-18 02:19:14 +00:00
#define REG_SP (2)
#endif
#ifndef REG_S0
2020-05-18 02:19:14 +00:00
#define REG_S0 (8)
#endif
2020-05-18 02:19:14 +00:00
#define REG_S1 (9)
#ifndef REG_A0
2020-05-18 02:19:14 +00:00
#define REG_A0 (10)
#endif
2020-05-18 02:19:14 +00:00
#define REG_A1 (11)
#define REG_A2 (12)
#define REG_A3 (13)
#define REG_A4 (14)
#define REG_A5 (15)
#define REG_A6 (16)
#define REG_A7 (17)
#define REG_S2 (18)
#define REG_S3 (19)
#define REG_S4 (20)
#define REG_S5 (21)
#define REG_S6 (22)
#define REG_S7 (23)
#define REG_S8 (24)
#define REG_S9 (25)
#define REG_S10 (26)
#define REG_S11 (27)
#define PC_OFFSET REG_OFFSET(REG_PC)
2020-05-18 02:19:14 +00:00
2020-12-12 07:07:32 +00:00
#define FETCH_LINKPTR(dest) \
asm("mv %0, s1" : "=r" ((dest)))
2020-12-12 07:07:32 +00:00
2020-05-18 02:19:14 +00:00
#include "common-defs.h"
#endif