1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-05-25 22:22:37 +02:00

Code for resume

This commit is contained in:
Konstantin Belousov 2010-03-07 23:43:07 +02:00
parent c64723835c
commit 53095e6b3e
4 changed files with 12 additions and 11 deletions

View file

@ -244,7 +244,7 @@ libunwind_x86_la_SOURCES_x86 = $(libunwind_la_SOURCES_x86_common) \
# The list of files that go both into libunwind and libunwind-x86_64:
libunwind_la_SOURCES_x86_64_common = $(libunwind_la_SOURCES_common) \
$(dwarf_SOURCES_common) \
elf64.c elf64.h \
elf64.c elf64.h x86_64/offsets.h \
x86_64/init.h x86_64/unwind_i.h x86_64/ucontext_i.h \
x86_64/is_fpreg.c x86_64/regname.c

View file

@ -82,6 +82,3 @@
#define LINUX_FPSTATE_XMM5_OFF 0x160
#define LINUX_FPSTATE_XMM6_OFF 0x170
#define LINUX_FPSTATE_XMM7_OFF 0x180
/* FreeBSD specific definitions */
#define FREEBSD_UC_MCONTEXT_OFF 0x10

View file

@ -27,13 +27,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include "offsets.h"
#include "unwind_i.h"
#ifndef UNW_REMOTE_ONLY
#include <sys/syscall.h>
#if defined(__linux)
#if defined __linux
/* sigreturn() is a no-op on x86_64 glibc. */
static NORETURN inline long
@ -51,7 +52,6 @@ my_rt_sigreturn (void *new_sp)
HIDDEN inline int
x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
#if defined(__linux)
struct cursor *c = (struct cursor *) cursor;
ucontext_t *uc = c->uc;
@ -67,7 +67,13 @@ x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
(unsigned long long) c->dwarf.ip, sc);
#if defined __linux__
my_rt_sigreturn (sc);
#elif defined __FreeBSD__
sigreturn((char *)(c->uc) - FREEBSD_UC_MCONTEXT_OFF);
#else
#error Port me
#endif
}
else
{
@ -75,11 +81,6 @@ x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
(unsigned long long) c->dwarf.ip);
setcontext (uc);
}
#elif defined(__FreeBSD__)
/* XXXKIB */
#else
# warning Implement me!
#endif
return -UNW_EINVAL;
}

3
src/x86_64/offsets.h Normal file
View file

@ -0,0 +1,3 @@
/* FreeBSD specific definitions */
#define FREEBSD_UC_MCONTEXT_OFF 0x10