db_exception.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. /* Copyright (C) 2014 Stony Brook University
  4. This file is part of Graphene Library OS.
  5. Graphene Library OS is free software: you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation, either version 3 of the
  8. License, or (at your option) any later version.
  9. Graphene Library OS is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. /*
  16. * db_signal.c
  17. *
  18. * This file contains APIs to set up handlers of exceptions issued by the
  19. * host, and the methods to pass the exceptions to the upcalls.
  20. */
  21. #include "pal_defs.h"
  22. #include "pal_freebsd_defs.h"
  23. #include "pal.h"
  24. #include "pal_internal.h"
  25. #include "pal_freebsd.h"
  26. #include "pal_error.h"
  27. #include "pal_security.h"
  28. #include "api.h"
  29. #include "list.h"
  30. #include <atomic.h>
  31. #include <sigset.h>
  32. #include "signal.h"
  33. #include <ucontext.h>
  34. #include <errno.h>
  35. int set_sighandler (int * sigs, int nsig, void * handler)
  36. {
  37. struct sigaction action;
  38. action.sa_handler = (void (*)(int)) handler;
  39. action.sa_flags = SA_SIGINFO;
  40. __sigemptyset((_sigset_t *) &action.sa_mask);
  41. __sigaddset((_sigset_t *) &action.sa_mask, SIGCONT);
  42. for (int i = 0 ; i < nsig ; i++) {
  43. if (sigs[i] == SIGCHLD)
  44. action.sa_flags |= SA_NOCLDSTOP|SA_NOCLDWAIT;
  45. #if defined(__i386__)
  46. int ret = INLINE_SYSCALL(sigaction, 3, sigs[i], &action, NULL)
  47. #else
  48. int ret = INLINE_SYSCALL(sigaction, 4, sigs[i], &action, NULL,
  49. sizeof(sigset_t));
  50. #endif
  51. if (IS_ERR(ret))
  52. return -PAL_ERROR_DENIED;
  53. action.sa_flags &= ~(SA_NOCLDSTOP|SA_NOCLDWAIT);
  54. }
  55. bool maskset = false;
  56. int ret = 0;
  57. _sigset_t mask;
  58. __sigemptyset(&mask);
  59. for (int i = 0 ; i < nsig ; i++)
  60. if (__sigismember(&bsd_state.sigset, sigs[i])) {
  61. __sigdelset(&bsd_state.sigset, sigs[i]);
  62. __sigaddset(&mask, sigs[i]);
  63. maskset = true;
  64. }
  65. if (maskset) {
  66. #if defined(__i386__)
  67. ret = INLINE_SYSCALL(sigprocmask, 3, SIG_UNBLOCK, &mask, NULL)
  68. #else
  69. ret = INLINE_SYSCALL(sigprocmask, 4, SIG_UNBLOCK, &mask, NULL,
  70. sizeof(sigset_t));
  71. #endif
  72. }
  73. if (IS_ERR(ret))
  74. return -PAL_ERROR_DENIED;
  75. return 0;
  76. }
  77. int block_signals (int * sigs, int nsig)
  78. {
  79. bool maskset = false;
  80. int ret = 0;
  81. _sigset_t mask;
  82. __sigemptyset(&mask);
  83. for (int i = 0 ; i < nsig ; i++)
  84. if (!__sigismember(&bsd_state.sigset, sigs[i])) {
  85. __sigaddset(&bsd_state.sigset, sigs[i]);
  86. __sigaddset(&mask, sigs[i]);
  87. maskset = true;
  88. }
  89. if (maskset) {
  90. #if defined(__i386__)
  91. ret = INLINE_SYSCALL(sigprocmask, 3, SIG_BLOCK, &mask, NULL)
  92. #else
  93. ret = INLINE_SYSCALL(sigprocmask, 4, SIG_BLOCK, &mask, NULL,
  94. sizeof(sigset_t));
  95. #endif
  96. }
  97. if (IS_ERR(ret))
  98. return -PAL_ERROR_DENIED;
  99. return 0;
  100. }
  101. int unblock_signals (int * sigs, int nsig)
  102. {
  103. bool maskset = false;
  104. int ret = 0;
  105. _sigset_t mask;
  106. __sigemptyset(&mask);
  107. for (int i = 0 ; i < nsig ; i++)
  108. if (__sigismember(&bsd_state.sigset, sigs[i])) {
  109. __sigdelset(&bsd_state.sigset, sigs[i]);
  110. __sigaddset(&mask, sigs[i]);
  111. maskset = true;
  112. }
  113. if (maskset) {
  114. #if defined(__i386__)
  115. ret = INLINE_SYSCALL(sigprocmask, 3, SIG_UNBLOCK, &mask, NULL)
  116. #else
  117. ret = INLINE_SYSCALL(sigprocmask, 4, SIG_UNBLOCK, &mask, NULL,
  118. sizeof(sigset_t));
  119. #endif
  120. }
  121. if (IS_ERR(ret))
  122. return -PAL_ERROR_DENIED;
  123. return 0;
  124. }
  125. int unset_sighandler (int * sigs, int nsig)
  126. {
  127. for (int i = 0 ; i < nsig ; i++) {
  128. #if defined(__i386__)
  129. int ret = INLINE_SYSCALL(sigaction, 4, sigs[i], SIG_DFL, NULL)
  130. #else
  131. int ret = INLINE_SYSCALL(sigaction, 4, sigs[i], SIG_DFL, NULL,
  132. sizeof(_sigset_t));
  133. #endif
  134. if (IS_ERR(ret))
  135. return -PAL_ERROR_DENIED;
  136. }
  137. return 0;
  138. }
  139. struct exception_handler {
  140. struct mutex_handle lock;
  141. int flags;
  142. PAL_UPCALL upcall;
  143. } __attribute__((aligned(sizeof(int))));
  144. struct exception_event {
  145. int event_num;
  146. int flags;
  147. PAL_CONTEXT context;
  148. ucontext_t * uc;
  149. void * eframe;
  150. };
  151. #define DECLARE_HANDLER_HEAD(event) \
  152. static struct exception_handler handler_##event = \
  153. { .lock = MUTEX_HANDLE_INIT, \
  154. .upcall = NULL, \
  155. .flags = 0, };
  156. DECLARE_HANDLER_HEAD(DivZero);
  157. DECLARE_HANDLER_HEAD(MemFault);
  158. DECLARE_HANDLER_HEAD(Illegal);
  159. DECLARE_HANDLER_HEAD(Quit);
  160. DECLARE_HANDLER_HEAD(Suspend);
  161. DECLARE_HANDLER_HEAD(Resume);
  162. DECLARE_HANDLER_HEAD(Failure);
  163. struct exception_handler * pal_handlers [PAL_EVENT_NUM_BOUND] = {
  164. NULL, /* reserved */
  165. &handler_DivZero,
  166. &handler_MemFault,
  167. &handler_Illegal,
  168. &handler_Quit,
  169. &handler_Suspend,
  170. &handler_Resume,
  171. &handler_Failure,
  172. };
  173. #define SIGNAL_MASK_TIME 1000
  174. #define save_return_point(ptr) \
  175. asm volatile ("leaq 0(%%rip), %%rax\r\n" \
  176. "movq %%rax, %0\r\n" \
  177. : "=b"(ptr) :: "memory", "rax")
  178. static int get_event_num (int signum)
  179. {
  180. switch(signum) {
  181. case SIGFPE: return PAL_EVENT_DIVZERO;
  182. case SIGSEGV: case SIGBUS: return PAL_EVENT_MEMFAULT;
  183. case SIGILL: return PAL_EVENT_ILLEGAL;
  184. case SIGTERM: return PAL_EVENT_QUIT;
  185. case SIGINT: return PAL_EVENT_SUSPEND;
  186. case SIGCONT: return PAL_EVENT_RESUME;
  187. default: return -1;
  188. }
  189. }
  190. void _DkGenericEventTrigger (int event_num, PAL_UPCALL upcall,
  191. int flags, PAL_NUM arg, struct pal_frame * frame,
  192. ucontext_t * uc, void * eframe)
  193. {
  194. struct exception_event event;
  195. event.event_num = event_num;
  196. event.flags = flags;
  197. if (uc) {
  198. event.context.r8 = uc->uc_mcontext.mc_r8;
  199. event.context.r9 = uc->uc_mcontext.mc_r9;
  200. event.context.r10 = uc->uc_mcontext.mc_r10;
  201. event.context.r11 = uc->uc_mcontext.mc_r11;
  202. event.context.r12 = uc->uc_mcontext.mc_r12;
  203. event.context.r13 = uc->uc_mcontext.mc_r13;
  204. event.context.r14 = uc->uc_mcontext.mc_r14;
  205. event.context.r15 = uc->uc_mcontext.mc_r15;
  206. event.context.rdi = uc->uc_mcontext.mc_rdi;
  207. event.context.rsi = uc->uc_mcontext.mc_rsi;
  208. event.context.rbp = uc->uc_mcontext.mc_rbp;
  209. event.context.rbx = uc->uc_mcontext.mc_rbx;
  210. event.context.rdx = uc->uc_mcontext.mc_rdx;
  211. event.context.rax = uc->uc_mcontext.mc_rax;
  212. event.context.rcx = uc->uc_mcontext.mc_rcx;
  213. event.context.rsp = uc->uc_mcontext.mc_rsp;
  214. event.context.rip = uc->uc_mcontext.mc_rip;
  215. event.context.efl = uc->uc_mcontext.mc_flags;
  216. event.context.err = uc->uc_mcontext.mc_err;
  217. event.context.trapno = uc->uc_mcontext.mc_trapno;
  218. event.context.csgsfs = 0;
  219. event.context.oldmask = 0;
  220. event.context.cr2 = 0;
  221. }
  222. if (frame) {
  223. event.context.r15 = frame->arch.r15;
  224. event.context.r14 = frame->arch.r14;
  225. event.context.r13 = frame->arch.r13;
  226. event.context.r12 = frame->arch.r12;
  227. event.context.rdi = frame->arch.rdi;
  228. event.context.rsi = frame->arch.rsi;
  229. event.context.rbx = frame->arch.rbx;
  230. /* find last frame */
  231. event.context.rsp = frame->arch.rbp + sizeof(unsigned long) * 2;
  232. event.context.rbp = ((unsigned long *) frame->arch.rbp)[0];
  233. event.context.rip = ((unsigned long *) frame->arch.rbp)[1];
  234. }
  235. event.uc = uc;
  236. event.eframe = eframe;
  237. (*upcall) (&event, arg, &event.context);
  238. }
  239. static bool _DkGenericSignalHandle (int event_num, siginfo_t * info,
  240. struct pal_frame * frame,
  241. ucontext_t * uc, void * eframe)
  242. {
  243. struct exception_handler * handler = pal_handlers[event_num];
  244. _DkMutexLock(&handler->lock);
  245. PAL_UPCALL upcall = handler->upcall;
  246. int flags = handler->flags;
  247. _DkMutexUnlock(&handler->lock);
  248. if (upcall) {
  249. PAL_NUM arg = 0;
  250. if (event_num == PAL_EVENT_DIVZERO ||
  251. event_num == PAL_EVENT_MEMFAULT ||
  252. event_num == PAL_EVENT_ILLEGAL)
  253. arg = (PAL_NUM) (info ? info->si_addr : 0);
  254. _DkGenericEventTrigger(event_num, upcall, flags, arg, frame,
  255. uc, eframe);
  256. return true;
  257. }
  258. return false;
  259. }
  260. #define ADDR_IN_PAL(addr) \
  261. ((void *) (addr) > TEXT_START && (void *) (addr) < TEXT_END)
  262. static struct pal_frame * get_frame (ucontext_t * uc)
  263. {
  264. unsigned long rip = uc->uc_mcontext.mc_rip;
  265. unsigned long rbp = uc->uc_mcontext.mc_rbp;
  266. unsigned long last_rbp = rbp - 1024;
  267. if (!ADDR_IN_PAL(rip))
  268. return NULL;
  269. while (ADDR_IN_PAL(((unsigned long *) rbp)[1])) {
  270. last_rbp = rbp;
  271. rbp = *(unsigned long *) rbp;
  272. }
  273. /* search frame record in the top frame of PAL */
  274. for (unsigned long ptr = rbp - sizeof(unsigned long) ;
  275. ptr > last_rbp ; ptr -= 8) {
  276. struct pal_frame * frame = (struct pal_frame *) ptr;
  277. if (frame->self == frame)
  278. return frame;
  279. }
  280. return NULL;
  281. }
  282. static void return_frame (struct pal_frame * frame, int err)
  283. {
  284. if (err)
  285. _DkRaiseFailure(err);
  286. __clear_frame(frame);
  287. arch_restore_frame(&frame->arch);
  288. asm volatile ("xor %%rax, %%rax\r\n"
  289. "leaveq\r\n"
  290. "retq\r\n" ::: "memory");
  291. }
  292. static void _DkGenericSighandler (int signum, siginfo_t * info,
  293. ucontext_t * uc)
  294. {
  295. #if 0
  296. /* reseurrect this code if signal handler if giving segmentation fault */
  297. if (signum == SIGSEGV) {
  298. int pid = INLINE_SYSCALL(getpid, 0);
  299. char msg[24] = "--- SIGSEGV --- [ ]\n";
  300. msg[17] = '0' + pid / 10000;
  301. msg[18] = '0' + (pid / 1000) % 10;
  302. msg[19] = '0' + (pid / 100) % 10;
  303. msg[20] = '0' + (pid / 10) % 10;
  304. msg[21] = '0' + pid % 10;
  305. INLINE_SYSCALL(write, 3, 1, msg, 24);
  306. }
  307. #endif
  308. struct pal_frame * frame = get_frame(uc);
  309. void * eframe;
  310. asm volatile ("movq %%rbp, %0" : "=r"(eframe));
  311. if (frame && frame->func != &_DkGenericSighandler &&
  312. signum != SIGCONT &&
  313. signum != SIGINT &&
  314. signum != SIGTERM) {
  315. return_frame(frame, PAL_ERROR_BADADDR);
  316. return;
  317. }
  318. int event_num = get_event_num(signum);
  319. if (event_num == -1)
  320. return;
  321. _DkGenericSignalHandle(event_num, info, frame, uc, eframe);
  322. }
  323. static void _DkTerminateSighandler (int signum, siginfo_t * info,
  324. ucontext_t * uc)
  325. {
  326. struct pal_frame * frame = get_frame(uc);
  327. void * eframe;
  328. asm volatile ("movq %%rbp, %0" : "=r"(eframe));
  329. int event_num = get_event_num(signum);
  330. if (event_num == -1)
  331. return;
  332. if (!_DkGenericSignalHandle(event_num, NULL, frame, uc, eframe))
  333. _DkThreadExit();
  334. }
  335. static void _DkPipeSighandler (int signum, siginfo_t * info,
  336. ucontext_t * uc)
  337. {
  338. struct pal_frame * frame = get_frame(uc);
  339. if (frame)
  340. return_frame(frame, PAL_ERROR_CONNFAILED);
  341. }
  342. void _DkRaiseFailure (int error)
  343. {
  344. _DkMutexLock(&handler_Failure.lock);
  345. PAL_UPCALL upcall = handler_Failure.upcall;
  346. int flags = handler_Failure.flags;
  347. _DkMutexUnlock(&handler_Failure.lock);
  348. if (upcall)
  349. _DkGenericEventTrigger(PAL_EVENT_FAILURE, upcall, flags, error,
  350. NULL, NULL, NULL);
  351. }
  352. struct signal_ops {
  353. int signum[3];
  354. void (*handler) (int signum, siginfo_t * info, ucontext_t * uc);
  355. };
  356. struct signal_ops on_signals[PAL_EVENT_NUM_BOUND] = {
  357. /* reserved */ { .signum = { 0 }, .handler = NULL },
  358. /* DivZero */ { .signum = { SIGFPE, 0 },
  359. .handler = _DkGenericSighandler },
  360. /* MemFault */ { .signum = { SIGSEGV, SIGBUS, 0 },
  361. .handler = _DkGenericSighandler },
  362. /* Illegal */ { .signum = { SIGILL, 0 },
  363. .handler = _DkGenericSighandler },
  364. /* Quit */ { .signum = { SIGTERM, 0, 0 },
  365. .handler = _DkTerminateSighandler },
  366. /* Suspend */ { .signum = { SIGINT, 0 },
  367. .handler = _DkTerminateSighandler },
  368. /* Resume */ { .signum = { SIGCONT, 0 },
  369. .handler = _DkGenericSighandler },
  370. /* Failure */ { .signum = { 0 }, .handler = NULL },
  371. };
  372. static int _DkPersistentSighandlerSetup (int event_num)
  373. {
  374. int nsigs, * sigs = on_signals[event_num].signum;
  375. for (nsigs = 0 ; sigs[nsigs] ; nsigs++);
  376. void * sighandler = on_signals[event_num].handler;
  377. int ret = set_sighandler (sigs, nsigs, sighandler);
  378. if (ret < 0)
  379. return ret;
  380. return 0;
  381. }
  382. static int _DkPersistentEventUpcall (int event_num, PAL_UPCALL upcall,
  383. int flags)
  384. {
  385. struct exception_handler * handler = pal_handlers[event_num];
  386. _DkMutexLock(&handler->lock);
  387. handler->upcall = upcall;
  388. handler->flags = flags;
  389. _DkMutexUnlock(&handler->lock);
  390. return _DkPersistentSighandlerSetup(event_num);
  391. }
  392. static int _DkGenericEventUpcall (int event_num, PAL_UPCALL upcall,
  393. int flags)
  394. {
  395. int nsigs, * sigs = on_signals[event_num].signum;
  396. for (nsigs = 0 ; sigs[nsigs] ; nsigs++);
  397. void * sighandler = on_signals[event_num].handler;
  398. struct exception_handler * handler = pal_handlers[event_num];
  399. int ret = 0;
  400. _DkMutexLock(&handler->lock);
  401. handler->upcall = upcall;
  402. handler->flags = flags;
  403. _DkMutexUnlock(&handler->lock);
  404. if (upcall)
  405. ret = set_sighandler (sigs, nsigs, sighandler);
  406. else
  407. ret = block_signals (sigs, nsigs);
  408. return ret;
  409. }
  410. static int _DkDummyEventUpcall (int event_num, PAL_UPCALL upcall,
  411. int flags)
  412. {
  413. struct exception_handler * handler = pal_handlers[event_num];
  414. _DkMutexLock(&handler->lock);
  415. handler->upcall = upcall;
  416. handler->flags = flags;
  417. _DkMutexUnlock(&handler->lock);
  418. return 0;
  419. }
  420. typedef void (*PAL_UPCALL) (PAL_PTR, PAL_NUM, PAL_CONTEXT *);
  421. int (*_DkExceptionHandlers[PAL_EVENT_NUM_BOUND])
  422. (int, PAL_UPCALL, int) = {
  423. /* reserved */ NULL,
  424. /* DivZero */ &_DkPersistentEventUpcall,
  425. /* MemFault */ &_DkPersistentEventUpcall,
  426. /* Illegal */ &_DkPersistentEventUpcall,
  427. /* Quit */ &_DkGenericEventUpcall,
  428. /* Suspend */ &_DkGenericEventUpcall,
  429. /* Resume */ &_DkGenericEventUpcall,
  430. /* Failure */ &_DkDummyEventUpcall,
  431. };
  432. static void _DkCompatibilitySighandler (int signum, siginfo_t * info,
  433. ucontext_t * uc)
  434. {
  435. /* not implemented */
  436. }
  437. void signal_setup (void)
  438. {
  439. int ret, sig;
  440. __sigemptyset(&bsd_state.sigset);
  441. struct sigaction action;
  442. action.sa_handler = (void (*)(int)) SIG_IGN;
  443. action.sa_flags = 0;
  444. #if defined(__i386__)
  445. ret = INLINE_SYSCALL(sigaction, 3, SIGCHLD, &action, NULL)
  446. #else
  447. ret = INLINE_SYSCALL(sigaction, 4, SIGCHLD, &action, NULL,
  448. sizeof(sigset_t));
  449. #endif
  450. if (IS_ERR(ret)) {
  451. ret = -PAL_ERROR_DENIED;
  452. goto err;
  453. }
  454. if ((ret = _DkPersistentEventUpcall(PAL_EVENT_DIVZERO, NULL, 0)) < 0)
  455. goto err;
  456. if ((ret = _DkPersistentEventUpcall(PAL_EVENT_MEMFAULT, NULL, 0)) < 0)
  457. goto err;
  458. if ((ret = _DkPersistentEventUpcall(PAL_EVENT_ILLEGAL, NULL, 0)) < 0)
  459. goto err;
  460. sig = SIGPIPE;
  461. if ((ret = set_sighandler(&sig, 1, &_DkPipeSighandler)) < 0)
  462. goto err;
  463. sig = SIGSYS;
  464. if ((ret = set_sighandler(&sig, 1, &_DkCompatibilitySighandler)) < 0)
  465. goto err;
  466. return;
  467. err:
  468. init_fail(-ret, "cannot setup signal handlers");
  469. }
  470. void _DkExceptionReturn (const void * event)
  471. {
  472. const struct exception_event * e = (const struct exception_event *) event;
  473. if (e->uc) {
  474. /* copy the context back to ucontext */
  475. e->uc->uc_mcontext.mc_r8 = e->context.r8;
  476. e->uc->uc_mcontext.mc_r9 = e->context.r9;
  477. e->uc->uc_mcontext.mc_r10 = e->context.r10;
  478. e->uc->uc_mcontext.mc_r11 = e->context.r11;
  479. e->uc->uc_mcontext.mc_r12 = e->context.r12;
  480. e->uc->uc_mcontext.mc_r13 = e->context.r13;
  481. e->uc->uc_mcontext.mc_r14 = e->context.r14;
  482. e->uc->uc_mcontext.mc_r15 = e->context.r15;
  483. e->uc->uc_mcontext.mc_rdi = e->context.rdi;
  484. e->uc->uc_mcontext.mc_rsi = e->context.rsi;
  485. e->uc->uc_mcontext.mc_rbp = e->context.rbp;
  486. e->uc->uc_mcontext.mc_rbx = e->context.rbx;
  487. e->uc->uc_mcontext.mc_rdx = e->context.rdx;
  488. e->uc->uc_mcontext.mc_rax = e->context.rax;
  489. e->uc->uc_mcontext.mc_rcx = e->context.rcx;
  490. e->uc->uc_mcontext.mc_rsp = e->context.rsp;
  491. e->uc->uc_mcontext.mc_rip = e->context.rip;
  492. e->uc->uc_mcontext.mc_flags = e->context.efl;
  493. e->uc->uc_mcontext.mc_err = e->context.err;
  494. e->uc->uc_mcontext.mc_trapno = e->context.trapno;
  495. /* return to the frame of exception handler */
  496. asm volatile ("movq %0, %%rbp\r\n"
  497. "leaveq\r\n"
  498. "retq\r\n" :: "r"(e->eframe) : "memory");
  499. }
  500. }