flat assembler
Message board for the users of flat assembler.
Index
> Windows > [content deleted] |
Author |
|
asmcoder 27 Oct 2008, 16:28
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:55; edited 1 time in total |
|||
27 Oct 2008, 16:28 |
|
LocoDelAssembly 27 Oct 2008, 18:52
|
|||
27 Oct 2008, 18:52 |
|
Hrstka 29 Oct 2008, 19:36
Perhaps you mean something like spinlock?
|
|||
29 Oct 2008, 19:36 |
|
asmcoder 16 Nov 2008, 09:47
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:55; edited 1 time in total |
|||
16 Nov 2008, 09:47 |
|
asmfan 16 Nov 2008, 13:26
xchg doesn't need lock prefix at all. this instruction is special about lock.
|
|||
16 Nov 2008, 13:26 |
|
Hrstka 17 Nov 2008, 01:38
Have you read http://en.wikipedia.org/wiki/Spinlock#Example_implementation properly?
Code: lock: ; The lock variable. 1 = locked, 0 = unlocked. dd 0 The lock variable is defined somewhere in YOUR program, not in the kernel. You also have to change the name of the variable, otherwise fasm will complain. Then you do this: Code: call spin_lock ; now you can manipulate your structure without any harm ; ... call spin_unlock Quote: xchg doesn't need lock prefix at all. |
|||
17 Nov 2008, 01:38 |
|
asmfan 17 Nov 2008, 09:47
bitRAKE, it's wrong method of acquiring spinlock. it should be done by lock + cmpxchg(8/16b). test eax,eax can be already invalid.
also i doublt that xchg need memory aligned. if it'is aligned even mov is atomic write instruction (on latest processors). |
|||
17 Nov 2008, 09:47 |
|
Feryno 17 Nov 2008, 11:49
I like this way (simple, no registers destroyed, the PAUSE optimalization for newer CPUs)
Code: call acquire_spinlock ; ... do the job call release_spinlock ret ; subprocedures: acquire_spinlock_pause: pause align 10h acquire_spinlock: lock bts dword [spinlock],0 jc acquire_spinlock_pause ret align 10h release_spinlock: lock btr dword [spinlock],0 ret ; data: spinlock dd 0 |
|||
17 Nov 2008, 11:49 |
|
asmcoder 17 Nov 2008, 13:47
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:55; edited 1 time in total |
|||
17 Nov 2008, 13:47 |
|
asmfan 17 Nov 2008, 15:34
yes i was wrong. xchg is good for this.
cmpxchg is for more complicated situations. pause - it's good point for spin-lock loops. |
|||
17 Nov 2008, 15:34 |
|
asmcoder 17 Nov 2008, 16:04
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:55; edited 1 time in total |
|||
17 Nov 2008, 16:04 |
|
asmfan 17 Nov 2008, 16:34
Suppose it was to me, then you can "safe" UTFG & RTFM lil script-kiddie malware writer. Your posts here on this forum are so pitiful that sometimes i think that you're not a programmer.
if not, please use google and read something. |
|||
17 Nov 2008, 16:34 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.