flat assembler
Message board for the users of flat assembler.
Index
> Linux > System calls .inc files |
Author |
|
alkap 13 Jul 2017, 11:34
You don't seem to capture all the system calls there are, as far as I can tell:
Code: sed -n 's/#define\s\s*[_A-Z][_A-Z]*//p' /usr/include/asm/unistd_32.h | sed -n 's/^\([a-z][_a-z]*\)\s\s*\([0-9][0-9]*\)/sys_\1 = \2/p' | wc -l 303 Matching all the defines containing the NR pattern adds up to several more syscalls. See below. Code: sed '/NR/!d;s/#define[^a-z]*//;s/^/sys_/;s/ / = /' /usr/include/asm/unistd_32.h | wc -l 351 The same goes for the 64-bit include file: Code: sed -n 's/#define\s\s*[_A-Z][_A-Z]*//p' /usr/include/asm/unistd_64.h | sed -n 's/^\([a-z][_a-z]*\)\s\s*\([0-9][0-9]*\)/sys_\1 = \2/p' | wc -l 303 Code: sed '/NR/!d;s/#define[^a-z]*//;s/^/sys_/;s/ / = /' /usr/include/asm/unistd_64.h | wc -l 320 |
|||
13 Jul 2017, 11:34 |
|
triplefault 14 Jul 2017, 02:07
alkap wrote: Matching all the defines containing the NR pattern adds up to several more syscalls. You are absolutely right, my regex doesn't match syscalls that contain numbers in their names (like sys_vm86). Thank you for fixing and simplifying it. |
|||
14 Jul 2017, 02:07 |
|
alkap 14 Jul 2017, 05:36
No worries at all.
Thanks for sharing this method of retrieving the syscalls. |
|||
14 Jul 2017, 05:36 |
|
alkap 14 Jul 2017, 19:55
In retrospect, expressions 2 and 3 can be combined, like so:
Code: sed '/NR/!d;s/#define[^a-z]*/sys_/;s/ / = /' /usr/include/asm/unistd_32.h sed '/NR/!d;s/#define[^a-z]*/sys_/;s/ / = /' /usr/include/asm/unistd_64.h |
|||
14 Jul 2017, 19:55 |
|
NEASM 13 May 2018, 13:12
Can you send me that "inc" files? Thanks in advance.
|
|||
13 May 2018, 13:12 |
|
alkap 13 May 2018, 13:32
If you're on a Linux system, you can generate those files by running:
Code: sed '/NR/!d;s/#define[^a-z]*/sys_/;s/ / = /' /usr/include/asm/unistd_32.h >file.inc sed '/NR/!d;s/#define[^a-z]*/sys_/;s/ / = /' /usr/include/asm/unistd_64.h >file.inc |
|||
13 May 2018, 13:32 |
|
revolution 13 May 2018, 16:04
alkap wrote: If you're on a Linux system, you can generate those files by running: |
|||
13 May 2018, 16:04 |
|
alkap 13 May 2018, 20:28
revolution wrote:
System call numbers may differ on various architectures, e.g. the exit systems call numbers on arm, x86_32 and x86_64 are as follows: Code: arch/x86/entry/syscalls/syscall_32.tbl:15 1 common exit sys_exit arch/x86/entry/syscalls/syscall_64.tbl:71 60 common exit __x64_sys_exit arch/arm/tools/syscall.tbl:15 1 common exit sys_exit As far as syscall numbers being consistent across different kernel versions, this reference [1] states that all system calls supported by the kernel must be supported indefinitely. [1] https://www.kernel.org/doc/html/v4.10/process/adding-syscalls.html#designing-the-api-planning-for-extension |
|||
13 May 2018, 20:28 |
|
Furs 16 May 2018, 20:26
revolution wrote: Are the system call numbers the same across all Linux's? I get a bit nervous thinking that some Linux versions might decide to use different values. It's no different than Windows x64 having different calling conventions/ABI than the 32-bit version, even if the API is the same. The "syscall ID" is also different. But for the same architecture it will never change, just like how Windows ABIs/APIs don't (usually?) change. WriteFile won't suddenly decide to pass a parameter into a register instead of on the stack on 32-bit ABI, for example (Windows analogy). (only exception is if the API is so new that barely anyone uses it and a critical problem with it is found, then it's changed, because it is assumed that all the apps which used it (since it's new) will be easily recompiled; I think the term is like at most 1 week to be considered "new") |
|||
16 May 2018, 20:26 |
|
Endre 21 May 2018, 20:44
Look at this.
|
|||
21 May 2018, 20:44 |
|
FlierMate 06 Aug 2021, 17:29
On my Debian 10, the directory name is slightly different, it is :
/usr/include/x86_64-linux-gnu/asm |
|||
06 Aug 2021, 17:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.