Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

sys.h File Reference

Generic minirighi syscall library. More...

#include <types.h>

Go to the source code of this file.

Defines

#define SYS_exit   0
 Go back to the system.

#define SYS_getchar   1
 Get a char from stdin.

#define SYS_putchar   2
 Put a character on stdout.

#define SYS_malloc   3
 Allocate a memory area.

#define SYS_free   4
 Free a memory area.

#define _syscall0(type, name)
 The core of a system call with no argument.

#define _syscall1(type, name, type1, arg1)
 The core of a system call with 1 argument.

#define _syscall2(type, name, type1, arg1, type2, arg2)
 The core of a system call with 2 argument.

#define _syscall3(type, name, type1, arg1, type2, arg2, type3, arg3)
 The core of a system call with 3 argument.

#define _syscall4(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4)
 The core of a system call with 4 argument.


Functions

__inline__ _syscall1 (int, exit, int, exitcode)
__inline__ _syscall0 (int, getchar)
__inline__ _syscall1 (void, putchar, int, c)
__inline__ _syscall1 (void *, malloc, size_t, size)
__inline__ _syscall1 (void, free, void *, ptr)


Detailed Description

Generic minirighi syscall library.

Author:
Andrea Righi <drizzt@inwind.it>
Date:
Last update: 2003-11-15
Note:
Copyright (©) 2003 Andrea Righi

Definition in file sys.h.


Define Documentation

#define _syscall0 type,
name   
 

Value:

type name(void) \
{ \
        register long __ret; \
        __asm__ __volatile__ ( \
                "pushl  %%ebp\n" \
                "movl   %%esp, %%ebp\n" \
                "int    $0x80\n" \
                "popl   %%ebp" \
        : "=a"(__ret) : "0"(SYS_##name)); \
        return((type)__ret); \
}
The core of a system call with no argument.

Definition at line 25 of file sys.h.

#define _syscall1 type,
name,
type1,
arg1   
 

Value:

type name(type1 arg1) \
{ \
        register long __ret; \
        __asm__ __volatile__ ( \
                "pushl  %%ebp\n" \
                "pushl  %2\n" \
                "movl   %%esp, %%ebp\n" \
                "int    $0x80\n" \
                "add    $4, %%esp\n" \
                "popl   %%ebp" \
        : "=a"(__ret) : "0"(SYS_##name), \
        "r"((long)(arg1))); \
        return((type)__ret); \
}
The core of a system call with 1 argument.

Definition at line 39 of file sys.h.

#define _syscall2 type,
name,
type1,
arg1,
type2,
arg2   
 

Value:

type name(type1 arg1, type2 arg2) \
{ \
        register long __ret; \
        __asm__ __volatile__ ( \
                "pushl  %%ebp\n" \
                "pushl  %2\n" \
                "pushl  %3\n" \
                "movl   %%esp, %%ebp\n" \
                "int    $0x80\n" \
                "add    $8, %%esp\n" \
                "popl   %%ebp" \
        : "=a"(__ret) : "0"(SYS_##name), \
        "r"((long)(arg1)), "r"((long)(arg2))); \
        return((type)__ret); \
}
The core of a system call with 2 argument.

Definition at line 56 of file sys.h.

#define _syscall3 type,
name,
type1,
arg1,
type2,
arg2,
type3,
arg3   
 

Value:

type name(type1 arg1, type2 arg2, type3 arg3) \
{ \
        register long __ret; \
        __asm__ __volatile__ ( \
                "pushl  %%ebp\n" \
                "pushl  %2\n" \
                "pushl  %3\n" \
                "pushl  %4\n" \
                "movl   %%esp, %%ebp\n" \
                "int    $0x80\n" \
                "add    $12, %%esp\n" \
                "popl   %%ebp" \
        : "=a"(__ret) : "0"(SYS_##name), \
        "r"((long)(arg1)), "r"((long)(arg2)), "r"((long)(arg3))); \
        return((type)__ret); \
}
The core of a system call with 3 argument.

Definition at line 74 of file sys.h.

#define _syscall4 type,
name,
type1,
arg1,
type2,
arg2,
type3,
arg3,
type4,
arg4   
 

Value:

type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
{ \
        register long __ret; \
        __asm__ __volatile__ ( \
                "pushl  %%ebp\n" \
                "pushl  %2\n" \
                "pushl  %3\n" \
                "pushl  %4\n" \
                "pushl  %5\n" \
                "movl   %%esp, %%ebp\n" \
                "int    $0x80\n" \
                "add    $16, %%esp\n" \
                "popl   %%ebp" \
        : "=a"(__ret) : "0"(SYS_##name), \
        "r"((long)(arg1)), "r"((long)(arg2)), "r"((long)(arg3)), "r"((long)(arg4))); \
        return((type)__ret); \
}
The core of a system call with 4 argument.

Definition at line 93 of file sys.h.

#define SYS_exit   0
 

Go back to the system.

Definition at line 14 of file sys.h.

#define SYS_free   4
 

Free a memory area.

Definition at line 22 of file sys.h.

#define SYS_getchar   1
 

Get a char from stdin.

Definition at line 16 of file sys.h.

#define SYS_malloc   3
 

Allocate a memory area.

Definition at line 20 of file sys.h.

#define SYS_putchar   2
 

Put a character on stdout.

Definition at line 18 of file sys.h.


Function Documentation

__inline__ _syscall0 int   ,
getchar   
[static]
 

__inline__ _syscall1 void   ,
free   ,
void *   ,
ptr   
[static]
 

__inline__ _syscall1 void *   ,
malloc   ,
size_t   ,
size   
[static]
 

__inline__ _syscall1 void   ,
putchar   ,
int   ,
 
[static]
 

__inline__ _syscall1 int   ,
exit   ,
int   ,
exitcode   
[static]
 


Generated on Fri Feb 20 15:32:20 2004 for Minirighi by doxygen1.2.18