Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Feb 2022 21:34:03 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0987dc5be54b - main - riscv: Add static asssert for context size
Message-ID:  <202202102134.21ALY3qv083817@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=0987dc5be54b54c7e7678325586793b98838d61d

commit 0987dc5be54b54c7e7678325586793b98838d61d
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-02-10 21:27:15 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-02-10 21:32:21 +0000

    riscv: Add static asssert for context size
    
    Add a static assert for the siginfo_t, mcontext_t and ucontext_t
    sizes. These are de-factor ABI options and cannot change size ever.
    
    Differential Revision:  https://reviews.freebsd.org/D34214
---
 sys/riscv/riscv/exec_machdep.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/riscv/riscv/exec_machdep.c b/sys/riscv/riscv/exec_machdep.c
index 08fba5c83e51..2d30ba9cb01c 100644
--- a/sys/riscv/riscv/exec_machdep.c
+++ b/sys/riscv/riscv/exec_machdep.c
@@ -77,6 +77,10 @@ __FBSDID("$FreeBSD$");
 static void get_fpcontext(struct thread *td, mcontext_t *mcp);
 static void set_fpcontext(struct thread *td, mcontext_t *mcp);
 
+_Static_assert(sizeof(mcontext_t) == 864, "mcontext_t size incorrect");
+_Static_assert(sizeof(ucontext_t) == 936, "ucontext_t size incorrect");
+_Static_assert(sizeof(siginfo_t) == 80, "siginfo_t size incorrect");
+
 int
 fill_regs(struct thread *td, struct reg *regs)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202102134.21ALY3qv083817>