-
- state->fp = saved_state->ss_64.fp;
- state->lr = saved_state->ss_64.lr;
- state->sp = saved_state->ss_64.sp;
- state->pc = saved_state->ss_64.pc;
- state->cpsr = saved_state->ss_64.cpsr;
- bcopy(&saved_state->ss_64.x[0], &state->x[0], sizeof(state->x));
+ void *kpcb = processor->active_thread->machine.kpcb;
+ if (kpcb != NULL) {
+ arm_saved_state_t *saved_state = (arm_saved_state_t *)kpcb;
+
+ state->fp = saved_state->ss_64.fp;
+ state->lr = saved_state->ss_64.lr;
+ state->sp = saved_state->ss_64.sp;
+ state->pc = saved_state->ss_64.pc;
+ state->cpsr = saved_state->ss_64.cpsr;
+ bcopy(&saved_state->ss_64.x[0], &state->x[0], sizeof(state->x));
+ } else {
+ vm_offset_t kstackptr = (vm_offset_t) processor->active_thread->machine.kstackptr;
+ arm_kernel_saved_state_t *saved_state = (arm_kernel_saved_state_t *) kstackptr;
+
+ state->fp = saved_state->fp;
+ state->lr = saved_state->lr;
+ state->sp = saved_state->sp;
+ state->pc = saved_state->pc;
+ state->cpsr = saved_state->cpsr;
+ }