kernel/arm64: implement iframe stack and unwinding

Change-Id: I1587c1f57bd73777a188bb8f1bc58263de82fcb9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5684
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: David Karoly <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
David Karoly
2022-09-23 13:56:16 +00:00
parent 139831c54c
commit a0c8f15f33
8 changed files with 146 additions and 10 deletions
@@ -133,6 +133,7 @@ struct iframe {
uint64 x[20];
uint64 lr;
uint64 sp;
uint64 fp;
// exception info
uint64 esr;
@@ -1,4 +1,5 @@
/*
* Copyright 2022, Haiku Inc. All rights reserved.
* Copyright 2018, Jaroslaw Pelczar <[email protected]>
* Distributed under the terms of the MIT License.
*/
@@ -13,6 +14,8 @@
extern "C" {
#endif
void arm64_push_iframe(struct iframe_stack *stack, struct iframe *frame);
void arm64_pop_iframe(struct iframe_stack *stack);
static inline Thread * arch_thread_get_current_thread(void)
{
@@ -1,4 +1,5 @@
/*
* Copyright 2022, Haiku Inc. All rights reserved.
* Copyright 2018, Jaroslaw Pelczar <[email protected]>
* Distributed under the terms of the MIT License.
*/
@@ -8,10 +9,20 @@
#include <kernel.h>
#define IFRAME_TRACE_DEPTH 4
struct iframe_stack {
struct iframe *frames[IFRAME_TRACE_DEPTH];
int32 index;
};
struct arch_thread {
uint64 regs[13]; // x19-x30, sp
uint64 fp_regs[8]; // d8-d15
// used to track interrupts on this thread
struct iframe_stack iframes;
};
struct arch_team {