1 /*
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
125 epc = ExtendedPC(NULL);
126 if (ret_sp) {
127 *ret_sp = (intptr_t*) NULL;
128 }
129 if (ret_fp) {
130 *ret_fp = (intptr_t*) NULL;
131 }
132 }
133
134 return epc;
135 }
136
137 frame os::fetch_frame_from_context(void* ucVoid) {
138 intptr_t* sp;
139 intptr_t* fp;
140 ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
141 return frame(sp, fp, epc.pc());
142 }
143
144 frame os::get_sender_for_C_frame(frame* fr) {
145 return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
146 }
147
148 frame os::current_frame() {
149 fprintf(stderr, "current_frame()");
150
151 intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
152 frame myframe(sp, frame::unpatchable,
153 CAST_FROM_FN_PTR(address, os::current_frame));
154 if (os::is_first_C_frame(&myframe)) {
155 // stack is not walkable
156 return frame(NULL, frame::unpatchable, NULL);
157 } else {
158 return os::get_sender_for_C_frame(&myframe);
159 }
160 }
161
162 address os::current_stack_pointer() {
163 register void *sp __asm__ ("sp");
164 return (address)sp;
165 }
166
167 static void current_stack_region(address* bottom, size_t* size) {
168 if (os::Linux::is_initial_thread()) {
169 // initial thread needs special handling because pthread_getattr_np()
170 // may return bogus value.
|
1 /*
2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
125 epc = ExtendedPC(NULL);
126 if (ret_sp) {
127 *ret_sp = (intptr_t*) NULL;
128 }
129 if (ret_fp) {
130 *ret_fp = (intptr_t*) NULL;
131 }
132 }
133
134 return epc;
135 }
136
137 frame os::fetch_frame_from_context(void* ucVoid) {
138 intptr_t* sp;
139 intptr_t* fp;
140 ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
141 return frame(sp, fp, epc.pc());
142 }
143
144 frame os::get_sender_for_C_frame(frame* fr) {
145 return frame(fr->sender_sp(), frame::unpatchable, fr->sender_pc());
146 }
147
148 frame os::current_frame() {
149 intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
150 frame myframe(sp, frame::unpatchable,
151 CAST_FROM_FN_PTR(address, os::current_frame));
152 if (os::is_first_C_frame(&myframe)) {
153 // stack is not walkable
154 return frame(NULL, frame::unpatchable, NULL);
155 } else {
156 return os::get_sender_for_C_frame(&myframe);
157 }
158 }
159
160 address os::current_stack_pointer() {
161 register void *sp __asm__ ("sp");
162 return (address)sp;
163 }
164
165 static void current_stack_region(address* bottom, size_t* size) {
166 if (os::Linux::is_initial_thread()) {
167 // initial thread needs special handling because pthread_getattr_np()
168 // may return bogus value.
|