Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/stack_machdep.c
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | stack_save_td(struct stack *st, struct thread *td) | ||||
THREAD_LOCK_ASSERT(td, MA_OWNED); | THREAD_LOCK_ASSERT(td, MA_OWNED); | ||||
KASSERT(!TD_IS_SWAPPED(td), | KASSERT(!TD_IS_SWAPPED(td), | ||||
("stack_save_td: thread %p is swapped", td)); | ("stack_save_td: thread %p is swapped", td)); | ||||
if (TD_IS_RUNNING(td)) | if (TD_IS_RUNNING(td)) | ||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
frame.fp = td->td_pcb->pcb_x[29]; | frame.fp = td->td_pcb->pcb_x[29]; | ||||
frame.pc = td->td_pcb->pcb_lr; | frame.pc = ADDR_MAKE_CANONICAL(td->td_pcb->pcb_lr); | ||||
stack_capture(td, st, &frame); | stack_capture(td, st, &frame); | ||||
return (0); | return (0); | ||||
} | } | ||||
void | void | ||||
stack_save(struct stack *st) | stack_save(struct stack *st) | ||||
{ | { | ||||
struct unwind_state frame; | struct unwind_state frame; | ||||
frame.fp = (uintptr_t)__builtin_frame_address(0); | frame.fp = (uintptr_t)__builtin_frame_address(0); | ||||
frame.pc = (uintptr_t)stack_save; | frame.pc = (uintptr_t)stack_save; | ||||
stack_capture(curthread, st, &frame); | stack_capture(curthread, st, &frame); | ||||
} | } |