aboutsummaryrefslogtreecommitdiff
path: root/pk/pk.h
diff options
context:
space:
mode:
Diffstat (limited to 'pk/pk.h')
-rw-r--r--pk/pk.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/pk/pk.h b/pk/pk.h
index a55ab6c..0ac2cdc 100644
--- a/pk/pk.h
+++ b/pk/pk.h
@@ -36,6 +36,12 @@ int snprintf(char* out, size_t n, const char* s, ...);
void start_user(trapframe_t* tf) __attribute__((noreturn));
void dump_tf(trapframe_t*);
+static uint64_t lfsr63(uint64_t x)
+{
+ uint64_t bit = (x ^ (x >> 1)) & 1;
+ return (x >> 1) | (bit << 62);
+}
+
static inline int insn_len(long insn)
{
return (insn & 0x3) < 0x3 ? 2 : 4;