Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

[ltsmaster] Add setjmp/ucontext definitions for FreeBSD/aarch64 #155

Open
wants to merge 1 commit into
base: ldc-ltsmaster
Choose a base branch
from
Open
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
Add setjmp/ucontext definitions for FreeBSD/aarch64
valpackett committed Jun 15, 2019
commit 1f8dd08e67b81365ed67d3392159e4eb14fee267
11 changes: 11 additions & 0 deletions src/core/sys/posix/setjmp.d
Original file line number Diff line number Diff line change
@@ -163,6 +163,12 @@ else version( FreeBSD )
enum _JBLEN = 5;
struct _jmp_buf { c_long[_JBLEN + 1] _jb; }
}
else version( AArch64 )
{
enum _JBLEN = 31;
// __int128_t
struct _jmp_buf { long[2][_JBLEN + 1] _jb; };
}
else
static assert(0);
alias _jmp_buf[1] jmp_buf;
@@ -250,6 +256,11 @@ else version( FreeBSD )
enum _JB_SIGFLAG = 5;
struct _sigjmp_buf { c_long[_JBLEN + 1] _sjb; }
}
else version( AArch64 )
{
// __int128_t
struct _sigjmp_buf { long[2][_JBLEN + 1] _jb; };
}
else
static assert(0);
alias _sigjmp_buf[1] sigjmp_buf;
32 changes: 32 additions & 0 deletions src/core/sys/posix/ucontext.d
Original file line number Diff line number Diff line change
@@ -686,6 +686,38 @@ else version( FreeBSD )
int[6] mc_spare2;
}
}
else version( AArch64 )
{
alias __register_t = long;

struct gpregs
{
__register_t[30] gp_x;
__register_t gp_lr;
__register_t gp_sp;
__register_t gp_elr;
uint gp_spsr;
int gp_pad;
}

struct fpregs
{
ulong[2][32] fp_q; // __uint128_t
uint fp_sr;
uint fp_cr;
int fp_flags;
int fp_pad;
}

struct mcontext_t
{
gpregs mc_gpregs;
fpregs mc_fpregs;
int mc_flags;
int mc_pad;
ulong[8] mc_spare;
}
}

// <ucontext.h>
enum UCF_SWAPPED = 0x00000001;