#
21c534b9 |
| 04-Feb-2025 |
Jessica Clarke <jrtc27@FreeBSD.org> |
riscv: Fix and generalise saving TP (PCPU pointer) whilst in userspace
In cpu_fork, we allocate sizeof(struct pcb) + sizeof(struct trapframe) space on the stack, then round it for stack alignment. T
riscv: Fix and generalise saving TP (PCPU pointer) whilst in userspace
In cpu_fork, we allocate sizeof(struct pcb) + sizeof(struct trapframe) space on the stack, then round it for stack alignment. This not only fails to include the space needed for TP but also doesn't round up the trapframe allocation to be stack-aligned, yet TF_SIZE does, as is the expectation of fork_trampoline and cpu_exception_handler. Given that sizeof(struct pcb) + sizeof(struct trapframe) is a multiple of 16, this causes the saved TP to be stored in the PCB's pcb_sp (the intended trapframe padding aliasing pcb_ra), which is probably harmless in practice as the PCB isn't expected to be current, but definitely not intended.
In cpu_thread_alloc, we do include the 8 bytes for TP and then stack align that. This again fails to include the padding for trapframe as present in TF_SIZE, but sizeof(struct pcb) + sizeof(struct trapframe) happens to be a multiple of 16, as above, so adding 8 then rounding to stack alignment (16) includes an extra 8 bytes of padding, giving the right result for the wrong reason (and could be broken by future struct growth).
Extract the calculation into a shared function that rounds correctly regardless of the struct layouts. Also introduce a new struct kernframe to encapsulate and clearly document this shared state rather than using magic constants, and also enable it to be easily extended in future, as we intend to do downstream in CheriBSD.
Reviewed by: jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48799
show more ...
|
Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0 |
|
#
95ee2897 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
Revision tags: release/13.2.0 |
|
#
38720107 |
| 06-Feb-2023 |
Jessica Clarke <jrtc27@FreeBSD.org> |
dtrace: Fix RISC-V user stack unwinder
The unwind logic was copied from AArch64 which follows the peculiar AACPS (where, unlike typical RISC architectures, its frame pointer follows an x86/stack mac
dtrace: Fix RISC-V user stack unwinder
The unwind logic was copied from AArch64 which follows the peculiar AACPS (where, unlike typical RISC architectures, its frame pointer follows an x86/stack machine-like convention where the frame pointer points at the bottom of the frame record, not the top). Delete the pointless riscv_frame struct and fix this.
Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28054
show more ...
|
Revision tags: release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0 |
|
#
53941c0a |
| 19-Dec-2018 |
Mark Johnston <markj@FreeBSD.org> |
Replace uses of sbadaddr with stval.
The sbadaddr register was renamed in version 1.10 of the privileged architecture specification. No functional change intended.
Submitted by: Mitchell Horne <mh
Replace uses of sbadaddr with stval.
The sbadaddr register was renamed in version 1.10 of the privileged architecture specification. No functional change intended.
Submitted by: Mitchell Horne <mhorne063@gmail.com> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18594
show more ...
|
Revision tags: release/12.0.0, release/11.2.0, release/10.4.0, release/11.1.0 |
|
#
9b3ece1c |
| 04-Feb-2017 |
Enji Cooper <ngie@FreeBSD.org> |
MFhead@r313243
|
#
2004ce3f |
| 24-Jan-2017 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r312624 through r312719.
|
#
8ff21c23 |
| 24-Jan-2017 |
Li-Wen Hsu <lwhsu@FreeBSD.org> |
Add RISC-V support for truss(1)
While here, extract NARGREG as a definition.
Reviewed by: br Differential Revision: https://reviews.freebsd.org/D9249
|
Revision tags: release/11.0.1, release/11.0.0 |
|
#
fed1ca4b |
| 24-May-2016 |
Ruslan Bukin <br@FreeBSD.org> |
Add initial DTrace support for RISC-V.
Sponsored by: DARPA, AFRL Sponsored by: HEIF5
|
Revision tags: release/10.3.0 |
|
#
b626f5a7 |
| 04-Jan-2016 |
Glen Barber <gjb@FreeBSD.org> |
MFH r289384-r293170
Sponsored by: The FreeBSD Foundation
|
#
9a7cd2e6 |
| 22-Dec-2015 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
MFH @r292599
This includes the pluggable TCP framework and other chnages to the netstack to track for VNET stability.
Security: The FreeBSD Foundation
|
#
8d7e7a98 |
| 17-Dec-2015 |
Ruslan Bukin <br@FreeBSD.org> |
Import RISC-V machine headers. This is a minimal set required to compile kernel and userland.
Reviewed by: andrew, imp, kib Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https
Import RISC-V machine headers. This is a minimal set required to compile kernel and userland.
Reviewed by: andrew, imp, kib Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D4554
show more ...
|