# sys_call_new.S

Go to the documentation of this file.

    00001 /*****************************************************************************************
    00002  Copyright (c) 2002-2004 The UbixOS Project
    00003  All rights reserved.
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are
    00006  permitted provided that the following conditions are met:
    00007
    00008  Redistributions of source code must retain the above copyright notice, this list of
    00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
    00010  form must reproduce the above copyright notice, this list of conditions, the following
    00011  disclaimer and the list of authors in the documentation and/or other materials provided
    00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
    00013  contributors may be used to endorse or promote products derived from this software
    00014  without specific prior written permission.
    00015
    00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00025
    00026  $Id: sys__call__new_8S-source.html 88 2016-01-12 00:11:29Z reddawg $
    00027
    00028 *****************************************************************************************/
    00029
    00030 #define FAKE_MCOUNT(caller)     pushl caller ; call __mcount ; popl %ecx
    00031
    00032 .globl _sysCall_new
    00033 .text
    00034 .code32
    00035 _sysCall_new:
    00036   pushl   $2                      /* sizeof "int 0x80" */
    00037   subl    $4,%esp                 /* skip over tf_trapno */
    00038   pushal
    00039   pushl   %ds
    00040   pushl   %es
    00041   pushl   %fs
    00042   /* switch to kernel segments */
    00043   movl    $0x10,%eax
    00044   movl    %eax,%ds
    00045   movl    %eax,%es
    00046   movl    %eax,%fs
    00047   //FAKE_MCOUNT(TF_EIP(%esp))
    00048   call    syscall
    00049   //MEXITCOUNT
    00050   //jmp     doreti
    00051   popl    %fs
    00052   popl    %es
    00053   popl    %ds
    00054   popal
    00055   addl    $8,%esp
    00056   iret
    00057
    00058 invalidSysCall:
    00059   push %eax
    00060   call invalidCall
    00061   pop %eax
    00062   movl $-1,%eax
    00063   iret
    00064
    00065 /***
    00066  END
    00067  ***/
    00068