From 9e6ff44d9359ce062fb4f0e29c8f4c33eec7781e Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 8 Dec 2011 16:47:33 -0800 Subject: [PATCH] rt: Make __morestack work on win32 --- src/rt/arch/i386/morestack.S | 8 +------- src/rt/arch/i386/record_sp.S | 12 ++++++++---- src/rt/rust_scheduler.cpp | 1 + 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/rt/arch/i386/morestack.S b/src/rt/arch/i386/morestack.S index 30084ec2de0..e90c521a302 100644 --- a/src/rt/arch/i386/morestack.S +++ b/src/rt/arch/i386/morestack.S @@ -21,7 +21,7 @@ #define UPCALL_DEL_STACK _upcall_del_stack #define RUST_GET_TASK _rust_get_task #define UPCALL_CALL_C _upcall_call_shim_on_c_stack -#define MORESTACK __morestack +#define MORESTACK ___morestack #endif #endif @@ -44,7 +44,6 @@ .type MORESTACK,@function #endif -#if defined(__linux__) || defined(__APPLE__) MORESTACK: #ifdef __linux__ .cfi_startproc @@ -144,11 +143,6 @@ MORESTACK: .cfi_endproc #endif -#else -MORESTACK: - ret -#endif - #ifdef __APPLE__ .section __IMPORT,__pointers,non_lazy_symbol_pointers diff --git a/src/rt/arch/i386/record_sp.S b/src/rt/arch/i386/record_sp.S index 3f299de5d15..0c9f0782846 100644 --- a/src/rt/arch/i386/record_sp.S +++ b/src/rt/arch/i386/record_sp.S @@ -16,17 +16,21 @@ RECORD_SP: movl 4(%esp), %eax movl %eax, %gs:48 ret -#else +#endif + #if defined(__APPLE__) RECORD_SP: movl $0x48+90*4, %eax movl 4(%esp), %ecx movl %ecx, %gs:(%eax) ret -#else -RECORD_SP: - ret #endif + +#if defined(_WIN32) +RECORD_SP: + movl 4(%esp), %eax + movl %eax, %fs:0x14 + ret #endif GET_SP: diff --git a/src/rt/rust_scheduler.cpp b/src/rt/rust_scheduler.cpp index 601a7c3f0ef..03567bbe19a 100644 --- a/src/rt/rust_scheduler.cpp +++ b/src/rt/rust_scheduler.cpp @@ -394,6 +394,7 @@ void rust_scheduler::place_task_in_tls(rust_task *task) { BOOL result = TlsSetValue(task_key, task); assert(result && "Couldn't place the task in TLS!"); + task->record_stack_limit(); } rust_task *