diff options
| author | Miguel <m.i@gmx.at> | 2018-09-02 00:08:42 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-02 00:08:42 +0200 |
| commit | 8e3411139b27a3421e9ac75c13f14f99f6dd3137 (patch) | |
| tree | cf8b53ab02863117c310bde11ee4683e134cf1b2 /newlib | |
| parent | 0fff2e6dc6fae82da1c7978918a490c25cc36f04 (diff) | |
syscalls
Diffstat (limited to 'newlib')
| -rw-r--r-- | newlib/syscall.h | 11 | ||||
| -rw-r--r-- | newlib/syscall.s | 16 |
2 files changed, 27 insertions, 0 deletions
diff --git a/newlib/syscall.h b/newlib/syscall.h new file mode 100644 index 0000000..2cadce4 --- /dev/null +++ b/newlib/syscall.h @@ -0,0 +1,11 @@ +/* + * Issue a System Call from Ring 3 / User Space + * + * Accepts up to 3 parameters. + * Check syscalls.h for details. + */ + +uint32_t syscall(uint32_t code, + uint32_t param_1, + uint32_t param_2, + uint32_t param_3); diff --git a/newlib/syscall.s b/newlib/syscall.s new file mode 100644 index 0000000..abce63a --- /dev/null +++ b/newlib/syscall.s @@ -0,0 +1,16 @@ +.global syscall + +syscall: + + push %ebx // preserve (sysV abi convnetion) + + mov 0x8(%esp),%eax //syscall number + mov 0xC(%esp),%edx //p1 + mov 0x10(%esp),%ecx //p2 + mov 0x14(%esp),%ebx //p3 + + int $0x80 + mov %ebx, %eax // set as return value + + pop %ebx // preserve + ret |
