equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 2012, 2016 SAP SE. All rights reserved. |
3 * Copyright (c) 2012, 2018 SAP SE. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. |
8 * published by the Free Software Foundation. |
119 void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) { |
119 void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) { |
120 guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context"); |
120 guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context"); |
121 uc->uc_mcontext.regs->nip = (unsigned long)pc; |
121 uc->uc_mcontext.regs->nip = (unsigned long)pc; |
122 } |
122 } |
123 |
123 |
|
124 static address ucontext_get_lr(const ucontext_t * uc) { |
|
125 return (address)uc->uc_mcontext.regs->link; |
|
126 } |
|
127 |
124 intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) { |
128 intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) { |
125 return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/]; |
129 return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/]; |
126 } |
130 } |
127 |
131 |
128 intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { |
132 intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { |
176 // Not sure where the pc points to, fallback to default |
180 // Not sure where the pc points to, fallback to default |
177 // stack overflow handling. In compiled code, we bang before |
181 // stack overflow handling. In compiled code, we bang before |
178 // the frame is complete. |
182 // the frame is complete. |
179 return false; |
183 return false; |
180 } else { |
184 } else { |
181 intptr_t* fp = os::Linux::ucontext_get_fp(uc); |
|
182 intptr_t* sp = os::Linux::ucontext_get_sp(uc); |
185 intptr_t* sp = os::Linux::ucontext_get_sp(uc); |
183 *fr = frame(sp, (address)*sp); |
186 address lr = ucontext_get_lr(uc); |
|
187 *fr = frame(sp, lr); |
184 if (!fr->is_java_frame()) { |
188 if (!fr->is_java_frame()) { |
185 assert(fr->safe_for_sender(thread), "Safety check"); |
189 assert(fr->safe_for_sender(thread), "Safety check"); |
186 assert(!fr->is_first_frame(), "Safety check"); |
190 assert(!fr->is_first_frame(), "Safety check"); |
187 *fr = fr->java_sender(); |
191 *fr = fr->java_sender(); |
188 } |
192 } |