Skip to content
Open
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
9 changes: 9 additions & 0 deletions include/zephyr/arch/riscv/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ struct _cpu_arch {
atomic_ptr_val_t fpu_owner;
uint32_t fpu_state;
#endif
#if defined(CONFIG_CPP) && !defined(CONFIG_USERSPACE) && \
!(defined(CONFIG_SMP) || (CONFIG_MP_MAX_NUM_CPUS > 1)) && !defined(CONFIG_FPU_SHARING)
/* Empty struct has size 0 in C, size 1 in C++. Force them to be the same. */
uint8_t unused_cpp_size_compatibility;
#endif
};

#if defined(CONFIG_CPP)
BUILD_ASSERT(sizeof(struct _cpu_arch) >= 1);
#endif

#endif /* ZEPHYR_INCLUDE_RISCV_STRUCTS_H_ */
9 changes: 9 additions & 0 deletions include/zephyr/arch/riscv/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,17 @@ struct _thread_arch {
unsigned long m_mode_pmpaddr_regs[PMP_M_MODE_SLOTS];
unsigned long m_mode_pmpcfg_regs[PMP_M_MODE_SLOTS / sizeof(unsigned long)];
#endif
#if defined(CONFIG_CPP) && !defined(CONFIG_FPU_SHARING) && !defined(CONFIG_USERSPACE) && \
!defined(CONFIG_PMP_STACK_GUARD)
/* Empty struct has size 0 in C, size 1 in C++. Force them to be the same. */
uint8_t unused_cpp_size_compatibility;
#endif
};

#if defined(CONFIG_CPP)
BUILD_ASSERT(sizeof(struct _thread_arch) >= 1);
#endif

typedef struct _thread_arch _thread_arch_t;

#endif /* _ASMLANGUAGE */
Expand Down