<?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="i386__exec_8c" kind="file" language="C++">
    <compoundname>i386_exec.c</compoundname>
    <includes refid="__null_8h" local="no">sys/_null.h</includes>
    <includes refid="include_2sys_2types_8h" local="no">sys/types.h</includes>
    <includes refid="sys_2elf_8h" local="no">sys/elf.h</includes>
    <includes refid="gdt_8h" local="no">sys/gdt.h</includes>
    <includes refid="exec_8h" local="no">ubixos/exec.h</includes>
    <includes refid="ld_8h" local="no">ubixos/ld.h</includes>
    <includes refid="kpanic_8h" local="no">ubixos/kpanic.h</includes>
    <includes refid="endtask_8h" local="no">ubixos/endtask.h</includes>
    <includes refid="vmm_8h" local="no">vmm/vmm.h</includes>
    <includes refid="kmalloc_8h" local="no">lib/kmalloc.h</includes>
    <includes refid="kprintf_8h" local="no">lib/kprintf.h</includes>
    <includes refid="include_2vfs_2file_8h" local="no">vfs/file.h</includes>
    <includes refid="assert_8h" local="no">assert.h</includes>
    <includes refid="string_8h" local="no">string.h</includes>
    <includes refid="descrip_8h" local="no">sys/descrip.h</includes>
    <incdepgraph>
      <node id="51">
        <label>sys/fcntl.h</label>
        <link refid="fcntl_8h"/>
      </node>
      <node id="28">
        <label>ufs/ufs.h</label>
        <link refid="ufs_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="29" relation="include">
        </childnode>
      </node>
      <node id="49">
        <label>sys/descrip.h</label>
        <link refid="descrip_8h"/>
        <childnode refid="19" relation="include">
        </childnode>
        <childnode refid="42" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
        <childnode refid="50" relation="include">
        </childnode>
        <childnode refid="51" relation="include">
        </childnode>
      </node>
      <node id="45">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="38">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="32">
        <label>sys/tss.h</label>
        <link refid="tss_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="34">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="39">
        <label>ubixos/endtask.h</label>
        <link refid="endtask_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
      </node>
      <node id="35">
        <label>sys/gdt.h</label>
        <link refid="gdt_8h"/>
      </node>
      <node id="31">
        <label>ubixos/tty.h</label>
        <link refid="tty_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="48">
        <label>strings.h</label>
        <link refid="strings_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="21">
        <label>i386/cpu.h</label>
        <link refid="i386_2cpu_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="41">
        <label>vmm/paging.h</label>
        <link refid="paging_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="42" relation="include">
        </childnode>
        <childnode refid="19" 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="24">
        <label>vfs/inode.h</label>
        <link refid="inode_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="25" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
        <childnode refid="27" relation="include">
        </childnode>
        <childnode refid="28" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>sys/elf32.h</label>
        <link refid="elf32_8h"/>
        <childnode refid="13" relation="include">
        </childnode>
      </node>
      <node id="15">
        <label>ubixos/ubthread.h</label>
        <link refid="ubthread_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="33" 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="40">
        <label>vmm/vmm.h</label>
        <link refid="vmm_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="41" relation="include">
        </childnode>
      </node>
      <node id="43">
        <label>lib/kmalloc.h</label>
        <link refid="kmalloc_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="37">
        <label>ubixos/ld.h</label>
        <link refid="ld_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="30">
        <label>vfs/mount.h</label>
        <link refid="mount_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="23">
        <label>sys/resource.h</label>
        <link refid="resource_8h"/>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="20">
        <label>sys/trap.h</label>
        <link refid="trap_8h"/>
        <childnode refid="21" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>sys/_null.h</label>
        <link refid="__null_8h"/>
      </node>
      <node id="47">
        <label>string.h</label>
        <link refid="string_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="48" 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="19" relation="include">
        </childnode>
        <childnode refid="24" relation="include">
        </childnode>
        <childnode refid="30" relation="include">
        </childnode>
        <childnode refid="28" relation="include">
        </childnode>
      </node>
      <node id="36">
        <label>ubixos/exec.h</label>
        <link refid="exec_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
      </node>
      <node id="27">
        <label>fs/msdos_fs.h</label>
        <link refid="msdos__fs_8h"/>
      </node>
      <node id="46">
        <label>assert.h</label>
        <link refid="assert_8h"/>
      </node>
      <node id="22">
        <label>sys/signal.h</label>
        <link refid="sys_2signal_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="26">
        <label>fs/pipe_fs.h</label>
        <link refid="pipe__fs_8h"/>
      </node>
      <node id="25">
        <label>ubixos/wait.h</label>
        <link refid="wait_8h"/>
      </node>
      <node id="44">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="45" relation="include">
        </childnode>
      </node>
      <node id="19">
        <label>sys/thread.h</label>
        <link refid="thread_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="22" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
      </node>
      <node id="6">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="11">
        <label>i386/elf.h</label>
        <link refid="i386_2elf_8h"/>
      </node>
      <node id="33">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="34" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>ubixos/sched.h</label>
        <link refid="sched_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
        <childnode refid="31" relation="include">
        </childnode>
        <childnode refid="32" relation="include">
        </childnode>
        <childnode refid="19" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c</label>
        <link refid="i386__exec_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="35" relation="include">
        </childnode>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="37" relation="include">
        </childnode>
        <childnode refid="38" relation="include">
        </childnode>
        <childnode refid="39" relation="include">
        </childnode>
        <childnode refid="40" relation="include">
        </childnode>
        <childnode refid="43" relation="include">
        </childnode>
        <childnode refid="44" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
        <childnode refid="46" relation="include">
        </childnode>
        <childnode refid="47" relation="include">
        </childnode>
        <childnode refid="49" relation="include">
        </childnode>
      </node>
      <node id="14">
        <label>sys/elf64.h</label>
        <link refid="elf64_8h"/>
        <childnode refid="13" 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="29">
        <label>sys/device.h</label>
        <link refid="include_2sys_2device_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="42">
        <label>sys/sysproto_posix.h</label>
        <link refid="sysproto__posix_8h"/>
        <childnode refid="22" relation="include">
        </childnode>
        <childnode refid="19" 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>vfs/stat.h</label>
        <link refid="stat_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>sys/elf_common.h</label>
        <link refid="elf__common_8h"/>
      </node>
      <node id="10">
        <label>sys/elf.h</label>
        <link refid="sys_2elf_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
        <childnode refid="14" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
    </incdepgraph>
      <sectiondef kind="define">
      <memberdef kind="define" id="i386__exec_8c_1a2f29812bcfd1b9ad2a0b165a3b3c6d4a" prot="public" static="no">
        <name>ARGV_PAGE</name>
        <initializer>0x100</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="46" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="46" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a9b8e51a44a47d7ea827c570ffdca14e5" prot="public" static="no">
        <name>AT_BASE</name>
        <initializer>7       /* Interpreter&apos;s base address. */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="59" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="59" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a80f2ea99241a6afdc4718d3c4318c871" prot="public" static="no">
        <name>AT_ENTRY</name>
        <initializer>9       /* Where interpreter should transfer control. */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="61" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="61" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a8a3070773d3f9231c9390172ae3fd2e7" prot="public" static="no">
        <name>AT_EXECFD</name>
        <initializer>2       /* File descriptor of program to load. */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="54" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="54" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a08c6bdc11224c9d17fbde19666c332cc" prot="public" static="no">
        <name>AT_FLAGS</name>
        <initializer>8       /* Flags (unused for i386). */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="60" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="60" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1ab11dfd4fb71c15a128c3f70a310b53d1" prot="public" static="no">
        <name>AT_IGNORE</name>
        <initializer>1       /* Ignored entry. */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="53" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="53" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1aa893f7231479240d49c660c5649cac5b" prot="public" static="no">
        <name>AT_NULL</name>
        <initializer>0       /* Terminates the vector. */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="52" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="52" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a7269f0c135d4bd3f9bc074d18fb30f9d" prot="public" static="no">
        <name>AT_PAGESZ</name>
        <initializer>6       /* Page size in bytes. */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="58" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="58" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a3de7ec7b5cee2d34208387ab97dc0642" prot="public" static="no">
        <name>AT_PHDR</name>
        <initializer>3       /* Program header of program already loaded. */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="55" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="55" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a56f1f9975d88f768d7928b0ed587ef38" prot="public" static="no">
        <name>AT_PHENT</name>
        <initializer>4       /* <ref refid="elf__generic_8h_1a8f083052502d1aead5adf3f980dede7a" kindref="member">Size</ref> of each program header entry. */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="56" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="56" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1abc712c67bee059574b4e3c096538d5bd" prot="public" static="no">
        <name>AT_PHNUM</name>
        <initializer>5       /* Number of program header entries. */</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="57" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="57" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1afa8ddb544ff5a7ec07bbe00b16927559" prot="public" static="no">
        <name>AUXARGS_ENTRY</name>
        <param><defname>pos</defname></param>
        <param><defname>id</defname></param>
        <param><defname>val</defname></param>
        <initializer>{*pos = <ref refid="kernel_2elf_8c_1affd99ec09f321a630ec19d0333e291cd" kindref="member">id</ref>;pos++; *pos = val;pos++;}</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="63" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="63" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1af47d51fffc4c46a034ec9a821ecfb7d0" prot="public" static="no">
        <name>ELF_AUX</name>
        <initializer>0x100</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="47" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="47" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a4d0b1b435ec441e7d50a430b83df5832" prot="public" static="no">
        <name>ENOEXEC</name>
        <initializer>-1</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="50" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="50" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a04dd67a9a0ea56bb6cf7943ac00a1626" prot="public" static="no">
        <name>ENVP_PAGE</name>
        <initializer>0x100</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="45" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="45" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="i386__exec_8c_1a43c6dc010a1eea4fbe8de72a0826195b" prot="public" static="no">
        <name>STACK_PAD</name>
        <initializer>0x1000</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="48" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="48" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="i386__exec_8c_1a571025a8ed9197ad01a011caf242f7e8" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int args_copyin</definition>
        <argsstring>(char **argv_in, char **argv_out, char **args_out)</argsstring>
        <name>args_copyin</name>
        <param>
          <type>char **</type>
          <declname>argv_in</declname>
        </param>
        <param>
          <type>char **</type>
          <declname>argv_out</declname>
        </param>
        <param>
          <type>char **</type>
          <declname>args_out</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="83" column="12" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="83" bodyend="110"/>
      </memberdef>
      <memberdef kind="function" id="i386__exec_8c_1af7f03d9cc5f5b8bfb995a1fef3a39547" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int argv_count</definition>
        <argsstring>(char **argv)</argsstring>
        <name>argv_count</name>
        <param>
          <type>char **</type>
          <declname>argv</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="65" column="12" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="65" bodyend="72"/>
      </memberdef>
      <memberdef kind="function" id="i386__exec_8c_1a5ccc5fbe3a20c0d690b436ffb26c18ba" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int elf_parse_dynamic</definition>
        <argsstring>(elf_file_t ef)</argsstring>
        <name>elf_parse_dynamic</name>
        <param>
          <type><ref refid="sys_2elf_8h_1acd88ee00a6f247acbb3470170016c812" kindref="member">elf_file_t</ref></type>
          <declname>ef</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="900" column="12" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="900" bodyend="995" declfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" declline="136" declcolumn="12"/>
      </memberdef>
      <memberdef kind="function" id="i386__exec_8c_1a53fb757c0133a4e2645446ebadf60eee" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int envp_count</definition>
        <argsstring>(char **envp)</argsstring>
        <name>envp_count</name>
        <param>
          <type>char **</type>
          <declname>envp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="74" column="12" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="74" bodyend="81"/>
      </memberdef>
      <memberdef kind="function" id="i386__exec_8c_1ab532f144b41d10bc1b3214d7593d4a05" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int envs_copyin</definition>
        <argsstring>(char **envp_in, char **envp_out, char **envs_out)</argsstring>
        <name>envs_copyin</name>
        <param>
          <type>char **</type>
          <declname>envp_in</declname>
        </param>
        <param>
          <type>char **</type>
          <declname>envp_out</declname>
        </param>
        <param>
          <type>char **</type>
          <declname>envs_out</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="112" column="12" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="112" bodyend="134"/>
      </memberdef>
      <memberdef kind="function" id="i386__exec_8c_1aaff6720506bf63686b0c962ea31439d3" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void execFile</definition>
        <argsstring>(char *file, char **argv, char **envp, int console)</argsstring>
        <name>execFile</name>
        <param>
          <type>char *</type>
          <declname>file</declname>
        </param>
        <param>
          <type>char **</type>
          <declname>argv</declname>
        </param>
        <param>
          <type>char **</type>
          <declname>envp</declname>
        </param>
        <param>
          <type>int</type>
          <declname>console</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="244" column="6" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="244" bodyend="489"/>
      </memberdef>
      <memberdef kind="function" id="i386__exec_8c_1a2d25af2b05aa5dc4392daf1d97a3aa94" 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 execThread</definition>
        <argsstring>(void(*tproc)(void), uint32_t stack, char *arg)</argsstring>
        <name>execThread</name>
        <param>
          <type>void(*)(void)</type>
          <declname>tproc</declname>
        </param>
        <param>
          <type><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref></type>
          <declname>stack</declname>
        </param>
        <param>
          <type>char *</type>
          <declname>arg</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="148" column="10" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="148" bodyend="227"/>
        <references refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" compoundref="assert_8h" startline="64">assert</references>
        <references refid="structtssStruct_1afecbe8ea2cfebfb4d1a0aa7b6ebcac2c" compoundref="tss_8h" startline="35">tssStruct::back_link</references>
        <references refid="structtssStruct_1a8d312ed3dd0ea7a0f801c08a8cc4afd0" compoundref="tss_8h" startline="46">tssStruct::cr3</references>
        <references refid="structtssStruct_1a6d9085ec5af0fa1fe1de7015ad99c9e3" compoundref="tss_8h" startline="56">tssStruct::cs</references>
        <references refid="structtssStruct_1a01ee01c7f45c9b9ee2ad8338c21e6d33" compoundref="tss_8h" startline="60">tssStruct::ds</references>
        <references refid="structtssStruct_1ac2d32620149e07c40ee87696ef2509c2" compoundref="tss_8h" startline="51">tssStruct::ebp</references>
        <references refid="structtssStruct_1aa52b515706cd37e166c8eba348d5e68b" compoundref="tss_8h" startline="53">tssStruct::edi</references>
        <references refid="structtssStruct_1aa85f1fbaf622e0c6a39963da27de0194" compoundref="tss_8h" startline="48">tssStruct::eflags</references>
        <references refid="structtssStruct_1a3e758f2138799d63fc803f7e4db4f5b4" compoundref="tss_8h" startline="47">tssStruct::eip</references>
        <references refid="structtssStruct_1acd97dd6f6eabd83c0b819b6058b7041d" compoundref="tss_8h" startline="54">tssStruct::es</references>
        <references refid="structtssStruct_1a8beab5808aad776957d4544f6b139d4e" compoundref="tss_8h" startline="52">tssStruct::esi</references>
        <references refid="structtssStruct_1a85412a87dbdb8eda612c77bce8055a2c" compoundref="tss_8h" startline="50">tssStruct::esp</references>
        <references refid="structtssStruct_1a1017372aed82d7305586c330fa222b3b" compoundref="tss_8h" startline="37">tssStruct::esp0</references>
        <references refid="structtssStruct_1ad5ef8867200562fd8262f70312beff4d" compoundref="tss_8h" startline="40">tssStruct::esp1</references>
        <references refid="structtssStruct_1a60c88f3cd3f2110cb24be62444f42cfb" compoundref="tss_8h" startline="43">tssStruct::esp2</references>
        <references refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" compoundref="sched_8h" startline="71">taskStruct::files</references>
        <references refid="structtssStruct_1a8114a585123181ec835f8db3e029d390" compoundref="tss_8h" startline="62">tssStruct::fs</references>
        <references refid="structtssStruct_1a8dfa44423504293405785371d0e7b076" compoundref="tss_8h" startline="64">tssStruct::gs</references>
        <references refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" compoundref="sched_8h" startline="63">taskStruct::id</references>
        <references refid="structtssStruct_1a611a0a044f99f092ace469ce2381bb33" compoundref="tss_8h" startline="69">tssStruct::io_map</references>
        <references refid="paging_8h_1a7c58070dedac2ee9e1c73d8c8206b923" compoundref="paging_8c" startline="41">kernelPageDirectory</references>
        <references refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" compoundref="armv6_2kpanic_8c" startline="41" endline="61">kpanic</references>
        <references refid="structtssStruct_1ad7b6a367e1c2a38e1ee6c8e5dad955f7" compoundref="tss_8h" startline="66">tssStruct::ldt</references>
        <references refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" compoundref="sched_8h" startline="69">taskStruct::oInfo</references>
        <references refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" compoundref="paging_8h" startline="37">PAGE_SIZE</references>
        <references refid="sched_8h_1a3fb333b67375561d327e9b5a8ffa03b9a6564f2f3e15be06b670547bbcaaf0798" compoundref="sched_8h" startline="47">READY</references>
        <references refid="armv6_2sched_8c_1a2cbadd034400c65dbd11fd4892ddf26e" compoundref="armv6_2sched_8c" startline="265" endline="271">sched_setStatus</references>
        <references refid="armv6_2sched_8c_1a92458df2063761371869cdfe0c9b4ee3" compoundref="armv6_2sched_8c" startline="135" endline="165">schedNewTask</references>
        <references refid="structtssStruct_1a340a29782d3306ba84176c543725d70a" compoundref="tss_8h" startline="58">tssStruct::ss</references>
        <references refid="structtssStruct_1a26d03018de8c122451661bfe9d030541" compoundref="tss_8h" startline="38">tssStruct::ss0</references>
        <references refid="structtssStruct_1a6abf05d9a8f6356860a5606ffbadc989" compoundref="tss_8h" startline="41">tssStruct::ss1</references>
        <references refid="structtssStruct_1a5a79ace5652b01cc25fc5ba7ff45bfa8" compoundref="tss_8h" startline="44">tssStruct::ss2</references>
        <references refid="structtssStruct_1a52ac0b54c6b2c71450c62d7fc911f2e2" compoundref="tss_8h" startline="68">tssStruct::trace_bitmap</references>
        <references refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" compoundref="sched_8h" startline="67">taskStruct::tss</references>
        <references refid="paging_8h_1a3615feeeee9f4038cd1070372ccba22e" compoundref="paging_8c" startline="291" endline="346">vmm_getFreeKernelPage</references>
        <references refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" compoundref="sched_8h" startline="54">osInfo::vmStart</references>
      </memberdef>
      <memberdef kind="function" id="i386__exec_8c_1a8ca0db98ca165b1662f4b37b2d27b265" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int sys_exec</definition>
        <argsstring>(struct thread *td, char *file, char **argv, char **envp)</argsstring>
        <name>sys_exec</name>
        <param>
          <type>struct <ref refid="structthread" kindref="compound">thread</ref> *</type>
          <declname>td</declname>
        </param>
        <param>
          <type>char *</type>
          <declname>file</declname>
        </param>
        <param>
          <type>char **</type>
          <declname>argv</declname>
        </param>
        <param>
          <type>char **</type>
          <declname>envp</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
<para>Clean the virtual of COW pages left over from the fork</para>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" line="491" column="5" bodyfile="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c" bodystart="491" bodyend="898"/>
      </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="__null_8h" kindref="compound">sys/_null.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="include_2sys_2types_8h" kindref="compound">sys/types.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="sys_2elf_8h" kindref="compound">sys/elf.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="gdt_8h" kindref="compound">sys/gdt.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="exec_8h" kindref="compound">ubixos/exec.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="34"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="ld_8h" kindref="compound">ubixos/ld.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="35"><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="36"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="endtask_8h" kindref="compound">ubixos/endtask.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="37"><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="38"><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="39"><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="40"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="include_2vfs_2file_8h" kindref="compound">vfs/file.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><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="42"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="string_8h" kindref="compound">string.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="descrip_8h" kindref="compound">sys/descrip.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"></highlight></codeline>
<codeline lineno="45" refid="i386__exec_8c_1a04dd67a9a0ea56bb6cf7943ac00a1626" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ENVP_PAGE<sp/>0x100</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="46" refid="i386__exec_8c_1a2f29812bcfd1b9ad2a0b165a3b3c6d4a" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ARGV_PAGE<sp/>0x100</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="47" refid="i386__exec_8c_1af47d51fffc4c46a034ec9a821ecfb7d0" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ELF_AUX<sp/>0x100</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="48" refid="i386__exec_8c_1a43c6dc010a1eea4fbe8de72a0826195b" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>STACK_PAD<sp/>0x1000</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight></codeline>
<codeline lineno="50" refid="i386__exec_8c_1a4d0b1b435ec441e7d50a430b83df5832" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ENOEXEC<sp/>-1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight></codeline>
<codeline lineno="52" refid="i386__exec_8c_1aa893f7231479240d49c660c5649cac5b" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_NULL<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>0<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Terminates<sp/>the<sp/>vector.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="53" refid="i386__exec_8c_1ab11dfd4fb71c15a128c3f70a310b53d1" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_IGNORE<sp/><sp/><sp/><sp/><sp/><sp/><sp/>1<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Ignored<sp/>entry.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="54" refid="i386__exec_8c_1a8a3070773d3f9231c9390172ae3fd2e7" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_EXECFD<sp/><sp/><sp/><sp/><sp/><sp/><sp/>2<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>File<sp/>descriptor<sp/>of<sp/>program<sp/>to<sp/>load.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="55" refid="i386__exec_8c_1a3de7ec7b5cee2d34208387ab97dc0642" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_PHDR<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>3<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Program<sp/>header<sp/>of<sp/>program<sp/>already<sp/>loaded.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="56" refid="i386__exec_8c_1a56f1f9975d88f768d7928b0ed587ef38" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_PHENT<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>4<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Size<sp/>of<sp/>each<sp/>program<sp/>header<sp/>entry.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="57" refid="i386__exec_8c_1abc712c67bee059574b4e3c096538d5bd" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_PHNUM<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>5<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Number<sp/>of<sp/>program<sp/>header<sp/>entries.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="58" refid="i386__exec_8c_1a7269f0c135d4bd3f9bc074d18fb30f9d" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_PAGESZ<sp/><sp/><sp/><sp/><sp/><sp/><sp/>6<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Page<sp/>size<sp/>in<sp/>bytes.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59" refid="i386__exec_8c_1a9b8e51a44a47d7ea827c570ffdca14e5" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_BASE<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>7<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Interpreter&apos;s<sp/>base<sp/>address.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="60" refid="i386__exec_8c_1a08c6bdc11224c9d17fbde19666c332cc" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_FLAGS<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>8<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Flags<sp/>(unused<sp/>for<sp/>i386).<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="61" refid="i386__exec_8c_1a80f2ea99241a6afdc4718d3c4318c871" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AT_ENTRY<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>9<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Where<sp/>interpreter<sp/>should<sp/>transfer<sp/>control.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight></codeline>
<codeline lineno="63" refid="i386__exec_8c_1afa8ddb544ff5a7ec07bbe00b16927559" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>AUXARGS_ENTRY(pos,<sp/>id,<sp/>val)<sp/>{*pos<sp/>=<sp/>id;pos++;<sp/>*pos<sp/>=<sp/>val;pos++;}</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>argv_count(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argv)<sp/>{</highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="67"><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(*argv++<sp/>!=<sp/>0x0)</highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/>i++;</highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(i);</highlight></codeline>
<codeline lineno="72"><highlight class="normal">}</highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>envp_count(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**envp)<sp/>{</highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(*envp++<sp/>!=<sp/>0x0)</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/>i++;</highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(i);</highlight></codeline>
<codeline lineno="81"><highlight class="normal">}</highlight></codeline>
<codeline lineno="82"><highlight class="normal"></highlight></codeline>
<codeline lineno="83"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>args_copyin(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argv_in,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argv_out,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**args_out)<sp/>{</highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>argc<sp/>=<sp/>argv_count(argv_in);</highlight></codeline>
<codeline lineno="86"><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*argv_tmp<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>*<sp/>(argc<sp/>+<sp/>2));<sp/></highlight><highlight class="comment">//<sp/>+<sp/>1<sp/>For<sp/>ARGC<sp/>+<sp/>1<sp/>For<sp/>NULL<sp/>TERM</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="88"><highlight class="normal"></highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*args_tmp<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(<ref refid="i386__exec_8c_1a2f29812bcfd1b9ad2a0b165a3b3c6d4a" kindref="member">ARGV_PAGE</ref>);</highlight></codeline>
<codeline lineno="90"><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/>argv_tmp[0]<sp/>=<sp/>argc;</highlight></codeline>
<codeline lineno="92"><highlight class="normal"></highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>sp<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="94"><highlight class="normal"></highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>1;<sp/>i<sp/>&lt;=<sp/>argc;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/>argv_tmp[i]<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)(args_tmp<sp/>+<sp/>sp);</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1a55e123beb3d7f96e25e024a13582d987" kindref="member">strcpy</ref>((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)argv_tmp[i],<sp/>argv_in[i<sp/>-<sp/>1]);</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/>sp<sp/>+=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(argv_in[i<sp/>-<sp/>1])<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/>argv_tmp[i++]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/>*argv_out<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)argv_tmp;</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/>*args_out<sp/>=<sp/>args_tmp;</highlight></codeline>
<codeline lineno="107"><highlight class="normal"></highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight></codeline>
<codeline lineno="110"><highlight class="normal">}</highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>envs_copyin(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**envp_in,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**envp_out,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**envs_out)<sp/>{</highlight></codeline>
<codeline lineno="113"><highlight class="normal"></highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>envc<sp/>=<sp/>envp_count(envp_in);</highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*envp_tmp<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>*<sp/>(envc<sp/>+<sp/>1));<sp/></highlight><highlight class="comment">//<sp/>+<sp/>1<sp/>For<sp/>NULL<sp/>TERM</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="117"><highlight class="normal"></highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*envs_tmp<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(<ref refid="i386__exec_8c_1a04dd67a9a0ea56bb6cf7943ac00a1626" kindref="member">ENVP_PAGE</ref>);</highlight></codeline>
<codeline lineno="119"><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>sp<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="123"><highlight class="normal"></highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>envc;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/>envp_tmp[i]<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)(envs_tmp<sp/>+<sp/>sp);</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1a55e123beb3d7f96e25e024a13582d987" kindref="member">strcpy</ref>((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)envp_tmp[i],<sp/>envp_in[i]);</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/>sp<sp/>+=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(envp_in[i])<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/>envp_tmp[i++]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="130"><highlight class="normal"></highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/>*envp_out<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)envp_tmp;</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/>*envs_out<sp/>=<sp/>envs_tmp;</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="134"><highlight class="normal">}</highlight></codeline>
<codeline lineno="135"><highlight class="normal"></highlight></codeline>
<codeline lineno="136"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>elf_parse_dynamic(<ref refid="structelf__file" kindref="compound">elf_file_t</ref><sp/>ef);</highlight></codeline>
<codeline lineno="137"><highlight class="normal"></highlight></codeline>
<codeline lineno="138"><highlight class="normal"></highlight><highlight class="comment">/*****************************************************************************************</highlight></codeline>
<codeline lineno="139"><highlight class="comment"></highlight></codeline>
<codeline lineno="140"><highlight class="comment"><sp/>Function:<sp/><sp/><sp/>execThread(void<sp/>(*)(void),int,char<sp/>*);</highlight></codeline>
<codeline lineno="141"><highlight class="comment"><sp/>Description:<sp/>This<sp/>function<sp/>will<sp/>create<sp/>a<sp/>thread<sp/>from<sp/>code<sp/>in<sp/>the<sp/>current<sp/>memory<sp/>space</highlight></codeline>
<codeline lineno="142"><highlight class="comment"></highlight></codeline>
<codeline lineno="143"><highlight class="comment"><sp/>Notes:</highlight></codeline>
<codeline lineno="144"><highlight class="comment"></highlight></codeline>
<codeline lineno="145"><highlight class="comment"><sp/>05/19/04<sp/>-<sp/>This<sp/>does<sp/>not<sp/>work<sp/>the<sp/>way<sp/>I<sp/>want<sp/>it<sp/>to<sp/>it<sp/>still<sp/>makes<sp/>a<sp/>copy<sp/>of<sp/>kernel<sp/>space</highlight></codeline>
<codeline lineno="146"><highlight class="comment"><sp/>so<sp/>do<sp/>not<sp/>use<sp/>out<sp/>side<sp/>of<sp/>kernel<sp/>space</highlight></codeline>
<codeline lineno="147"><highlight class="comment"></highlight></codeline>
<codeline lineno="148" refid="exec_8h_1a82087e9a98b3a265b5a19266d0fc5970" refkind="member"><highlight class="comment"><sp/>*****************************************************************************************/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/><ref refid="i386__exec_8c_1a2d25af2b05aa5dc4392daf1d97a3aa94" kindref="member">execThread</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>(*tproc)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">),<sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>stack,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*arg)<sp/>{</highlight></codeline>
<codeline lineno="150"><highlight class="normal"></highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><ref refid="structtaskStruct" kindref="compound">kTask_t</ref><sp/>*<sp/>newProcess<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>stackAddr<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="153"><highlight class="normal"></highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Find<sp/>A<sp/>New<sp/>Thread<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/>newProcess<sp/>=<sp/><ref refid="armv6_2sched_8c_1a92458df2063761371869cdfe0c9b4ee3" kindref="member">schedNewTask</ref>();</highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(newProcess);</highlight></codeline>
<codeline lineno="157"><highlight class="normal"></highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/>stackAddr<sp/>=<sp/><ref refid="paging_8h_1a3615feeeee9f4038cd1070372ccba22e" kindref="member">vmm_getFreeKernelPage</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>stack<sp/>/<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>);</highlight></codeline>
<codeline lineno="159"><highlight class="normal"></highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>All<sp/>The<sp/>Correct<sp/>Thread<sp/>Attributes<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1afecbe8ea2cfebfb4d1a0aa7b6ebcac2c" kindref="member">back_link</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a1017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a26d03018de8c122451661bfe9d030541" kindref="member">ss0</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ad5ef8867200562fd8262f70312beff4d" kindref="member">esp1</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a6abf05d9a8f6356860a5606ffbadc989" kindref="member">ss1</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a60c88f3cd3f2110cb24be62444f42cfb" kindref="member">esp2</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a5a79ace5652b01cc25fc5ba7ff45bfa8" kindref="member">ss2</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8d312ed3dd0ea7a0f801c08a8cc4afd0" kindref="member">cr3</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/>int)<sp/><ref refid="paging_8h_1a7c58070dedac2ee9e1c73d8c8206b923" kindref="member">kernelPageDirectory</ref>;</highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a3e758f2138799d63fc803f7e4db4f5b4" kindref="member">eip</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/>int)<sp/>tproc;</highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1aa85f1fbaf622e0c6a39963da27de0194" kindref="member">eflags</ref><sp/>=<sp/>0x206;</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a85412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref><sp/>=<sp/>stackAddr<sp/>+<sp/>(stack<sp/>-<sp/>0x4);<sp/></highlight><highlight class="comment">//stack;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ac2d32620149e07c40ee87696ef2509c2" kindref="member">ebp</ref><sp/>=<sp/>0x0;</highlight><highlight class="comment">//stack;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8beab5808aad776957d4544f6b139d4e" kindref="member">esi</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1aa52b515706cd37e166c8eba348d5e68b" kindref="member">edi</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="175"><highlight class="normal"></highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Ring<sp/>3<sp/>Selectors<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="178"><highlight class="comment"><sp/><sp/><sp/>newProcess-&gt;tss.es<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline>
<codeline lineno="179"><highlight class="comment"><sp/><sp/><sp/>newProcess-&gt;tss.cs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x28+3;</highlight></codeline>
<codeline lineno="180"><highlight class="comment"><sp/><sp/><sp/>newProcess-&gt;tss.ss<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline>
<codeline lineno="181"><highlight class="comment"><sp/><sp/><sp/>newProcess-&gt;tss.ds<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline>
<codeline lineno="182"><highlight class="comment"><sp/><sp/><sp/>newProcess-&gt;tss.fs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline>
<codeline lineno="183"><highlight class="comment"><sp/><sp/><sp/>newProcess-&gt;tss.gs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline>
<codeline lineno="184"><highlight class="comment"><sp/><sp/><sp/>*/</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">/*<sp/>Ring<sp/>0<sp/>Selectors<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1acd97dd6f6eabd83c0b819b6058b7041d" kindref="member">es</ref><sp/>=<sp/>0x10;</highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a6d9085ec5af0fa1fe1de7015ad99c9e3" kindref="member">cs</ref><sp/>=<sp/>0x08;</highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a340a29782d3306ba84176c543725d70a" kindref="member">ss</ref><sp/>=<sp/>0x10;</highlight></codeline>
<codeline lineno="190"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a01ee01c7f45c9b9ee2ad8338c21e6d33" kindref="member">ds</ref><sp/>=<sp/>0x10;</highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8114a585123181ec835f8db3e029d390" kindref="member">fs</ref><sp/>=<sp/>0x10;</highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8dfa44423504293405785371d0e7b076" kindref="member">gs</ref><sp/>=<sp/>0x10;</highlight></codeline>
<codeline lineno="193"><highlight class="normal"></highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ad7b6a367e1c2a38e1ee6c8e5dad955f7" kindref="member">ldt</ref><sp/>=<sp/>0x18;</highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a52ac0b54c6b2c71450c62d7fc911f2e2" kindref="member">trace_bitmap</ref><sp/>=<sp/>0x0000;</highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a611a0a044f99f092ace469ce2381bb33" kindref="member">io_map</ref><sp/>=<sp/>0x8000;</highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>0x6400000;</highlight></codeline>
<codeline lineno="198"><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]<sp/>!=<sp/>0x0)</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;Problem<sp/>With<sp/>File<sp/>Descriptors&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="201"><highlight class="normal"></highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="203"><highlight class="normal"></highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf(&quot;EIP:<sp/>0x%X(%i)&quot;,<sp/>tproc,<sp/>newProcess-&gt;id);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="205"><highlight class="normal"></highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>up<sp/>default<sp/>stack<sp/>for<sp/>thread<sp/>here<sp/>filled<sp/>with<sp/>arg<sp/>list<sp/>3<sp/>times<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">volatile</highlight><highlight class="normal">(</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;pusha<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/><sp/><sp/>%%esp,%%ecx<sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/><sp/><sp/>%1,%%eax<sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/><sp/><sp/>%%eax,%%esp<sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;pushl<sp/><sp/>%%ebx<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;pushl<sp/><sp/>%%ebx<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="214"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;pushl<sp/><sp/>%%ebx<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/><sp/><sp/>%%esp,%%eax<sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/><sp/><sp/>%%eax,%1<sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/><sp/><sp/>%%ecx,%%esp<sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;popa<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/>:</highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/>:<sp/></highlight><highlight class="stringliteral">&quot;b&quot;</highlight><highlight class="normal"><sp/>(arg),</highlight><highlight class="stringliteral">&quot;m&quot;</highlight><highlight class="normal"><sp/>(newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a85412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref>)</highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/>);</highlight></codeline>
<codeline lineno="222"><highlight class="normal"></highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Put<sp/>new<sp/>thread<sp/>into<sp/>the<sp/>READY<sp/>state<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a2cbadd034400c65dbd11fd4892ddf26e" kindref="member">sched_setStatus</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/><ref refid="sched_8h_1a3fb333b67375561d327e9b5a8ffa03b9a6564f2f3e15be06b670547bbcaaf0798" kindref="member">READY</ref>);</highlight></codeline>
<codeline lineno="225"><highlight class="normal"></highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Return<sp/>with<sp/>the<sp/>new<sp/>process<sp/>ID<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>((<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/>newProcess);</highlight></codeline>
<codeline lineno="228"><highlight class="normal">}</highlight></codeline>
<codeline lineno="229"><highlight class="normal"></highlight></codeline>
<codeline lineno="230"><highlight class="normal"></highlight><highlight class="comment">/*****************************************************************************************</highlight></codeline>
<codeline lineno="231"><highlight class="comment"></highlight></codeline>
<codeline lineno="232"><highlight class="comment"><sp/>Function:<sp/>void<sp/>execFile(char<sp/>*file);</highlight></codeline>
<codeline lineno="233"><highlight class="comment"><sp/>Description:<sp/>This<sp/>Function<sp/>Executes<sp/>A<sp/>Kile<sp/>Into<sp/>A<sp/>New<sp/>VM<sp/>Space<sp/>With<sp/>Out</highlight></codeline>
<codeline lineno="234"><highlight class="comment"><sp/>Having<sp/>To<sp/>Fork</highlight></codeline>
<codeline lineno="235"><highlight class="comment"><sp/>Notes:</highlight></codeline>
<codeline lineno="236"><highlight class="comment"></highlight></codeline>
<codeline lineno="237"><highlight class="comment"><sp/>07/30/02<sp/>-<sp/>I<sp/>Have<sp/>Made<sp/>Some<sp/>Heavy<sp/>Changes<sp/>To<sp/>This<sp/>As<sp/>Well<sp/>As<sp/>Fixed<sp/>A<sp/>Few</highlight></codeline>
<codeline lineno="238"><highlight class="comment"><sp/>Memory<sp/>Leaks<sp/>The<sp/>Memory<sp/>Allocated<sp/>To<sp/>Load<sp/>The<sp/>Binary<sp/>Into<sp/>Is</highlight></codeline>
<codeline lineno="239"><highlight class="comment"><sp/>Now<sp/>Unmapped<sp/>So<sp/>It<sp/>Can<sp/>Be<sp/>Used<sp/>Again<sp/>And<sp/>Not<sp/>Held<sp/>Onto<sp/>Until</highlight></codeline>
<codeline lineno="240"><highlight class="comment"><sp/>The<sp/>Program<sp/>Exits</highlight></codeline>
<codeline lineno="241"><highlight class="comment"></highlight></codeline>
<codeline lineno="242"><highlight class="comment"><sp/>07/30/02<sp/>-<sp/>Now<sp/>I<sp/>Have<sp/>To<sp/>Make<sp/>A<sp/>Better<sp/>Memory<sp/>Allocator<sp/>So<sp/>We<sp/>Can<sp/>Set<sp/>Up</highlight></codeline>
<codeline lineno="243"><highlight class="comment"><sp/>The<sp/>Freshly<sp/>Allocated<sp/>Pages<sp/>With<sp/>The<sp/>Correct<sp/>Permissions</highlight></codeline>
<codeline lineno="244" refid="exec_8h_1aaff6720506bf63686b0c962ea31439d3" refkind="member"><highlight class="comment"></highlight></codeline>
<codeline lineno="245"><highlight class="comment"><sp/>*****************************************************************************************/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="246"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="i386__exec_8c_1aaff6720506bf63686b0c962ea31439d3" kindref="member">execFile</ref>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="structfile" kindref="compound">file</ref>,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argv,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**envp,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>console)<sp/>{</highlight></codeline>
<codeline lineno="247"><highlight class="normal"></highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/><ref refid="structtaskStruct" kindref="compound">kTask_t</ref><sp/>*newProcess<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="249"><highlight class="normal"></highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="252"><highlight class="normal"></highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*tmp<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="254"><highlight class="normal"></highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/>Elf_Ehdr<sp/>*binaryHeader<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="256"><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="normal"><sp/><sp/>Elf_Phdr<sp/>*programHeader<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="258"><highlight class="normal"></highlight></codeline>
<codeline lineno="259"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>argc<sp/>=<sp/>argv_count(argv);</highlight></codeline>
<codeline lineno="260"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>envc<sp/>=<sp/>envp_count(envp);</highlight></codeline>
<codeline lineno="261"><highlight class="normal"></highlight></codeline>
<codeline lineno="262"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Get<sp/>A<sp/>New<sp/>Task<sp/>For<sp/>This<sp/>Proccess<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/>newProcess<sp/>=<sp/><ref refid="armv6_2sched_8c_1a92458df2063761371869cdfe0c9b4ee3" kindref="member">schedNewTask</ref>();</highlight></codeline>
<codeline lineno="264"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(newProcess);</highlight></codeline>
<codeline lineno="265"><highlight class="normal"></highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1aa9363ba2e18b68870b9a7bd42a012fc3" kindref="member">gid</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a2d4f1664132da8b58cc4dfb25ac3509a" kindref="member">uid</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1aa48ed6126ded7be4fddb44a860b16bf5" kindref="member">pgrp</ref><sp/>=<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>;</highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" kindref="member">term</ref><sp/>=<sp/><ref refid="tty_8h_1a4f96ccac7e60296ef496008d8cbed0ff" kindref="member">tty_find</ref>(console);</highlight></codeline>
<codeline lineno="270"><highlight class="normal"></highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(newProcess-&gt;<ref refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" kindref="member">term</ref><sp/>==<sp/>0x0)</highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Error:<sp/>invalid<sp/>console\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="273"><highlight class="normal"></highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>tty<sp/>ownership<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" kindref="member">term</ref>-&gt;<ref refid="structtty__termNode_1af8e2ad49f523044768d8e768bfe531e4" kindref="member">owner</ref><sp/>=<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>;</highlight></codeline>
<codeline lineno="276"><highlight class="normal"></highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Now<sp/>We<sp/>Must<sp/>Create<sp/>A<sp/>Virtual<sp/>Space<sp/>For<sp/>This<sp/>Proccess<sp/>To<sp/>Run<sp/>In<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8d312ed3dd0ea7a0f801c08a8cc4afd0" kindref="member">cr3</ref><sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/><ref refid="paging_8h_1acd6d1b9b2687749ddd73542f7897696e" kindref="member">vmm_createVirtualSpace</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>);</highlight></codeline>
<codeline lineno="279"><highlight class="normal"></highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>To<sp/>Better<sp/>Load<sp/>This<sp/>Application<sp/>We<sp/>Will<sp/>Switch<sp/>Over<sp/>To<sp/>Its<sp/>VM<sp/>Space<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">volatile</highlight><highlight class="normal">(</highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/>%0,%%eax<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/>%%eax,%%cr3<sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/>:<sp/>:<sp/></highlight><highlight class="stringliteral">&quot;d&quot;</highlight><highlight class="normal"><sp/>((<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*)(newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8d312ed3dd0ea7a0f801c08a8cc4afd0" kindref="member">cr3</ref>))</highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/>);</highlight></codeline>
<codeline lineno="286"><highlight class="normal"></highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Lets<sp/>Find<sp/>The<sp/>File<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]<sp/>!=<sp/>0x0)</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;Problem<sp/>With<sp/>File<sp/>Descriptors&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]<sp/>=<sp/><ref refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" kindref="member">fopen</ref>(<ref refid="structfile" kindref="compound">file</ref>,<sp/></highlight><highlight class="stringliteral">&quot;r&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="291"><highlight class="normal"></highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>We<sp/>Dont<sp/>Find<sp/>the<sp/>File<sp/>Return<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]<sp/>==<sp/>0x0)<sp/>{</highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable1.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="298"><highlight class="normal"></highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]-&gt;<ref refid="structfileDescriptor_1aaf1c61f69cb312867bcdf95896a74bdc" kindref="member">perms</ref><sp/>==<sp/>0x0)<sp/>{</highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable2.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="304"><highlight class="normal"></highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>ELF<sp/>Header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/>binaryHeader<sp/>=<sp/>(Elf_Ehdr<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Ehdr));</highlight></codeline>
<codeline lineno="307"><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>(binaryHeader,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Ehdr),<sp/>1,<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline>
<codeline lineno="309"><highlight class="normal"></highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>If<sp/>App<sp/>Is<sp/>A<sp/>Real<sp/>Application<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader-&gt;e_ident[1]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;E&apos;</highlight><highlight class="normal">)<sp/>&amp;&amp;<sp/>(binaryHeader-&gt;e_ident[2]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;L&apos;</highlight><highlight class="normal">)<sp/>&amp;&amp;<sp/>(binaryHeader-&gt;e_ident[3]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;F&apos;</highlight><highlight class="normal">))<sp/>{</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable3.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(binaryHeader-&gt;e_type<sp/>!=<sp/>2)<sp/>{</highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable4.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(binaryHeader-&gt;e_entry<sp/>==<sp/>0x300000)<sp/>{</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable5.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</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/>newProcess-&gt;<ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ad50525c84c75cd60eace495f3731d457" kindref="member">abi</ref><sp/>=<sp/>binaryHeader-&gt;e_ident[<ref refid="elf__common_8h_1a862a7ea859a2a2bed110aedf7744d969" kindref="member">EI_OSABI</ref>];</highlight></codeline>
<codeline lineno="331"><highlight class="normal"></highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>The<sp/>Program<sp/>Header(s)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/>programHeader<sp/>=<sp/>(Elf_Phdr<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Phdr)<sp/>*<sp/>binaryHeader-&gt;e_phnum);</highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0],<sp/>binaryHeader-&gt;e_phoff,<sp/>0);</highlight></codeline>
<codeline lineno="335"><highlight class="normal"></highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>(programHeader,<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Phdr)<sp/>*<sp/>binaryHeader-&gt;e_phnum),<sp/>1,<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline>
<codeline lineno="337"><highlight class="normal"></highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Loop<sp/>Through<sp/>The<sp/>Header<sp/>And<sp/>Load<sp/>Sections<sp/>Which<sp/>Need<sp/>To<sp/>Be<sp/>Loaded<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>binaryHeader-&gt;e_phnum;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(programHeader[i].p_type<sp/>==<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="342"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Allocate<sp/>Memory<sp/>Im<sp/>Going<sp/>To<sp/>Have<sp/>To<sp/>Make<sp/>This<sp/>Load<sp/>Memory<sp/>With<sp/>Correct</highlight></codeline>
<codeline lineno="343"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Settings<sp/>so<sp/>it<sp/>helps<sp/>us<sp/>in<sp/>the<sp/>future</highlight></codeline>
<codeline lineno="344"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>0x0;<sp/>x<sp/>&lt;<sp/>(programHeader[i].p_memsz);<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Make<sp/>readonly<sp/>and<sp/>read/write<sp/>!!!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="paging_8h_1adea68f248df43bddee62a09d945304b0" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1ab8e4e189a7b1df2a03072ce5b75c89fe" kindref="member">vmm_findFreePage</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/>((programHeader[i].p_vaddr<sp/>&amp;<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/><ref refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>,<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>0)<sp/>==<sp/>0x0)</highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">&quot;Remap<sp/>Page<sp/>Failed&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="349"><highlight class="normal"></highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<sp/>((programHeader[i].p_vaddr<sp/>&amp;<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/>0x0,<sp/>0x1000);</highlight></codeline>
<codeline lineno="351"><highlight class="normal"></highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="353"><highlight class="normal"></highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Now<sp/>Load<sp/>Section<sp/>To<sp/>Memory<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0],<sp/>programHeader[i].p_offset,<sp/>0);</highlight></codeline>
<codeline lineno="356"><highlight class="normal"></highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<sp/>programHeader[i].p_vaddr,<sp/>programHeader[i].p_filesz,<sp/>1,<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline>
<codeline lineno="358"><highlight class="normal"></highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader[i].p_flags<sp/>&amp;<sp/>0x2)<sp/>!=<sp/>0x2)<sp/>{</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>0x0;<sp/>x<sp/>&lt;<sp/>(programHeader[i].p_memsz);<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline>
<codeline lineno="361"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="paging_8h_1ab060cb62a6dd6d22f63757d72c27c335" kindref="member">vmm_setPageAttributes</ref>((programHeader[i].p_vaddr<sp/>&amp;<sp/>0xFFFFF000)<sp/>+<sp/>x,<sp/><ref refid="paging_8h_1a122dfc414a40e260fd35dbe9743db26f" kindref="member">PAGE_PRESENT</ref><sp/>|<sp/><ref refid="paging_8h_1a2d0253527ea5080d6befe0ee3bde473f" kindref="member">PAGE_USER</ref>))<sp/>!=<sp/>0x0)</highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;Error:<sp/>vmm_setPageAttributes<sp/>failed,<sp/>File:<sp/>%s,<sp/>Line:<sp/>%i\n&quot;</highlight><highlight class="normal">,<sp/>__FILE__,<sp/>__LINE__);</highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="367"><highlight class="normal"></highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>Virtual<sp/>Memory<sp/>Start<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>0x80000000;</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a8f25a50daf29ce2cee1ec038a4d744ea" kindref="member">u_long</ref>)<sp/>(programHeader[i].p_vaddr<sp/>&amp;<sp/>0xFFFFF000);</highlight></codeline>
<codeline lineno="371"><highlight class="normal"></highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>Up<sp/>Stack<sp/>Space<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>(2016-01-14)<sp/>FIX:<sp/>is<sp/>the<sp/>stack<sp/>start<sp/>supposed<sp/>to<sp/>be<sp/>addressable<sp/>xhcnage<sp/>x=<sp/>1<sp/>to<sp/>x=0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//x<sp/>=<sp/>0<sp/>because<sp/>GS=<sp/>stack<sp/>address<sp/>not<sp/>address<sp/>-1<sp/>fix!</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>1;<sp/>x<sp/>&lt;=<sp/>100;<sp/>x++)<sp/>{</highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="paging_8h_1adea68f248df43bddee62a09d945304b0" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1ab8e4e189a7b1df2a03072ce5b75c89fe" kindref="member">vmm_findFreePage</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/>(<ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>+1)<sp/>-<sp/>(x<sp/>*<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>),<sp/><ref refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref><sp/>|<sp/><ref refid="paging_8h_1a1532db17068ba8d409b8ffe066414af2" kindref="member">PAGE_STACK</ref>,<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="gpt_8h_1a310ac455ac45de9713bd7dcb0b5500ad" kindref="member">bzero</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)((<ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>+1)<sp/>-<sp/>(x<sp/>*<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>)),<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>);</highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="379"><highlight class="normal"></highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Kernel<sp/>Stack<sp/>0x2000<sp/>bytes<sp/>long<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="381"><highlight class="normal"></highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//vmm_remapPage(vmm_findFreePage(newProcess-&gt;id),<sp/>0x5BC000,<sp/>KERNEL_PAGE_DEFAULT<sp/>|<sp/>PAGE_STACK,<sp/>newProcess-&gt;id);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//vmm_remapPage(vmm_findFreePage(newProcess-&gt;id),<sp/>0x5BB000,<sp/>KERNEL_PAGE_DEFAULT<sp/>|<sp/>PAGE_STACK,<sp/>newProcess-&gt;id);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="385"><highlight class="comment"><sp/><sp/>for<sp/>(x<sp/>=<sp/>0;<sp/>x<sp/>&lt;<sp/>2;<sp/>x++)</highlight></codeline>
<codeline lineno="386"><highlight class="comment"><sp/><sp/><sp/><sp/>vmm_remapPage(vmm_findFreePage(newProcess-&gt;id),<sp/>0xFFFFF000<sp/>-<sp/>(PAGE_SIZE<sp/>*<sp/>x),<sp/>KERNEL_PAGE_DEFAULT<sp/>|<sp/>PAGE_STACK,<sp/>newProcess-&gt;id,<sp/>0);</highlight></codeline>
<codeline lineno="387"><highlight class="comment"><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="388"><highlight class="normal"></highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>All<sp/>The<sp/>Proper<sp/>Information<sp/>For<sp/>The<sp/>Task<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1afecbe8ea2cfebfb4d1a0aa7b6ebcac2c" kindref="member">back_link</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a1017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/>=<sp/>0xFFFFFFFF;<sp/></highlight><highlight class="comment">//0x5BC000;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a26d03018de8c122451661bfe9d030541" kindref="member">ss0</ref><sp/>=<sp/>0x10;</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ad5ef8867200562fd8262f70312beff4d" kindref="member">esp1</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a6abf05d9a8f6356860a5606ffbadc989" kindref="member">ss1</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a60c88f3cd3f2110cb24be62444f42cfb" kindref="member">esp2</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a5a79ace5652b01cc25fc5ba7ff45bfa8" kindref="member">ss2</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a3e758f2138799d63fc803f7e4db4f5b4" kindref="member">eip</ref><sp/>=<sp/>(long)<sp/>binaryHeader-&gt;e_entry;</highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1aa85f1fbaf622e0c6a39963da27de0194" kindref="member">eflags</ref><sp/>=<sp/>0x206;</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a85412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref><sp/>=<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>;</highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ac2d32620149e07c40ee87696ef2509c2" kindref="member">ebp</ref><sp/>=<sp/>0x0;</highlight><highlight class="comment">//STACK_ADDR;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8beab5808aad776957d4544f6b139d4e" kindref="member">esi</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1aa52b515706cd37e166c8eba348d5e68b" kindref="member">edi</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="403"><highlight class="normal"></highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>these<sp/>up<sp/>to<sp/>be<sp/>ring<sp/>3<sp/>tasks<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="405"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1acd97dd6f6eabd83c0b819b6058b7041d" kindref="member">es</ref><sp/>=<sp/>0x30<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a6d9085ec5af0fa1fe1de7015ad99c9e3" kindref="member">cs</ref><sp/>=<sp/>0x28<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a340a29782d3306ba84176c543725d70a" kindref="member">ss</ref><sp/>=<sp/>0x30<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a01ee01c7f45c9b9ee2ad8338c21e6d33" kindref="member">ds</ref><sp/>=<sp/>0x30<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8114a585123181ec835f8db3e029d390" kindref="member">fs</ref><sp/>=<sp/>0x30<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8dfa44423504293405785371d0e7b076" kindref="member">gs</ref><sp/>=<sp/>0x8<sp/>+<sp/>3<sp/>+<sp/>4;</highlight><highlight class="comment">//0x50<sp/>+<sp/>3;<sp/>//0x30<sp/>+<sp/>3;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="411"><highlight class="normal"></highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ad7b6a367e1c2a38e1ee6c8e5dad955f7" kindref="member">ldt</ref><sp/>=<sp/>0x18;</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a52ac0b54c6b2c71450c62d7fc911f2e2" kindref="member">trace_bitmap</ref><sp/>=<sp/>0x0000;</highlight></codeline>
<codeline lineno="414"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a611a0a044f99f092ace469ce2381bb33" kindref="member">io_map</ref><sp/>=<sp/>0x8000;</highlight></codeline>
<codeline lineno="415"><highlight class="normal"></highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//sched_setStatus(newProcess-&gt;id,<sp/>READY);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="417"><highlight class="normal"></highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(programHeader);</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="422"><highlight class="normal"></highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*)<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a1017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/>-<sp/>5;</highlight></codeline>
<codeline lineno="424"><highlight class="normal"></highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/>tmp[0]<sp/>=<sp/>binaryHeader-&gt;e_entry;</highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/>tmp[3]<sp/>=<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/>12;</highlight></codeline>
<codeline lineno="427"><highlight class="normal"></highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a85412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref><sp/>=<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a2f29812bcfd1b9ad2a0b165a3b3c6d4a" kindref="member">ARGV_PAGE</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a04dd67a9a0ea56bb6cf7943ac00a1626" kindref="member">ENVP_PAGE</ref><sp/>-<sp/><ref refid="i386__exec_8c_1af47d51fffc4c46a034ec9a821ecfb7d0" kindref="member">ELF_AUX</ref><sp/>-<sp/>(argc<sp/>+<sp/>1)<sp/>-<sp/>(envc<sp/>+<sp/>1)<sp/>-<sp/><ref refid="i386__exec_8c_1a43c6dc010a1eea4fbe8de72a0826195b" kindref="member">STACK_PAD</ref>;</highlight></codeline>
<codeline lineno="429"><highlight class="normal"></highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*)<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a85412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref>;</highlight></codeline>
<codeline lineno="431"><highlight class="normal"></highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/>tmp[0]<sp/>=<sp/>argc;</highlight></codeline>
<codeline lineno="433"><highlight class="normal"></highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>sp<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="435"><highlight class="normal"></highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/>for<sp/>(i<sp/>=<sp/>1;<sp/>i<sp/>&lt;=<sp/>argc;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp[i]<sp/>=<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a2f29812bcfd1b9ad2a0b165a3b3c6d4a" kindref="member">ARGV_PAGE</ref><sp/>+<sp/>sp;</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1a55e123beb3d7f96e25e024a13582d987" kindref="member">strcpy</ref>((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>tmp[i],<sp/>argv[i<sp/>-<sp/>1]);</highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/>sp<sp/>+=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(argv[i<sp/>-<sp/>1])<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="440"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="442"><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/>sp<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="444"><highlight class="normal"></highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0;<sp/>x<sp/>&lt;<sp/>envc;<sp/>x++)<sp/>{</highlight></codeline>
<codeline lineno="446"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp[x<sp/>+<sp/>i]<sp/>=<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a2f29812bcfd1b9ad2a0b165a3b3c6d4a" kindref="member">ARGV_PAGE</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a04dd67a9a0ea56bb6cf7943ac00a1626" kindref="member">ENVP_PAGE</ref><sp/>+<sp/>sp;</highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1a55e123beb3d7f96e25e024a13582d987" kindref="member">strcpy</ref>((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>tmp[x<sp/>+<sp/>i],<sp/>envp[x]);</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/>sp<sp/>+=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(envp[x])<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/>tmp[i<sp/>+<sp/>x]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="451"><highlight class="normal"></highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Build<sp/>LDT<sp/>For<sp/>GS<sp/>and<sp/>FS<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><ref refid="vmm_8h_1a457446966aafafd939af6603f68516b1" kindref="member">vmm_unmapPage</ref>(<ref refid="vmm_8h_1ab73be2fd1f1c93794618941747db46c6" kindref="member">VMM_USER_LDT</ref>,<sp/>1);</highlight></codeline>
<codeline lineno="454"><highlight class="normal"></highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="paging_8h_1adea68f248df43bddee62a09d945304b0" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1ab8e4e189a7b1df2a03072ce5b75c89fe" kindref="member">vmm_findFreePage</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/><ref refid="vmm_8h_1ab73be2fd1f1c93794618941747db46c6" kindref="member">VMM_USER_LDT</ref>,<sp/><ref refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>,<sp/>newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>0)<sp/>==<sp/>0x0)<sp/>{</highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">&quot;Error:<sp/>Remap<sp/>Page<sp/>Failed&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="458"><highlight class="normal"></highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structgdtDescriptor" kindref="compound">gdtDescriptor</ref><sp/>*taskLDT<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="460"><highlight class="normal"></highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/>taskLDT<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structgdtDescriptor" kindref="compound">gdtDescriptor</ref><sp/>*)(<ref refid="vmm_8h_1ab73be2fd1f1c93794618941747db46c6" kindref="member">VMM_USER_LDT</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structgdtDescriptor" kindref="compound">gdtDescriptor</ref>));</highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>data_addr<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="463"><highlight class="normal"></highlight></codeline>
<codeline lineno="464"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1a3b6f25eeaf186c263985eabffb96cb1a" kindref="member">limitLow</ref><sp/>=<sp/>(0xFFFFF<sp/>&amp;<sp/>0xFFFF);</highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1ad8fb7196c3b0b2d15ebbc0d20006d0a8" kindref="member">baseLow</ref><sp/>=<sp/>(data_addr<sp/>&amp;<sp/>0xFFFF);</highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1aef125e8406580a85d2201c2d63245575" kindref="member">baseMed</ref><sp/>=<sp/>((data_addr<sp/>&gt;&gt;<sp/>16)<sp/>&amp;<sp/>0xFF);</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1ae0bca342b5caa6d39826f21fc9ac4d56" kindref="member">access</ref><sp/>=<sp/>((<ref refid="gdt_8h_1afcbb50cc521f6214eda9bca84aaee513" kindref="member">dData</ref><sp/>+<sp/><ref refid="gdt_8h_1a9785c919d49cacd1b0fa92590a7562c8" kindref="member">dWrite</ref><sp/>+<sp/><ref refid="gdt_8h_1a6b595357c10a17c620edcbeeb1c7f6a1" kindref="member">dBig</ref><sp/>+<sp/><ref refid="gdt_8h_1abc269d96e027bb39b828cadb2fc8660f" kindref="member">dBiglim</ref><sp/>+<sp/><ref refid="gdt_8h_1a2e29d1e158d5e81dc70dfae75f17d7f4" kindref="member">dDpl3</ref>)<sp/>+<sp/><ref refid="gdt_8h_1abe5eb76416aff1d9114e1cdb8b0797fe" kindref="member">dPresent</ref>)<sp/>&gt;&gt;<sp/>8;</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1a8f380d84a88a1982542a08fd9b53698f" kindref="member">limitHigh</ref><sp/>=<sp/>(0xFFFFF<sp/>&gt;&gt;<sp/>16);</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1a1c5e6d9ddc74b0998b968a383e5f314c" kindref="member">granularity</ref><sp/>=<sp/>((<ref refid="gdt_8h_1afcbb50cc521f6214eda9bca84aaee513" kindref="member">dData</ref><sp/>+<sp/><ref refid="gdt_8h_1a9785c919d49cacd1b0fa92590a7562c8" kindref="member">dWrite</ref><sp/>+<sp/><ref refid="gdt_8h_1a6b595357c10a17c620edcbeeb1c7f6a1" kindref="member">dBig</ref><sp/>+<sp/><ref refid="gdt_8h_1abc269d96e027bb39b828cadb2fc8660f" kindref="member">dBiglim</ref><sp/>+<sp/><ref refid="gdt_8h_1a2e29d1e158d5e81dc70dfae75f17d7f4" kindref="member">dDpl3</ref>)<sp/>&amp;<sp/>0xFF)<sp/>&gt;&gt;<sp/>4;</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1a2cd45ddaee984e45ef519b5f96cb4151" kindref="member">baseHigh</ref><sp/>=<sp/>data_addr<sp/>&gt;&gt;<sp/>24;</highlight></codeline>
<codeline lineno="471"><highlight class="normal"></highlight></codeline>
<codeline lineno="472"><highlight class="normal"></highlight></codeline>
<codeline lineno="473"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Switch<sp/>Back<sp/>To<sp/>The<sp/>Kernels<sp/>VM<sp/>Space<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="474"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">volatile</highlight><highlight class="normal">(</highlight></codeline>
<codeline lineno="475"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/>%0,%%eax<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="476"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;movl<sp/>%%eax,%%cr3<sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="477"><highlight class="normal"><sp/><sp/><sp/><sp/>:<sp/>:<sp/></highlight><highlight class="stringliteral">&quot;d&quot;</highlight><highlight class="normal"><sp/>((<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*)(<ref refid="paging_8h_1a7c58070dedac2ee9e1c73d8c8206b923" kindref="member">kernelPageDirectory</ref>))</highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/>);</highlight></codeline>
<codeline lineno="479"><highlight class="normal"></highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1ac38cd16373d98782e1465bd3d5aba470" kindref="member">sprintf</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_1ae9411eaa7df66cd0148237248848bbdf" kindref="member">cwd</ref>,<sp/></highlight><highlight class="stringliteral">&quot;/&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="481"><highlight class="normal"></highlight></codeline>
<codeline lineno="482"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018<sp/>kprintf(&quot;execFile<sp/>Return:<sp/>0x%X<sp/>-<sp/>%i\n&quot;,<sp/><sp/>newProcess-&gt;tss.eip,<sp/>newProcess-&gt;id);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="483"><highlight class="normal"></highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Put<sp/>new<sp/>thread<sp/>into<sp/>the<sp/>READY<sp/>state<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a2cbadd034400c65dbd11fd4892ddf26e" kindref="member">sched_setStatus</ref>(newProcess-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/><ref refid="sched_8h_1a3fb333b67375561d327e9b5a8ffa03b9a6564f2f3e15be06b670547bbcaaf0798" kindref="member">READY</ref>);</highlight></codeline>
<codeline lineno="486"><highlight class="normal"></highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//_current<sp/>=<sp/>newProcess;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="488"><highlight class="normal"></highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Finally<sp/>Return<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="491" refid="exec_8h_1a61302088712929af86b255393411366c" refkind="member"><highlight class="normal">}</highlight></codeline>
<codeline lineno="492"><highlight class="normal"></highlight></codeline>
<codeline lineno="493"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="i386__exec_8c_1a8ca0db98ca165b1662f4b37b2d27b265" kindref="member">sys_exec</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structthread" kindref="compound">thread</ref><sp/>*td,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="structfile" kindref="compound">file</ref>,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argv,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**envp)<sp/>{</highlight></codeline>
<codeline lineno="494"><highlight class="normal"></highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="497"><highlight class="normal"></highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>argc<sp/>=<sp/>argv_count(argv);</highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>envc<sp/>=<sp/>envp_count(envp);</highlight></codeline>
<codeline lineno="500"><highlight class="normal"></highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>cr3<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="502"><highlight class="normal"></highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*tmp<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="504"><highlight class="normal"></highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>seg_size<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>seg_addr<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="507"><highlight class="normal"></highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*interp<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>ldAddr<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="510"><highlight class="normal"></highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><ref refid="structfileDescriptor" kindref="compound">fileDescriptor_t</ref><sp/>*fd<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="512"><highlight class="normal"></highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/>Elf_Ehdr<sp/>*binaryHeader<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/>Elf_Phdr<sp/>*programHeader<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/>Elf_Shdr<sp/>*sectionHeader<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="516"><highlight class="normal"></highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/><ref refid="structelf__file" kindref="compound">elf_file_t</ref><sp/>ef<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="518"><highlight class="normal"></highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a8f25a50daf29ce2cee1ec038a4d744ea" kindref="member">u_long</ref><sp/>text_addr<sp/>=<sp/>0,<sp/>text_size<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a8f25a50daf29ce2cee1ec038a4d744ea" kindref="member">u_long</ref><sp/>data_addr<sp/>=<sp/>0,<sp/>data_size<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="521"><highlight class="normal"></highlight></codeline>
<codeline lineno="522"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structi386__frame" kindref="compound">i386_frame</ref><sp/>*iFrame<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="523"><highlight class="normal"></highlight></codeline>
<codeline lineno="524"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">asm</highlight><highlight class="normal">(</highlight><highlight class="stringliteral">&quot;movl<sp/>%%cr3,<sp/>%0;&quot;</highlight><highlight class="normal"><sp/>:<sp/></highlight><highlight class="stringliteral">&quot;=r&quot;</highlight><highlight class="normal"><sp/>(cr3));</highlight></codeline>
<codeline lineno="525"><highlight class="normal"></highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/>fd<sp/>=<sp/><ref refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" kindref="member">fopen</ref>(<ref refid="structfile" kindref="compound">file</ref>,<sp/></highlight><highlight class="stringliteral">&quot;r&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="527"><highlight class="normal"></highlight></codeline>
<codeline lineno="528"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(fd<sp/>==<sp/>0x0)<sp/>{</highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/>td-&gt;<ref refid="structthread_1af3ec0788a84e5cb640a1646d1347998a" kindref="member">td_retval</ref>[0]<sp/>=<sp/>2;</highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(-1);</highlight></codeline>
<codeline lineno="531"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="532"><highlight class="normal"></highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Test<sp/>If<sp/>Executable<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="534"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(fd-&gt;<ref refid="structfileDescriptor_1aaf1c61f69cb312867bcdf95896a74bdc" kindref="member">perms</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="535"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable6.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(fd);</highlight></codeline>
<codeline lineno="537"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(-1);</highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="539"><highlight class="normal"></highlight></codeline>
<codeline lineno="540"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>Threads<sp/>FD<sp/>to<sp/>open<sp/>FD<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]<sp/>=<sp/>fd;</highlight></codeline>
<codeline lineno="542"><highlight class="normal"></highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Copy<sp/>In<sp/>ARGS<sp/>&amp;<sp/>ENVS<sp/>Before<sp/>Cleaning<sp/>Virtual<sp/>Space<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*argv_out<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*args_out<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="546"><highlight class="normal"></highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/>args_copyin(argv,<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**)&amp;argv_out,<sp/>&amp;args_out);</highlight></codeline>
<codeline lineno="548"><highlight class="normal"></highlight></codeline>
<codeline lineno="549"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*envp_out<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*envs_out<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="551"><highlight class="normal"></highlight></codeline>
<codeline lineno="552"><highlight class="normal"><sp/><sp/>envs_copyin(envp,<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**)&amp;envp_out,<sp/>&amp;envs_out);</highlight></codeline>
<codeline lineno="553"><highlight class="normal"></highlight></codeline>
<codeline lineno="555"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//vmm_cleanVirtualSpace(<sp/>(uint32_t)<sp/>_current-&gt;td.vm_daddr<sp/>+<sp/>(_current-&gt;td.vm_dsize<sp/>&lt;&lt;<sp/>PAGE_SHIFT)<sp/>);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="556"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2017-12-15<sp/>-<sp/>FIX!<sp/>-<sp/>This<sp/>should<sp/>be<sp/>done<sp/>before<sp/>it<sp/>was<sp/>causing<sp/>a<sp/>lot<sp/>of<sp/>problems<sp/>why<sp/>did<sp/>I<sp/>free<sp/>space<sp/>after<sp/>loading<sp/>binary????</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="557"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//vmm_cleanVirtualSpace((uint32_t)<sp/>0x8048000);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="558"><highlight class="normal"><sp/><sp/><ref refid="paging_8h_1adf104ab2196331b538186550cb7ada3e" kindref="member">vmm_cleanVirtualSpace</ref>((<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/><ref refid="vmm_8h_1ad43d15bd90c1980dae3db013c1a5abb0" kindref="member">VMM_USER_START</ref>);</highlight></codeline>
<codeline lineno="559"><highlight class="normal"></highlight></codeline>
<codeline lineno="560"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Clear<sp/>Stack<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="561"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//bzero(STACK_ADDR<sp/>-<sp/>(100<sp/>*<sp/>PAGE_SIZE),<sp/>(PAGE_SIZE<sp/>*<sp/>100));</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="562"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>1;<sp/>x<sp/>&lt;=<sp/>100;<sp/>x++)<sp/>{</highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="paging_8h_1adea68f248df43bddee62a09d945304b0" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1ab8e4e189a7b1df2a03072ce5b75c89fe" kindref="member">vmm_findFreePage</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/>(<ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>+1)<sp/>-<sp/>(x<sp/>*<sp/>0x1000),<sp/><ref refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref><sp/>|<sp/><ref refid="paging_8h_1a1532db17068ba8d409b8ffe066414af2" kindref="member">PAGE_STACK</ref>,<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="gpt_8h_1a310ac455ac45de9713bd7dcb0b5500ad" kindref="member">bzero</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)((<ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>+1)<sp/>-<sp/>(x<sp/>*<sp/>0x1000)),<sp/>0x1000);</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="566"><highlight class="normal"></highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>ELF<sp/>Header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="568"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader<sp/>=<sp/>(Elf_Ehdr<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Ehdr)))<sp/>==<sp/>0x0)</highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">&quot;MALLOC<sp/>FAILED&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="570"><highlight class="normal"></highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>(binaryHeader,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Ehdr),<sp/>1,<sp/>fd);</highlight></codeline>
<codeline lineno="572"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Done<sp/>Loading<sp/>ELF<sp/>Header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="573"><highlight class="normal"></highlight></codeline>
<codeline lineno="574"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>If<sp/>App<sp/>Is<sp/>A<sp/>Real<sp/>Application<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="575"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader-&gt;e_ident[1]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;E&apos;</highlight><highlight class="normal">)<sp/>&amp;&amp;<sp/>(binaryHeader-&gt;e_ident[2]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;L&apos;</highlight><highlight class="normal">)<sp/>&amp;&amp;<sp/>(binaryHeader-&gt;e_ident[3]<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;F&apos;</highlight><highlight class="normal">))<sp/>{</highlight></codeline>
<codeline lineno="576"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable7.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="577"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline>
<codeline lineno="578"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(fd);</highlight></codeline>
<codeline lineno="579"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(-1);</highlight></codeline>
<codeline lineno="580"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="581"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(binaryHeader-&gt;e_type<sp/>!=<sp/><ref refid="elf__common_8h_1a942478985eb016311380dee473cc8c3e" kindref="member">ET_EXEC</ref>)<sp/>{</highlight></codeline>
<codeline lineno="582"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable8.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="583"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline>
<codeline lineno="584"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(fd);</highlight></codeline>
<codeline lineno="585"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(-1);</highlight></codeline>
<codeline lineno="586"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="587"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(binaryHeader-&gt;e_entry<sp/>==<sp/>0x300000)<sp/>{</highlight></codeline>
<codeline lineno="588"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable9.\n&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="589"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline>
<codeline lineno="590"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(fd);</highlight></codeline>
<codeline lineno="591"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(-1);</highlight></codeline>
<codeline lineno="592"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="593"><highlight class="normal"></highlight></codeline>
<codeline lineno="594"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>Thread<sp/>ABI<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="595"><highlight class="normal"><sp/><sp/>td-&gt;<ref refid="structthread_1ad50525c84c75cd60eace495f3731d457" kindref="member">abi</ref><sp/>=<sp/>binaryHeader-&gt;e_ident[<ref refid="elf__common_8h_1a862a7ea859a2a2bed110aedf7744d969" kindref="member">EI_OSABI</ref>];</highlight></codeline>
<codeline lineno="596"><highlight class="normal"></highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>The<sp/>Program<sp/>Header(s)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader<sp/>=<sp/>(Elf_Phdr<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Phdr)<sp/>*<sp/>binaryHeader-&gt;e_phnum))<sp/>==<sp/>0x0)</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">&quot;MALLOC<sp/>FAILED&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="600"><highlight class="normal"></highlight></codeline>
<codeline lineno="601"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(programHeader);</highlight></codeline>
<codeline lineno="602"><highlight class="normal"></highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(fd,<sp/>binaryHeader-&gt;e_phoff,<sp/>0);</highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>(programHeader,<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Phdr)<sp/>*<sp/>binaryHeader-&gt;e_phnum),<sp/>1,<sp/>fd);</highlight></codeline>
<codeline lineno="605"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Done<sp/>Loading<sp/>Program<sp/>Header(s)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="606"><highlight class="normal"></highlight></codeline>
<codeline lineno="607"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>The<sp/>Section<sp/>Header(s)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((sectionHeader<sp/>=<sp/>(Elf_Shdr<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Shdr)<sp/>*<sp/>binaryHeader-&gt;e_shnum))<sp/>==<sp/>0x0)</highlight></codeline>
<codeline lineno="609"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">&quot;MALLOC<sp/>FAILED&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="610"><highlight class="normal"></highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(sectionHeader);</highlight></codeline>
<codeline lineno="612"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(fd,<sp/>binaryHeader-&gt;e_shoff,<sp/>0);</highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>(sectionHeader,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Shdr)<sp/>*<sp/>binaryHeader-&gt;e_shnum,<sp/>1,<sp/>fd);</highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Done<sp/>Loading<sp/>Section<sp/>Header(s)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="615"><highlight class="normal"></highlight></codeline>
<codeline lineno="616"><highlight class="normal"><sp/><sp/>ef<sp/>=<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structelf__file" kindref="compound">elf_file</ref>));</highlight></codeline>
<codeline lineno="617"><highlight class="normal"><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(ef,<sp/>0x0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structelf__file" kindref="compound">elf_file</ref>));</highlight></codeline>
<codeline lineno="618"><highlight class="normal"></highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Loop<sp/>Through<sp/>The<sp/>Header<sp/>And<sp/>Load<sp/>Sections<sp/>Which<sp/>Need<sp/>To<sp/>Be<sp/>Loaded<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="620"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>binaryHeader-&gt;e_phnum;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(programHeader[i].p_type)<sp/>{</highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a84d7768fd6c6ece599d297090900cf92" kindref="member">PT_LOAD</ref>:</highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(programHeader[i].p_memsz<sp/>==<sp/>0x0)</highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="625"><highlight class="normal"></highlight></codeline>
<codeline lineno="626"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>seg_addr<sp/>=<sp/><ref refid="paging_8h_1abd636a9b61ad98f4fc23b1f4a9210d78" kindref="member">trunc_page</ref>(programHeader[i].p_vaddr);</highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>seg_size<sp/>=<sp/><ref refid="paging_8h_1a2702263fcf2b3b026cb26c6d895cb0ee" kindref="member">round_page</ref>(programHeader[i].p_memsz<sp/>+<sp/>programHeader[i].p_vaddr<sp/>-<sp/>seg_addr);</highlight></codeline>
<codeline lineno="628"><highlight class="normal"></highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="630"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Allocate<sp/>Memory<sp/>Im<sp/>Going<sp/>To<sp/>Have<sp/>To<sp/>Make<sp/>This<sp/>Load<sp/>Memory<sp/>With<sp/>Correct</highlight></codeline>
<codeline lineno="631"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Settings<sp/>so<sp/>it<sp/>helps<sp/>us<sp/>in<sp/>the<sp/>future</highlight></codeline>
<codeline lineno="632"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="633"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>0x0;<sp/>x<sp/>&lt;<sp/>(<ref refid="paging_8h_1a2702263fcf2b3b026cb26c6d895cb0ee" kindref="member">round_page</ref>(programHeader[i].p_memsz));<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline>
<codeline lineno="634"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Make<sp/>readonly<sp/>and<sp/>read/write<sp/>!!!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="635"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="paging_8h_1adea68f248df43bddee62a09d945304b0" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1ab8e4e189a7b1df2a03072ce5b75c89fe" kindref="member">vmm_findFreePage</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/>((programHeader[i].p_vaddr<sp/>&amp;<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/><ref refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>,<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>0)<sp/>==<sp/>0x0)<sp/>{</highlight></codeline>
<codeline lineno="636"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">&quot;Error:<sp/>Remap<sp/>Page<sp/>Failed&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="637"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="638"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="639"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018-01-15<sp/>kprintf(&quot;rP[0x%X]&quot;,<sp/>(programHeader[i].p_vaddr<sp/>&amp;<sp/>0xFFFFF000)<sp/>+<sp/>x);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="640"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="641"><highlight class="normal"></highlight></codeline>
<codeline lineno="642"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<sp/>((programHeader[i].p_vaddr<sp/>&amp;<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/>0x0,<sp/>0x1000);</highlight></codeline>
<codeline lineno="643"><highlight class="normal"></highlight></codeline>
<codeline lineno="644"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="645"><highlight class="normal"></highlight></codeline>
<codeline lineno="646"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Now<sp/>Load<sp/>Section<sp/>To<sp/>Memory<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="647"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(fd,<sp/>programHeader[i].p_offset,<sp/>0);</highlight></codeline>
<codeline lineno="648"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<sp/>programHeader[i].p_vaddr,<sp/>programHeader[i].p_filesz,<sp/>1,<sp/>fd);</highlight></codeline>
<codeline lineno="649"><highlight class="normal"></highlight></codeline>
<codeline lineno="650"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader[i].p_flags<sp/>&amp;<sp/>0x2)<sp/>!=<sp/>0x2)<sp/>{</highlight></codeline>
<codeline lineno="651"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>0x0;<sp/>x<sp/>&lt;<sp/>(<ref refid="paging_8h_1a2702263fcf2b3b026cb26c6d895cb0ee" kindref="member">round_page</ref>(programHeader[i].p_memsz));<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline>
<codeline lineno="652"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="paging_8h_1ab060cb62a6dd6d22f63757d72c27c335" kindref="member">vmm_setPageAttributes</ref>((programHeader[i].p_vaddr<sp/>&amp;<sp/>0xFFFFF000)<sp/>+<sp/>x,<sp/><ref refid="paging_8h_1a122dfc414a40e260fd35dbe9743db26f" kindref="member">PAGE_PRESENT</ref><sp/>|<sp/><ref refid="paging_8h_1a2d0253527ea5080d6befe0ee3bde473f" kindref="member">PAGE_USER</ref>))<sp/>!=<sp/>0x0)</highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;Error:<sp/>vmm_setPageAttributes<sp/>failed,<sp/>File:<sp/>%s,Line:<sp/>%i\n&quot;</highlight><highlight class="normal">,<sp/>__FILE__,<sp/>__LINE__);</highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="655"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="656"><highlight class="normal"></highlight></codeline>
<codeline lineno="657"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader[i].p_flags<sp/>&amp;<sp/><ref refid="elf__common_8h_1a1780bfb8eae34d26e52459699877c640" kindref="member">PF_X</ref>)<sp/>&amp;&amp;<sp/>text_size<sp/>&lt;<sp/>seg_size)<sp/>{</highlight></codeline>
<codeline lineno="658"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018kprintf(&quot;setting<sp/>text:<sp/>0x%X<sp/>-<sp/>0x%X\n&quot;,<sp/>seg_addr,<sp/>seg_size);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="659"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>text_size<sp/>=<sp/>seg_size;</highlight></codeline>
<codeline lineno="660"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>text_addr<sp/>=<sp/>seg_addr;</highlight></codeline>
<codeline lineno="661"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="662"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018kprintf(&quot;setting<sp/>data:<sp/>0x%X<sp/>-<sp/>0x%X\n&quot;,<sp/>seg_addr,<sp/>seg_size);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="664"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>data_size<sp/>=<sp/>seg_size;</highlight></codeline>
<codeline lineno="665"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>data_addr<sp/>=<sp/>seg_addr;</highlight></codeline>
<codeline lineno="666"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="667"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>_current-&gt;td.vm_dsize<sp/>=<sp/>seg_size<sp/>&gt;&gt;<sp/>PAGE_SHIFT;</highlight></codeline>
<codeline lineno="668"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>_current-&gt;td.vm_daddr<sp/>=<sp/>(char<sp/>*)<sp/>seg_addr;</highlight></codeline>
<codeline lineno="669"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>kprintf(<sp/>&quot;setting<sp/>daddr:<sp/>0x%X,<sp/>dsiize:<sp/>0x%X\n&quot;,<sp/>_current-&gt;td.vm_daddr,<sp/>_current-&gt;td.vm_dsize<sp/>);</highlight></codeline>
<codeline lineno="670"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="671"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="672"><highlight class="normal"></highlight></codeline>
<codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="674"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/><sp/>MrOlsen<sp/>(2016-01-19)<sp/>NOTE:<sp/>Note<sp/>Sure,<sp/>I<sp/>should<sp/>Do<sp/>This<sp/>Later</highlight></codeline>
<codeline lineno="675"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Thjis<sp/>is<sp/>for<sp/>stack<sp/>space</highlight></codeline>
<codeline lineno="676"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="677"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>((programHeader[i].p_vaddr<sp/>&amp;<sp/>0xFFFFF000)<sp/>+<sp/>0xA900000);</highlight></codeline>
<codeline lineno="678"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="679"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a2121a2f01c51e8462bfd4d47725649d8" kindref="member">PT_DYNAMIC</ref>:</highlight></codeline>
<codeline lineno="680"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//newLoc<sp/>=<sp/>(char<sp/>*)programHeader[i].phVaddr;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="681"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//elfDynamicS<sp/>=<sp/>(elfDynamic<sp/>*)<sp/>programHeader[i].p_vaddr;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="682"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1ab8111701a8d834289326d463e21dc67e" kindref="member">dynamic</ref><sp/>=<sp/>(Elf_Dyn<sp/>*)<sp/>programHeader[i].p_vaddr;</highlight></codeline>
<codeline lineno="683"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//fseek(<sp/>fd,<sp/>programHeader[i].phOffset,<sp/>0<sp/>);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="684"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//fread(<sp/>(void<sp/>*)<sp/>programHeader[i].phVaddr,<sp/>programHeader[i].phFilesz,<sp/>1,<sp/>fd<sp/>);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="685"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="686"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1abcd3aa15bc567949c1ab6b1abc137710" kindref="member">PT_INTERP</ref>:</highlight></codeline>
<codeline lineno="687"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>#ifdef<sp/>DEBUG_EXEC</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="688"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;%s:%i&gt;Malloc:<sp/>%i\n&quot;</highlight><highlight class="normal">,<sp/>_FILE_,_LINE_,programHeader[i].p_filesz);</highlight></codeline>
<codeline lineno="689"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="690"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>interp<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(programHeader[i].p_filesz);</highlight></codeline>
<codeline lineno="691"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(fd,<sp/>programHeader[i].p_offset,<sp/>0);</highlight></codeline>
<codeline lineno="692"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" kindref="member">fread</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<sp/>interp,<sp/>programHeader[i].p_filesz,<sp/>1,<sp/>fd);</highlight></codeline>
<codeline lineno="693"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>#ifdef<sp/>DEBUG_EXEC</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="694"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;Interp:<sp/>[%s]\n&quot;</highlight><highlight class="normal">,<sp/>interp);</highlight></codeline>
<codeline lineno="695"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="696"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ldAddr<sp/>=<sp/><ref refid="ld_8h_1ab0622e93915d1824df770950e425875f" kindref="member">ldEnable</ref>(interp);</highlight></codeline>
<codeline lineno="697"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//ef-&gt;ld_addr<sp/>=<sp/>ldEnable();</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="698"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="699"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1af9283bc32e6d3e87d2bab2f55bc1949b" kindref="member">PT_GNU_STACK</ref>:</highlight></codeline>
<codeline lineno="700"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><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="701"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="702"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="703"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="704"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="705"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="706"><highlight class="normal"></highlight></codeline>
<codeline lineno="707"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1a06071e22f28a91ba81be0bcac20381be" kindref="member">vm_tsize</ref><sp/>=<sp/>text_size<sp/>&gt;&gt;<sp/><ref refid="paging_8h_1a850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline>
<codeline lineno="708"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ad0eacc093248865db3d911c3c17e6d92" kindref="member">vm_taddr</ref><sp/>=<sp/>text_addr;</highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ac5ce95b5be4422e5f5a61f081547d425" kindref="member">vm_dsize</ref><sp/>=<sp/>data_size<sp/>&gt;&gt;<sp/><ref refid="paging_8h_1a850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline>
<codeline lineno="710"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>=<sp/>data_addr;</highlight></codeline>
<codeline lineno="711"><highlight class="normal"></highlight></codeline>
<codeline lineno="712"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018kprintf(&quot;Done<sp/>Looping\n&quot;);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="713"><highlight class="normal"></highlight></codeline>
<codeline lineno="714"><highlight class="normal"><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a8d1a6d2403f16fb2213af368f98090e4" kindref="member">preloaded</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="715"><highlight class="normal"><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a3cdc3dfff0554c0a888a5773541f5d16" kindref="member">address</ref><sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="716"><highlight class="normal"><sp/><sp/>elf_parse_dynamic(ef);</highlight></codeline>
<codeline lineno="717"><highlight class="normal"></highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//asm(&quot;cld&quot;);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="719"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//irqDisable(0);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="720"><highlight class="normal"><sp/><sp/>iFrame<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structi386__frame" kindref="compound">i386_frame</ref><sp/>*)<sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a1017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/>-<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structi386__frame" kindref="compound">i386_frame</ref>));</highlight></codeline>
<codeline lineno="721"><highlight class="normal"></highlight></codeline>
<codeline lineno="722"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//iFrame-&gt;ebp<sp/>=<sp/>0x0;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="723"><highlight class="normal"></highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ldAddr<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline>
<codeline lineno="725"><highlight class="normal"><sp/><sp/><sp/><sp/>iFrame-&gt;<ref refid="structi386__frame_1a031746b975400ea26eac2e8dcbc2bb13" kindref="member">eip</ref><sp/>=<sp/>ldAddr;</highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="727"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="728"><highlight class="normal"><sp/><sp/><sp/><sp/>iFrame-&gt;<ref refid="structi386__frame_1a031746b975400ea26eac2e8dcbc2bb13" kindref="member">eip</ref><sp/>=<sp/>binaryHeader-&gt;e_entry;</highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="730"><highlight class="normal"></highlight></codeline>
<codeline lineno="731"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//iFrame-&gt;edx<sp/>=<sp/>0x0;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="732"><highlight class="normal"></highlight></codeline>
<codeline lineno="733"><highlight class="normal"><sp/><sp/>iFrame-&gt;<ref refid="structi386__frame_1aae0679acc1998f636b00761b546ed656" kindref="member">user_esp</ref><sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/>(<ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a2f29812bcfd1b9ad2a0b165a3b3c6d4a" kindref="member">ARGV_PAGE</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a04dd67a9a0ea56bb6cf7943ac00a1626" kindref="member">ENVP_PAGE</ref><sp/>-<sp/><ref refid="i386__exec_8c_1af47d51fffc4c46a034ec9a821ecfb7d0" kindref="member">ELF_AUX</ref><sp/>-<sp/>(argc<sp/>+<sp/>1)<sp/>-<sp/>(envc<sp/>+<sp/>1)<sp/>-<sp/><ref refid="i386__exec_8c_1a43c6dc010a1eea4fbe8de72a0826195b" kindref="member">STACK_PAD</ref>)<sp/>&amp;<sp/>0xFFFFF000;</highlight></codeline>
<codeline lineno="734"><highlight class="normal"></highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>*)<sp/>iFrame-&gt;<ref refid="structi386__frame_1aae0679acc1998f636b00761b546ed656" kindref="member">user_esp</ref>;</highlight></codeline>
<codeline lineno="736"><highlight class="normal"></highlight></codeline>
<codeline lineno="737"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>memset((char<sp/>*)<sp/>tmp,<sp/>0x0,<sp/>ARGV_PAGE<sp/>+<sp/>ENVP_PAGE<sp/>+<sp/>ELF_AUX<sp/>+<sp/>(argc<sp/>+<sp/>1)<sp/>+<sp/>(envc<sp/>+<sp/>1)<sp/>+<sp/>STACK_PAD);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="738"><highlight class="normal"></highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/>tmp[0]<sp/>=<sp/>argc;</highlight></codeline>
<codeline lineno="740"><highlight class="normal"></highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>sp<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="742"><highlight class="normal"></highlight></codeline>
<codeline lineno="743"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*EXECP<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="744"><highlight class="normal"></highlight></codeline>
<codeline lineno="745"><highlight class="normal"><sp/><sp/>for<sp/>(i<sp/>=<sp/>1;<sp/>i<sp/>&lt;=<sp/>argc;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="746"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp[i]<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a2f29812bcfd1b9ad2a0b165a3b3c6d4a" kindref="member">ARGV_PAGE</ref><sp/>+<sp/>sp;</highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>==<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>EXECP<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)tmp[i];</highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1a55e123beb3d7f96e25e024a13582d987" kindref="member">strcpy</ref>((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)tmp[i],<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)argv_out[i]);</highlight></codeline>
<codeline lineno="751"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/>#ifdef<sp/>EXEC_DEBUG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="752"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;argv[%i]:%s&quot;</highlight><highlight class="normal">,i,<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)argv_out[i]);</highlight></codeline>
<codeline lineno="753"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/>#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="754"><highlight class="normal"><sp/><sp/><sp/><sp/>sp<sp/>+=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>((</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)argv_out[i])<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="755"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="756"><highlight class="normal"></highlight></codeline>
<codeline lineno="757"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="758"><highlight class="normal"></highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(argv_out);</highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(args_out);</highlight></codeline>
<codeline lineno="761"><highlight class="normal"></highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/>sp<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="763"><highlight class="normal"></highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/>x<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="765"><highlight class="normal"></highlight></codeline>
<codeline lineno="766"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>0;<sp/>x<sp/>&lt;<sp/>envc;<sp/>x++)<sp/>{</highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp[x<sp/>+<sp/>i]<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a2f29812bcfd1b9ad2a0b165a3b3c6d4a" kindref="member">ARGV_PAGE</ref><sp/>-<sp/><ref refid="i386__exec_8c_1a04dd67a9a0ea56bb6cf7943ac00a1626" kindref="member">ENVP_PAGE</ref><sp/>+<sp/>sp;</highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1a55e123beb3d7f96e25e024a13582d987" kindref="member">strcpy</ref>((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>tmp[x<sp/>+<sp/>i],<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)envp_out[x]);</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/>sp<sp/>+=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>((</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)envp_out[x])<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="771"><highlight class="normal"></highlight></codeline>
<codeline lineno="772"><highlight class="normal"><sp/><sp/>tmp[i<sp/>+<sp/>x]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="773"><highlight class="normal"></highlight></codeline>
<codeline lineno="774"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(envp_out);</highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(envs_out);</highlight></codeline>
<codeline lineno="776"><highlight class="normal"></highlight></codeline>
<codeline lineno="777"><highlight class="normal"><sp/><sp/>i<sp/>=<sp/>i<sp/>+<sp/>x<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="778"><highlight class="normal"></highlight></codeline>
<codeline lineno="779"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structfile" kindref="compound">file</ref><sp/>*tFP<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>tFD<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="781"><highlight class="normal"></highlight></codeline>
<codeline lineno="782"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0],<sp/>0x0,<sp/>0x0);<sp/></highlight><highlight class="comment">//<sp/>Reset<sp/>File<sp/>Position</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/><ref refid="descrip_8h_1a434fb15226182b0ee879a5afe9a8c190" kindref="member">falloc</ref>(&amp;<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>,<sp/>&amp;tFP,<sp/>&amp;tFD);</highlight></codeline>
<codeline lineno="784"><highlight class="normal"></highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/>tFP-&gt;<ref refid="structfile_1af2108e4a1620fe81b2b5e7b6db5d41d4" kindref="member">fd</ref><sp/>=<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0];</highlight></codeline>
<codeline lineno="786"><highlight class="normal"></highlight></codeline>
<codeline lineno="787"><highlight class="normal"></highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>2;</highlight></codeline>
<codeline lineno="789"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>-1;</highlight><highlight class="comment">//<sp/>tFD;<sp/><sp/>//<sp/>_current-&gt;imageFd;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="790"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1a68f1e552f18575d52731e9e61ad411fe" kindref="member">o_files</ref>[4]<sp/>=<sp/>tFP;<sp/></highlight><highlight class="comment">//<sp/>XXX<sp/>-<sp/>I<sp/>had<sp/>this<sp/>-&gt;<sp/>_current-&gt;files[0];<sp/>not<sp/>sure<sp/>why<sp/>changed<sp/>to<sp/>tFP<sp/>on<sp/>2018-11-09</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="791"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018kprintf(&quot;AT_EXECFD:<sp/>[%i:%i]&quot;,<sp/>tmp[i<sp/>-<sp/>1],<sp/>tFD);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="792"><highlight class="normal"></highlight></codeline>
<codeline lineno="793"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>3;</highlight></codeline>
<codeline lineno="794"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>binaryHeader-&gt;e_phoff<sp/>+<sp/>0x08048000;</highlight></codeline>
<codeline lineno="795"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018kprintf(&quot;AT_PHDR:<sp/>[0x%X]&quot;,<sp/>tmp[i<sp/>-<sp/>1]);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="796"><highlight class="normal"></highlight></codeline>
<codeline lineno="797"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>4;</highlight></codeline>
<codeline lineno="798"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>binaryHeader-&gt;e_phentsize;</highlight></codeline>
<codeline lineno="799"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018kprintf(&quot;AT_PHENT:<sp/>[0x%X]&quot;,<sp/>tmp[i<sp/>-<sp/>1]);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="800"><highlight class="normal"></highlight></codeline>
<codeline lineno="801"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>5;</highlight></codeline>
<codeline lineno="802"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>binaryHeader-&gt;e_phnum;</highlight></codeline>
<codeline lineno="803"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018kprintf(&quot;AT_PHNUM:<sp/>[0x%X]&quot;,<sp/>tmp[i<sp/>-<sp/>1]);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="804"><highlight class="normal"></highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>6;</highlight></codeline>
<codeline lineno="806"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x1000;</highlight></codeline>
<codeline lineno="807"><highlight class="normal"></highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>7;</highlight></codeline>
<codeline lineno="809"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/><ref refid="kmod_8h_1af4d6f389174a00e0de80e1ea0e23e956" kindref="member">LD_START</ref>;</highlight></codeline>
<codeline lineno="810"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//MrOlsen<sp/>2018kprintf(&quot;AT_BASE:<sp/>[0x%X]&quot;,<sp/>tmp[i<sp/>-<sp/>1]);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="811"><highlight class="normal"></highlight></codeline>
<codeline lineno="812"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>8;</highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="814"><highlight class="normal"></highlight></codeline>
<codeline lineno="815"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>9;</highlight></codeline>
<codeline lineno="816"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>binaryHeader-&gt;e_entry;</highlight></codeline>
<codeline lineno="817"><highlight class="normal"></highlight></codeline>
<codeline lineno="818"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>11;</highlight></codeline>
<codeline lineno="819"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="820"><highlight class="normal"></highlight></codeline>
<codeline lineno="821"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>12;</highlight></codeline>
<codeline lineno="822"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="823"><highlight class="normal"></highlight></codeline>
<codeline lineno="824"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>13;</highlight></codeline>
<codeline lineno="825"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="826"><highlight class="normal"></highlight></codeline>
<codeline lineno="827"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>14;</highlight></codeline>
<codeline lineno="828"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="829"><highlight class="normal"></highlight></codeline>
<codeline lineno="830"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>15;<sp/></highlight><highlight class="comment">//EXEC<sp/>PATH</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="831"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)EXECP;</highlight></codeline>
<codeline lineno="832"><highlight class="normal"></highlight></codeline>
<codeline lineno="833"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>19;<sp/></highlight><highlight class="comment">//NCPUS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="834"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x1;</highlight></codeline>
<codeline lineno="835"><highlight class="normal"></highlight></codeline>
<codeline lineno="836"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>23;<sp/></highlight><highlight class="comment">//STACKPROT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="837"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0x3;</highlight></codeline>
<codeline lineno="838"><highlight class="normal"></highlight></codeline>
<codeline lineno="839"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/>tmp[i++]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="841"><highlight class="normal"></highlight></codeline>
<codeline lineno="842"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Now<sp/>That<sp/>We<sp/>Relocated<sp/>The<sp/>Binary<sp/>We<sp/>Can<sp/>Unmap<sp/>And<sp/>Free<sp/>Header<sp/>Info<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="843"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline>
<codeline lineno="844"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(programHeader);</highlight></codeline>
<codeline lineno="845"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//irqEnable(0);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="846"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//asm(&quot;sti&quot;);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="847"><highlight class="normal"></highlight></codeline>
<codeline lineno="848"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="849"><highlight class="comment"><sp/><sp/><sp/>_current-&gt;tss.es<sp/>=<sp/>0x30<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="850"><highlight class="comment"><sp/><sp/><sp/>_current-&gt;tss.cs<sp/>=<sp/>0x28<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="851"><highlight class="comment"><sp/><sp/><sp/>_current-&gt;tss.ss<sp/>=<sp/>0x30<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="852"><highlight class="comment"><sp/><sp/><sp/>_current-&gt;tss.ds<sp/>=<sp/>0x30<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="853"><highlight class="comment"><sp/><sp/><sp/>_current-&gt;tss.fs<sp/>=<sp/>0x30<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="854"><highlight class="comment"><sp/><sp/><sp/>_current-&gt;tss.gs<sp/>=<sp/>0x50<sp/>+<sp/>3;<sp/>//0x30<sp/>+<sp/>3;</highlight></codeline>
<codeline lineno="855"><highlight class="comment"></highlight></codeline>
<codeline lineno="856"><highlight class="comment"><sp/><sp/><sp/>_current-&gt;tss.ldt<sp/>=<sp/>0x18;</highlight></codeline>
<codeline lineno="857"><highlight class="comment"><sp/><sp/><sp/>_current-&gt;tss.trace_bitmap<sp/>=<sp/>0x0000;</highlight></codeline>
<codeline lineno="858"><highlight class="comment"><sp/><sp/><sp/>_current-&gt;tss.io_map<sp/>=<sp/>0x8000;</highlight></codeline>
<codeline lineno="859"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="860"><highlight class="normal"></highlight></codeline>
<codeline lineno="861"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="862"><highlight class="comment"><sp/><sp/><sp/>kfree<sp/>(iFrameNew);</highlight></codeline>
<codeline lineno="863"><highlight class="comment"></highlight></codeline>
<codeline lineno="864"><highlight class="comment"><sp/><sp/><sp/>memAddr<sp/>=<sp/>(uint32_t)<sp/>&amp;<sp/>(_current-&gt;tss);</highlight></codeline>
<codeline lineno="865"><highlight class="comment"><sp/><sp/><sp/>ubixGDT[4].descriptor.baseLow<sp/>=<sp/>(memAddr<sp/>&amp;<sp/>0xFFFF);</highlight></codeline>
<codeline lineno="866"><highlight class="comment"><sp/><sp/><sp/>ubixGDT[4].descriptor.baseMed<sp/>=<sp/>((memAddr<sp/>&gt;&gt;<sp/>16)<sp/>&amp;<sp/>0xFF);</highlight></codeline>
<codeline lineno="867"><highlight class="comment"><sp/><sp/><sp/>ubixGDT[4].descriptor.baseHigh<sp/>=<sp/>(memAddr<sp/>&gt;&gt;<sp/>24);</highlight></codeline>
<codeline lineno="868"><highlight class="comment"><sp/><sp/><sp/>ubixGDT[4].descriptor.access<sp/>=<sp/>&apos;\x89&apos;;</highlight></codeline>
<codeline lineno="869"><highlight class="comment"></highlight></codeline>
<codeline lineno="870"><highlight class="comment"><sp/><sp/><sp/>ubixGDT[10].descriptor.baseLow<sp/>=<sp/>(STACK_ADDR<sp/>&amp;<sp/>0xFFFF);</highlight></codeline>
<codeline lineno="871"><highlight class="comment"><sp/><sp/><sp/>ubixGDT[10].descriptor.baseMed<sp/>=<sp/>((STACK_ADDR<sp/>&gt;&gt;<sp/>16)<sp/>&amp;<sp/>0xFF);</highlight></codeline>
<codeline lineno="872"><highlight class="comment"><sp/><sp/><sp/>ubixGDT[10].descriptor.baseHigh<sp/>=<sp/>(STACK_ADDR<sp/>&gt;&gt;<sp/>24);</highlight></codeline>
<codeline lineno="873"><highlight class="comment"></highlight></codeline>
<codeline lineno="874"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="875"><highlight class="normal"></highlight></codeline>
<codeline lineno="876"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Build<sp/>LDT<sp/>For<sp/>GS<sp/>and<sp/>FS<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="877"><highlight class="normal"><sp/><sp/><ref refid="vmm_8h_1a457446966aafafd939af6603f68516b1" kindref="member">vmm_unmapPage</ref>(<ref refid="vmm_8h_1ab73be2fd1f1c93794618941747db46c6" kindref="member">VMM_USER_LDT</ref>,<sp/>1);<sp/></highlight><highlight class="comment">//<sp/>Can<sp/>I<sp/>Free<sp/>This?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="878"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="paging_8h_1adea68f248df43bddee62a09d945304b0" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1ab8e4e189a7b1df2a03072ce5b75c89fe" kindref="member">vmm_findFreePage</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/><ref refid="vmm_8h_1ab73be2fd1f1c93794618941747db46c6" kindref="member">VMM_USER_LDT</ref>,<sp/><ref refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>,<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>0)<sp/>==<sp/>0x0)<sp/>{</highlight></codeline>
<codeline lineno="879"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">&quot;Error:<sp/>Remap<sp/>Page<sp/>Failed&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="880"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="881"><highlight class="normal"></highlight></codeline>
<codeline lineno="882"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structgdtDescriptor" kindref="compound">gdtDescriptor</ref><sp/>*taskLDT<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="883"><highlight class="normal"></highlight></codeline>
<codeline lineno="884"><highlight class="normal"><sp/><sp/>taskLDT<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structgdtDescriptor" kindref="compound">gdtDescriptor</ref><sp/>*)(<ref refid="vmm_8h_1ab73be2fd1f1c93794618941747db46c6" kindref="member">VMM_USER_LDT</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structgdtDescriptor" kindref="compound">gdtDescriptor</ref>));</highlight></codeline>
<codeline lineno="885"><highlight class="normal"></highlight></codeline>
<codeline lineno="886"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//data_addr<sp/>=<sp/>0x0;<sp/>//TEMP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="887"><highlight class="normal"></highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1a3b6f25eeaf186c263985eabffb96cb1a" kindref="member">limitLow</ref><sp/>=<sp/>(0xFFFFF<sp/>&amp;<sp/>0xFFFF);</highlight></codeline>
<codeline lineno="889"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1ad8fb7196c3b0b2d15ebbc0d20006d0a8" kindref="member">baseLow</ref><sp/>=<sp/>(data_addr<sp/>&amp;<sp/>0xFFFF);</highlight></codeline>
<codeline lineno="890"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1aef125e8406580a85d2201c2d63245575" kindref="member">baseMed</ref><sp/>=<sp/>((data_addr<sp/>&gt;&gt;<sp/>16)<sp/>&amp;<sp/>0xFF);</highlight></codeline>
<codeline lineno="891"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1ae0bca342b5caa6d39826f21fc9ac4d56" kindref="member">access</ref><sp/>=<sp/>((<ref refid="gdt_8h_1afcbb50cc521f6214eda9bca84aaee513" kindref="member">dData</ref><sp/>+<sp/><ref refid="gdt_8h_1a9785c919d49cacd1b0fa92590a7562c8" kindref="member">dWrite</ref><sp/>+<sp/><ref refid="gdt_8h_1a6b595357c10a17c620edcbeeb1c7f6a1" kindref="member">dBig</ref><sp/>+<sp/><ref refid="gdt_8h_1abc269d96e027bb39b828cadb2fc8660f" kindref="member">dBiglim</ref><sp/>+<sp/><ref refid="gdt_8h_1a2e29d1e158d5e81dc70dfae75f17d7f4" kindref="member">dDpl3</ref>)<sp/>+<sp/><ref refid="gdt_8h_1abe5eb76416aff1d9114e1cdb8b0797fe" kindref="member">dPresent</ref>)<sp/>&gt;&gt;<sp/>8;</highlight></codeline>
<codeline lineno="892"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1a8f380d84a88a1982542a08fd9b53698f" kindref="member">limitHigh</ref><sp/>=<sp/>(0xFFFFF<sp/>&gt;&gt;<sp/>16);</highlight></codeline>
<codeline lineno="893"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1a1c5e6d9ddc74b0998b968a383e5f314c" kindref="member">granularity</ref><sp/>=<sp/>((<ref refid="gdt_8h_1afcbb50cc521f6214eda9bca84aaee513" kindref="member">dData</ref><sp/>+<sp/><ref refid="gdt_8h_1a9785c919d49cacd1b0fa92590a7562c8" kindref="member">dWrite</ref><sp/>+<sp/><ref refid="gdt_8h_1a6b595357c10a17c620edcbeeb1c7f6a1" kindref="member">dBig</ref><sp/>+<sp/><ref refid="gdt_8h_1abc269d96e027bb39b828cadb2fc8660f" kindref="member">dBiglim</ref><sp/>+<sp/><ref refid="gdt_8h_1a2e29d1e158d5e81dc70dfae75f17d7f4" kindref="member">dDpl3</ref>)<sp/>&amp;<sp/>0xFF)<sp/>&gt;&gt;<sp/>4;</highlight></codeline>
<codeline lineno="894"><highlight class="normal"><sp/><sp/>taskLDT-&gt;<ref refid="structgdtDescriptor_1a2cd45ddaee984e45ef519b5f96cb4151" kindref="member">baseHigh</ref><sp/>=<sp/>data_addr<sp/>&gt;&gt;<sp/>24;</highlight></codeline>
<codeline lineno="895"><highlight class="normal"></highlight></codeline>
<codeline lineno="896"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8dfa44423504293405785371d0e7b076" kindref="member">gs</ref><sp/>=<sp/>0xF;<sp/></highlight><highlight class="comment">//Select<sp/>0x8<sp/>+<sp/>Ring<sp/>3<sp/>+<sp/>LDT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="897"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1aa48ed6126ded7be4fddb44a860b16bf5" kindref="member">pgrp</ref><sp/>=<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>;</highlight></codeline>
<codeline lineno="898"><highlight class="normal"></highlight></codeline>
<codeline lineno="899"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0x0);</highlight></codeline>
<codeline lineno="900"><highlight class="normal">}</highlight></codeline>
<codeline lineno="901"><highlight class="normal"></highlight></codeline>
<codeline lineno="902"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>elf_parse_dynamic(<ref refid="structelf__file" kindref="compound">elf_file_t</ref><sp/>ef)<sp/>{</highlight></codeline>
<codeline lineno="903"><highlight class="normal"><sp/><sp/><ref refid="structElf32__Dyn" kindref="compound">Elf32_Dyn</ref><sp/>*dynp;</highlight></codeline>
<codeline lineno="904"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>plttype<sp/>=<sp/><ref refid="elf__common_8h_1a91eac2138273488244f4865cd05fd12e" kindref="member">DT_REL</ref>;</highlight></codeline>
<codeline lineno="905"><highlight class="normal"></highlight></codeline>
<codeline lineno="906"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(dynp<sp/>=<sp/>ef-&gt;<ref refid="structelf__file_1ab8111701a8d834289326d463e21dc67e" kindref="member">dynamic</ref>;<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a0edbe45a1c49cbb352dc3e1937369180" kindref="member">d_tag</ref><sp/>!=<sp/>0x0;<sp/>dynp++)<sp/>{</highlight></codeline>
<codeline lineno="907"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(dynp-&gt;<ref refid="structElf32__Dyn_1a0edbe45a1c49cbb352dc3e1937369180" kindref="member">d_tag</ref>)<sp/>{</highlight></codeline>
<codeline lineno="908"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a4451778c7253623b413bb160d47ee1e6" kindref="member">DT_NEEDED</ref>:</highlight></codeline>
<codeline lineno="909"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><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="910"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="911"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a2c316800fdd2ad211b26737fa44da6dd" kindref="member">DT_INIT</ref>:</highlight></codeline>
<codeline lineno="912"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><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="913"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="914"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a813d71f2e87f1c5cf856b510bb8e62ff" kindref="member">DT_FINI</ref>:</highlight></codeline>
<codeline lineno="915"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><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="916"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="917"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1af38c667f9a1573d87caa9348b18f3411" kindref="member">DT_HASH</ref>:</highlight></codeline>
<codeline lineno="918"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><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="919"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>From<sp/>src/libexec/rtld-elf/rtld.c<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="920"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Elf_Hashelt<sp/>*hashtab<sp/>=<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Elf_Hashelt<sp/>*)<sp/>(ef-&gt;<ref refid="structelf__file_1a3cdc3dfff0554c0a888a5773541f5d16" kindref="member">address</ref><sp/>+<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1adcdb4fa1682c07a7e7874c99f9cbd028" kindref="member">d_ptr</ref>);</highlight></codeline>
<codeline lineno="921"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a6b6d480fa558f2a588fb5f63d2ebeea8" kindref="member">nbuckets</ref><sp/>=<sp/>hashtab[0];</highlight></codeline>
<codeline lineno="922"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a72f454afe05387ff880b400cdacae642" kindref="member">nchains</ref><sp/>=<sp/>hashtab[1];</highlight></codeline>
<codeline lineno="923"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1ac76e36146f8909ff02ba36bc4693d458" kindref="member">buckets</ref><sp/>=<sp/>hashtab<sp/>+<sp/>2;</highlight></codeline>
<codeline lineno="924"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1add95691d9796d447970b7065b772df7e" kindref="member">chains</ref><sp/>=<sp/>ef-&gt;<ref refid="structelf__file_1ac76e36146f8909ff02ba36bc4693d458" kindref="member">buckets</ref><sp/>+<sp/>ef-&gt;<ref refid="structelf__file_1a6b6d480fa558f2a588fb5f63d2ebeea8" kindref="member">nbuckets</ref>;</highlight></codeline>
<codeline lineno="925"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1afba78bdbf28e311e5f3e478f07905aed" kindref="member">DT_STRTAB</ref>:</highlight></codeline>
<codeline lineno="927"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a81ac81c56b630ca8b35a0640899f338e" kindref="member">strtab</ref><sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a06b0051d3f39d5cd5ad781e5871e49ee" kindref="member">caddr_t</ref>)<sp/>(ef-&gt;<ref refid="structelf__file_1a3cdc3dfff0554c0a888a5773541f5d16" kindref="member">address</ref><sp/>+<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1adcdb4fa1682c07a7e7874c99f9cbd028" kindref="member">d_ptr</ref>);</highlight></codeline>
<codeline lineno="928"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="929"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1aebb0156d8b53a9895935c26c2f766ef9" kindref="member">DT_STRSZ</ref>:</highlight></codeline>
<codeline lineno="930"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a96d09d0cba6e6a26c991a84db6b462cb" kindref="member">strsz</ref><sp/>=<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1a00a89085454a384ae77fd9112b3062c7" kindref="member">d_val</ref>;</highlight></codeline>
<codeline lineno="931"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="932"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a3a4f3eea0cdef015deb56d85476118d1" kindref="member">DT_SYMTAB</ref>:</highlight></codeline>
<codeline lineno="933"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1ae20fc8892c4b58b6e01b474ad5495d2d" kindref="member">symtab</ref><sp/>=<sp/>(Elf_Sym<sp/>*)<sp/>(ef-&gt;<ref refid="structelf__file_1a3cdc3dfff0554c0a888a5773541f5d16" kindref="member">address</ref><sp/>+<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1adcdb4fa1682c07a7e7874c99f9cbd028" kindref="member">d_ptr</ref>);</highlight></codeline>
<codeline lineno="934"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="935"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1ac54ac9d514ac475109e978a43c43f5c3" kindref="member">DT_SYMENT</ref>:</highlight></codeline>
<codeline lineno="936"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1a00a89085454a384ae77fd9112b3062c7" kindref="member">d_val</ref><sp/>!=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structElf32__Sym" kindref="compound">Elf32_Sym</ref>))</highlight></codeline>
<codeline lineno="937"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="i386__exec_8c_1a4d0b1b435ec441e7d50a430b83df5832" kindref="member">ENOEXEC</ref>);</highlight></codeline>
<codeline lineno="938"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="939"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a91eac2138273488244f4865cd05fd12e" kindref="member">DT_REL</ref>:</highlight></codeline>
<codeline lineno="940"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a34491983703dced98e9c1481eaaad06b" kindref="member">rel</ref><sp/>=<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Elf_Rel<sp/>*)<sp/>(ef-&gt;<ref refid="structelf__file_1a3cdc3dfff0554c0a888a5773541f5d16" kindref="member">address</ref><sp/>+<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1adcdb4fa1682c07a7e7874c99f9cbd028" kindref="member">d_ptr</ref>);</highlight></codeline>
<codeline lineno="941"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="942"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a5693118a149e462dd602f7310a4430e6" kindref="member">DT_RELSZ</ref>:</highlight></codeline>
<codeline lineno="943"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a6d4e9c913c8e95522040504a8a3d840b" kindref="member">relsize</ref><sp/>=<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1a00a89085454a384ae77fd9112b3062c7" kindref="member">d_val</ref>;</highlight></codeline>
<codeline lineno="944"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="945"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1adfa81a12735e992ed33d74373ae9ff53" kindref="member">DT_RELENT</ref>:</highlight></codeline>
<codeline lineno="946"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1a00a89085454a384ae77fd9112b3062c7" kindref="member">d_val</ref><sp/>!=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Rel))</highlight></codeline>
<codeline lineno="947"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="i386__exec_8c_1a4d0b1b435ec441e7d50a430b83df5832" kindref="member">ENOEXEC</ref>);</highlight></codeline>
<codeline lineno="948"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="949"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1ad7cbdc6f9aeb70f37aec7ae6c2311edc" kindref="member">DT_JMPREL</ref>:</highlight></codeline>
<codeline lineno="950"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1aa7dd2de2ea1d207ab3f3fbfa7e3b89f9" kindref="member">pltrel</ref><sp/>=<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Elf_Rel<sp/>*)<sp/>(ef-&gt;<ref refid="structelf__file_1a3cdc3dfff0554c0a888a5773541f5d16" kindref="member">address</ref><sp/>+<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1adcdb4fa1682c07a7e7874c99f9cbd028" kindref="member">d_ptr</ref>);</highlight></codeline>
<codeline lineno="951"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="952"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a9e5d691d362627655a9bbfb9ded5e7ed" kindref="member">DT_PLTRELSZ</ref>:</highlight></codeline>
<codeline lineno="953"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1ae7af19c65fab6d791b5b02077167319b" kindref="member">pltrelsize</ref><sp/>=<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1a00a89085454a384ae77fd9112b3062c7" kindref="member">d_val</ref>;</highlight></codeline>
<codeline lineno="954"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="955"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1af3fc0eb843f585ae41c72b57a5e4258e" kindref="member">DT_RELA</ref>:</highlight></codeline>
<codeline lineno="956"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a5401558f6878a7320a0848dc2854b265" kindref="member">rela</ref><sp/>=<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Elf_Rela<sp/>*)<sp/>(ef-&gt;<ref refid="structelf__file_1a3cdc3dfff0554c0a888a5773541f5d16" kindref="member">address</ref><sp/>+<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1adcdb4fa1682c07a7e7874c99f9cbd028" kindref="member">d_ptr</ref>);</highlight></codeline>
<codeline lineno="957"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="958"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a6833e2faf117338d34ba80f30d981370" kindref="member">DT_RELASZ</ref>:</highlight></codeline>
<codeline lineno="959"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a674267389f17658414520572548d2d4e" kindref="member">relasize</ref><sp/>=<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1a00a89085454a384ae77fd9112b3062c7" kindref="member">d_val</ref>;</highlight></codeline>
<codeline lineno="960"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="961"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a8028213ea49da91a81f9f1e893ea56b7" kindref="member">DT_RELAENT</ref>:</highlight></codeline>
<codeline lineno="962"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1a00a89085454a384ae77fd9112b3062c7" kindref="member">d_val</ref><sp/>!=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(Elf_Rela))</highlight></codeline>
<codeline lineno="963"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="i386__exec_8c_1a4d0b1b435ec441e7d50a430b83df5832" kindref="member">ENOEXEC</ref>);</highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a87300a0cb6754476456d9067b77656ba" kindref="member">DT_PLTREL</ref>:</highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>plttype<sp/>=<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1a00a89085454a384ae77fd9112b3062c7" kindref="member">d_val</ref>;</highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(plttype<sp/>!=<sp/><ref refid="elf__common_8h_1a91eac2138273488244f4865cd05fd12e" kindref="member">DT_REL</ref><sp/>&amp;&amp;<sp/>plttype<sp/>!=<sp/><ref refid="elf__common_8h_1af3fc0eb843f585ae41c72b57a5e4258e" kindref="member">DT_RELA</ref>)</highlight></codeline>
<codeline lineno="968"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="i386__exec_8c_1a4d0b1b435ec441e7d50a430b83df5832" kindref="member">ENOEXEC</ref>);</highlight></codeline>
<codeline lineno="969"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="970"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a2060cf45d9ee7217dc3880a78c12d316" kindref="member">DT_PLTGOT</ref>:</highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1acc91f95bcc8b731bdc26d8175d66e98b" kindref="member">got</ref><sp/>=<sp/>(Elf_Addr<sp/>*)<sp/>(ef-&gt;<ref refid="structelf__file_1a3cdc3dfff0554c0a888a5773541f5d16" kindref="member">address</ref><sp/>+<sp/>dynp-&gt;<ref refid="structElf32__Dyn_1a01827e35b8f67916583c73f157c9f1c7" kindref="member">d_un</ref>.<ref refid="structElf32__Dyn_1adcdb4fa1682c07a7e7874c99f9cbd028" kindref="member">d_ptr</ref>);</highlight></codeline>
<codeline lineno="972"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="973"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp<sp/>=<sp/>(void<sp/>*)<sp/>dynp-&gt;d_un.d_ptr;<sp/>//elfDynamicS[i].dynPtr;</highlight></codeline>
<codeline lineno="974"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp[2]<sp/>=<sp/>(uInt32)<sp/>ef-&gt;ld_addr;</highlight></codeline>
<codeline lineno="975"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp[1]<sp/>=<sp/>(uInt32)<sp/>ef;<sp/>//0x0;//0xBEEFEAD;//STACK_ADDR<sp/>-<sp/>128;//_current-&gt;imageFd;//0xBEEFDEAD;//ef;</highlight></codeline>
<codeline lineno="976"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="977"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="978"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="979"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><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="980"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//kprintf(&quot;t_tag:<sp/>0x%X&gt;&quot;,<sp/>dynp-&gt;d_tag);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="981"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="982"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="983"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="984"><highlight class="normal"></highlight></codeline>
<codeline lineno="985"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(plttype<sp/>==<sp/><ref refid="elf__common_8h_1af3fc0eb843f585ae41c72b57a5e4258e" kindref="member">DT_RELA</ref>)<sp/>{</highlight></codeline>
<codeline lineno="986"><highlight class="normal"><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a4e137930e93c57023f16000ef06e86d1" kindref="member">pltrela</ref><sp/>=<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Elf_Rela<sp/>*)<sp/>ef-&gt;<ref refid="structelf__file_1aa7dd2de2ea1d207ab3f3fbfa7e3b89f9" kindref="member">pltrel</ref>;</highlight></codeline>
<codeline lineno="987"><highlight class="normal"><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1aa7dd2de2ea1d207ab3f3fbfa7e3b89f9" kindref="member">pltrel</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="988"><highlight class="normal"><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a2081c8ee01340f25c5a0df729302fe35" kindref="member">pltrelasize</ref><sp/>=<sp/>ef-&gt;<ref refid="structelf__file_1ae7af19c65fab6d791b5b02077167319b" kindref="member">pltrelsize</ref>;</highlight></codeline>
<codeline lineno="989"><highlight class="normal"><sp/><sp/><sp/><sp/>ef-&gt;<ref refid="structelf__file_1ae7af19c65fab6d791b5b02077167319b" kindref="member">pltrelsize</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="990"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="991"><highlight class="normal"></highlight></codeline>
<codeline lineno="992"><highlight class="normal"><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a899c46e13415eab1dfdd96fd65443f74" kindref="member">ddbsymtab</ref><sp/>=<sp/>ef-&gt;<ref refid="structelf__file_1ae20fc8892c4b58b6e01b474ad5495d2d" kindref="member">symtab</ref>;</highlight></codeline>
<codeline lineno="993"><highlight class="normal"><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a6e46c7ddb204bc395157e1bca48e12ef" kindref="member">ddbsymcnt</ref><sp/>=<sp/>ef-&gt;<ref refid="structelf__file_1a72f454afe05387ff880b400cdacae642" kindref="member">nchains</ref>;</highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/>ef-&gt;<ref refid="structelf__file_1a302c2e919c7dc56e816cf0053a4e02d7" kindref="member">ddbstrtab</ref><sp/>=<sp/>ef-&gt;<ref refid="structelf__file_1a81ac81c56b630ca8b35a0640899f338e" kindref="member">strtab</ref>;</highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/>ef-&gt;<ref refid="structelf__file_1af892468f243e1b6564735e7161150804" kindref="member">ddbstrcnt</ref><sp/>=<sp/>ef-&gt;<ref refid="structelf__file_1a96d09d0cba6e6a26c991a84db6b462cb" kindref="member">strsz</ref>;</highlight></codeline>
<codeline lineno="996"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="997"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c"/>
  </compounddef>
</doxygen>
