POK
/home/jaouen/pok_official/pok/trunk/libpok/arch/x86/syscall.c
00001 /*
00002  *                               POK header
00003  * 
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team 
00013  *
00014  * Created by julien on Thu Jan 15 23:34:13 2009 
00015  */
00016 
00017 
00018 #include <core/syscall.h>
00019 #include <types.h>
00020 
00021 pok_ret_t pok_do_syscall (pok_syscall_id_t syscall_id, pok_syscall_args_t* args)
00022 {
00023    pok_ret_t   ret;
00024    uint32_t    args_addr;
00025    uint32_t    id;
00026 
00027    args_addr = (uint32_t) args;
00028    id        = (uint32_t) syscall_id;
00029 
00030    asm volatile ( "movl %1,%%eax \n\t"
00031                   "movl %2,%%ebx \n\t"
00032                   "int  $42 \n\t"
00033                   "movl %%eax, %0"
00034                   :"=g"(ret)
00035                   :"g"(id), "g"(args_addr)
00036                   : "%eax" , "%ebx"
00037                   );
00038    return ret;
00039 }
00040