KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
stack.h File Reference

Stack functions. More...

#include <kos/cdefs.h>
#include <stdint.h>
#include <kos/thread.h>

Go to the source code of this file.

Macros

#define THD_STACK_ALIGNMENT   8
 Required alignment for stack.
 
#define THD_STACK_SIZE   32768
 Default thread stack size.
 
#define THD_KERNEL_STACK_SIZE   (64 * 1024)
 Main/kernel thread's stack size.
 

Functions

static __always_inline uintptr_t arch_get_ret_addr (void)
 DC specific "function" to get the return address from the current function.
 
static __always_inline uintptr_t arch_get_fptr (void)
 DC specific "function" to get the frame pointer from the current function.
 
static uintptr_t arch_fptr_ret_addr (uintptr_t fptr)
 Pass in a frame pointer value to get the return address for the given frame.
 
static uintptr_t arch_fptr_next (uintptr_t fptr)
 Pass in a frame pointer value to get the previous frame pointer for the given frame.
 
void arch_stk_setup (kthread_t *nt)
 Set up new stack before running.
 
void arch_stk_trace (int n)
 Do a stack trace from the current function.
 
void arch_stk_trace_at (uint32_t fp, size_t n)
 Do a stack trace from the current function.
 

Detailed Description

Stack functions.

This file contains arch-specific stack implementations, including defining stack sizes and alignments, as well as functions for stack tracing and debugging. On Dreamcast, the stack tracing functions only work if frame pointers have been enabled at compile time (-DFRAME_POINTERS and no -fomit-frame-pointer flag).

Author
Megan Potter
Eric Fradella