setpageattributes.c
vmm/vmm.h
ubixos/kpanic.h
sys/thread.h
ubixos/kpanic.h
ubixos/types.h
sys/_types.h
vmm/paging.h
vmm/vmm.h
src/sys/vmm/setpageattributes.c
sys/sysproto.h
sys/signal.h
int int vmm_setPageAttributes (uInt32 memAddr, uInt16 attributes) vmm_setPageAttributes uInt32 memAddr uInt16 attributes kpanic tablesBaseAddress x1000 elf_loadfile execFile sys_exec sysExec

    /*****************************************************************************************
    Copyright(c)2002TheUbixOSProject
    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: setpageattributes_8c.xml 88 2016-01-12 00:11:29Z reddawg $

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

    #include<vmm/vmm.h>
    #include<ubixos/kpanic.h>

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

    Function:voidvmmSetPageAttributes(uInt32pageAddr,intattributes;
    Description:ThisFunctionWillSetThePageAttributesSuchAs
    AReadOnlyPage,StackPage,COWPage,ETC.
    Notes:

    ************************************************************************/
    intvmm_setPageAttributes(uInt32memAddr,uInt16attributes){
    uInt16directoryIndex=0x0,tableIndex=0x0;
    uInt32*pageTable=0x0;

    /*CalculateThePageDirectoryIndex*/
    directoryIndex=(memAddr>>22);

    /*CalculateThePageTableIndex*/
    tableIndex=((memAddr>>12)&0x3FF);

    /*SetTablePointer*/
    if((pageTable=(uInt32*)(tablesBaseAddress+(0x1000*directoryIndex)))==0x0)
    kpanic("Error:pageTable==NULL,File:%s,Line:%i\n",__FILE__,__LINE__);

    /*SetAttributeIfPageIsMapped*/
    if(pageTable[tableIndex]!=0x0)
    pageTable[tableIndex]=((pageTable[tableIndex]&0xFFFFF000)|attributes);

    /*ReloadThePageTable;*/
    asmvolatile(
    "push%eax\n"
    "movl%cr3,%eax\n"
    "movl%eax,%cr3\n"
    "pop%eax\n"
    );
    /*Return*/
    return(0x0);
    }

    /***
    $Log: setpageattributes_8c.xml,v $
    Revision 1.6  2006/12/19 14:12:52  reddawg
    rtld-elf almost workign

    Revision1.1.1.12006/06/0112:46:13reddawg
    ubix2

    Revision1.22005/10/1200:13:38reddawg
    Removed

    Revision1.1.1.12005/09/2617:24:53reddawg
    nomessage

    Revision1.42004/07/2815:05:43reddawg
    Major:
    Pagesnowhavestrictsecurityenforcement.
    Manynulldereferenceshavebeenresolved.
    Whenappsloadedpermissionssetforpagesrwandro

    Revision1.32004/07/2022:29:55reddawg
    assert:remadeassert

    Revision1.22004/06/1022:23:56reddawg
    Volatiles

    Revision1.1.1.12004/04/1512:06:53reddawg
    UbixOSv1.0

    Revision1.62004/04/1316:36:34reddawg
    Changedourcopyright,itisallnowunderaBSD-Stylelicense

    END
    ***/