Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 4c9fb7d

Browse files
authored
Merge pull request #2269 from myfreeweb/aarch64-fbsd-for-upstream
Add setjmp/ucontext definitions for FreeBSD/aarch64 merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
2 parents 2867c9e + c7854d7 commit 4c9fb7d

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/core/sys/posix/setjmp.d

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ else version( FreeBSD )
167167
enum _JBLEN = 5;
168168
struct _jmp_buf { c_long[_JBLEN + 1] _jb; }
169169
}
170+
else version( AArch64 )
171+
{
172+
enum _JBLEN = 31;
173+
// __int128_t
174+
struct _jmp_buf { long[2][_JBLEN + 1] _jb; };
175+
}
170176
else
171177
static assert(0);
172178
alias _jmp_buf[1] jmp_buf;
@@ -365,6 +371,11 @@ else version( FreeBSD )
365371
enum _JB_SIGFLAG = 5;
366372
struct _sigjmp_buf { c_long[_JBLEN + 1] _sjb; }
367373
}
374+
else version( AArch64 )
375+
{
376+
// __int128_t
377+
struct _sigjmp_buf { long[2][_JBLEN + 1] _jb; };
378+
}
368379
else
369380
static assert(0);
370381
alias _sigjmp_buf[1] sigjmp_buf;

src/core/sys/posix/ucontext.d

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,38 @@ else version( FreeBSD )
765765
int[6] mc_spare2;
766766
}
767767
}
768+
else version( AArch64 )
769+
{
770+
alias __register_t = long;
771+
772+
struct gpregs
773+
{
774+
__register_t[30] gp_x;
775+
__register_t gp_lr;
776+
__register_t gp_sp;
777+
__register_t gp_elr;
778+
uint gp_spsr;
779+
int gp_pad;
780+
}
781+
782+
struct fpregs
783+
{
784+
ulong[2][32] fp_q; // __uint128_t
785+
uint fp_sr;
786+
uint fp_cr;
787+
int fp_flags;
788+
int fp_pad;
789+
}
790+
791+
struct mcontext_t
792+
{
793+
gpregs mc_gpregs;
794+
fpregs mc_fpregs;
795+
int mc_flags;
796+
int mc_pad;
797+
ulong[8] mc_spare;
798+
}
799+
}
768800

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

0 commit comments

Comments
 (0)