Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/hotspot/cpu/zero/vm_version_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ void VM_Version::initialize() {
}

// Enable error context decoding on known platforms
#if defined(IA32) || defined(AMD64) || defined(ARM) || \
defined(AARCH64) || defined(PPC) || defined(RISCV) || \
defined(S390)
#if defined(AMD64) || defined(ARM) || defined(AARCH64) || \
defined(PPC) || defined(RISCV) || defined(S390)
if (FLAG_IS_DEFAULT(DecodeErrorContext)) {
FLAG_SET_DEFAULT(DecodeErrorContext, true);
}
Expand Down
16 changes: 2 additions & 14 deletions src/hotspot/os/bsd/os_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ size_t os::rss() {
// Cpu architecture string
#if defined(ZERO)
static char cpu_arch[] = ZERO_LIBARCH;
#elif defined(IA32)
static char cpu_arch[] = "i386";
#elif defined(AMD64)
static char cpu_arch[] = "amd64";
#elif defined(ARM)
Expand Down Expand Up @@ -1011,7 +1009,6 @@ bool os::dll_address_to_library_name(address addr, char* buf,
// same architecture as Hotspot is running on

void *os::Bsd::dlopen_helper(const char *filename, int mode, char *ebuf, int ebuflen) {
#ifndef IA32
bool ieee_handling = IEEE_subnormal_handling_OK();
if (!ieee_handling) {
Events::log_dll_message(nullptr, "IEEE subnormal handling check failed before loading %s", filename);
Expand All @@ -1034,14 +1031,9 @@ void *os::Bsd::dlopen_helper(const char *filename, int mode, char *ebuf, int ebu
// numerical "accuracy", but we need to protect Java semantics first
// and foremost. See JDK-8295159.

// This workaround is ineffective on IA32 systems because the MXCSR
// register (which controls flush-to-zero mode) is not stored in the
// legacy fenv.

fenv_t default_fenv;
int rtn = fegetenv(&default_fenv);
assert(rtn == 0, "fegetenv must succeed");
#endif // IA32

void* result;
JFR_ONLY(NativeLibraryLoadEvent load_event(filename, &result);)
Expand All @@ -1061,7 +1053,6 @@ void *os::Bsd::dlopen_helper(const char *filename, int mode, char *ebuf, int ebu
} else {
Events::log_dll_message(nullptr, "Loaded shared library %s", filename);
log_info(os)("shared library load of %s was successful", filename);
#ifndef IA32
if (! IEEE_subnormal_handling_OK()) {
// We just dlopen()ed a library that mangled the floating-point
// flags. Silently fix things now.
Expand All @@ -1086,7 +1077,6 @@ void *os::Bsd::dlopen_helper(const char *filename, int mode, char *ebuf, int ebu
assert(false, "fesetenv didn't work");
}
}
#endif // IA32
}

return result;
Expand Down Expand Up @@ -1195,9 +1185,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
{EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"}
};

#if (defined IA32)
static Elf32_Half running_arch_code=EM_386;
#elif (defined AMD64)
#if (defined AMD64)
static Elf32_Half running_arch_code=EM_X86_64;
#elif (defined __powerpc64__)
static Elf32_Half running_arch_code=EM_PPC64;
Expand All @@ -1219,7 +1207,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_68K;
#else
#error Method os::dll_load requires that one of following is defined:\
IA32, AMD64, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K
AMD64, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K
#endif

// Identify compatibility class for VM's architecture and library's architecture
Expand Down
121 changes: 8 additions & 113 deletions src/hotspot/os/linux/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1795,9 +1795,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
{EM_LOONGARCH, EM_LOONGARCH, ELFCLASS64, ELFDATA2LSB, (char*)"LoongArch"},
};

#if (defined IA32)
static Elf32_Half running_arch_code=EM_386;
#elif (defined AMD64) || (defined X32)
#if (defined AMD64)
static Elf32_Half running_arch_code=EM_X86_64;
#elif (defined __sparc) && (defined _LP64)
static Elf32_Half running_arch_code=EM_SPARCV9;
Expand Down Expand Up @@ -1831,7 +1829,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_LOONGARCH;
#else
#error Method os::dll_load requires that one of following is defined:\
AARCH64, ALPHA, ARM, AMD64, IA32, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
AARCH64, ALPHA, ARM, AMD64, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
#endif

// Identify compatibility class for VM's architecture and library's architecture
Expand Down Expand Up @@ -1893,7 +1891,6 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
}

void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) {
#ifndef IA32
bool ieee_handling = IEEE_subnormal_handling_OK();
if (!ieee_handling) {
Events::log_dll_message(nullptr, "IEEE subnormal handling check failed before loading %s", filename);
Expand All @@ -1916,14 +1913,9 @@ void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) {
// numerical "accuracy", but we need to protect Java semantics first
// and foremost. See JDK-8295159.

// This workaround is ineffective on IA32 systems because the MXCSR
// register (which controls flush-to-zero mode) is not stored in the
// legacy fenv.

fenv_t default_fenv;
int rtn = fegetenv(&default_fenv);
assert(rtn == 0, "fegetenv must succeed");
#endif // IA32

void* result;
JFR_ONLY(NativeLibraryLoadEvent load_event(filename, &result);)
Expand All @@ -1943,7 +1935,6 @@ void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) {
} else {
Events::log_dll_message(nullptr, "Loaded shared library %s", filename);
log_info(os)("shared library load of %s was successful", filename);
#ifndef IA32
// Quickly test to make sure subnormals are correctly handled.
if (! IEEE_subnormal_handling_OK()) {
// We just dlopen()ed a library that mangled the floating-point flags.
Expand All @@ -1969,7 +1960,6 @@ void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) {
assert(false, "fesetenv didn't work");
}
}
#endif // IA32
}
return result;
}
Expand Down Expand Up @@ -2613,7 +2603,7 @@ void os::print_memory_info(outputStream* st) {
// before "flags" so if we find a second "model name", then the
// "flags" field is considered missing.
static bool print_model_name_and_flags(outputStream* st, char* buf, size_t buflen) {
#if defined(IA32) || defined(AMD64)
#if defined(AMD64)
// Other platforms have less repetitive cpuinfo files
FILE *fp = os::fopen("/proc/cpuinfo", "r");
if (fp) {
Expand Down Expand Up @@ -2672,7 +2662,7 @@ static void print_sys_devices_cpu_info(outputStream* st) {
}

// we miss the cpufreq entries on Power and s390x
#if defined(IA32) || defined(AMD64)
#if defined(AMD64)
_print_ascii_file_h("BIOS frequency limitation", "/sys/devices/system/cpu/cpu0/cpufreq/bios_limit", st);
_print_ascii_file_h("Frequency switch latency (ns)", "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_transition_latency", st);
_print_ascii_file_h("Available cpu frequencies", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies", st);
Expand Down Expand Up @@ -2725,7 +2715,7 @@ void os::jfr_report_memory_info() {

#endif // INCLUDE_JFR

#if defined(AMD64) || defined(IA32) || defined(X32)
#if defined(AMD64)
const char* search_string = "model name";
#elif defined(M68K)
const char* search_string = "CPU";
Expand Down Expand Up @@ -2778,8 +2768,6 @@ void os::get_summary_cpu_info(char* cpuinfo, size_t length) {
strncpy(cpuinfo, "x86_64", length);
#elif defined(ARM) // Order wrt. AARCH64 is relevant!
strncpy(cpuinfo, "ARM", length);
#elif defined(IA32)
strncpy(cpuinfo, "x86_32", length);
#elif defined(PPC)
strncpy(cpuinfo, "PPC64", length);
#elif defined(RISCV)
Expand Down Expand Up @@ -3079,14 +3067,9 @@ int os::Linux::sched_getcpu_syscall(void) {
unsigned int cpu = 0;
long retval = -1;

#if defined(IA32)
#ifndef SYS_getcpu
#define SYS_getcpu 318
#endif
retval = syscall(SYS_getcpu, &cpu, nullptr, nullptr);
#elif defined(AMD64)
// Unfortunately we have to bring all these macros here from vsyscall.h
// to be able to compile on old linuxes.
#if defined(AMD64)
// Unfortunately we have to bring all these macros here from vsyscall.h
// to be able to compile on old linuxes.
#define __NR_vgetcpu 2
#define VSYSCALL_START (-10UL << 20)
#define VSYSCALL_SIZE 1024
Expand Down Expand Up @@ -4459,87 +4442,6 @@ void os::Linux::disable_numa(const char* reason, bool warning) {
FLAG_SET_ERGO(UseNUMAInterleaving, false);
}

#if defined(IA32) && !defined(ZERO)
/*
* Work-around (execute code at a high address) for broken NX emulation using CS limit,
* Red Hat patch "Exec-Shield" (IA32 only).
*
* Map and execute at a high VA to prevent CS lazy updates race with SMP MM
* invalidation.Further code generation by the JVM will no longer cause CS limit
* updates.
*
* Affects IA32: RHEL 5 & 6, Ubuntu 10.04 (LTS), 10.10, 11.04, 11.10, 12.04.
* @see JDK-8023956
*/
static void workaround_expand_exec_shield_cs_limit() {
assert(os::Linux::initial_thread_stack_bottom() != nullptr, "sanity");
size_t page_size = os::vm_page_size();

/*
* JDK-8197429
*
* Expand the stack mapping to the end of the initial stack before
* attempting to install the codebuf. This is needed because newer
* Linux kernels impose a distance of a megabyte between stack
* memory and other memory regions. If we try to install the
* codebuf before expanding the stack the installation will appear
* to succeed but we'll get a segfault later if we expand the stack
* in Java code.
*
*/
if (os::is_primordial_thread()) {
address limit = os::Linux::initial_thread_stack_bottom();
if (! DisablePrimordialThreadGuardPages) {
limit += StackOverflow::stack_red_zone_size() +
StackOverflow::stack_yellow_zone_size();
}
os::Linux::expand_stack_to(limit);
}

/*
* Take the highest VA the OS will give us and exec
*
* Although using -(pagesz) as mmap hint works on newer kernel as you would
* think, older variants affected by this work-around don't (search forward only).
*
* On the affected distributions, we understand the memory layout to be:
*
* TASK_LIMIT= 3G, main stack base close to TASK_LIMT.
*
* A few pages south main stack will do it.
*
* If we are embedded in an app other than launcher (initial != main stack),
* we don't have much control or understanding of the address space, just let it slide.
*/
char* hint = (char*)(os::Linux::initial_thread_stack_bottom() -
(StackOverflow::stack_guard_zone_size() + page_size));
char* codebuf = os::attempt_reserve_memory_at(hint, page_size, mtThread);

if (codebuf == nullptr) {
// JDK-8197429: There may be a stack gap of one megabyte between
// the limit of the stack and the nearest memory region: this is a
// Linux kernel workaround for CVE-2017-1000364. If we failed to
// map our codebuf, try again at an address one megabyte lower.
hint -= 1 * M;
codebuf = os::attempt_reserve_memory_at(hint, page_size, mtThread);
}

if ((codebuf == nullptr) || (!os::commit_memory(codebuf, page_size, true))) {
return; // No matter, we tried, best effort.
}

log_info(os)("[CS limit NX emulation work-around, exec code at: %p]", codebuf);

// Some code to exec: the 'ret' instruction
codebuf[0] = 0xC3;

// Call the code in the codebuf
__asm__ volatile("call *%0" : : "r"(codebuf));

// keep the page mapped so CS limit isn't reduced.
}
#endif // defined(IA32) && !defined(ZERO)

// this is called _after_ the global arguments have been parsed
jint os::init_2(void) {

Expand All @@ -4560,17 +4462,10 @@ jint os::init_2(void) {
return JNI_ERR;
}

#if defined(IA32) && !defined(ZERO)
// Need to ensure we've determined the process's initial stack to
// perform the workaround
Linux::capture_initial_stack(JavaThread::stack_size_at_create());
workaround_expand_exec_shield_cs_limit();
#else
suppress_primordial_thread_resolution = Arguments::created_by_java_launcher();
if (!suppress_primordial_thread_resolution) {
Linux::capture_initial_stack(JavaThread::stack_size_at_create());
}
#endif

Linux::libpthread_init();
Linux::sched_getcpu_init();
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3150,7 +3150,6 @@ void os::large_page_init() {
_large_page_size = os::win32::large_page_init_decide_size();
const size_t default_page_size = os::vm_page_size();
if (_large_page_size > default_page_size) {
#if !defined(IA32)
if (EnableAllLargePageSizesForWindows) {
size_t min_size = GetLargePageMinimum();

Expand All @@ -3159,7 +3158,6 @@ void os::large_page_init() {
_page_sizes.add(page_size);
}
}
#endif

_page_sizes.add(_large_page_size);
}
Expand Down
12 changes: 3 additions & 9 deletions src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ char* os::non_memory_address_word() {

address os::Posix::ucontext_get_pc(const ucontext_t* uc) {
if (DecodeErrorContext) {
#if defined(IA32)
return (address)uc->uc_mcontext.gregs[REG_EIP];
#elif defined(AMD64)
#if defined(AMD64)
return (address)uc->uc_mcontext.gregs[REG_RIP];
#elif defined(ARM)
return (address)uc->uc_mcontext.arm_pc;
Expand Down Expand Up @@ -117,9 +115,7 @@ void os::Posix::ucontext_set_pc(ucontext_t* uc, address pc) {

intptr_t* os::Linux::ucontext_get_sp(const ucontext_t* uc) {
if (DecodeErrorContext) {
#if defined(IA32)
return (intptr_t*)uc->uc_mcontext.gregs[REG_UESP];
#elif defined(AMD64)
#if defined(AMD64)
return (intptr_t*)uc->uc_mcontext.gregs[REG_RSP];
#elif defined(ARM)
return (intptr_t*)uc->uc_mcontext.arm_sp;
Expand All @@ -144,9 +140,7 @@ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t* uc) {

intptr_t* os::Linux::ucontext_get_fp(const ucontext_t* uc) {
if (DecodeErrorContext) {
#if defined(IA32)
return (intptr_t*)uc->uc_mcontext.gregs[REG_EBP];
#elif defined(AMD64)
#if defined(AMD64)
return (intptr_t*)uc->uc_mcontext.gregs[REG_RBP];
#elif defined(ARM)
return (intptr_t*)uc->uc_mcontext.arm_fp;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/adlc/output_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2323,7 +2323,7 @@ class DefineEmitState {
if (strcmp(rep_var,"$Register") == 0) return "as_Register";
if (strcmp(rep_var,"$KRegister") == 0) return "as_KRegister";
if (strcmp(rep_var,"$FloatRegister") == 0) return "as_FloatRegister";
#if defined(IA32) || defined(AMD64)
#if defined(AMD64)
if (strcmp(rep_var,"$XMMRegister") == 0) return "as_XMMRegister";
#endif
if (strcmp(rep_var,"$CondRegister") == 0) return "as_ConditionRegister";
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/c1/c1_CodeStubs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class ConversionStub: public CodeStub {
public:
ConversionStub(Bytecodes::Code bytecode, LIR_Opr input, LIR_Opr result)
: _bytecode(bytecode), _input(input), _result(result) {
NOT_IA32( ShouldNotReachHere(); ) // used only on x86-32
ShouldNotReachHere();
Comment on lines 139 to +141
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this code then in separate RFE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I have filed JDK-8370878 for it

}

Bytecodes::Code bytecode() { return _bytecode; }
Expand Down
16 changes: 0 additions & 16 deletions src/hotspot/share/c1/c1_LIRAssembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,16 +527,6 @@ void LIR_Assembler::emit_op1(LIR_Op1* op) {
safepoint_poll(op->in_opr(), op->info());
break;

#ifdef IA32
case lir_fxch:
fxch(op->in_opr()->as_jint());
break;

case lir_fld:
fld(op->in_opr()->as_jint());
break;
#endif // IA32

case lir_branch:
break;

Expand Down Expand Up @@ -612,12 +602,6 @@ void LIR_Assembler::emit_op0(LIR_Op0* op) {
osr_entry();
break;

#ifdef IA32
case lir_fpop_raw:
fpop();
break;
#endif // IA32

case lir_breakpoint:
breakpoint();
break;
Expand Down
Loading