96 |
96 |
97 address os::Aix::ucontext_get_pc(const ucontext_t * uc) { |
97 address os::Aix::ucontext_get_pc(const ucontext_t * uc) { |
98 return (address)uc->uc_mcontext.jmp_context.iar; |
98 return (address)uc->uc_mcontext.jmp_context.iar; |
99 } |
99 } |
100 |
100 |
101 intptr_t* os::Aix::ucontext_get_sp(ucontext_t * uc) { |
101 intptr_t* os::Aix::ucontext_get_sp(const ucontext_t * uc) { |
102 // gpr1 holds the stack pointer on aix |
102 // gpr1 holds the stack pointer on aix |
103 return (intptr_t*)uc->uc_mcontext.jmp_context.gpr[1/*REG_SP*/]; |
103 return (intptr_t*)uc->uc_mcontext.jmp_context.gpr[1/*REG_SP*/]; |
104 } |
104 } |
105 |
105 |
106 intptr_t* os::Aix::ucontext_get_fp(ucontext_t * uc) { |
106 intptr_t* os::Aix::ucontext_get_fp(const ucontext_t * uc) { |
107 return NULL; |
107 return NULL; |
108 } |
108 } |
109 |
109 |
110 void os::Aix::ucontext_set_pc(ucontext_t* uc, address new_pc) { |
110 void os::Aix::ucontext_set_pc(ucontext_t* uc, address new_pc) { |
111 uc->uc_mcontext.jmp_context.iar = (uint64_t) new_pc; |
111 uc->uc_mcontext.jmp_context.iar = (uint64_t) new_pc; |
112 } |
112 } |
113 |
113 |
114 ExtendedPC os::fetch_frame_from_context(void* ucVoid, |
114 ExtendedPC os::fetch_frame_from_context(const void* ucVoid, |
115 intptr_t** ret_sp, intptr_t** ret_fp) { |
115 intptr_t** ret_sp, intptr_t** ret_fp) { |
116 |
116 |
117 ExtendedPC epc; |
117 ExtendedPC epc; |
118 ucontext_t* uc = (ucontext_t*)ucVoid; |
118 const ucontext_t* uc = (const ucontext_t*)ucVoid; |
119 |
119 |
120 if (uc != NULL) { |
120 if (uc != NULL) { |
121 epc = ExtendedPC(os::Aix::ucontext_get_pc(uc)); |
121 epc = ExtendedPC(os::Aix::ucontext_get_pc(uc)); |
122 if (ret_sp) *ret_sp = os::Aix::ucontext_get_sp(uc); |
122 if (ret_sp) *ret_sp = os::Aix::ucontext_get_sp(uc); |
123 if (ret_fp) *ret_fp = os::Aix::ucontext_get_fp(uc); |
123 if (ret_fp) *ret_fp = os::Aix::ucontext_get_fp(uc); |
505 } |
505 } |
506 |
506 |
507 ///////////////////////////////////////////////////////////////////////////// |
507 ///////////////////////////////////////////////////////////////////////////// |
508 // helper functions for fatal error handler |
508 // helper functions for fatal error handler |
509 |
509 |
510 void os::print_context(outputStream *st, void *context) { |
510 void os::print_context(outputStream *st, const void *context) { |
511 if (context == NULL) return; |
511 if (context == NULL) return; |
512 |
512 |
513 ucontext_t* uc = (ucontext_t*)context; |
513 const ucontext_t* uc = (const ucontext_t*)context; |
514 |
514 |
515 st->print_cr("Registers:"); |
515 st->print_cr("Registers:"); |
516 st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.iar); |
516 st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.iar); |
517 st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.lr); |
517 st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.lr); |
518 st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.ctr); |
518 st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.ctr); |
542 st->print("<TODO: PPC port - print_context>"); |
542 st->print("<TODO: PPC port - print_context>"); |
543 // TODO: PPC port Disassembler::decode(pc, 16, 16, st); |
543 // TODO: PPC port Disassembler::decode(pc, 16, 16, st); |
544 st->cr(); |
544 st->cr(); |
545 } |
545 } |
546 |
546 |
547 void os::print_register_info(outputStream *st, void *context) { |
547 void os::print_register_info(outputStream *st, const void *context) { |
548 if (context == NULL) return; |
548 if (context == NULL) return; |
549 |
549 |
550 ucontext_t *uc = (ucontext_t*)context; |
550 ucontext_t *uc = (ucontext_t*)context; |
551 |
551 |
552 st->print_cr("Register to memory mapping:"); |
552 st->print_cr("Register to memory mapping:"); |