Mercurial > hg > truffle
comparison src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp @ 14415:666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
Reviewed-by: kvn
author | simonis |
---|---|
date | Fri, 06 Sep 2013 20:16:09 +0200 |
parents | |
children | 67fa91961822 |
comparison
equal
deleted
inserted
replaced
14414:b83f7d608548 | 14415:666e6ce3976c |
---|---|
1 /* | |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | |
3 * Copyright 2012, 2013 SAP AG. All rights reserved. | |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
5 * | |
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 | |
8 * published by the Free Software Foundation. | |
9 * | |
10 * This code is distributed in the hope that it will be useful, but WITHOUT | |
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 * version 2 for more details (a copy is included in the LICENSE file that | |
14 * accompanied this code). | |
15 * | |
16 * You should have received a copy of the GNU General Public License version | |
17 * 2 along with this work; if not, write to the Free Software Foundation, | |
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 * | |
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
21 * or visit www.oracle.com if you need additional information or have any | |
22 * questions. | |
23 * | |
24 */ | |
25 | |
26 // no precompiled headers | |
27 #include "assembler_ppc.inline.hpp" | |
28 #include "classfile/classLoader.hpp" | |
29 #include "classfile/systemDictionary.hpp" | |
30 #include "classfile/vmSymbols.hpp" | |
31 #include "code/icBuffer.hpp" | |
32 #include "code/vtableStubs.hpp" | |
33 #include "interpreter/interpreter.hpp" | |
34 #include "jvm_aix.h" | |
35 #include "memory/allocation.inline.hpp" | |
36 #include "mutex_aix.inline.hpp" | |
37 #include "nativeInst_ppc.hpp" | |
38 #include "os_share_aix.hpp" | |
39 #include "prims/jniFastGetField.hpp" | |
40 #include "prims/jvm.h" | |
41 #include "prims/jvm_misc.hpp" | |
42 #include "runtime/arguments.hpp" | |
43 #include "runtime/extendedPC.hpp" | |
44 #include "runtime/frame.inline.hpp" | |
45 #include "runtime/interfaceSupport.hpp" | |
46 #include "runtime/java.hpp" | |
47 #include "runtime/javaCalls.hpp" | |
48 #include "runtime/mutexLocker.hpp" | |
49 #include "runtime/osThread.hpp" | |
50 #include "runtime/sharedRuntime.hpp" | |
51 #include "runtime/stubRoutines.hpp" | |
52 #include "runtime/timer.hpp" | |
53 #include "thread_aix.inline.hpp" | |
54 #include "utilities/events.hpp" | |
55 #include "utilities/vmError.hpp" | |
56 #ifdef COMPILER1 | |
57 #include "c1/c1_Runtime1.hpp" | |
58 #endif | |
59 #ifdef COMPILER2 | |
60 #include "opto/runtime.hpp" | |
61 #endif | |
62 | |
63 // put OS-includes here | |
64 # include <ucontext.h> | |
65 | |
66 address os::current_stack_pointer() { | |
67 address csp; | |
68 | |
69 #if !defined(USE_XLC_BUILTINS) | |
70 // inline assembly for `ppc_mr regno(csp), PPC_SP': | |
71 __asm__ __volatile__ ("mr %0, 1":"=r"(csp):); | |
72 #else | |
73 csp = (address) __builtin_frame_address(0); | |
74 #endif | |
75 | |
76 return csp; | |
77 } | |
78 | |
79 char* os::non_memory_address_word() { | |
80 // Must never look like an address returned by reserve_memory, | |
81 // even in its subfields (as defined by the CPU immediate fields, | |
82 // if the CPU splits constants across multiple instructions). | |
83 | |
84 return (char*) -1; | |
85 } | |
86 | |
87 // OS specific thread initialization | |
88 // | |
89 // Calculate and store the limits of the memory stack. | |
90 void os::initialize_thread(Thread *thread) { } | |
91 | |
92 // Frame information (pc, sp, fp) retrieved via ucontext | |
93 // always looks like a C-frame according to the frame | |
94 // conventions in frame_ppc64.hpp. | |
95 address os::Aix::ucontext_get_pc(ucontext_t * uc) { | |
96 return (address)uc->uc_mcontext.jmp_context.iar; | |
97 } | |
98 | |
99 intptr_t* os::Aix::ucontext_get_sp(ucontext_t * uc) { | |
100 // gpr1 holds the stack pointer on aix | |
101 return (intptr_t*)uc->uc_mcontext.jmp_context.gpr[1/*REG_SP*/]; | |
102 } | |
103 | |
104 intptr_t* os::Aix::ucontext_get_fp(ucontext_t * uc) { | |
105 return NULL; | |
106 } | |
107 | |
108 void os::Aix::ucontext_set_pc(ucontext_t* uc, address new_pc) { | |
109 uc->uc_mcontext.jmp_context.iar = (uint64_t) new_pc; | |
110 } | |
111 | |
112 ExtendedPC os::fetch_frame_from_context(void* ucVoid, | |
113 intptr_t** ret_sp, intptr_t** ret_fp) { | |
114 | |
115 ExtendedPC epc; | |
116 ucontext_t* uc = (ucontext_t*)ucVoid; | |
117 | |
118 if (uc != NULL) { | |
119 epc = ExtendedPC(os::Aix::ucontext_get_pc(uc)); | |
120 if (ret_sp) *ret_sp = os::Aix::ucontext_get_sp(uc); | |
121 if (ret_fp) *ret_fp = os::Aix::ucontext_get_fp(uc); | |
122 } else { | |
123 // construct empty ExtendedPC for return value checking | |
124 epc = ExtendedPC(NULL); | |
125 if (ret_sp) *ret_sp = (intptr_t *)NULL; | |
126 if (ret_fp) *ret_fp = (intptr_t *)NULL; | |
127 } | |
128 | |
129 return epc; | |
130 } | |
131 | |
132 frame os::fetch_frame_from_context(void* ucVoid) { | |
133 intptr_t* sp; | |
134 intptr_t* fp; | |
135 ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp); | |
136 // Avoid crash during crash if pc broken. | |
137 if (epc.pc()) { | |
138 frame fr(sp, epc.pc()); | |
139 return fr; | |
140 } | |
141 frame fr(sp); | |
142 return fr; | |
143 } | |
144 | |
145 frame os::get_sender_for_C_frame(frame* fr) { | |
146 if (*fr->sp() == NULL) { | |
147 // fr is the last C frame | |
148 return frame(NULL, NULL); | |
149 } | |
150 return frame(fr->sender_sp(), fr->sender_pc()); | |
151 } | |
152 | |
153 | |
154 frame os::current_frame() { | |
155 intptr_t* csp = (intptr_t*) *((intptr_t*) os::current_stack_pointer()); | |
156 // hack. | |
157 frame topframe(csp, (address)0x8); | |
158 // return sender of current topframe which hopefully has pc != NULL. | |
159 return os::get_sender_for_C_frame(&topframe); | |
160 } | |
161 | |
162 // Utility functions | |
163 | |
164 extern "C" JNIEXPORT int | |
165 JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrecognized) { | |
166 | |
167 ucontext_t* uc = (ucontext_t*) ucVoid; | |
168 | |
169 Thread* t = ThreadLocalStorage::get_thread_slow(); // slow & steady | |
170 | |
171 SignalHandlerMark shm(t); | |
172 | |
173 // Note: it's not uncommon that JNI code uses signal/sigset to install | |
174 // then restore certain signal handler (e.g. to temporarily block SIGPIPE, | |
175 // or have a SIGILL handler when detecting CPU type). When that happens, | |
176 // JVM_handle_aix_signal() might be invoked with junk info/ucVoid. To | |
177 // avoid unnecessary crash when libjsig is not preloaded, try handle signals | |
178 // that do not require siginfo/ucontext first. | |
179 | |
180 if (sig == SIGPIPE) { | |
181 if (os::Aix::chained_handler(sig, info, ucVoid)) { | |
182 return 1; | |
183 } else { | |
184 if (PrintMiscellaneous && (WizardMode || Verbose)) { | |
185 warning("Ignoring SIGPIPE - see bug 4229104"); | |
186 } | |
187 return 1; | |
188 } | |
189 } | |
190 | |
191 JavaThread* thread = NULL; | |
192 VMThread* vmthread = NULL; | |
193 if (os::Aix::signal_handlers_are_installed) { | |
194 if (t != NULL) { | |
195 if(t->is_Java_thread()) { | |
196 thread = (JavaThread*)t; | |
197 } | |
198 else if(t->is_VM_thread()) { | |
199 vmthread = (VMThread *)t; | |
200 } | |
201 } | |
202 } | |
203 | |
204 // Decide if this trap can be handled by a stub. | |
205 address stub = NULL; | |
206 | |
207 // retrieve program counter | |
208 address const pc = uc ? os::Aix::ucontext_get_pc(uc) : NULL; | |
209 | |
210 // retrieve crash address | |
211 address const addr = info ? (const address) info->si_addr : NULL; | |
212 | |
213 // SafeFetch 32 handling: | |
214 // - make it work if _thread is null | |
215 // - make it use the standard os::...::ucontext_get/set_pc APIs | |
216 if (uc) { | |
217 address const pc = os::Aix::ucontext_get_pc(uc); | |
218 if (pc && StubRoutines::is_safefetch_fault(pc)) { | |
219 os::Aix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); | |
220 return true; | |
221 } | |
222 } | |
223 | |
224 // Handle SIGDANGER right away. AIX would raise SIGDANGER whenever available swap | |
225 // space falls below 30%. This is only a chance for the process to gracefully abort. | |
226 // We can't hope to proceed after SIGDANGER since SIGKILL tailgates. | |
227 if (sig == SIGDANGER) { | |
228 goto report_and_die; | |
229 } | |
230 | |
231 if (info == NULL || uc == NULL || thread == NULL && vmthread == NULL) { | |
232 goto run_chained_handler; | |
233 } | |
234 | |
235 // If we are a java thread... | |
236 if (thread != NULL) { | |
237 | |
238 // Handle ALL stack overflow variations here | |
239 if (sig == SIGSEGV && (addr < thread->stack_base() && | |
240 addr >= thread->stack_base() - thread->stack_size())) { | |
241 // stack overflow | |
242 // | |
243 // If we are in a yellow zone and we are inside java, we disable the yellow zone and | |
244 // throw a stack overflow exception. | |
245 // If we are in native code or VM C code, we report-and-die. The original coding tried | |
246 // to continue with yellow zone disabled, but that doesn't buy us much and prevents | |
247 // hs_err_pid files. | |
248 if (thread->in_stack_yellow_zone(addr)) { | |
249 thread->disable_stack_yellow_zone(); | |
250 if (thread->thread_state() == _thread_in_Java) { | |
251 // Throw a stack overflow exception. | |
252 // Guard pages will be reenabled while unwinding the stack. | |
253 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); | |
254 goto run_stub; | |
255 } else { | |
256 // Thread was in the vm or native code. Return and try to finish. | |
257 return 1; | |
258 } | |
259 } else if (thread->in_stack_red_zone(addr)) { | |
260 // Fatal red zone violation. Disable the guard pages and fall through | |
261 // to handle_unexpected_exception way down below. | |
262 thread->disable_stack_red_zone(); | |
263 tty->print_raw_cr("An irrecoverable stack overflow has occurred."); | |
264 goto report_and_die; | |
265 } else { | |
266 // this means a segv happened inside our stack, but not in | |
267 // the guarded zone. I'd like to know when this happens, | |
268 tty->print_raw_cr("SIGSEGV happened inside stack but outside yellow and red zone."); | |
269 goto report_and_die; | |
270 } | |
271 | |
272 } // end handle SIGSEGV inside stack boundaries | |
273 | |
274 if (thread->thread_state() == _thread_in_Java) { | |
275 // Java thread running in Java code | |
276 | |
277 // The following signals are used for communicating VM events: | |
278 // | |
279 // SIGILL: the compiler generates illegal opcodes | |
280 // at places where it wishes to interrupt the VM: | |
281 // Safepoints, Unreachable Code, Entry points of Zombie methods, | |
282 // This results in a SIGILL with (*pc) == inserted illegal instruction. | |
283 // | |
284 // (so, SIGILLs with a pc inside the zero page are real errors) | |
285 // | |
286 // SIGTRAP: | |
287 // The ppc trap instruction raises a SIGTRAP and is very efficient if it | |
288 // does not trap. It is used for conditional branches that are expected | |
289 // to be never taken. These are: | |
290 // - zombie methods | |
291 // - IC (inline cache) misses. | |
292 // - null checks leading to UncommonTraps. | |
293 // - range checks leading to Uncommon Traps. | |
294 // On Aix, these are especially null checks, as the ImplicitNullCheck | |
295 // optimization works only in rare cases, as the page at address 0 is only | |
296 // write protected. // | |
297 // Note: !UseSIGTRAP is used to prevent SIGTRAPS altogether, to facilitate debugging. | |
298 // | |
299 // SIGSEGV: | |
300 // used for safe point polling: | |
301 // To notify all threads that they have to reach a safe point, safe point polling is used: | |
302 // All threads poll a certain mapped memory page. Normally, this page has read access. | |
303 // If the VM wants to inform the threads about impending safe points, it puts this | |
304 // page to read only ("poisens" the page), and the threads then reach a safe point. | |
305 // used for null checks: | |
306 // If the compiler finds a store it uses it for a null check. Unfortunately this | |
307 // happens rarely. In heap based and disjoint base compressd oop modes also loads | |
308 // are used for null checks. | |
309 | |
310 // A VM-related SIGILL may only occur if we are not in the zero page. | |
311 // On AIX, we get a SIGILL if we jump to 0x0 or to somewhere else | |
312 // in the zero page, because it is filled with 0x0. We ignore | |
313 // explicit SIGILLs in the zero page. | |
314 if (sig == SIGILL && (pc < (address) 0x200)) { | |
315 if (TraceTraps) | |
316 tty->print_raw_cr("SIGILL happened inside zero page."); | |
317 goto report_and_die; | |
318 } | |
319 | |
320 // Handle signal from NativeJump::patch_verified_entry(). | |
321 if (( TrapBasedNotEntrantChecks && sig == SIGTRAP && nativeInstruction_at(pc)->is_sigtrap_zombie_not_entrant()) || | |
322 (!TrapBasedNotEntrantChecks && sig == SIGILL && nativeInstruction_at(pc)->is_sigill_zombie_not_entrant())) { | |
323 if (TraceTraps) | |
324 tty->print_cr("trap: zombie_not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL"); | |
325 stub = SharedRuntime::get_handle_wrong_method_stub(); | |
326 goto run_stub; | |
327 } | |
328 | |
329 else if (sig == SIGSEGV && os::is_poll_address(addr)) { | |
330 if (TraceTraps) | |
331 tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", pc); | |
332 stub = SharedRuntime::get_poll_stub(pc); | |
333 goto run_stub; | |
334 } | |
335 | |
336 // SIGTRAP-based ic miss check in compiled code | |
337 else if (sig == SIGTRAP && TrapBasedICMissChecks && | |
338 nativeInstruction_at(pc)->is_sigtrap_ic_miss_check()) { | |
339 if (TraceTraps) | |
340 tty->print_cr("trap: ic_miss_check at " INTPTR_FORMAT " (SIGTRAP)", pc); | |
341 stub = SharedRuntime::get_ic_miss_stub(); | |
342 goto run_stub; | |
343 } | |
344 | |
345 #ifdef COMPILER2 | |
346 // SIGTRAP-based implicit null check in compiled code. | |
347 else if (sig == SIGTRAP && TrapBasedNullChecks && | |
348 nativeInstruction_at(pc)->is_sigtrap_null_check()) { | |
349 if (TraceTraps) | |
350 tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGTRAP)", pc); | |
351 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); | |
352 goto run_stub; | |
353 } | |
354 #endif | |
355 | |
356 // SIGSEGV-based implicit null check in compiled code. | |
357 else if (sig == SIGSEGV && ImplicitNullChecks && | |
358 CodeCache::contains((void*) pc) && | |
359 !MacroAssembler::needs_explicit_null_check((intptr_t) info->si_addr)) { | |
360 if (TraceTraps) | |
361 tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", pc); | |
362 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); | |
363 } | |
364 | |
365 #ifdef COMPILER2 | |
366 // SIGTRAP-based implicit range check in compiled code. | |
367 else if (sig == SIGTRAP && TrapBasedRangeChecks && | |
368 nativeInstruction_at(pc)->is_sigtrap_range_check()) { | |
369 if (TraceTraps) | |
370 tty->print_cr("trap: range_check at " INTPTR_FORMAT " (SIGTRAP)", pc); | |
371 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); | |
372 goto run_stub; | |
373 } | |
374 #endif | |
375 | |
376 else if (sig == SIGFPE /* && info->si_code == FPE_INTDIV */) { | |
377 if (TraceTraps) { | |
378 tty->print_raw_cr("Fix SIGFPE handler, trying divide by zero handler."); | |
379 } | |
380 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO); | |
381 goto run_stub; | |
382 } | |
383 | |
384 else if (sig == SIGBUS) { | |
385 // BugId 4454115: A read from a MappedByteBuffer can fault here if the | |
386 // underlying file has been truncated. Do not crash the VM in such a case. | |
387 CodeBlob* cb = CodeCache::find_blob_unsafe(pc); | |
388 nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL; | |
389 if (nm != NULL && nm->has_unsafe_access()) { | |
390 // We don't really need a stub here! Just set the pending exeption and | |
391 // continue at the next instruction after the faulting read. Returning | |
392 // garbage from this read is ok. | |
393 thread->set_pending_unsafe_access_error(); | |
394 uc->uc_mcontext.jmp_context.iar = ((unsigned long)pc) + 4; | |
395 return 1; | |
396 } | |
397 } | |
398 } | |
399 | |
400 else { // thread->thread_state() != _thread_in_Java | |
401 // Detect CPU features. This is only done at the very start of the VM. Later, the | |
402 // VM_Version::is_determine_features_test_running() flag should be false. | |
403 | |
404 if (sig == SIGILL && VM_Version::is_determine_features_test_running()) { | |
405 // SIGILL must be caused by VM_Version::determine_features(). | |
406 *(int *)pc = 0; // patch instruction to 0 to indicate that it causes a SIGILL, | |
407 // flushing of icache is not necessary. | |
408 stub = pc + 4; // continue with next instruction. | |
409 goto run_stub; | |
410 } | |
411 else if (thread->thread_state() == _thread_in_vm && | |
412 sig == SIGBUS && thread->doing_unsafe_access()) { | |
413 // We don't really need a stub here! Just set the pending exeption and | |
414 // continue at the next instruction after the faulting read. Returning | |
415 // garbage from this read is ok. | |
416 thread->set_pending_unsafe_access_error(); | |
417 uc->uc_mcontext.jmp_context.iar = ((unsigned long)pc) + 4; | |
418 return 1; | |
419 } | |
420 } | |
421 | |
422 // Check to see if we caught the safepoint code in the | |
423 // process of write protecting the memory serialization page. | |
424 // It write enables the page immediately after protecting it | |
425 // so we can just return to retry the write. | |
426 if ((sig == SIGSEGV) && | |
427 os::is_memory_serialize_page(thread, addr)) { | |
428 // Synchronization problem in the pseudo memory barrier code (bug id 6546278) | |
429 // Block current thread until the memory serialize page permission restored. | |
430 os::block_on_serialize_page_trap(); | |
431 return true; | |
432 } | |
433 } | |
434 | |
435 run_stub: | |
436 | |
437 // One of the above code blocks ininitalized the stub, so we want to | |
438 // delegate control to that stub. | |
439 if (stub != NULL) { | |
440 // Save all thread context in case we need to restore it. | |
441 if (thread != NULL) thread->set_saved_exception_pc(pc); | |
442 uc->uc_mcontext.jmp_context.iar = (unsigned long)stub; | |
443 return 1; | |
444 } | |
445 | |
446 run_chained_handler: | |
447 | |
448 // signal-chaining | |
449 if (os::Aix::chained_handler(sig, info, ucVoid)) { | |
450 return 1; | |
451 } | |
452 if (!abort_if_unrecognized) { | |
453 // caller wants another chance, so give it to him | |
454 return 0; | |
455 } | |
456 | |
457 report_and_die: | |
458 | |
459 // Use sigthreadmask instead of sigprocmask on AIX and unmask current signal. | |
460 sigset_t newset; | |
461 sigemptyset(&newset); | |
462 sigaddset(&newset, sig); | |
463 sigthreadmask(SIG_UNBLOCK, &newset, NULL); | |
464 | |
465 VMError err(t, sig, pc, info, ucVoid); | |
466 err.report_and_die(); | |
467 | |
468 ShouldNotReachHere(); | |
469 return 0; | |
470 } | |
471 | |
472 void os::Aix::init_thread_fpu_state(void) { | |
473 #if !defined(USE_XLC_BUILTINS) | |
474 // Disable FP exceptions. | |
475 __asm__ __volatile__ ("mtfsfi 6,0"); | |
476 #else | |
477 __mtfsfi(6, 0); | |
478 #endif | |
479 } | |
480 | |
481 //////////////////////////////////////////////////////////////////////////////// | |
482 // thread stack | |
483 | |
484 size_t os::Aix::min_stack_allowed = 768*K; | |
485 | |
486 // Aix is always in floating stack mode. The stack size for a new | |
487 // thread can be set via pthread_attr_setstacksize(). | |
488 bool os::Aix::supports_variable_stack_size() { return true; } | |
489 | |
490 // return default stack size for thr_type | |
491 size_t os::Aix::default_stack_size(os::ThreadType thr_type) { | |
492 // default stack size (compiler thread needs larger stack) | |
493 // Notice that the setting for compiler threads here have no impact | |
494 // because of the strange 'fallback logic' in os::create_thread(). | |
495 // Better set CompilerThreadStackSize in globals_<os_cpu>.hpp if you want to | |
496 // specify a different stack size for compiler threads! | |
497 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1024 * K); | |
498 return s; | |
499 } | |
500 | |
501 size_t os::Aix::default_guard_size(os::ThreadType thr_type) { | |
502 return 2 * page_size(); | |
503 } | |
504 | |
505 ///////////////////////////////////////////////////////////////////////////// | |
506 // helper functions for fatal error handler | |
507 | |
508 void os::print_context(outputStream *st, void *context) { | |
509 if (context == NULL) return; | |
510 | |
511 ucontext_t* uc = (ucontext_t*)context; | |
512 | |
513 st->print_cr("Registers:"); | |
514 st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.iar); | |
515 st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.lr); | |
516 st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.ctr); | |
517 st->cr(); | |
518 for (int i = 0; i < 32; i++) { | |
519 st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.jmp_context.gpr[i]); | |
520 if (i % 3 == 2) st->cr(); | |
521 } | |
522 st->cr(); | |
523 st->cr(); | |
524 | |
525 intptr_t *sp = (intptr_t *)os::Aix::ucontext_get_sp(uc); | |
526 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); | |
527 print_hex_dump(st, (address)sp, (address)(sp + 128), sizeof(intptr_t)); | |
528 st->cr(); | |
529 | |
530 // Note: it may be unsafe to inspect memory near pc. For example, pc may | |
531 // point to garbage if entry point in an nmethod is corrupted. Leave | |
532 // this at the end, and hope for the best. | |
533 address pc = os::Aix::ucontext_get_pc(uc); | |
534 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); | |
535 print_hex_dump(st, pc - 64, pc + 64, /*instrsize=*/4); | |
536 st->cr(); | |
537 | |
538 // Try to decode the instructions. | |
539 st->print_cr("Decoded instructions: (pc=" PTR_FORMAT ")", pc); | |
540 st->print("<TODO: PPC port - print_context>"); | |
541 // TODO: PPC port Disassembler::decode(pc, 16, 16, st); | |
542 st->cr(); | |
543 } | |
544 | |
545 void os::print_register_info(outputStream *st, void *context) { | |
546 if (context == NULL) return; | |
547 st->print("Not ported - print_register_info\n"); | |
548 } | |
549 | |
550 extern "C" { | |
551 int SpinPause() { | |
552 return 0; | |
553 } | |
554 } | |
555 | |
556 #ifndef PRODUCT | |
557 void os::verify_stack_alignment() { | |
558 assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment"); | |
559 } | |
560 #endif |