git: f0f44cdb69c1 - main - kboot: Save the upper limit of the call stack.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Apr 2025 21:59:12 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=f0f44cdb69c16842cec5c8b0716edeff214eebf6
commit f0f44cdb69c16842cec5c8b0716edeff214eebf6
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-04-17 04:03:48 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-04-17 21:56:45 +0000
kboot: Save the upper limit of the call stack.
The location of argc argument is a fine limit for the extent of the
stack traceback. We could save the location of return address for the
call to _start_c, but we'd have to move that into MD assembler. While
not hard, it wouldn't improve the traces we can get. And the math to
find it is architecture dependent (though the same for both arm64 and
amd64).
Sponsored by: Netflix
Reviewed by: kevans, andrew, jhibbits
Differential Revision: https://reviews.freebsd.org/D49858
---
stand/kboot/libkboot/crt1.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/stand/kboot/libkboot/crt1.c b/stand/kboot/libkboot/crt1.c
index 2fbe00262da7..67ddacccfd26 100644
--- a/stand/kboot/libkboot/crt1.c
+++ b/stand/kboot/libkboot/crt1.c
@@ -57,6 +57,8 @@ extern int main(int, const char **, char **);
#include "start_arch.h"
+void *stack_upper_limit;
+
void
_start_c(long *p)
{
@@ -64,6 +66,7 @@ _start_c(long *p)
const char **argv;
char **envp;
+ stack_upper_limit = p; /* Save the upper limit of call stack */
argc = p[0];
argv = (const char **)(p + 1);
envp = (char **)argv + argc + 1;