unmappage.c
vmm/vmm.h
sys/thread.h
ubixos/types.h
sys/_types.h
vmm/paging.h
vmm/vmm.h
sys/sysproto.h
src/sys/vmm/unmappage.c
sys/signal.h
void void vmmUnmapPage (uInt32 pageAddr, int flags) vmmUnmapPage uInt32 pageAddr int flags tablesBaseAddress x1000 vmm_pageFault vmmCopyVirtualSpace vmmCreateVirtualSpace vmmMapFromTask
void void vmmUnmapPages (void *ptr, uInt32 size) vmmUnmapPages void * ptr uInt32 size tablesBaseAddress

    /*****************************************************************************************
    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: unmappage_8c.xml 88 2016-01-12 00:11:29Z reddawg $

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

    #include<vmm/vmm.h>

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

    Function:voidvmmUnmapPage(uInt32pageAddr,intflags);
    Description:ThisFunctionWillUnmapAPageFromTheKernelVMSpace
    TheFlagsVariableDecidesIfItsToFreeThePageOrNot
    AFlagOf0WillFreeItAndAFlagOf1WillKeepIt
    Notes:

    07/30/02-IHaveDecidedThatThisShouldFreeThePhysicalPageThere
    IsNoReasonToKeepItMarkedAsNotAvailable

    07/30/02-OkAFoundAReasonToKeepItMarkedAsAvailableIAdmit
    EvenIAmNotPerfectOkTheCaseWhereYouWouldn'tWantTo
    FreeItWouldBeOnSomethingLikeWhereIAllocatedAPage
    ToCreateANewVirtualSpaceSoNowItHasAFlag

    ************************************************************************/
    void
    vmmUnmapPage(uInt32pageAddr,intflags)
    {
    intpageDirectoryIndex=0,pageTableIndex=0;
    uInt32*pageTable=0x0;

    /*GetTheIndexToThePageDirectory*/
    pageDirectoryIndex=(pageAddr>>22);

    //CalculateThePageTableIndex
    pageTableIndex=((pageAddr>>12)&0x3FF);

    /*SetpageTableToTheVirtualAddressOfTable*/
    pageTable=(uInt32*)(tablesBaseAddress+(0x1000*pageDirectoryIndex));
    /*FreeThePhysicalPageIfFlagsIs0*/
    if(flags==0){

    /*
    *ThisistempithinkitsstillanissueclearVirtualPage(pageAddr);
    *freePage((uInt32)(pageTable[pageTableIndex]&0xFFFFF000));
    */
    }
    /*UnmapThePage*/
    pageTable[pageTableIndex]=0x0;
    /*RehashThePageDirectory*/
    asmvolatile(
    "movl%cr3,%eax\n"
    "movl%eax,%cr3\n"
    );
    /*Return*/
    return;
    }

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

    Function:voidvmmUnmapPages(uInt32pageAddr,intflags);
    Description:ThisFunctionWillUnmapAPageFromTheKernelVMSpace
    TheFlagsVariableDecidesIfItsToFreeThePageOrNot
    AFlagOf0WillFreeItAndAFlagOf1WillKeepIt
    Notes:

    07/30/02-IHaveDecidedThatThisShouldFreeThePhysicalPageThere
    IsNoReasonToKeepItMarkedAsNotAvailable

    07/30/02-OkAFoundAReasonToKeepItMarkedAsAvailableIAdmit
    EvenIAmNotPerfectOkTheCaseWhereYouWouldn'tWantTo
    FreeItWouldBeOnSomethingLikeWhereIAllocatedAPage
    ToCreateANewVirtualSpaceSoNowItHasAFlag

    ************************************************************************/
    voidvmmUnmapPages(void*ptr,uInt32size){
    uInt32baseAddr=(uInt32)ptr&0xFFFFF000;
    uInt32dI=0x0,tI=0x0;
    uInt32y=0x0;
    uInt32*pageTable=0x0;

    dI=(baseAddr/(1024*4096));
    tI=((baseAddr-(dI*(1024*4096)))/4096);
    pageTable=(uInt32*)(tablesBaseAddress+(4096*dI));
    for(y=tI;y<(tI+((size+4095)/4096));y++){
    pageTable[y]=0x0;
    }
    return;
    }

    /***
    $Log: unmappage_8c.xml,v $
    Revision 1.6  2006/12/19 14:12:54  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:54reddawg
    nomessage

    Revision1.42004/07/2619:15:49reddawg
    testcode,fixesandthelike

    Revision1.32004/06/1512:35:05reddawg
    CleanedUp

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

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

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

    END
    ***/