source: trunk/System/Sources/libc/src/kernel/netbsd/i386/syscalls.S @ 200

Last change on this file since 200 was 200, checked in by khorben, 13 years ago

Merge from upstream

File size: 1.5 KB
Line 
1/* $Id: syscalls.S,v 1.13 2007/09/26 15:00:35 khorben Exp $ */
2/* Copyright (c) 2007 Pierre Pronchery <khorben@defora.org> */
3/* This file is part of DeforaOS System libc */
4/* libc is not free software; you can redistribute it and/or modify it under
5 * the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
6 * Unported as published by the Creative Commons organization.
7 *
8 * libc is distributed in the hope that it will be useful, but WITHOUT ANY
9 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
10 * A PARTICULAR PURPOSE.  See the Creative Commons Attribution-NonCommercial-
11 * ShareAlike 3.0 Unported license for more details.
12 *
13 * You should have received a copy of the Creative Commons Attribution-
14 * NonCommercial-ShareAlike 3.0 along with libc; if not, browse to
15 * http://creativecommons.org/licenses/by-nc-sa/3.0/ */
16/* FIXME:
17 * - some syscalls may return an additional value into %edx (eg lseek) */
18
19
20
21_syscall:
22        int     $0x80
23        jnc     .errnoret
24.errno:
25        mov     %eax, errno
26        mov     $-1, %eax
27.errnoret:
28        ret
29
30
31/* macros */
32#define SYSCALL(name) \
33.global name; \
34.type name,@function; \
35name:; \
36        mov     $SYS_ ## name, %eax; \
37        jmp     _syscall
38
39
40/* functions */
41/* _brk */
42.global _brk
43.type _brk,@function
44_brk:
45        mov     $SYS_brk, %eax
46        int     $0x80
47        jc      .errno
48        ret
49#undef SYS_brk
50
51/* _exit */
52.global _exit
53.type _exit,@function
54_exit:
55        mov     $SYS_exit, %eax
56        jmp     _syscall
57
58/* execve */
59.global execve
60.type execve,@function
61execve:
62        mov     $SYS_execve, %eax
63        int     $0x80
64        mov     %eax, errno
65        mov     $-1, %eax
66        ret
67#undef SYS_execve
Note: See TracBrowser for help on using the repository browser.