diff --git a/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp b/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp index 095128870c012..6f89899f4d8bb 100644 --- a/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp +++ b/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp @@ -58,7 +58,7 @@ # include # include # include -# include +# include # include # include # include @@ -341,8 +341,12 @@ static const char* reg_abi_names[] = { "x28(t3)", "x29(t4)","x30(t5)", "x31(t6)" }; -/* -struct __riscv_v_ext_state { + +// If compiling on kernel without V support the struct: +// "struct __riscv_v_ext_state" is not defined. +// As below code below requires this layout we just define it here, +// instead of trying to include it, even if available. +struct redefine_riscv_v_ext_state { unsigned long vstart; unsigned long vl; unsigned long vtype; @@ -350,8 +354,9 @@ struct __riscv_v_ext_state { unsigned long vlenb; void *datap; }; -*/ +// This magic number is not in any user-space header. +// No other choice but to define it. #ifndef RISCV_V_MAGIC #define RISCV_V_MAGIC 0x53465457 #endif @@ -378,7 +383,7 @@ void os::print_context(outputStream *st, const void *context) { // vector state struct __riscv_extra_ext_header *ext; - struct __riscv_v_ext_state *v_ext_state; + struct redefine_riscv_v_ext_state *v_ext_state; // Find the vector context ext = (struct __riscv_extra_ext_header *)(&uc->uc_mcontext.__fpregs); @@ -387,7 +392,7 @@ void os::print_context(outputStream *st, const void *context) { return; } - v_ext_state = (struct __riscv_v_ext_state *)((char *)(ext) + sizeof(*ext)); + v_ext_state = (struct redefine_riscv_v_ext_state *)((char *)(ext) + sizeof(*ext)); st->print_cr("Vector state:"); st->print_cr("vstart=" INTPTR_FORMAT, v_ext_state->vstart);