util/cpu: enable SPARC misalignment emulation at startup

Call a SPARC-specific helper during pre-init so the kernel emulates unaligned accesses for this process instead of terminating on alignment faults. This matches the Solaris/SPARC portability fix that motivated the original patch.
pull/15601/head
Martin Rehak 2 months ago committed by Victor Julien
parent 1faa2921c1
commit f34acfdeed

@ -3089,6 +3089,8 @@ int InitGlobal(void)
void SuricataPreInit(const char *progname)
{
UtilCpuEnableSparcMisalignEmulation();
SCInstanceInit(&suricata, progname);
if (InitGlobal() != 0) {

@ -204,3 +204,16 @@ uint64_t UtilCpuGetTicks(void)
#endif
return val;
}
/**
* \brief Handle memory access miss align on SPARC processors
*/
void UtilCpuEnableSparcMisalignEmulation(void)
{
/* 'ta 6' tells the kernel to synthesize any unaligned accesses this process
* makes, instead of just signalling an error and terminating the process.
*/
#ifdef __sparc
__asm("ta 6");
#endif /* __sparc */
}

@ -33,4 +33,6 @@ void UtilCpuPrintSummary(void);
uint64_t UtilCpuGetTicks(void);
void UtilCpuEnableSparcMisalignEmulation(void);
#endif /* SURICATA_UTIL_CPU_H */

Loading…
Cancel
Save