Skip to content

Commit f8fb97d

Browse files
committed
yukon: deal with strange segfault-on-handle bug
Turns out, we have to invalidate the handle we faulted on, so this commit has a naive system which invalidates the whole htlb when you segfault and retires the instruction :)
1 parent a1b6589 commit f8fb97d

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

runtime/yukon/yukon.cpp

+17-7
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,25 @@ static void handle_sig(int sig) {
116116
}
117117

118118

119+
120+
// If a pagefault occurs while handle table walking, we will throw the
121+
// exception back up and even if you handle the page fault, the HTLB
122+
// stores the fact that it will cause an exception until you
123+
// invalidate the entry.
119124
static void segv_handler(int sig, siginfo_t *info, void *ucontext) {
120125
printf("Caught segfault to address %p\n", info->si_addr);
121-
void *buffer[BACKTRACE_SIZE];
122-
// Get the backtrace
123-
int nptrs = backtrace(buffer, BACKTRACE_SIZE);
124-
// Print the backtrace symbols
125-
backtrace_symbols_fd(buffer, nptrs, STDOUT_FILENO);
126-
alaska_dump_backtrace();
127-
exit(0);
126+
127+
// void *buffer[BACKTRACE_SIZE];
128+
// // Get the backtrace
129+
// int nptrs = backtrace(buffer, BACKTRACE_SIZE);
130+
// // Print the backtrace symbols
131+
// backtrace_symbols_fd(buffer, nptrs, STDOUT_FILENO);
132+
// alaska_dump_backtrace();
133+
134+
__asm__ volatile("csrw 0xc4, %0" ::"rK"((1LU << (64 - ALASKA_SIZE_BITS)) - 1) : "memory");
135+
__asm__ volatile("fence" ::: "memory");
136+
// exit(0);
137+
return;
128138
}
129139

130140

0 commit comments

Comments
 (0)