flat assembler
Message board for the users of flat assembler.
Index
> Linux > linux 2.6+ system calls reference Goto page Previous 1, 2, 3, 4 |
Author |
|
LocoDelAssembly 08 Aug 2010, 18:14
d.j.peters, Yes, I've tried it several times with Ubuntu for AMD64, using INT $80 from a 32-bit executable works correctly (and I think that also SYSENTER and maybe SYSCALL). In 64-bit, you should use SYSCALL instead (which is guaranteed to be available in both Intel and AMD). I think that INT $80 is also available in 64-bit, but I'm not sure (and it is slower anyway). Check the examples in the fasm for Linux package.
|
|||
08 Aug 2010, 18:14 |
|
JohnFound 02 Feb 2013, 14:14
Int 80h is supported in 64 bit Linux, so, all 32 bit ELF executables will work. The only possible problems is if the executable dynamically links to some 32 bit libraries. They are not installed by default, so the application will end with error.
|
|||
02 Feb 2013, 14:14 |
|
keantoken 27 Mar 2013, 01:58
Okay, let's look at the documentation for sys_clone. man clone:
Code: On success, the thread ID of the child process is returned in the call er's thread of execution. On failure, -1 is returned in the caller's context, no child process will be created, and errno will be set appro priately. And now the reference in the first post: Code: If the system call succeeds the return value is 0. If the system call fails the return value is one of the following errno values: This is a direct contradiction. Also, doesn't anyone want to know what the return value is for the CHILD? Huh? How do you tell the child apart from the caller then!? It doesn't appear to be the same way it's done with sys_fork. |
|||
27 Mar 2013, 01:58 |
|
JohnFound 27 Mar 2013, 06:15
keantoken wrote: Okay, let's look at the documentation for sys_clone. man clone: It seems to be the C/C++ wrapper description. There is no "errno" variable actually. The system calls return negative error codes instead. _________________ Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9 |
|||
27 Mar 2013, 06:15 |
|
randall 27 Mar 2013, 15:11
keantoken wrote: Okay, let's look at the documentation for sys_clone. man clone: sys_clone returns thread id (value grater than zero) in the parent thread and zero in the child thread. For example: Code: sys_clone test eax,eax jnz .L0 ; child pop rsi rdi call rsi sys_exit 0 .L0: ; parent |
|||
27 Mar 2013, 15:11 |
|
keantoken 28 Mar 2013, 00:57
Thanks!
You'd think that crucial detail would be included in the linux manpages..? I did figure out the errno thing eventually. |
|||
28 Mar 2013, 00:57 |
|
sleepsleep 26 Jun 2013, 21:45
arafel wrote: Hi, great and thanks! |
|||
26 Jun 2013, 21:45 |
|
JohnFound 23 Feb 2014, 15:44
The lscr help pages about Linux system calls are now accessible online on: http://fresh.flatassembler.net/lscr/
|
|||
23 Feb 2014, 15:44 |
|
FlierMate 02 Oct 2021, 06:25
JohnFound wrote: The lscr help pages about Linux system calls are now accessible online on: http://fresh.flatassembler.net/lscr/ It is very handy to categorize them as tree view, but those are 32-bit system call numbers. Do you happen to have similar list of 64-bit system call numbers in tree view? |
|||
02 Oct 2021, 06:25 |
|
Ali.Z 03 Oct 2021, 22:48
there is no official reference for system calls in assembly, however many people have built their own from linux source.
the best imo is consult the man pages, and please dont check the man pages online; check them locally, i.e. man command. things to do: - read "/usr/include/x86_64-linux-gnu/asm/unistd_64.h" - execute "man 2 syscall" - execute "man ..." replace the dots with your desired function name to get its return value/errno and arg list. (e.g. "man lseek") the header file lists all functions and their numbers, and syscall man page gives you info regarding your target architecture; calling conventions and few other things.
_________________ Asm For Wise Humans |
||||||||||
03 Oct 2021, 22:48 |
|
bitRAKE 04 Oct 2021, 03:19
There is a handy compact table at:
https://github.com/torvalds/linux/blob/master/arch/x86/entry/syscalls/syscall_64.tbl Looking at the source, it is interesting to note that although many seem to use RAX for the call number, EAX is always extended as the value type is int. These kinds of discrepancies have me always wanting to grep the source to understand the correct typing of parameters. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
04 Oct 2021, 03:19 |
|
Goto page Previous 1, 2, 3, 4 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.