flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
LocoDelAssembly 28 Mar 2011, 21:51
Perhaps it is not the problem but are you sure you have to use so few registers to pass the parameters?
If you are following this prototype: Code: int sys_futex(void *futex, int op, int val, const struct timespec *timeout, void *futex2, int val3); Then I would try this: Code: mov eax, sys_futex mov ebx, futex mov ecx, [op] mov edx, [val] mov esi, timeout mov edi, futex2 mov ebp, [val3] int $80 [edit]The 6th parameter goes in EBP, not the stack, so I've corrected that[/edit] |
|||
![]() |
|
JohnFound 28 Mar 2011, 22:08
I know that when parameters are up to 5 they are placed in ebx, ecx, edx, esi and edi. With 6 or more parameters - ebx contains pointer to memory that contains parameters. In both cases eax contains the number of the system function.
|
|||
![]() |
|
LocoDelAssembly 28 Mar 2011, 22:27
http://www.win.tue.nl/~aeb/linux/lk/lk-4.html wrote: 4.3 System call parameters I think your function was added after all these changes so probably you should use registers only. Also in http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.38.y.git;a=blob;f=arch/x86/ia32/ia32entry.S;h=518bb99c339480820fc3995b1456d29704d67f07;hb=HEAD#l386 you'll see EBP as well (although I'm not so sure if this is actual proof or if something happens earlier to get everything mapped as the comments say) |
|||
![]() |
|
JohnFound 29 Mar 2011, 04:42
I see now. And I understand why mmap2 didn't work, so I was forced to use old one.
![]() Thanks for the help. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.