git: 690601f0b4c3 - main - amd64: Add static asssert for context size
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 10 Feb 2022 21:34:00 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=690601f0b4c381b09295eecd08dfe5041d17445a
commit 690601f0b4c381b09295eecd08dfe5041d17445a
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-02-10 21:27:01 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-02-10 21:32:20 +0000
amd64: Add static asssert for context size
Add a static assert for the siginfo_t, mcontext_t and ucontext_t
sizes. These are de-facto ABI options and cannot change size ever.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D34212
---
sys/amd64/amd64/exec_machdep.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c
index 233f222b49f1..f66203d1812e 100644
--- a/sys/amd64/amd64/exec_machdep.c
+++ b/sys/amd64/amd64/exec_machdep.c
@@ -95,6 +95,10 @@ __FBSDID("$FreeBSD$");
#include <machine/specialreg.h>
#include <machine/trap.h>
+_Static_assert(sizeof(mcontext_t) == 800, "mcontext_t size incorrect");
+_Static_assert(sizeof(ucontext_t) == 880, "ucontext_t size incorrect");
+_Static_assert(sizeof(siginfo_t) == 80, "siginfo_t size incorrect");
+
/*
* Send an interrupt to process.
*