Newer
Older
UbixOS / doc / xml / vmm__memory_8c.xml
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16">
  <compounddef id="vmm__memory_8c" kind="file" language="C++">
    <compoundname>vmm_memory.c</compoundname>
    <includes refid="vmm_8h" local="no">vmm/vmm.h</includes>
    <includes refid="io_8h" local="no">sys/io.h</includes>
    <includes refid="kpanic_8h" local="no">ubixos/kpanic.h</includes>
    <includes refid="kprintf_8h" local="no">lib/kprintf.h</includes>
    <includes refid="kmalloc_8h" local="no">lib/kmalloc.h</includes>
    <includes refid="vitals_8h" local="no">ubixos/vitals.h</includes>
    <includes refid="spinlock_8h" local="no">ubixos/spinlock.h</includes>
    <includes refid="assert_8h" local="no">assert.h</includes>
    <includes refid="i386_2cpu_8h" local="no">i386/cpu.h</includes>
    <incdepgraph>
      <node id="23">
        <label>ufs/ufs.h</label>
        <link refid="ufs_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="24" relation="include">
        </childnode>
      </node>
      <node id="29">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="27">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="26">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="47">
        <label>net/pbuf.h</label>
        <link refid="pbuf_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="42" relation="include">
        </childnode>
      </node>
      <node id="34">
        <label>net/net.h</label>
        <link refid="net_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="35" relation="include">
        </childnode>
      </node>
      <node id="52">
        <label>net/priv/memp_priv.h</label>
        <link refid="memp__priv_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="49" relation="include">
        </childnode>
      </node>
      <node id="15">
        <label>i386/cpu.h</label>
        <link refid="i386_2cpu_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="10">
        <label>vmm/paging.h</label>
        <link refid="paging_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>sys/select.h</label>
        <link refid="select_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
        <childnode refid="9" relation="include">
        </childnode>
      </node>
      <node id="19">
        <label>vfs/inode.h</label>
        <link refid="inode_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="21" relation="include">
        </childnode>
        <childnode refid="22" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
      </node>
      <node id="32">
        <label>ubixos/spinlock.h</label>
        <link refid="spinlock_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="40">
        <label>net/arch/cc.h</label>
        <link refid="cc_8h"/>
        <childnode refid="41" relation="include">
        </childnode>
      </node>
      <node id="9">
        <label>sys/_sigset.h</label>
        <link refid="__sigset_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>vmm/vmm.h</label>
        <link refid="vmm_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
      </node>
      <node id="31">
        <label>ubixos/vitals.h</label>
        <link refid="vitals_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="32" relation="include">
        </childnode>
        <childnode refid="33" relation="include">
        </childnode>
      </node>
      <node id="30">
        <label>lib/kmalloc.h</label>
        <link refid="kmalloc_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="49">
        <label>net/mem.h</label>
        <link refid="mem_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
      </node>
      <node id="48">
        <label>net/stats.h</label>
        <link refid="stats_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="49" relation="include">
        </childnode>
        <childnode refid="50" relation="include">
        </childnode>
      </node>
      <node id="33">
        <label>vfs/vfs.h</label>
        <link refid="include_2vfs_2vfs_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
        <childnode refid="25" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="34" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
      </node>
      <node id="37">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="25">
        <label>vfs/mount.h</label>
        <link refid="mount_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>sys/resource.h</label>
        <link refid="resource_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="14">
        <label>sys/trap.h</label>
        <link refid="trap_8h"/>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>sys/types.h</label>
        <link refid="include_2sys_2types_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
        <childnode refid="5" relation="include">
        </childnode>
      </node>
      <node id="17">
        <label>vfs/file.h</label>
        <link refid="include_2vfs_2file_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="19" relation="include">
        </childnode>
        <childnode refid="25" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
      </node>
      <node id="44">
        <label>net/def.h</label>
        <link refid="def_8h"/>
        <childnode refid="39" relation="include">
        </childnode>
        <childnode refid="36" relation="include">
        </childnode>
      </node>
      <node id="35">
        <label>net/netif.h</label>
        <link refid="netif_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="42" relation="include">
        </childnode>
        <childnode refid="43" relation="include">
        </childnode>
        <childnode refid="44" relation="include">
        </childnode>
        <childnode refid="47" relation="include">
        </childnode>
        <childnode refid="48" relation="include">
        </childnode>
      </node>
      <node id="39">
        <label>net/arch.h</label>
        <link refid="arch_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="40" relation="include">
        </childnode>
        <childnode refid="28" relation="include">
        </childnode>
        <childnode refid="27" relation="include">
        </childnode>
      </node>
      <node id="22">
        <label>fs/msdos_fs.h</label>
        <link refid="msdos__fs_8h"/>
      </node>
      <node id="53">
        <label>assert.h</label>
        <link refid="assert_8h"/>
      </node>
      <node id="12">
        <label>sys/signal.h</label>
        <link refid="sys_2signal_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="21">
        <label>fs/pipe_fs.h</label>
        <link refid="pipe__fs_8h"/>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c</label>
        <link refid="vmm__memory_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
        <childnode refid="27" relation="include">
        </childnode>
        <childnode refid="28" relation="include">
        </childnode>
        <childnode refid="30" relation="include">
        </childnode>
        <childnode refid="31" relation="include">
        </childnode>
        <childnode refid="32" relation="include">
        </childnode>
        <childnode refid="53" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="20">
        <label>ubixos/wait.h</label>
        <link refid="wait_8h"/>
      </node>
      <node id="46">
        <label>net/ip6_addr.h</label>
        <link refid="ip6__addr_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="44" relation="include">
        </childnode>
      </node>
      <node id="36">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="37" relation="include">
        </childnode>
        <childnode refid="38" relation="include">
        </childnode>
      </node>
      <node id="28">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="29" relation="include">
        </childnode>
      </node>
      <node id="38">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
        <childnode refid="39" relation="include">
        </childnode>
        <childnode refid="36" relation="include">
        </childnode>
      </node>
      <node id="45">
        <label>net/ip4_addr.h</label>
        <link refid="ip4__addr_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="44" relation="include">
        </childnode>
      </node>
      <node id="43">
        <label>net/ip_addr.h</label>
        <link refid="ip__addr_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="44" relation="include">
        </childnode>
        <childnode refid="45" relation="include">
        </childnode>
        <childnode refid="46" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>sys/thread.h</label>
        <link refid="thread_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="14" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
      </node>
      <node id="51">
        <label>net/priv/memp_std.h</label>
        <link refid="memp__std_8h"/>
      </node>
      <node id="6">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="41">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="42">
        <label>net/err.h</label>
        <link refid="err_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="39" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="24">
        <label>sys/device.h</label>
        <link refid="include_2sys_2device_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>sys/sysproto_posix.h</label>
        <link refid="sysproto__posix_8h"/>
        <childnode refid="12" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
      </node>
      <node id="18">
        <label>ubixfs/dirCache.h</label>
        <link refid="dirCache_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="8">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="50">
        <label>net/memp.h</label>
        <link refid="memp_8h"/>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="51" relation="include">
        </childnode>
        <childnode refid="52" relation="include">
        </childnode>
        <childnode refid="48" relation="include">
        </childnode>
      </node>
    </incdepgraph>
      <sectiondef kind="var">
      <memberdef kind="variable" id="vmm__memory_8c_1ab1ef4044a44489f716ae08c6b79e0f6e" prot="public" static="yes" mutable="no">
        <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
        <definition>uint32_t freePages</definition>
        <argsstring></argsstring>
        <name>freePages</name>
        <initializer>= 0</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="41" column="17" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="41" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" prot="public" static="no" mutable="no">
        <type>int</type>
        <definition>int numPages</definition>
        <argsstring></argsstring>
        <name>numPages</name>
        <initializer>= 0x0</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="45" column="5" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="45" bodyend="-1"/>
        <referencedby refid="vmm__memory_8c_1a4fc8ad0b76f4382b01c4a0e53529750c" compoundref="vmm__memory_8c" startline="57" endline="99">vmm_memMapInit</referencedby>
        <referencedby refid="paging_8c_1af47a45e3f0802f5aac053808127aaaf1" compoundref="paging_8c" startline="58" endline="187">vmm_pagingInit</referencedby>
      </memberdef>
      <memberdef kind="variable" id="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" prot="public" static="no" mutable="no">
        <type><ref refid="structmMap" kindref="compound">mMap</ref> *</type>
        <definition>mMap* vmmMemoryMap</definition>
        <argsstring></argsstring>
        <name>vmmMemoryMap</name>
        <initializer>= (<ref refid="structmMap" kindref="compound">mMap</ref> *) <ref refid="vmm_8h_1a1e10465731ac6cbfc253ce7d89ae34c8" kindref="member">VMM_MMAP_ADDR_RMODE</ref></initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="47" column="6" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="47" bodyend="-1"/>
        <referencedby refid="vmm__memory_8c_1a38c3fe6ce5f3bf8af4a0631d4c41b0ba" compoundref="vmm__memory_8c" startline="262" endline="290">freePage</referencedby>
        <referencedby refid="vmm__memory_8c_1a4fc8ad0b76f4382b01c4a0e53529750c" compoundref="vmm__memory_8c" startline="57" endline="99">vmm_memMapInit</referencedby>
        <referencedby refid="paging_8c_1af47a45e3f0802f5aac053808127aaaf1" compoundref="paging_8c" startline="58" endline="187">vmm_pagingInit</referencedby>
      </memberdef>
      <memberdef kind="variable" id="vmm__memory_8c_1ad053c35b5c07eb917986abe7d32dadcb" prot="public" static="yes" mutable="no">
        <type>struct <ref refid="structspinLock" kindref="compound">spinLock</ref></type>
        <definition>struct spinLock vmmSpinLock</definition>
        <argsstring></argsstring>
        <name>vmmSpinLock</name>
        <initializer>= <ref refid="spinlock_8h_1a0fe85a4f3642683148b25916d6c5eafd" kindref="member">SPIN_LOCK_INITIALIZER</ref></initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="41" column="17" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="42" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="vmm__memory_8c_1a362d462b3a1e19b5e0ef95e1839dbf11" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int adjustCowCounter</definition>
        <argsstring>(uInt32 baseAddr, int adjustment)</argsstring>
        <name>adjustCowCounter</name>
        <param>
          <type><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref></type>
          <declname>baseAddr</declname>
        </param>
        <param>
          <type>int</type>
          <declname>adjustment</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="303" column="5" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="303" bodyend="328"/>
        <references refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" compoundref="assert_8h" startline="64">assert</references>
        <references refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" compoundref="paging_8h" startline="37">PAGE_SIZE</references>
        <references refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" compoundref="armv6_2spinlock_8c" startline="55" endline="61">spinLock</references>
      </memberdef>
      <memberdef kind="function" id="vmm__memory_8c_1a1a89fbc2f80ca828332c5ef31801faa3" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int countMemory</definition>
        <argsstring>()</argsstring>
        <name>countMemory</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="109" column="5" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="109" bodyend="210"/>
        <references refid="io_8h_1a77b934268de1b3ecdcf3f275413b3108" compoundref="io_8c" startline="38" endline="46">inportByte</references>
        <references refid="io_8h_1a8acc1a06073db2e7b92ffbd00fbd0cf1" compoundref="io_8c" startline="72" endline="78">outportByte</references>
        <referencedby refid="vmm__memory_8c_1a4fc8ad0b76f4382b01c4a0e53529750c" compoundref="vmm__memory_8c" startline="57" endline="99">vmm_memMapInit</referencedby>
      </memberdef>
      <memberdef kind="function" id="vmm__memory_8c_1a38c3fe6ce5f3bf8af4a0631d4c41b0ba" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int freePage</definition>
        <argsstring>(uint32_t pageAddr)</argsstring>
        <name>freePage</name>
        <param>
          <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
          <declname>pageAddr</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="262" column="5" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="262" bodyend="290"/>
        <references refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" compoundref="assert_8h" startline="64">assert</references>
        <references refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" compoundref="armv6_2spinlock_8c" startline="55" endline="61">spinLock</references>
        <references refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" compoundref="vmm__memory_8c" startline="47">vmmMemoryMap</references>
        <referencedby refid="unmappage_8c_1a58fb96856e9c4c2e85b31a779afb097d" compoundref="unmappage_8c" startline="47" endline="81">vmm_unmapPage</referencedby>
      </memberdef>
      <memberdef kind="function" id="vmm__memory_8c_1ab8e4e189a7b1df2a03072ce5b75c89fe" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
        <definition>uint32_t vmm_findFreePage</definition>
        <argsstring>(pidType pid)</argsstring>
        <name>vmm_findFreePage</name>
        <param>
          <type><ref refid="include_2sys_2types_8h_1ae438ba74394b14d7b24b6df3b3b8c252" kindref="member">pidType</ref></type>
          <declname>pid</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="221" column="10" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="221" bodyend="252"/>
        <references refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" compoundref="armv6_2kpanic_8c" startline="41" endline="61">kpanic</references>
        <references refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" compoundref="armv6_2spinlock_8c" startline="55" endline="61">spinLock</references>
        <references refid="kmalloc_8h_1a81d09bc848b49133401b3efeeb65f1af" compoundref="kmalloc_8h" startline="38">sysID</references>
        <referencedby refid="kernel_2elf_8c_1aaf5f82fbbff76c71fcefe513c40730b4" compoundref="kernel_2elf_8c" startline="37" endline="137">elf_load_file</referencedby>
        <referencedby refid="exec_8c_1af80d4412d42ed1b5bf9a1b9774230f33" compoundref="exec_8c" startline="153" endline="330">execFile</referencedby>
        <referencedby refid="vmm__mmap_8c_1ac6b3ef6da47d002e7ff528f9a8e75012" compoundref="vmm__mmap_8c" startline="75" endline="153">freebsd6_mmap</referencedby>
        <referencedby refid="kmod_8c_1a92b68dbf95bf5d651555a4c02ee1a74b" compoundref="kmod_8c" startline="70" endline="207">kmod_load</referencedby>
        <referencedby refid="ld_8c_1add6ca1fb619f0bc0f4addffbfc5577a7" compoundref="ld_8c" startline="40" endline="194">ldEnable</referencedby>
        <referencedby refid="vmm__mmap_8c_1a34f95e2ffa8a4bb4ca88918a3a3af580" compoundref="vmm__mmap_8c" startline="162" endline="220">sys_mmap</referencedby>
        <referencedby refid="exec_8c_1a219681612352232186a0f568457d851d" compoundref="exec_8c" startline="340" endline="545">sysExec</referencedby>
        <referencedby refid="vmm__allocpagetable_8c_1ab5107978c7d2053460e2d890e4fd6242" compoundref="vmm__allocpagetable_8c" startline="7" endline="46">vmm_allocPageTable</referencedby>
        <referencedby refid="paging_8c_1a3615feeeee9f4038cd1070372ccba22e" compoundref="paging_8c" startline="291" endline="346">vmm_getFreeKernelPage</referencedby>
        <referencedby refid="paging_8c_1af47a45e3f0802f5aac053808127aaaf1" compoundref="paging_8c" startline="58" endline="187">vmm_pagingInit</referencedby>
      </memberdef>
      <memberdef kind="function" id="vmm__memory_8c_1a6a46a3d519d9f38f00d8b00d2ce60e04" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void vmm_freeProcessPages</definition>
        <argsstring>(pidType pid)</argsstring>
        <name>vmm_freeProcessPages</name>
        <param>
          <type><ref refid="include_2sys_2types_8h_1ae438ba74394b14d7b24b6df3b3b8c252" kindref="member">pidType</ref></type>
          <declname>pid</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="342" column="6" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="342" bodyend="393"/>
        <references refid="paging_8h_1a1b0f37794d3da1a86f1df77e503ed98f" compoundref="paging_8h" startline="45">PD_BASE_ADDR</references>
        <references refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" compoundref="armv6_2spinlock_8c" startline="55" endline="61">spinLock</references>
        <referencedby refid="i386_2systemtask_8c_1ac7cc6a806237f8657fcdce169319fd7f" compoundref="i386_2systemtask_8c" startline="46" endline="131">systemTask</referencedby>
      </memberdef>
      <memberdef kind="function" id="vmm__memory_8c_1a4fc8ad0b76f4382b01c4a0e53529750c" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int vmm_memMapInit</definition>
        <argsstring>()</argsstring>
        <name>vmm_memMapInit</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" line="57" column="5" bodyfile="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c" bodystart="57" bodyend="99"/>
        <references refid="vmm__memory_8c_1a1a89fbc2f80ca828332c5ef31801faa3" compoundref="vmm__memory_8c" startline="109" endline="210">countMemory</references>
        <references refid="structmMap_1a2fb919d9c0a2653979ed667d59a395cb" compoundref="vmm_8h" startline="107">mMap::cowCounter</references>
        <references refid="vmm_8h_1a41dc1abc6436bd66a4269de8ab471181" compoundref="vmm_8h" startline="42">memNotavail</references>
        <references refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" compoundref="vmm__memory_8c" startline="45">numPages</references>
        <references refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" compoundref="paging_8h" startline="37">PAGE_SIZE</references>
        <references refid="structmMap_1a4d15e398d755e47c972d2b87e71c40ce" compoundref="vmm_8h" startline="103">mMap::pageAddr</references>
        <references refid="structmMap_1ad72d5f52b2195f98e60aa61ed52ae9b1" compoundref="vmm_8h" startline="106">mMap::pid</references>
        <references refid="structmMap_1a94139af73246d6ef3bae0f34d4182acd" compoundref="vmm_8h" startline="104">mMap::status</references>
        <references refid="vmm_8h_1a1e10465731ac6cbfc253ce7d89ae34c8" compoundref="vmm_8h" startline="51">VMM_MMAP_ADDR_RMODE</references>
        <references refid="vmm_8h_1ae6c443b60824c02f199f51cf4a14e9f4" compoundref="vmm_8h" startline="43">vmmID</references>
        <references refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" compoundref="vmm__memory_8c" startline="47">vmmMemoryMap</references>
        <referencedby refid="vmm__init_8c_1aac183f585641487a954ca46c0d7bde31" compoundref="vmm__init_8c" startline="43" endline="51">vmm_init</referencedby>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="comment">/*-</highlight></codeline>
<codeline lineno="2"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2002-2018<sp/>The<sp/>UbixOS<sp/>Project.</highlight></codeline>
<codeline lineno="3"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="5"><highlight class="comment"><sp/>*<sp/>This<sp/>was<sp/>developed<sp/>by<sp/>Christopher<sp/>W.<sp/>Olsen<sp/>for<sp/>the<sp/>UbixOS<sp/>Project.</highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="7"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/>modification,<sp/>are<sp/>permitted</highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>*<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/>1)<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/>notice,<sp/>this<sp/>list<sp/>of</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>conditions,<sp/>the<sp/>following<sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors.</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*<sp/>2)<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,<sp/>this<sp/>list<sp/>of</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>conditions,<sp/>the<sp/>following<sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors<sp/>in<sp/>the<sp/>documentation<sp/>and/or</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/>3)<sp/>Neither<sp/>the<sp/>name<sp/>of<sp/>the<sp/>UbixOS<sp/>Project<sp/>nor<sp/>the<sp/>names<sp/>of<sp/>its<sp/>contributors<sp/>may<sp/>be<sp/>used<sp/>to</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>endorse<sp/>or<sp/>promote<sp/>products<sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>permission.</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>AND<sp/>CONTRIBUTORS<sp/>&quot;AS<sp/>IS&quot;<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS</highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>*<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>THE<sp/>COPYRIGHT<sp/>OWNER<sp/>OR<sp/>CONTRIBUTORS</highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES</highlight></codeline>
<codeline lineno="23"><highlight class="comment"><sp/>*<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,</highlight></codeline>
<codeline lineno="24"><highlight class="comment"><sp/>*<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline>
<codeline lineno="25"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT</highlight></codeline>
<codeline lineno="26"><highlight class="comment"><sp/>*<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="27"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="vmm_8h" kindref="compound">vmm/vmm.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="io_8h" kindref="compound">sys/io.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="kpanic_8h" kindref="compound">ubixos/kpanic.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="kprintf_8h" kindref="compound">lib/kprintf.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="kmalloc_8h" kindref="compound">lib/kmalloc.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="34"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="vitals_8h" kindref="compound">ubixos/vitals.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="spinlock_8h" kindref="compound">ubixos/spinlock.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="assert_8h" kindref="compound">assert.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="37"><highlight class="normal"></highlight></codeline>
<codeline lineno="38"><highlight class="normal"></highlight><highlight class="comment">//MrOlsen<sp/>(2016-01-11)<sp/>NOTE:<sp/>Need<sp/>to<sp/>Seperate<sp/>Out<sp/>CPU<sp/>Specific<sp/>Stuff<sp/>Over<sp/>Time</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="i386_2cpu_8h" kindref="compound">i386/cpu.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>freePages<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="42"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structspinLock" kindref="compound">spinLock</ref><sp/>vmmSpinLock<sp/>=<sp/><ref refid="spinlock_8h_1a0fe85a4f3642683148b25916d6c5eafd" kindref="member">SPIN_LOCK_INITIALIZER</ref>;</highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight><highlight class="comment">//static<sp/>struct<sp/>spinLock<sp/>vmmCowSpinLock<sp/>=<sp/>SPIN_LOCK_INITIALIZER;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"></highlight></codeline>
<codeline lineno="45" refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" kindref="member">numPages</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight></codeline>
<codeline lineno="47" refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" refkind="member"><highlight class="normal"><ref refid="structmMap" kindref="compound">mMap</ref><sp/>*<ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref><sp/>=<sp/>(<ref refid="structmMap" kindref="compound">mMap</ref><sp/>*)<sp/><ref refid="vmm_8h_1a1e10465731ac6cbfc253ce7d89ae34c8" kindref="member">VMM_MMAP_ADDR_RMODE</ref>;</highlight></codeline>
<codeline lineno="48"><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight><highlight class="comment">/************************************************************************</highlight></codeline>
<codeline lineno="50"><highlight class="comment"></highlight></codeline>
<codeline lineno="51"><highlight class="comment"><sp/>Function:<sp/>void<sp/>vmm_memMapInit();</highlight></codeline>
<codeline lineno="52"><highlight class="comment"><sp/>Description:<sp/>This<sp/>Function<sp/>Initializes<sp/>The<sp/>Memory<sp/>Map<sp/>For<sp/>the<sp/>System</highlight></codeline>
<codeline lineno="53"><highlight class="comment"><sp/>Notes:</highlight></codeline>
<codeline lineno="54"><highlight class="comment"></highlight></codeline>
<codeline lineno="55"><highlight class="comment"><sp/>02/20/2004<sp/>-<sp/>Made<sp/>It<sp/>Report<sp/>Real<sp/>And<sp/>Available<sp/>Memory</highlight></codeline>
<codeline lineno="56"><highlight class="comment"></highlight></codeline>
<codeline lineno="57" refid="vmm__memory_8c_1a4fc8ad0b76f4382b01c4a0e53529750c" refkind="member"><highlight class="comment"><sp/>************************************************************************/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vmm__memory_8c_1a4fc8ad0b76f4382b01c4a0e53529750c" kindref="member">vmm_memMapInit</ref>()<sp/>{</highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>memStart<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="61"><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Count<sp/>System<sp/>Memory<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/><ref refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" kindref="member">numPages</ref><sp/>=<sp/><ref refid="vmm__memory_8c_1a1a89fbc2f80ca828332c5ef31801faa3" kindref="member">countMemory</ref>();</highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>Memory<sp/>Map<sp/>To<sp/>Point<sp/>To<sp/>First<sp/>Physical<sp/>Page<sp/>That<sp/>We<sp/>Will<sp/>Use<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref><sp/>=<sp/>(<ref refid="structmMap" kindref="compound">mMap</ref><sp/>*)<sp/><ref refid="vmm_8h_1a1e10465731ac6cbfc253ce7d89ae34c8" kindref="member">VMM_MMAP_ADDR_RMODE</ref>;</highlight></codeline>
<codeline lineno="67"><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Initialize<sp/>Map<sp/>Make<sp/>All<sp/>Pages<sp/>Not<sp/>Available<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0x0;<sp/>i<sp/>&lt;<sp/><ref refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" kindref="member">numPages</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1a2fb919d9c0a2653979ed667d59a395cb" kindref="member">cowCounter</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1a94139af73246d6ef3bae0f34d4182acd" kindref="member">status</ref><sp/>=<sp/><ref refid="vmm_8h_1a41dc1abc6436bd66a4269de8ab471181" kindref="member">memNotavail</ref>;</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1ad72d5f52b2195f98e60aa61ed52ae9b1" kindref="member">pid</ref><sp/>=<sp/><ref refid="vmm_8h_1ae6c443b60824c02f199f51cf4a14e9f4" kindref="member">vmmID</ref>;</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1a4d15e398d755e47c972d2b87e71c40ce" kindref="member">pageAddr</ref><sp/>=<sp/>i<sp/>*<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>;</highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Calculate<sp/>Start<sp/>Of<sp/>Free<sp/>Memory<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/>memStart<sp/>=<sp/>(0x101000<sp/>/<sp/>0x1000);</highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/>memStart<sp/>+=<sp/>(((</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structmMap" kindref="compound">mMap</ref>)<sp/>*<sp/><ref refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" kindref="member">numPages</ref>)<sp/>+<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structmMap" kindref="compound">mMap</ref>)<sp/>-<sp/>1))<sp/>/<sp/>0x1000);</highlight></codeline>
<codeline lineno="80"><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Initialize<sp/>All<sp/>Free<sp/>Pages<sp/>To<sp/>Available<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[(0x100000<sp/>/<sp/>0x1000)].status<sp/>=<sp/><ref refid="vmm_8h_1ab75ffaa83e1dc903d97c411c84dfec0f" kindref="member">memAvail</ref>;</highlight></codeline>
<codeline lineno="83"><highlight class="normal"></highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/>freePages++;</highlight></codeline>
<codeline lineno="85"><highlight class="normal"></highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>memStart;<sp/>i<sp/>&lt;<sp/><ref refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" kindref="member">numPages</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1a94139af73246d6ef3bae0f34d4182acd" kindref="member">status</ref><sp/>=<sp/><ref refid="vmm_8h_1ab75ffaa83e1dc903d97c411c84dfec0f" kindref="member">memAvail</ref>;</highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/>freePages++;</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="90"><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="vitals_8h_1a67aae71be472453526fc1a0bfbf80280" kindref="member">systemVitals</ref>)</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vitals_8h_1a67aae71be472453526fc1a0bfbf80280" kindref="member">systemVitals</ref>-&gt;<ref refid="structvitalsStruct_1a53cac06836c76cd2aa0724d90b3672da" kindref="member">freePages</ref><sp/>=<sp/>freePages;</highlight></codeline>
<codeline lineno="93"><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Print<sp/>Out<sp/>Amount<sp/>Of<sp/>Memory<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Real<sp/>Memory:<sp/><sp/><sp/><sp/><sp/><sp/>%iKB\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" kindref="member">numPages</ref><sp/>*<sp/>4);</highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Available<sp/>Memory:<sp/>%iKB\n&quot;</highlight><highlight class="normal">,<sp/>freePages<sp/>*<sp/>4);</highlight></codeline>
<codeline lineno="97"><highlight class="normal"></highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Return<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="100"><highlight class="normal">}</highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight><highlight class="comment">/************************************************************************</highlight></codeline>
<codeline lineno="103"><highlight class="comment"></highlight></codeline>
<codeline lineno="104"><highlight class="comment"><sp/>Function:<sp/>int<sp/>countMemory();</highlight></codeline>
<codeline lineno="105"><highlight class="comment"><sp/>Description:<sp/>This<sp/>Function<sp/>Counts<sp/>The<sp/>Systems<sp/>Physical<sp/>Memory</highlight></codeline>
<codeline lineno="106"><highlight class="comment"><sp/>Notes:</highlight></codeline>
<codeline lineno="107"><highlight class="comment"></highlight></codeline>
<codeline lineno="108"><highlight class="comment"><sp/>02/20/2004<sp/>-<sp/>Inspect<sp/>For<sp/>Quality<sp/>And<sp/>Approved</highlight></codeline>
<codeline lineno="109" refid="vmm__memory_8c_1a1a89fbc2f80ca828332c5ef31801faa3" refkind="member"><highlight class="comment"></highlight></codeline>
<codeline lineno="110"><highlight class="comment"><sp/>************************************************************************/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vmm__memory_8c_1a1a89fbc2f80ca828332c5ef31801faa3" kindref="member">countMemory</ref>()<sp/>{</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">register</highlight><highlight class="normal"><sp/><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>*<ref refid="structmem" kindref="compound">mem</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/>memCount<sp/>=<sp/>-1,<sp/>tempMemory<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">short</highlight><highlight class="normal"><sp/>memKb<sp/>=<sp/>8;</highlight></codeline>
<codeline lineno="115"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>irq1State,<sp/>irq2State;</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/>cr0<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="117"><highlight class="normal"></highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="119"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Save<sp/>The<sp/>States<sp/>Of<sp/>Both<sp/>IRQ<sp/>1<sp/>And<sp/>2<sp/>So<sp/>We<sp/>Can<sp/>Turn<sp/>Them<sp/>Off<sp/>And<sp/>Restore</highlight></codeline>
<codeline lineno="120"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Them<sp/>Later</highlight></codeline>
<codeline lineno="121"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/>irq1State<sp/>=<sp/><ref refid="io_8h_1a77b934268de1b3ecdcf3f275413b3108" kindref="member">inportByte</ref>(0x21);</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/>irq2State<sp/>=<sp/><ref refid="io_8h_1a77b934268de1b3ecdcf3f275413b3108" kindref="member">inportByte</ref>(0xA1);</highlight></codeline>
<codeline lineno="124"><highlight class="normal"></highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Turn<sp/>Off<sp/>IRQ<sp/>1<sp/>And<sp/>2<sp/>To<sp/>Prevent<sp/>Chances<sp/>Of<sp/>Faults<sp/>While<sp/>Examining<sp/>Memory<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><ref refid="io_8h_1a8acc1a06073db2e7b92ffbd00fbd0cf1" kindref="member">outportByte</ref>(0x21,<sp/>0xFF);</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><ref refid="io_8h_1a8acc1a06073db2e7b92ffbd00fbd0cf1" kindref="member">outportByte</ref>(0xA1,<sp/>0xFF);</highlight></codeline>
<codeline lineno="128"><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Save<sp/>The<sp/>State<sp/>Of<sp/>Register<sp/>CR0<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/>cr0<sp/>=<sp/>rcr0();</highlight></codeline>
<codeline lineno="131"><highlight class="normal"></highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="133"><highlight class="comment"><sp/><sp/><sp/>asm<sp/>volatile<sp/>(</highlight></codeline>
<codeline lineno="134"><highlight class="comment"><sp/><sp/><sp/>&quot;movl<sp/>%%cr0,<sp/>%%ebx\n&quot;</highlight></codeline>
<codeline lineno="135"><highlight class="comment"><sp/><sp/><sp/>:<sp/>&quot;=a&quot;<sp/>(cr0)</highlight></codeline>
<codeline lineno="136"><highlight class="comment"><sp/><sp/><sp/>:</highlight></codeline>
<codeline lineno="137"><highlight class="comment"><sp/><sp/><sp/>:<sp/>&quot;ebx&quot;</highlight></codeline>
<codeline lineno="138"><highlight class="comment"><sp/><sp/><sp/>);</highlight></codeline>
<codeline lineno="139"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="140"><highlight class="normal"></highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">volatile</highlight><highlight class="normal"><sp/>(</highlight><highlight class="stringliteral">&quot;wbinvd&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="142"><highlight class="normal"></highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/>load_cr0(cr0<sp/>|<sp/>0x00000001<sp/>|<sp/>0x40000000<sp/>|<sp/>0x20000000);</highlight></codeline>
<codeline lineno="144"><highlight class="normal"></highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="146"><highlight class="comment"><sp/><sp/><sp/>asm<sp/>volatile<sp/>(</highlight></codeline>
<codeline lineno="147"><highlight class="comment"><sp/><sp/><sp/>&quot;movl<sp/>%%ebx,<sp/>%%cr0\n&quot;</highlight></codeline>
<codeline lineno="148"><highlight class="comment"><sp/><sp/><sp/>:</highlight></codeline>
<codeline lineno="149"><highlight class="comment"><sp/><sp/><sp/>:<sp/>&quot;a&quot;<sp/>(cr0<sp/>|<sp/>0x00000001<sp/>|<sp/>0x40000000<sp/>|<sp/>0x20000000)</highlight></codeline>
<codeline lineno="150"><highlight class="comment"><sp/><sp/><sp/>:<sp/>&quot;ebx&quot;</highlight></codeline>
<codeline lineno="151"><highlight class="comment"><sp/><sp/><sp/>);</highlight></codeline>
<codeline lineno="152"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="153"><highlight class="normal"></highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(memKb<sp/>&lt;<sp/>4096<sp/>&amp;&amp;<sp/>memCount<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/>memKb++;</highlight></codeline>
<codeline lineno="156"><highlight class="normal"></highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(memCount<sp/>==<sp/>-1)</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>memCount<sp/>=<sp/>8388608;</highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>memCount<sp/>+=<sp/>1024<sp/>*<sp/>1024;</highlight></codeline>
<codeline lineno="161"><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structmem" kindref="compound">mem</ref><sp/>=<sp/>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>*)<sp/>memCount;</highlight></codeline>
<codeline lineno="163"><highlight class="normal"></highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/>tempMemory<sp/>=<sp/>*<ref refid="structmem" kindref="compound">mem</ref>;</highlight></codeline>
<codeline lineno="165"><highlight class="normal"></highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/>*<ref refid="structmem" kindref="compound">mem</ref><sp/>=<sp/>0x55AA55AA;</highlight></codeline>
<codeline lineno="167"><highlight class="normal"></highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal">(</highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">:<sp/>:<sp/>:</highlight><highlight class="stringliteral">&quot;memory&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="169"><highlight class="normal"></highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(*<ref refid="structmem" kindref="compound">mem</ref><sp/>!=<sp/>0x55AA55AA)<sp/>{</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>memCount<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>*<ref refid="structmem" kindref="compound">mem</ref><sp/>=<sp/>0xAA55AA55;</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal">(</highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">:<sp/>:<sp/>:</highlight><highlight class="stringliteral">&quot;memory&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(*<ref refid="structmem" kindref="compound">mem</ref><sp/>!=<sp/>0xAA55AA55)<sp/>{</highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>memCount<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal">(</highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">:<sp/>:<sp/>:</highlight><highlight class="stringliteral">&quot;memory&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/>*<ref refid="structmem" kindref="compound">mem</ref><sp/>=<sp/>tempMemory;</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="183"><highlight class="normal"></highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal">(</highlight><highlight class="stringliteral">&quot;nop&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="185"><highlight class="normal"></highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>(2016-01-10)<sp/>NOTE:<sp/>I<sp/>don&apos;t<sp/>like<sp/>this<sp/>but<sp/>I<sp/>start<sp/>incrementing<sp/>form<sp/>the<sp/>start.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/>memKb--;</highlight></codeline>
<codeline lineno="188"><highlight class="normal"></highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal">(</highlight><highlight class="stringliteral">&quot;nop&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="190"><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/>load_cr0(cr0);</highlight></codeline>
<codeline lineno="192"><highlight class="normal"></highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="194"><highlight class="comment"><sp/><sp/><sp/>asm<sp/>volatile<sp/>(</highlight></codeline>
<codeline lineno="195"><highlight class="comment"><sp/><sp/><sp/>&quot;movl<sp/>%%ebx,<sp/>%%cr0\n&quot;</highlight></codeline>
<codeline lineno="196"><highlight class="comment"><sp/><sp/><sp/>:</highlight></codeline>
<codeline lineno="197"><highlight class="comment"><sp/><sp/><sp/>:<sp/>&quot;a&quot;<sp/>(cr0)</highlight></codeline>
<codeline lineno="198"><highlight class="comment"><sp/><sp/><sp/>:<sp/>&quot;ebx&quot;</highlight></codeline>
<codeline lineno="199"><highlight class="comment"><sp/><sp/><sp/>);</highlight></codeline>
<codeline lineno="200"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="201"><highlight class="normal"></highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal">(</highlight><highlight class="stringliteral">&quot;nop&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="203"><highlight class="normal"></highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Restore<sp/>States<sp/>For<sp/>Both<sp/>IRQ<sp/>1<sp/>And<sp/>2<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><ref refid="io_8h_1a8acc1a06073db2e7b92ffbd00fbd0cf1" kindref="member">outportByte</ref>(0x21,<sp/>irq1State);</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/><ref refid="io_8h_1a8acc1a06073db2e7b92ffbd00fbd0cf1" kindref="member">outportByte</ref>(0xA1,<sp/>irq2State);</highlight></codeline>
<codeline lineno="207"><highlight class="normal"></highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal">(</highlight><highlight class="stringliteral">&quot;nop&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="209"><highlight class="normal"></highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Return<sp/>Amount<sp/>Of<sp/>Memory<sp/>In<sp/>Pages<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>((memKb<sp/>*<sp/>1024<sp/>*<sp/>1024)<sp/>/<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>);</highlight></codeline>
<codeline lineno="212"><highlight class="normal">}</highlight></codeline>
<codeline lineno="213"><highlight class="normal"></highlight></codeline>
<codeline lineno="214"><highlight class="normal"></highlight><highlight class="comment">/************************************************************************</highlight></codeline>
<codeline lineno="215"><highlight class="comment"></highlight></codeline>
<codeline lineno="216"><highlight class="comment"><sp/>Function:<sp/>uInt32<sp/>vmm_findFreePage(pid_t<sp/>pid);</highlight></codeline>
<codeline lineno="217"><highlight class="comment"></highlight></codeline>
<codeline lineno="218"><highlight class="comment"><sp/>Description:<sp/>This<sp/>Returns<sp/>A<sp/>Free<sp/><sp/>Physical<sp/>Page<sp/>Address<sp/>Then<sp/>Marks<sp/>It</highlight></codeline>
<codeline lineno="219"><highlight class="comment"><sp/>Not<sp/>Available<sp/>As<sp/>Well<sp/>As<sp/>Setting<sp/>The<sp/>PID<sp/>To<sp/>The<sp/>Proccess</highlight></codeline>
<codeline lineno="220"><highlight class="comment"><sp/>Allocating<sp/>This<sp/>Page</highlight></codeline>
<codeline lineno="221" refid="vmm__memory_8c_1ab8e4e189a7b1df2a03072ce5b75c89fe" refkind="member"><highlight class="comment"><sp/>Notes:</highlight></codeline>
<codeline lineno="222"><highlight class="comment"></highlight></codeline>
<codeline lineno="223"><highlight class="comment"><sp/>************************************************************************/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="224"><highlight class="normal"><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/><ref refid="vmm__memory_8c_1ab8e4e189a7b1df2a03072ce5b75c89fe" kindref="member">vmm_findFreePage</ref>(<ref refid="include_2sys_2types_8h_1ae438ba74394b14d7b24b6df3b3b8c252" kindref="member">pidType</ref><sp/>pid)<sp/>{</highlight></codeline>
<codeline lineno="225"><highlight class="normal"></highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="227"><highlight class="normal"></highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Lets<sp/>Look<sp/>For<sp/>A<sp/>Free<sp/>Page<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pid<sp/>&lt;<sp/><ref refid="kmalloc_8h_1a81d09bc848b49133401b3efeeb65f1af" kindref="member">sysID</ref>)</highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;Error:<sp/>invalid<sp/>PID<sp/>%i\n&quot;</highlight><highlight class="normal">,<sp/>pid);</highlight></codeline>
<codeline lineno="231"><highlight class="normal"></highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/><ref refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" kindref="member">spinLock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="233"><highlight class="normal"></highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;=<sp/><ref refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" kindref="member">numPages</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="235"><highlight class="normal"></highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="237"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>If<sp/>We<sp/>Found<sp/>A<sp/>Free<sp/>Page<sp/>Set<sp/>It<sp/>To<sp/>Not<sp/>Available<sp/>After<sp/>That<sp/>Set<sp/>Its<sp/>Own</highlight></codeline>
<codeline lineno="238"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>And<sp/>Return<sp/>The<sp/>Address</highlight></codeline>
<codeline lineno="239"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].status<sp/>==<sp/><ref refid="vmm_8h_1ab75ffaa83e1dc903d97c411c84dfec0f" kindref="member">memAvail</ref>)<sp/>&amp;&amp;<sp/>(<ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].cowCounter<sp/>==<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1a94139af73246d6ef3bae0f34d4182acd" kindref="member">status</ref><sp/>=<sp/><ref refid="vmm_8h_1a41dc1abc6436bd66a4269de8ab471181" kindref="member">memNotavail</ref>;</highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1ad72d5f52b2195f98e60aa61ed52ae9b1" kindref="member">pid</ref><sp/>=<sp/>pid;</highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>freePages--;</highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="vitals_8h_1a67aae71be472453526fc1a0bfbf80280" kindref="member">systemVitals</ref>)</highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="vitals_8h_1a67aae71be472453526fc1a0bfbf80280" kindref="member">systemVitals</ref>-&gt;<ref refid="structvitalsStruct_1a53cac06836c76cd2aa0724d90b3672da" kindref="member">freePages</ref><sp/>=<sp/>freePages;</highlight></codeline>
<codeline lineno="246"><highlight class="normal"></highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2spinlock_8c_1ae29ab191c93f9ead066cb462dd2e7247" kindref="member">spinUnlock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].pageAddr);</highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="251"><highlight class="normal"></highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>No<sp/>Free<sp/>Memory<sp/>Is<sp/>Found<sp/>Return<sp/>NULL<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;Out<sp/>Of<sp/>Memory!!!!&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0x0);</highlight></codeline>
<codeline lineno="255"><highlight class="normal">}</highlight></codeline>
<codeline lineno="256"><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="normal"></highlight><highlight class="comment">/************************************************************************</highlight></codeline>
<codeline lineno="258"><highlight class="comment"></highlight></codeline>
<codeline lineno="259"><highlight class="comment"><sp/>Function:<sp/>int<sp/>freePage(uInt32<sp/>pageAddr);</highlight></codeline>
<codeline lineno="260"><highlight class="comment"></highlight></codeline>
<codeline lineno="261"><highlight class="comment"><sp/>Description:<sp/>This<sp/>Function<sp/>Marks<sp/>The<sp/>Page<sp/>As<sp/>Free</highlight></codeline>
<codeline lineno="262" refid="vmm__memory_8c_1a38c3fe6ce5f3bf8af4a0631d4c41b0ba" refkind="member"><highlight class="comment"></highlight></codeline>
<codeline lineno="263"><highlight class="comment"><sp/>Notes:</highlight></codeline>
<codeline lineno="264"><highlight class="comment"></highlight></codeline>
<codeline lineno="265"><highlight class="comment"><sp/>************************************************************************/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="266"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vmm__memory_8c_1a38c3fe6ce5f3bf8af4a0631d4c41b0ba" kindref="member">freePage</ref>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>pageAddr)<sp/>{</highlight></codeline>
<codeline lineno="267"><highlight class="normal"></highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pageIndex<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>((pageAddr<sp/>&amp;<sp/>0xFFF)<sp/>==<sp/>0x0);</highlight></codeline>
<codeline lineno="270"><highlight class="normal"></highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Find<sp/>The<sp/>Page<sp/>Index<sp/>To<sp/>The<sp/>Memory<sp/>Map<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/>pageIndex<sp/>=<sp/>(pageAddr<sp/>/<sp/>4096);</highlight></codeline>
<codeline lineno="273"><highlight class="normal"></highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>If<sp/>Page<sp/>COW<sp/>Is<sp/>Greater<sp/>Then<sp/>0<sp/>If<sp/>It<sp/>Is<sp/>Dec<sp/>It<sp/>If<sp/>Not<sp/>Free<sp/>It<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[pageIndex].cowCounter<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="276"><highlight class="normal"></highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>Page<sp/>As<sp/>Avail<sp/>So<sp/>It<sp/>Can<sp/>Be<sp/>Used<sp/>Again<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" kindref="member">spinLock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[pageIndex].<ref refid="structmMap_1a94139af73246d6ef3bae0f34d4182acd" kindref="member">status</ref><sp/>=<sp/><ref refid="vmm_8h_1ab75ffaa83e1dc903d97c411c84dfec0f" kindref="member">memAvail</ref>;</highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[pageIndex].<ref refid="structmMap_1a2fb919d9c0a2653979ed667d59a395cb" kindref="member">cowCounter</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[pageIndex].<ref refid="structmMap_1ad72d5f52b2195f98e60aa61ed52ae9b1" kindref="member">pid</ref><sp/>=<sp/>-2;</highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/>freePages++;</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vitals_8h_1a67aae71be472453526fc1a0bfbf80280" kindref="member">systemVitals</ref>-&gt;<ref refid="structvitalsStruct_1a53cac06836c76cd2aa0724d90b3672da" kindref="member">freePages</ref><sp/>=<sp/>freePages;</highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="armv6_2spinlock_8c_1ae29ab191c93f9ead066cb462dd2e7247" kindref="member">spinUnlock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="285"><highlight class="normal"></highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Adjust<sp/>The<sp/>COW<sp/>Counter<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a362d462b3a1e19b5e0ef95e1839dbf11" kindref="member">adjustCowCounter</ref>(((<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[pageIndex].pageAddr),<sp/>-1);</highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="291"><highlight class="normal"></highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Return<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="294"><highlight class="normal">}</highlight></codeline>
<codeline lineno="295"><highlight class="normal"></highlight></codeline>
<codeline lineno="296"><highlight class="normal"></highlight><highlight class="comment">/************************************************************************</highlight></codeline>
<codeline lineno="297"><highlight class="comment"></highlight></codeline>
<codeline lineno="298"><highlight class="comment"><sp/>Function:<sp/>int<sp/>adjustCowCounter(uInt32<sp/>baseAddr,int<sp/>adjustment);</highlight></codeline>
<codeline lineno="299"><highlight class="comment"></highlight></codeline>
<codeline lineno="300"><highlight class="comment"><sp/>Description:<sp/>This<sp/>Adjust<sp/>The<sp/>COW<sp/>Counter<sp/>For<sp/>Page<sp/>At<sp/>baseAddr<sp/>It<sp/>Will</highlight></codeline>
<codeline lineno="301"><highlight class="comment"><sp/>Error<sp/>If<sp/>The<sp/>Count<sp/>Goes<sp/>Below<sp/>0</highlight></codeline>
<codeline lineno="302"><highlight class="comment"></highlight></codeline>
<codeline lineno="303" refid="vmm__memory_8c_1a362d462b3a1e19b5e0ef95e1839dbf11" refkind="member"><highlight class="comment"><sp/>Notes:</highlight></codeline>
<codeline lineno="304"><highlight class="comment"></highlight></codeline>
<codeline lineno="305"><highlight class="comment"><sp/>08/01/02<sp/>-<sp/>I<sp/>Think<sp/>If<sp/>Counter<sp/>Gets<sp/>To<sp/>0<sp/>I<sp/>Should<sp/>Free<sp/>The<sp/>Page</highlight></codeline>
<codeline lineno="306"><highlight class="comment"></highlight></codeline>
<codeline lineno="307"><highlight class="comment"><sp/>************************************************************************/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="vmm__memory_8c_1a362d462b3a1e19b5e0ef95e1839dbf11" kindref="member">adjustCowCounter</ref>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>baseAddr,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>adjustment)<sp/>{</highlight></codeline>
<codeline lineno="309"><highlight class="normal"></highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>vmmMemoryMapIndex<sp/>=<sp/>(baseAddr<sp/>/<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>);</highlight></codeline>
<codeline lineno="311"><highlight class="normal"></highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>((baseAddr<sp/>&amp;<sp/>0xFFF)<sp/>==<sp/>0x0);</highlight></codeline>
<codeline lineno="313"><highlight class="normal"></highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><ref refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" kindref="member">spinLock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Adjust<sp/>COW<sp/>Counter<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[vmmMemoryMapIndex].<ref refid="structmMap_1a2fb919d9c0a2653979ed667d59a395cb" kindref="member">cowCounter</ref><sp/>+=<sp/>adjustment;</highlight></codeline>
<codeline lineno="317"><highlight class="normal"></highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[vmmMemoryMapIndex].cowCounter<sp/>&lt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="319"><highlight class="normal"></highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[vmmMemoryMapIndex].cowCounter<sp/>&lt;<sp/>0)</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;ERROR:<sp/>Why<sp/>is<sp/>COW<sp/>less<sp/>than<sp/>0&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="322"><highlight class="normal"></highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[vmmMemoryMapIndex].<ref refid="structmMap_1a2fb919d9c0a2653979ed667d59a395cb" kindref="member">cowCounter</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[vmmMemoryMapIndex].<ref refid="structmMap_1ad72d5f52b2195f98e60aa61ed52ae9b1" kindref="member">pid</ref><sp/>=<sp/><ref refid="vmm_8h_1ae6c443b60824c02f199f51cf4a14e9f4" kindref="member">vmmID</ref>;</highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[vmmMemoryMapIndex].<ref refid="structmMap_1a94139af73246d6ef3bae0f34d4182acd" kindref="member">status</ref><sp/>=<sp/><ref refid="vmm_8h_1ab75ffaa83e1dc903d97c411c84dfec0f" kindref="member">memAvail</ref>;</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/>freePages++;</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="vitals_8h_1a67aae71be472453526fc1a0bfbf80280" kindref="member">systemVitals</ref>-&gt;<ref refid="structvitalsStruct_1a53cac06836c76cd2aa0724d90b3672da" kindref="member">freePages</ref><sp/>=<sp/>freePages;</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="329"><highlight class="normal"></highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><ref refid="armv6_2spinlock_8c_1ae29ab191c93f9ead066cb462dd2e7247" kindref="member">spinUnlock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Return<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="333"><highlight class="normal">}</highlight></codeline>
<codeline lineno="334"><highlight class="normal"></highlight></codeline>
<codeline lineno="335"><highlight class="normal"></highlight><highlight class="comment">/************************************************************************</highlight></codeline>
<codeline lineno="336"><highlight class="comment"></highlight></codeline>
<codeline lineno="337"><highlight class="comment"><sp/>Function:<sp/>void<sp/>vmm_freeProcessPages(pid_t<sp/>pid);</highlight></codeline>
<codeline lineno="338"><highlight class="comment"></highlight></codeline>
<codeline lineno="339"><highlight class="comment"><sp/>Description:<sp/>This<sp/>Function<sp/>Will<sp/>Free<sp/>Up<sp/>Memory<sp/>For<sp/>The<sp/>Exiting<sp/>Process</highlight></codeline>
<codeline lineno="340"><highlight class="comment"></highlight></codeline>
<codeline lineno="341"><highlight class="comment"><sp/>Notes:</highlight></codeline>
<codeline lineno="342" refid="vmm__memory_8c_1a6a46a3d519d9f38f00d8b00d2ce60e04" refkind="member"><highlight class="comment"></highlight></codeline>
<codeline lineno="343"><highlight class="comment"><sp/>08/04/02<sp/>-<sp/>Added<sp/>Checking<sp/>For<sp/>COW<sp/>Pages<sp/>First</highlight></codeline>
<codeline lineno="344"><highlight class="comment"></highlight></codeline>
<codeline lineno="345"><highlight class="comment"><sp/>************************************************************************/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="346"><highlight class="normal"></highlight></codeline>
<codeline lineno="347"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>TODO:<sp/>This<sp/>can<sp/>be<sp/>greatly<sp/>improved<sp/>for<sp/>performance<sp/>but<sp/>it<sp/>gets<sp/>the<sp/>job<sp/>done<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="348"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="vmm__memory_8c_1a6a46a3d519d9f38f00d8b00d2ce60e04" kindref="member">vmm_freeProcessPages</ref>(<ref refid="include_2sys_2types_8h_1ae438ba74394b14d7b24b6df3b3b8c252" kindref="member">pidType</ref><sp/>pid)<sp/>{</highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0,<sp/>x<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*tmpPageTable<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*tmpPageDir<sp/>=<sp/>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>*)<sp/><ref refid="paging_8h_1a1b0f37794d3da1a86f1df77e503ed98f" kindref="member">PD_BASE_ADDR</ref>;</highlight></codeline>
<codeline lineno="352"><highlight class="normal"></highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><ref refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" kindref="member">spinLock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="354"><highlight class="normal"></highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>Page<sp/>Directory<sp/>For<sp/>An<sp/>Avail<sp/>Page<sp/>Table<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//NOTE:<sp/>This<sp/>cleans<sp/>all<sp/>memory<sp/>space<sp/>up<sp/>to<sp/>kernel<sp/>space</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="357"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>_IGNORE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>(<ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref><sp/>-<sp/>(<ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref><sp/>/<sp/>4));<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="359"><highlight class="normal"></highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmpPageDir[i]<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="361"><highlight class="normal"></highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>Up<sp/>Page<sp/>Table<sp/>Pointer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tmpPageTable<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*)<sp/>(<ref refid="paging_8h_1a8d42a9a09d9dea53cab3044f51482acc" kindref="member">PT_BASE_ADDR</ref><sp/>+<sp/>(i<sp/>*<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>));</highlight></codeline>
<codeline lineno="364"><highlight class="normal"></highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>The<sp/>Page<sp/>Table<sp/>For<sp/>COW<sp/>Pages<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>0;<sp/>x<sp/>&lt;<sp/><ref refid="paging_8h_1a91bd4c1c49996222f571b2f53ca00dc4" kindref="member">PD_ENTRIES</ref>;<sp/>x++)<sp/>{</highlight></codeline>
<codeline lineno="367"><highlight class="normal"></highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>The<sp/>Page<sp/>Is<sp/>COW<sp/>Adjust<sp/>COW<sp/>Counter<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/>tmpPageTable[x]<sp/>&amp;<sp/><ref refid="paging_8h_1a57d743cb60fe478f6720c42315e7e813" kindref="member">PAGE_COW</ref>)<sp/>==<sp/><ref refid="paging_8h_1a57d743cb60fe478f6720c42315e7e813" kindref="member">PAGE_COW</ref>)<sp/>{</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a362d462b3a1e19b5e0ef95e1839dbf11" kindref="member">adjustCowCounter</ref>(((<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/>tmpPageTable[x]<sp/>&amp;<sp/>0xFFFFF000),<sp/>-1);</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="375"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="376"><highlight class="normal"></highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Loop<sp/>Through<sp/>Pages<sp/>To<sp/>Find<sp/>Pages<sp/>Owned<sp/>By<sp/>Process<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="vmm__memory_8c_1a2b0091bdc36e32af3daf9cfcaa7c04e1" kindref="member">numPages</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].pid<sp/>==<sp/>pid)<sp/>{</highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>To<sp/>See<sp/>If<sp/>The<sp/>cowCounter<sp/>Is<sp/>Zero<sp/>If<sp/>So<sp/>We<sp/>Can<sp/>Ree<sp/>It<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].cowCounter<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1a94139af73246d6ef3bae0f34d4182acd" kindref="member">status</ref><sp/>=<sp/><ref refid="vmm_8h_1ab75ffaa83e1dc903d97c411c84dfec0f" kindref="member">memAvail</ref>;</highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1a2fb919d9c0a2653979ed667d59a395cb" kindref="member">cowCounter</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a89e87741958ee81f1811075b25af058a" kindref="member">vmmMemoryMap</ref>[i].<ref refid="structmMap_1ad72d5f52b2195f98e60aa61ed52ae9b1" kindref="member">pid</ref><sp/>=<sp/><ref refid="vmm_8h_1ae6c443b60824c02f199f51cf4a14e9f4" kindref="member">vmmID</ref>;</highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>freePages++;</highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="vitals_8h_1a67aae71be472453526fc1a0bfbf80280" kindref="member">systemVitals</ref>-&gt;<ref refid="structvitalsStruct_1a53cac06836c76cd2aa0724d90b3672da" kindref="member">freePages</ref><sp/>=<sp/>freePages;</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="388"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2spinlock_8c_1ae29ab191c93f9ead066cb462dd2e7247" kindref="member">spinUnlock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="vmm__memory_8c_1a362d462b3a1e19b5e0ef95e1839dbf11" kindref="member">adjustCowCounter</ref>((i<sp/>*<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>),<sp/>-1);</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2spinlock_8c_1a71f03d2ba55111c715b6068254847a53" kindref="member">spinLock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="395"><highlight class="normal"></highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Return<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><ref refid="armv6_2spinlock_8c_1ae29ab191c93f9ead066cb462dd2e7247" kindref="member">spinUnlock</ref>(&amp;vmmSpinLock);</highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="399"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c"/>
  </compounddef>
</doxygen>