Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion examples/heartbleed/legacy/heartbleed.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,19 @@ void write_to_uart(const char *format, ...)
write_to_uart(__VA_ARGS__); \
}

#define rdcycle64 get_mcycle
uint64_t rdcycle64()
{
uint32_t mcycle_high, mcycle_low;
__asm__ volatile("1: "
"csrr t0, mcycleh\n"
"csrr %0, mcycle\n"
"csrr %1, mcycleh\n"
"bne t0, %1, 1b"
: "=r"(mcycle_low), "=r"(mcycle_high)
:
: "t0");
return ((uint64_t)mcycle_high << 32) | mcycle_low;
}

/**
* @brief Read the current GPIO joystick state.
Expand Down