I'm trying to port this XS JavaScript engine to genode. It wants to know the stack limit. Any suggestions on how to do this?
https://github.com/Moddable-OpenSource/moddable/blob/public/xs/sources/xsCom...
char* fxCStackLimit() { #if mxWindows ULONG_PTR low, high; GetCurrentThreadStackLimits(&low, &high); return (char*)low + (32 * 1024); #elif mxMacOSX pthread_t self = pthread_self(); void* stackAddr = pthread_get_stackaddr_np(self); size_t stackSize = pthread_get_stacksize_np(self); return (char*)stackAddr - stackSize + (8 * 1024); #elif mxLinux pthread_attr_t attrs; if (pthread_getattr_np(pthread_self(), &attrs) == 0) { void* stackAddr; size_t stackSize; if (pthread_attr_getstack(&attrs, &stackAddr, &stackSize) == 0) { return (char*)stackAddr + (4 * 1024); } } return C_NULL; #else return C_NULL; #endif }