Skip to content

Commit

Permalink
Define missing struct
Browse files Browse the repository at this point in the history
  • Loading branch information
robehn committed Dec 19, 2024
1 parent c160db2 commit f99163b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
# include <dlfcn.h>
# include <errno.h>
# include <fpu_control.h>
# include <linux/ptrace.h>
# include <fpu_control.h>
# include <pthread.h>
# include <signal.h>
# include <stdio.h>
Expand Down Expand Up @@ -341,17 +341,22 @@ 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;
unsigned long vcsr;
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
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit f99163b

Please sign in to comment.