mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 22:43:40 +00:00
windows: add windows/386 support
This commit is contained in:
committed by
Ron Evans
parent
922ba6a4a3
commit
f542717992
@@ -1,7 +1,12 @@
|
||||
#ifdef _WIN32
|
||||
.global _tinygo_startTask
|
||||
_tinygo_startTask:
|
||||
#else // Linux etc
|
||||
.section .text.tinygo_startTask
|
||||
.global tinygo_startTask
|
||||
.type tinygo_startTask, %function
|
||||
tinygo_startTask:
|
||||
#endif
|
||||
.cfi_startproc
|
||||
// Small assembly stub for starting a goroutine. This is already run on the
|
||||
// new stack, with the callee-saved registers already loaded.
|
||||
@@ -24,12 +29,21 @@ tinygo_startTask:
|
||||
addl $4, %esp
|
||||
|
||||
// After return, exit this goroutine. This is a tail call.
|
||||
#ifdef _WIN32
|
||||
jmp _tinygo_task_exit
|
||||
#else
|
||||
jmp tinygo_task_exit
|
||||
#endif
|
||||
.cfi_endproc
|
||||
|
||||
#ifdef _WIN32
|
||||
.global _tinygo_swapTask
|
||||
_tinygo_swapTask:
|
||||
#else
|
||||
.global tinygo_swapTask
|
||||
.type tinygo_swapTask, %function
|
||||
tinygo_swapTask:
|
||||
#endif
|
||||
// This function gets the following parameters:
|
||||
movl 4(%esp), %eax // newStack uintptr
|
||||
movl 8(%esp), %ecx // oldStack *uintptr
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#ifdef _WIN32
|
||||
.global _tinygo_scanCurrentStack
|
||||
_tinygo_scanCurrentStack:
|
||||
#else
|
||||
.section .text.tinygo_scanCurrentStack
|
||||
.global tinygo_scanCurrentStack
|
||||
.type tinygo_scanCurrentStack, %function
|
||||
tinygo_scanCurrentStack:
|
||||
#endif
|
||||
// Sources:
|
||||
// * https://stackoverflow.com/questions/18024672/what-registers-are-preserved-through-a-linux-x86-64-function-call
|
||||
// * https://godbolt.org/z/q7e8dn
|
||||
@@ -15,7 +20,11 @@ tinygo_scanCurrentStack:
|
||||
// Scan the stack.
|
||||
subl $8, %esp // adjust the stack before the call to maintain 16-byte alignment
|
||||
pushl %esp
|
||||
#ifdef _WIN32
|
||||
calll _tinygo_scanstack
|
||||
#else
|
||||
calll tinygo_scanstack
|
||||
#endif
|
||||
|
||||
// Restore the stack pointer. Registers do not need to be restored as they
|
||||
// were only pushed to be discoverable by the GC.
|
||||
@@ -23,9 +32,14 @@ tinygo_scanCurrentStack:
|
||||
retl
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
.global _tinygo_longjmp
|
||||
_tinygo_longjmp:
|
||||
#else
|
||||
.section .text.tinygo_longjmp
|
||||
.global tinygo_longjmp
|
||||
tinygo_longjmp:
|
||||
#endif
|
||||
// Note: the code we jump to assumes eax is set to a non-zero value if we
|
||||
// jump from here.
|
||||
movl 4(%esp), %eax
|
||||
|
||||
Reference in New Issue
Block a user