equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
61 const int FPU_CNTRL_WRD_MASK = 0xFFFF; |
61 const int FPU_CNTRL_WRD_MASK = 0xFFFF; |
62 |
62 |
63 // ------------------------------------------------------------------------------------------------------------------------- |
63 // ------------------------------------------------------------------------------------------------------------------------- |
64 // Stub Code definitions |
64 // Stub Code definitions |
65 |
65 |
66 static address handle_unsafe_access() { |
|
67 JavaThread* thread = JavaThread::current(); |
|
68 address pc = thread->saved_exception_pc(); |
|
69 // pc is the instruction which we must emulate |
|
70 // doing a no-op is fine: return garbage from the load |
|
71 // therefore, compute npc |
|
72 address npc = Assembler::locate_next_instruction(pc); |
|
73 |
|
74 // request an async exception |
|
75 thread->set_pending_unsafe_access_error(); |
|
76 |
|
77 // return address of next instruction to execute |
|
78 return npc; |
|
79 } |
|
80 |
|
81 class StubGenerator: public StubCodeGenerator { |
66 class StubGenerator: public StubCodeGenerator { |
82 private: |
67 private: |
83 |
68 |
84 #ifdef PRODUCT |
69 #ifdef PRODUCT |
85 #define inc_counter_np(counter) ((void)0) |
70 #define inc_counter_np(counter) ((void)0) |
616 __ pop(rcx); |
601 __ pop(rcx); |
617 __ pop(rbx); |
602 __ pop(rbx); |
618 __ addptr(rsp, wordSize * 2); |
603 __ addptr(rsp, wordSize * 2); |
619 |
604 |
620 __ ret(0); |
605 __ ret(0); |
621 |
|
622 return start; |
|
623 } |
|
624 |
|
625 |
|
626 //--------------------------------------------------------------------------- |
|
627 // The following routine generates a subroutine to throw an asynchronous |
|
628 // UnknownError when an unsafe access gets a fault that could not be |
|
629 // reasonably prevented by the programmer. (Example: SIGBUS/OBJERR.) |
|
630 address generate_handler_for_unsafe_access() { |
|
631 StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access"); |
|
632 address start = __ pc(); |
|
633 |
|
634 __ push(0); // hole for return address-to-be |
|
635 __ pusha(); // push registers |
|
636 Address next_pc(rsp, RegisterImpl::number_of_registers * BytesPerWord); |
|
637 BLOCK_COMMENT("call handle_unsafe_access"); |
|
638 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, handle_unsafe_access))); |
|
639 __ movptr(next_pc, rax); // stuff next address |
|
640 __ popa(); |
|
641 __ ret(0); // jump to next address |
|
642 |
606 |
643 return start; |
607 return start; |
644 } |
608 } |
645 |
609 |
646 |
610 |
3863 StubRoutines::_catch_exception_entry = generate_catch_exception(); |
3827 StubRoutines::_catch_exception_entry = generate_catch_exception(); |
3864 |
3828 |
3865 // These are currently used by Solaris/Intel |
3829 // These are currently used by Solaris/Intel |
3866 StubRoutines::_atomic_xchg_entry = generate_atomic_xchg(); |
3830 StubRoutines::_atomic_xchg_entry = generate_atomic_xchg(); |
3867 |
3831 |
3868 StubRoutines::_handler_for_unsafe_access_entry = |
|
3869 generate_handler_for_unsafe_access(); |
|
3870 |
|
3871 // platform dependent |
3832 // platform dependent |
3872 create_control_words(); |
3833 create_control_words(); |
3873 |
3834 |
3874 StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr(); |
3835 StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr(); |
3875 StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = generate_verify_fpu_cntrl_wrd(); |
3836 StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = generate_verify_fpu_cntrl_wrd(); |