mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Avoid an --ftrace crash on Windows
This commit is contained in:
parent
dcf9596620
commit
ad11fc32ad
3 changed files with 24 additions and 11 deletions
|
@ -106,8 +106,9 @@ static long AlignStack(long sp, char *stk, long stksz, int mal) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// THE NEW TECHNOLOGY
|
||||
|
||||
__msabi extern typeof(TlsSetValue) *const __imp_TlsSetValue;
|
||||
__msabi extern typeof(ExitThread) *const __imp_ExitThread;
|
||||
__msabi extern typeof(GetCurrentThreadId) *const __imp_GetCurrentThreadId;
|
||||
__msabi extern typeof(TlsSetValue) *const __imp_TlsSetValue;
|
||||
__msabi extern typeof(WakeByAddressAll) *const __imp_WakeByAddressAll;
|
||||
|
||||
static textwindows dontinstrument wontreturn void //
|
||||
|
@ -118,7 +119,7 @@ WinThreadEntry(int rdi, // rcx
|
|||
int rc;
|
||||
if (wt->tls)
|
||||
__set_tls_win32(wt->tls);
|
||||
*wt->ctid = GetCurrentThreadId();
|
||||
*wt->ctid = __imp_GetCurrentThreadId();
|
||||
rc = __stack_call(wt->arg, wt->tid, 0, 0, wt->func, wt->sp);
|
||||
// we can now clear ctid directly since we're no longer using our own
|
||||
// stack memory, which can now be safely free'd by the parent thread.
|
||||
|
|
|
@ -69,9 +69,8 @@ uintptr_t GetStackBottom(void) pureconst;
|
|||
* will also trigger the stack to grow down safely.
|
||||
*/
|
||||
forceinline void CheckLargeStackAllocation(void *p, ssize_t n) {
|
||||
for (; n > 0; n -= 4096) {
|
||||
((char *)p)[n - 1] = 0;
|
||||
}
|
||||
for (; n > 0; n -= 4096)
|
||||
((volatile char *)p)[n - 1] = 0;
|
||||
}
|
||||
|
||||
void *NewCosmoStack(void) vallocesque;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue