flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
tthsqe 12 Sep 2009, 23:47
Could someone post a simple exmple that demonstrates how to use multiple threads in a windows app?
|
|||
![]() |
|
revolution 13 Sep 2009, 03:36
Have a look at this post: http://board.flatassembler.net/topic.php?p=71735#71735
I just upload the simple thread tester again. |
|||
![]() |
|
revolution 14 Sep 2009, 04:34
It is on that stack as the first parameter.
Win32 manual wrote: DWORD WINAPI ThreadFunc( LPVOID lpParam ) |
|||
![]() |
|
tthsqe 14 Sep 2009, 05:23
am I doing something wrong? it doesn't seem to be working
Code: mov [var],7 sub rsp,6*8 mov rcx,0 mov rdx,0 lea r8,[Thread] lea r9,[var] mov qword [rsp+4*8],CREATE_SUSPENDED mov qword [rsp+5*8],0 call [CreateThread] add rsp,6*8 ... Thread: mov rax,[rsp] mov rax,[rax] rax = 7 ? |
|||
![]() |
|
revolution 14 Sep 2009, 05:36
Well since you seem to be using 64bit Windows then the first parameter is of course in a register (complying to the fastcall standard). IIRC it will be in rcx? Anyhow check the fastcall standard to confirm which register the first parameter is placed into.
BTW: For stdcall (with all parameters on the stack) the first parameter is [esp+4]. The return address is always at [esp] (and [rsp]) |
|||
![]() |
|
tthsqe 14 Sep 2009, 06:10
great! I wouldn't have though it would be just like other function calls too. (I kept looking for it somewhere on the stack)
Quote: IIRC it will be in rcx? Yeah, arguments should be passed in Code: rcx, rdx, r8, r9, [rsp+8*4], [rsp+8*5],... and r12-r15 should be preserved by the function. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.