aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tcc.h4
-rw-r--r--tccrun.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/tcc.h b/tcc.h
index 8aa2c47..efb1c92 100644
--- a/tcc.h
+++ b/tcc.h
@@ -39,7 +39,9 @@
#ifndef _WIN32
# include <unistd.h>
# include <sys/time.h>
-# include <sys/ucontext.h>
+# ifndef __OpenBSD__
+# include <sys/ucontext.h>
+# endif
# include <sys/mman.h>
# ifndef CONFIG_TCC_STATIC
# include <dlfcn.h>
diff --git a/tccrun.c b/tccrun.c
index 4903f90..2fcecd9 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -496,6 +496,8 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
*paddr = uc->uc_mcontext.eip;
#elif defined(__NetBSD__)
*paddr = uc->uc_mcontext.__gregs[_REG_EIP];
+#elif defined(__OpenBSD__)
+ *paddr = uc->sc_eip;
#else
*paddr = uc->uc_mcontext.gregs[REG_EIP];
#endif
@@ -509,6 +511,8 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
fp = uc->uc_mcontext.ebp;
#elif defined(__NetBSD__)
fp = uc->uc_mcontext.__gregs[_REG_EBP];
+#elif defined(__OpenBSD__)
+ *paddr = uc->sc_ebp;
#else
fp = uc->uc_mcontext.gregs[REG_EBP];
#endif