Skip to content

Commit

Permalink
8289350: Better media supports
Browse files Browse the repository at this point in the history
Reviewed-by: mbalao
  • Loading branch information
Alexei Voitylov authored and RealCLanger committed Jan 9, 2023
1 parent 9f00921 commit ba9a70c
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 19 deletions.
18 changes: 10 additions & 8 deletions src/hotspot/os/posix/vmError_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,21 @@ static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
}

// Needed to make it possible to call SafeFetch.. APIs in error handling.
if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return;
}
if (sig == SIGSEGV || sig == SIGBUS) {
if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return;
}

// Needed because asserts may happen in error handling too.
#ifdef CAN_SHOW_REGISTERS_ON_ASSERT
if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) {
if (handle_assert_poison_fault(ucVoid, info->si_addr)) {
return;
if (info != NULL && info->si_addr == g_assert_poison) {
if (handle_assert_poison_fault(ucVoid, info->si_addr)) {
return;
}
}
}
#endif // CAN_SHOW_REGISTERS_ON_ASSERT
}

VMError::report_and_die(NULL, sig, pc, info, ucVoid);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec
// SafeFetch 32 handling:
// - make it work if _thread is null
// - make it use the standard os::...::ucontext_get/set_pc APIs
if (uc) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc) {
address const pc = os::Aix::ucontext_get_pc(uc);
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Aix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ JVM_handle_bsd_signal(int sig,
}

// Handle SafeFetch faults:
if (uc != NULL) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc != NULL) {
address const pc = (address) os::Bsd::ucontext_get_pc(uc);
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Bsd::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ JVM_handle_bsd_signal(int sig,
}

// Handle SafeFetch faults:
if (uc != NULL) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc != NULL) {
address const pc = (address) os::Bsd::ucontext_get_pc(uc);
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Bsd::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ JVM_handle_linux_signal(int sig,
}

// Handle SafeFetch faults:
if (uc != NULL) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc != NULL) {
address const pc = (address) os::Linux::ucontext_get_pc(uc);
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ extern "C" int JVM_handle_linux_signal(int sig, siginfo_t* info,
}

// Handle SafeFetch faults:
if (uc != NULL) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc != NULL) {
address const pc = (address) os::Linux::ucontext_get_pc(uc);
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ JVM_handle_linux_signal(int sig,

// Moved SafeFetch32 handling outside thread!=NULL conditional block to make
// it work if no associated JavaThread object exists.
if (uc) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc) {
address const pc = os::Linux::ucontext_get_pc(uc);
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ JVM_handle_linux_signal(int sig,

// Moved SafeFetch32 handling outside thread!=NULL conditional block to make
// it work if no associated JavaThread object exists.
if (uc) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc) {
address const pc = os::Linux::ucontext_get_pc(uc);
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/linux_sparc/os_linux_sparc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ JVM_handle_linux_signal(int sig,
return 1;
}

if (checkPrefetch(uc, pc)) {
if ((sig == SIGSEGV || sig == SIGBUS) && checkPrefetch(uc, pc)) {
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ JVM_handle_linux_signal(int sig,
}

// Handle SafeFetch faults:
if (uc != NULL) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc != NULL) {
address const pc = (address) os::Linux::ucontext_get_pc(uc);
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
}

// Handle SafeFetch faults:
if (uc != NULL) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc != NULL) {
address const pc = (address) uc->uc_mcontext.gregs[REG_PC];
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
}

// Handle SafeFetch faults:
if (uc != NULL) {
if ((sig == SIGSEGV || sig == SIGBUS) && uc != NULL) {
address const pc = (address) uc->uc_mcontext.gregs[REG_PC];
if (pc && StubRoutines::is_safefetch_fault(pc)) {
os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
Expand Down

0 comments on commit ba9a70c

Please sign in to comment.