aboutsummaryrefslogtreecommitdiff
path: root/sys/riscv/include
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-08-12 18:45:36 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-08-12 18:45:36 +0000
commit90699f2a767445c0b2eaaaeed582b8e86ccc9601 (patch)
treecf2ca1a2c62c63772a4d167073fc9c46ebf2266b /sys/riscv/include
parentd5c62a6f032e9fac5cf108d4a3ef0126a54dea19 (diff)
downloadsrc-90699f2a767445c0b2eaaaeed582b8e86ccc9601.tar.gz
src-90699f2a767445c0b2eaaaeed582b8e86ccc9601.zip
Correct padding length for RISC-V PCPU data.
There was an additional 7 bytes of compiler-inserted padding at the end of the structure visible via 'ptype /o' in gdb. Reviewed by: mhorne Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25867
Notes
Notes: svn path=/head/; revision=364176
Diffstat (limited to 'sys/riscv/include')
-rw-r--r--sys/riscv/include/pcpu.h2
-rw-r--r--sys/riscv/include/pcpu_aux.h3
2 files changed, 4 insertions, 1 deletions
diff --git a/sys/riscv/include/pcpu.h b/sys/riscv/include/pcpu.h
index 46b258380a10..5068596462fc 100644
--- a/sys/riscv/include/pcpu.h
+++ b/sys/riscv/include/pcpu.h
@@ -48,7 +48,7 @@
struct pmap *pc_curpmap; /* Currently active pmap */ \
uint32_t pc_pending_ipis; /* IPIs pending to this CPU */ \
uint32_t pc_hart; /* Hart ID */ \
- char __pad[49]
+ char __pad[56] /* Pad to factor of PAGE_SIZE */
#ifdef _KERNEL
diff --git a/sys/riscv/include/pcpu_aux.h b/sys/riscv/include/pcpu_aux.h
index 3d4c70c491d6..9fecd25c67cb 100644
--- a/sys/riscv/include/pcpu_aux.h
+++ b/sys/riscv/include/pcpu_aux.h
@@ -46,6 +46,9 @@
* be a multiple of the size of struct pcpu.
*/
_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size");
+_Static_assert(offsetof(struct pcpu, __pad) +
+ sizeof(((struct pcpu *)0)->__pad) == sizeof(struct pcpu),
+ "fix pcpu padding");
extern struct pcpu __pcpu[];