diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2013-07-13 21:43:57 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2013-07-13 21:44:16 -0700 |
commit | cc72987e655578b0529b6c3c8084e810cf40b358 (patch) | |
tree | a7a99a9406dfef2d4103e85bc0976cb8d039d7e7 /pk/pcr.h | |
parent | 0bdb8c84092bf7c5eb4c981c620997a5893bfb70 (diff) | |
download | pk-cc72987e655578b0529b6c3c8084e810cf40b358.zip pk-cc72987e655578b0529b6c3c8084e810cf40b358.tar.gz pk-cc72987e655578b0529b6c3c8084e810cf40b358.tar.bz2 |
Support Linux ABI and (optionally) virtual memory
Diffstat (limited to 'pk/pcr.h')
-rw-r--r-- | pk/pcr.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -64,6 +64,16 @@ #ifdef __riscv +#ifdef __riscv64 +# define RISCV_PGLEVELS 3 +# define RISCV_PGSHIFT 13 +#else +# define RISCV_PGLEVELS 2 +# define RISCV_PGSHIFT 12 +#endif +#define RISCV_PGLEVEL_BITS 10 +#define RISCV_PGSIZE (1 << RISCV_PGSHIFT) + #define ASM_CR(r) _ASM_CR(r) #define _ASM_CR(r) cr##r @@ -85,6 +95,10 @@ asm volatile ("clearpcr %0,cr%2,%1" : "=r"(__tmp) : "i"(val), "i"(reg)); \ __tmp; }) +#define rdcycle() ({ unsigned long __tmp; \ + asm volatile ("rdcycle %0" : "=r"(__tmp)); \ + __tmp; }) + #endif #endif |