syscall_new.c
ubixos/syscalls_new.h
ubixos/sched.h
ubixos/types.h
ubixos/endtask.h
ubixos/spinlock.h
sys/trap.h
lib/string.h
lib/kprintf.h
sys/thread.h
ubixos/sched.h
ubixos/spinlock.h
ubixos/endtask.h
ubixos/types.h
sys/_types.h
lib/string.h
vfs/file.h
sys/tss.h
vfs/mount.h
lib/kprintf.h
ubixfs/dirCache.h
sys/sysproto.h
sys/signal.h
ubixos/tty.h
src/sys/kernel/syscall_new.c
ubixos/syscalls_new.h
sys/trap.h
void void syscall (struct trapframe frame) syscall struct trapframe frame _current EJUSTRETURN ERESTART kprintf memcpy PSL_C systemCalls_new taskStruct::td thread::td_retval trapframe::tf_eax trapframe::tf_edx trapframe::tf_eflags trapframe::tf_eip trapframe::tf_err trapframe::tf_esp totalCalls_new
spinLock_t spinLock_t Master Master SPIN_LOCK_INITIALIZER

    /*****************************************************************************************
    Copyright(c)2002-2004TheUbixOSProject
    Allrightsreserved.

    Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are
    permittedprovidedthatthefollowingconditionsaremet:

    Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof
    conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary
    formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing
    disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided
    withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits
    contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware
    withoutspecificpriorwrittenpermission.

    THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY
    EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF
    MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL
    THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,
    SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT
    OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR
    TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS
    SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE.

    $Id: syscall__new_8c.xml 88 2016-01-12 00:11:29Z reddawg $

    *****************************************************************************************/

    #include<ubixos/syscalls_new.h>
    #include<ubixos/sched.h>
    #include<ubixos/types.h>
    #include<ubixos/endtask.h>
    #include<ubixos/spinlock.h>
    #include<sys/trap.h>
    #include<lib/string.h>
    #include<lib/kprintf.h>

    spinLock_tMaster=SPIN_LOCK_INITIALIZER;

    voidsyscall(structtrapframeframe){
    uInt32code=0x0;
    caddr_tparams;
    structthread*td=&_current->td;
    intargs[8];
    interror=0x0;

    params=(caddr_t)frame.tf_esp+sizeof(int);

    code=frame.tf_eax;
    if(code==198){
    memcpy(&code,params,sizeof(int));
    params+=sizeof(quad_t);
    }

    if(code>totalCalls_new){
    kprintf("InvalidCall:[%i]\n",frame.tf_eax);
    }
    elseif((uInt32)systemCalls_new[code]==0x0){
    kprintf("InvalidCall:[%i][0x%X]\n",code,(uInt32)systemCalls_new[code]);
    frame.tf_eax=-1;
    frame.tf_edx=0x0;
    }
    else{
    memcpy(args,params,8*sizeof(int));
    td->td_retval[0]=0;
    td->td_retval[1]=frame.tf_edx;

    error=(int)systemCalls_new[code](td,args);
    switch(error){
    case0:
    frame.tf_eax=td->td_retval[0];
    frame.tf_edx=td->td_retval[1];
    frame.tf_eflags&=~PSL_C;
    break;
    caseERESTART:
    frame.tf_eip-=frame.tf_err;
    break;
    caseEJUSTRETURN:
    break;
    default:
    frame.tf_eax=error;
    frame.tf_eflags|=PSL_C;
    break;

    }
    }
    }

    /***
    END
    ***/