<?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="exec_8c" kind="file" language="C++"> <compoundname>exec.c</compoundname> <includes refid="exec_8h" local="no">ubixos/exec.h</includes> <includes refid="sys_2elf_8h" local="no">sys/elf.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 local="no">lib/string.h</includes> <includes refid="assert_8h" local="no">assert.h</includes> <incdepgraph> <node id="22"> <label>ufs/ufs.h</label> <link refid="ufs_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="23" relation="include"> </childnode> </node> <node id="43"> <label>stdarg.h</label> <link refid="stdarg_8h"/> </node> <node id="36"> <label>ubixos/kpanic.h</label> <link refid="kpanic_8h"/> </node> <node id="26"> <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="37"> <label>ubixos/endtask.h</label> <link refid="endtask_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> </node> <node id="25"> <label>ubixos/tty.h</label> <link refid="tty_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="15"> <label>i386/cpu.h</label> <link refid="i386_2cpu_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="39"> <label>vmm/paging.h</label> <link refid="paging_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="40" relation="include"> </childnode> <childnode refid="13" relation="include"> </childnode> </node> <node id="5"> <label>sys/select.h</label> <link refid="select_8h"/> <childnode refid="6" relation="include"> </childnode> <childnode refid="4" relation="include"> </childnode> <childnode refid="7" relation="include"> </childnode> <childnode refid="8" relation="include"> </childnode> <childnode refid="9" relation="include"> </childnode> </node> <node id="18"> <label>vfs/inode.h</label> <link refid="inode_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="19" relation="include"> </childnode> <childnode refid="20" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> <childnode refid="22" relation="include"> </childnode> </node> <node id="29"> <label>sys/elf32.h</label> <link refid="elf32_8h"/> <childnode refid="30" relation="include"> </childnode> </node> <node id="32"> <label>ubixos/ubthread.h</label> <link refid="ubthread_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> <childnode refid="33" relation="include"> </childnode> </node> <node id="44"> <label>lib/string.h</label> </node> <node id="9"> <label>sys/_sigset.h</label> <link refid="__sigset_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="38"> <label>vmm/vmm.h</label> <link refid="vmm_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="39" relation="include"> </childnode> </node> <node id="41"> <label>lib/kmalloc.h</label> <link refid="kmalloc_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="1"> <label>C:/Dev/git/UbixOS/sys/arch/armv6/exec.c</label> <link refid="exec_8c"/> <childnode refid="2" relation="include"> </childnode> <childnode refid="27" 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="41" relation="include"> </childnode> <childnode refid="42" relation="include"> </childnode> <childnode refid="44" relation="include"> </childnode> <childnode refid="45" relation="include"> </childnode> </node> <node id="35"> <label>ubixos/ld.h</label> <link refid="ld_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="24"> <label>vfs/mount.h</label> <link refid="mount_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="17"> <label>sys/resource.h</label> <link refid="resource_8h"/> <childnode refid="4" relation="include"> </childnode> </node> <node id="14"> <label>sys/trap.h</label> <link refid="trap_8h"/> <childnode refid="15" relation="include"> </childnode> </node> <node id="3"> <label>sys/types.h</label> <link refid="include_2sys_2types_8h"/> <childnode refid="4" relation="include"> </childnode> <childnode refid="5" relation="include"> </childnode> </node> <node id="11"> <label>vfs/file.h</label> <link refid="include_2vfs_2file_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="12" relation="include"> </childnode> <childnode refid="13" relation="include"> </childnode> <childnode refid="18" relation="include"> </childnode> <childnode refid="24" relation="include"> </childnode> <childnode refid="22" relation="include"> </childnode> </node> <node id="2"> <label>ubixos/exec.h</label> <link refid="exec_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> </node> <node id="21"> <label>fs/msdos_fs.h</label> <link refid="msdos__fs_8h"/> </node> <node id="45"> <label>assert.h</label> <link refid="assert_8h"/> </node> <node id="16"> <label>sys/signal.h</label> <link refid="sys_2signal_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="20"> <label>fs/pipe_fs.h</label> <link refid="pipe__fs_8h"/> </node> <node id="19"> <label>ubixos/wait.h</label> <link refid="wait_8h"/> </node> <node id="42"> <label>lib/kprintf.h</label> <link refid="kprintf_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="43" relation="include"> </childnode> </node> <node id="13"> <label>sys/thread.h</label> <link refid="thread_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="14" relation="include"> </childnode> <childnode refid="16" relation="include"> </childnode> <childnode refid="17" relation="include"> </childnode> </node> <node id="6"> <label>sys/cdefs.h</label> <link refid="cdefs_8h"/> </node> <node id="28"> <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="10"> <label>ubixos/sched.h</label> <link refid="sched_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="11" relation="include"> </childnode> <childnode refid="25" relation="include"> </childnode> <childnode refid="26" relation="include"> </childnode> <childnode refid="13" relation="include"> </childnode> </node> <node id="4"> <label>sys/_types.h</label> <link refid="__types_8h"/> </node> <node id="31"> <label>sys/elf64.h</label> <link refid="elf64_8h"/> <childnode refid="30" 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="23"> <label>sys/device.h</label> <link refid="include_2sys_2device_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="40"> <label>sys/sysproto_posix.h</label> <link refid="sysproto__posix_8h"/> <childnode refid="16" relation="include"> </childnode> <childnode refid="13" relation="include"> </childnode> <childnode refid="11" relation="include"> </childnode> </node> <node id="12"> <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="30"> <label>sys/elf_common.h</label> <link refid="elf__common_8h"/> </node> <node id="27"> <label>sys/elf.h</label> <link refid="sys_2elf_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="28" relation="include"> </childnode> <childnode refid="29" relation="include"> </childnode> <childnode refid="31" relation="include"> </childnode> <childnode refid="32" relation="include"> </childnode> </node> </incdepgraph> <sectiondef kind="define"> <memberdef kind="define" id="exec_8c_1a9b8e51a44a47d7ea827c570ffdca14e5" prot="public" static="no"> <name>AT_BASE</name> <initializer>7 /* Interpreter's base address. */</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" line="49" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="49" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="51" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="51" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="44" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="44" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="50" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="50" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="43" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="43" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="42" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="42" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="48" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="48" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="45" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="45" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="46" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="46" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="47" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="47" bodyend="-1"/> </memberdef> <memberdef kind="define" id="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/armv6/exec.c" line="54" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="54" bodyend="-1"/> </memberdef> <memberdef kind="define" id="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" prot="public" static="no"> <name>STACK_ADDR</name> <initializer>0xC800000</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" line="40" column="9" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="40" bodyend="-1"/> </memberdef> </sectiondef> <sectiondef kind="func"> <memberdef kind="function" id="exec_8c_1af80d4412d42ed1b5bf9a1b9774230f33" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>void</type> <definition>void execFile</definition> <argsstring>(char *file, int argc, char **argv, int console)</argsstring> <name>execFile</name> <param> <type>char *</type> <declname>file</declname> </param> <param> <type>int</type> <declname>argc</declname> </param> <param> <type>char **</type> <declname>argv</declname> </param> <param> <type>int</type> <declname>console</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" line="153" column="6" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="153" bodyend="330"/> <references refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" compoundref="armv6_2sched_8c" startline="50">_current</references> <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="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" compoundref="file_8c" startline="526" endline="566">fclose</references> <references refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" compoundref="file_8c" startline="388" endline="518">fopen</references> <references refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" compoundref="file_8c" startline="291" endline="309">fread</references> <references refid="structtssStruct_1a8114a585123181ec835f8db3e029d390" compoundref="tss_8h" startline="62">tssStruct::fs</references> <references refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" compoundref="file_8c" startline="326" endline="329">fseek</references> <references refid="structtaskStruct_1aa9363ba2e18b68870b9a7bd42a012fc3" compoundref="sched_8h" startline="73">taskStruct::gid</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="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" compoundref="kpanic_8h" startline="32">K_PANIC</references> <references refid="paging_8h_1a8b838cda4f0bc79ab8d07eb19dd35420" compoundref="paging_8h" startline="69">KERNEL_PAGE_DEFAULT</references> <references refid="paging_8h_1a7c58070dedac2ee9e1c73d8c8206b923" compoundref="paging_8c" startline="41">kernelPageDirectory</references> <references refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="342" endline="382">kfree</references> <references refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="241" endline="331">kmalloc</references> <references refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" compoundref="armv6_2kpanic_8c" startline="41" endline="61">kpanic</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="structtssStruct_1ad7b6a367e1c2a38e1ee6c8e5dad955f7" compoundref="tss_8h" startline="66">tssStruct::ldt</references> <references refid="string_8h_1ace4b911463887af5e748326323e99a23">memset</references> <references refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" compoundref="sched_8h" startline="69">taskStruct::oInfo</references> <references refid="structtty__termNode_1af8e2ad49f523044768d8e768bfe531e4" compoundref="tty_8h" startline="42">tty_termNode::owner</references> <references refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" compoundref="paging_8h" startline="68">PAGE_DEFAULT</references> <references refid="paging_8h_1a122dfc414a40e260fd35dbe9743db26f" compoundref="paging_8h" startline="55">PAGE_PRESENT</references> <references refid="paging_8h_1a1532db17068ba8d409b8ffe066414af2" compoundref="paging_8h" startline="65">PAGE_STACK</references> <references refid="paging_8h_1a2d0253527ea5080d6befe0ee3bde473f" compoundref="paging_8h" startline="57">PAGE_USER</references> <references refid="structfileDescriptor_1aaf1c61f69cb312867bcdf95896a74bdc" compoundref="include_2vfs_2file_8h" startline="76">fileDescriptor::perms</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="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" compoundref="exec_8c" startline="40">STACK_ADDR</references> <references refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" compoundref="sched_8h" startline="78">taskStruct::td</references> <references refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" compoundref="sched_8h" startline="77">taskStruct::term</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="tty_8h_1a4f96ccac7e60296ef496008d8cbed0ff" compoundref="tty_8c" startline="167" endline="169">tty_find</references> <references refid="structtaskStruct_1a2d4f1664132da8b58cc4dfb25ac3509a" compoundref="sched_8h" startline="73">taskStruct::uid</references> <references refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" compoundref="thread_8h" startline="43">thread::vm_daddr</references> <references refid="vmm_8h_1ab8e4e189a7b1df2a03072ce5b75c89fe" compoundref="vmm__memory_8c" startline="221" endline="252">vmm_findFreePage</references> <references refid="paging_8h_1adea68f248df43bddee62a09d945304b0" compoundref="paging_8c" startline="199" endline="281">vmm_remapPage</references> <references refid="paging_8h_1ab060cb62a6dd6d22f63757d72c27c335" compoundref="setpageattributes_8c" startline="39" endline="66">vmm_setPageAttributes</references> <references refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" compoundref="sched_8h" startline="54">osInfo::vmStart</references> </memberdef> <memberdef kind="function" id="exec_8c_1a4b86d28d8fd56197042aef174de2fd58" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref></type> <definition>uInt32 execThread</definition> <argsstring>(void(*tproc)(void), uInt32 stack, char *arg)</argsstring> <name>execThread</name> <param> <type>void(*)(void)</type> <declname>tproc</declname> </param> <param> <type><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</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/armv6/exec.c" line="66" column="8" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="66" bodyend="136"/> <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="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="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="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" compoundref="sched_8h" startline="54">osInfo::vmStart</references> <referencedby refid="main_8cc_1aa6c38d07b193857fbaebc1656b89136e" compoundref="main_8cc" startline="51" endline="143">sdeThread</referencedby> <referencedby refid="i386_2systemtask_8c_1ac7cc6a806237f8657fcdce169319fd7f" compoundref="i386_2systemtask_8c" startline="46" endline="131">systemTask</referencedby> <referencedby refid="ubthread_8c_1aa0af177ef44888f3c93883294207328e" compoundref="ubthread_8c" startline="83" endline="86">ubthread_create</referencedby> </memberdef> <memberdef kind="function" id="exec_8c_1a094c23346b6d226a03866a54b755ed64" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>void</type> <definition>void sys_exec</definition> <argsstring>(char *file, char *ap)</argsstring> <name>sys_exec</name> <param> <type>char *</type> <declname>file</declname> </param> <param> <type>char *</type> <declname>ap</declname> </param> <briefdescription> <para>New exec... </para> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> <para>copy in arg strings</para> <para>Clean the virtual of COW pages left over from the fork</para> <para>Adjust iframe</para> <para>build argc and argv[]</para> <para>Build ENV</para> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" line="551" column="6" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="551" bodyend="743"/> <referencedby refid="execve_8c_1ac05d0992d0ab7f05cc3555380ed092a9" compoundref="execve_8c" startline="33" endline="39">sys_execve</referencedby> </memberdef> <memberdef kind="function" id="exec_8c_1a219681612352232186a0f568457d851d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>void</type> <definition>void sysExec</definition> <argsstring>(char *file, char *ap)</argsstring> <name>sysExec</name> <param> <type>char *</type> <declname>file</declname> </param> <param> <type>char *</type> <declname>ap</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> <para>Clean the virtual of COW pages left over from the fork</para> <para>Adjust iframe</para> <para>build argc and argv[]</para> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" line="340" column="6" bodyfile="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c" bodystart="340" bodyend="545"/> <references refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" compoundref="armv6_2sched_8c" startline="50">_current</references> <references refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" compoundref="assert_8h" startline="64">assert</references> <references refid="structi386__frame_1a41628a27790fd3a5e7841964e2cfb567" compoundref="tss_8h" startline="92">i386_frame::ebp</references> <references refid="structi386__frame_1a031746b975400ea26eac2e8dcbc2bb13" compoundref="tss_8h" startline="102">i386_frame::eip</references> <references refid="endtask_8h_1a152c1859ada097cc21071f471bfa2e67" compoundref="endtask_8c" startline="44" endline="50">endTask</references> <references refid="structtssStruct_1a1017372aed82d7305586c330fa222b3b" compoundref="tss_8h" startline="37">tssStruct::esp0</references> <references refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" compoundref="file_8c" startline="526" endline="566">fclose</references> <references refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" compoundref="sched_8h" startline="71">taskStruct::files</references> <references refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" compoundref="file_8c" startline="388" endline="518">fopen</references> <references refid="file_8c_1ac539f57edd90fcd088fd3baa10319166" compoundref="file_8c" startline="291" endline="309">fread</references> <references refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" compoundref="file_8c" startline="326" endline="329">fseek</references> <references refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" compoundref="sched_8h" startline="63">taskStruct::id</references> <references refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" compoundref="kpanic_8h" startline="32">K_PANIC</references> <references refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="342" endline="382">kfree</references> <references refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="241" endline="331">kmalloc</references> <references refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" compoundref="armv6_2kpanic_8c" startline="41" endline="61">kpanic</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="ld_8h_1ab0622e93915d1824df770950e425875f">ldEnable</references> <references refid="string_8h_1ace4b911463887af5e748326323e99a23">memset</references> <references refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" compoundref="sched_8h" startline="69">taskStruct::oInfo</references> <references refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" compoundref="paging_8h" startline="68">PAGE_DEFAULT</references> <references refid="paging_8h_1a122dfc414a40e260fd35dbe9743db26f" compoundref="paging_8h" startline="55">PAGE_PRESENT</references> <references refid="paging_8h_1a850d80ca2291d26b40dc6b25c419f81a" compoundref="paging_8h" startline="36">PAGE_SHIFT</references> <references refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" compoundref="paging_8h" startline="37">PAGE_SIZE</references> <references refid="paging_8h_1a2d0253527ea5080d6befe0ee3bde473f" compoundref="paging_8h" startline="57">PAGE_USER</references> <references refid="structfileDescriptor_1aaf1c61f69cb312867bcdf95896a74bdc" compoundref="include_2vfs_2file_8h" startline="76">fileDescriptor::perms</references> <references refid="elf__common_8h_1a2121a2f01c51e8462bfd4d47725649d8" compoundref="elf__common_8h" startline="493">PT_DYNAMIC</references> <references refid="elf__common_8h_1abcd3aa15bc567949c1ab6b1abc137710" compoundref="elf__common_8h" startline="494">PT_INTERP</references> <references refid="elf__common_8h_1a84d7768fd6c6ece599d297090900cf92" compoundref="elf__common_8h" startline="492">PT_LOAD</references> <references refid="paging_8h_1a2702263fcf2b3b026cb26c6d895cb0ee" compoundref="paging_8h" startline="72">round_page</references> <references refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" compoundref="exec_8c" startline="40">STACK_ADDR</references> <references refid="string_8h_1a55e123beb3d7f96e25e024a13582d987">strcpy</references> <references refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" compoundref="strlen_8c" startline="55" endline="101">strlen</references> <references refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" compoundref="sched_8h" startline="78">taskStruct::td</references> <references refid="paging_8h_1abd636a9b61ad98f4fc23b1f4a9210d78" compoundref="paging_8h" startline="71">trunc_page</references> <references refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" compoundref="sched_8h" startline="67">taskStruct::tss</references> <references refid="structi386__frame_1aae0679acc1998f636b00761b546ed656" compoundref="tss_8h" startline="105">i386_frame::user_esp</references> <references refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" compoundref="thread_8h" startline="43">thread::vm_daddr</references> <references refid="structthread_1ac5ce95b5be4422e5f5a61f081547d425" compoundref="thread_8h" startline="44">thread::vm_dsize</references> <references refid="paging_8h_1a59a518704bf2f0b56603476bcb1eebbf" compoundref="paging_8h" startline="52">VM_TASK</references> <references refid="paging_8h_1adf104ab2196331b538186550cb7ada3e" compoundref="paging_8c" startline="587" endline="639">vmm_cleanVirtualSpace</references> <references refid="vmm_8h_1ab8e4e189a7b1df2a03072ce5b75c89fe" compoundref="vmm__memory_8c" startline="221" endline="252">vmm_findFreePage</references> <references refid="paging_8h_1adea68f248df43bddee62a09d945304b0" compoundref="paging_8c" startline="199" endline="281">vmm_remapPage</references> <references refid="paging_8h_1ab060cb62a6dd6d22f63757d72c27c335" compoundref="setpageattributes_8c" startline="39" endline="66">vmm_setPageAttributes</references> <references refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" compoundref="sched_8h" startline="54">osInfo::vmStart</references> </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/>"AS<sp/>IS"<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/><<ref refid="exec_8h" kindref="compound">ubixos/exec.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="30"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="sys_2elf_8h" kindref="compound">sys/elf.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="31"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="ld_8h" kindref="compound">ubixos/ld.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="32"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="kpanic_8h" kindref="compound">ubixos/kpanic.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="33"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="endtask_8h" kindref="compound">ubixos/endtask.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="34"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="vmm_8h" kindref="compound">vmm/vmm.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="35"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="kmalloc_8h" kindref="compound">lib/kmalloc.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="36"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="kprintf_8h" kindref="compound">lib/kprintf.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="37"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><lib/string.h></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="38"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="assert_8h" kindref="compound">assert.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="39"><highlight class="normal"></highlight></codeline> <codeline lineno="40" refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>STACK_ADDR<sp/>0xC800000</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="41"><highlight class="normal"></highlight></codeline> <codeline lineno="42" refid="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="43" refid="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="44" refid="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="45" refid="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="46" refid="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="47" refid="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="48" refid="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="49" refid="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's<sp/>base<sp/>address.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="50" refid="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="51" refid="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="52"><highlight class="normal"></highlight></codeline> <codeline lineno="53"><highlight class="normal"></highlight><highlight class="comment">//#define<sp/>AUXARGS_ENTRY(pos,<sp/>id,<sp/>val)<sp/>{memcpy((void<sp/>*)pos++,(void<sp/>*)id,sizeof(long));<sp/>memcpy((void<sp/>*)pos++,(void<sp/>*)val,sizeof(long));}</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="54" refid="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="55"><highlight class="normal"></highlight></codeline> <codeline lineno="56"><highlight class="normal"></highlight><highlight class="comment">/*****************************************************************************************</highlight></codeline> <codeline lineno="57"><highlight class="comment"></highlight></codeline> <codeline lineno="58"><highlight class="comment"><sp/>Function:<sp/><sp/><sp/>execThread(void<sp/>(*)(void),int,char<sp/>*);</highlight></codeline> <codeline lineno="59"><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="60"><highlight class="comment"></highlight></codeline> <codeline lineno="61"><highlight class="comment"><sp/>Notes:</highlight></codeline> <codeline lineno="62"><highlight class="comment"></highlight></codeline> <codeline lineno="63"><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="64"><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="65"><highlight class="comment"></highlight></codeline> <codeline lineno="66" refid="exec_8c_1a4b86d28d8fd56197042aef174de2fd58" refkind="member"><highlight class="comment"><sp/>*****************************************************************************************/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="67"><highlight class="normal"><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/><ref refid="exec_8c_1a4b86d28d8fd56197042aef174de2fd58" 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="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>stack,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*arg)<sp/>{</highlight></codeline> <codeline lineno="68"><highlight class="normal"><sp/><sp/><ref refid="structtaskStruct" kindref="compound">kTask_t</ref><sp/>*<sp/>newProcess<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="69"><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="70"><highlight class="normal"><sp/><sp/>newProcess<sp/>=<sp/><ref refid="armv6_2sched_8c_1a92458df2063761371869cdfe0c9b4ee3" kindref="member">schedNewTask</ref>();</highlight></codeline> <codeline lineno="71"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(newProcess);</highlight></codeline> <codeline lineno="72"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(stack<sp/><<sp/>0x100000)</highlight></codeline> <codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">"exec:<sp/>stack<sp/>not<sp/>in<sp/>valid<sp/>area:<sp/>[0x%X]\n"</highlight><highlight class="normal">,<sp/>stack);</highlight></codeline> <codeline lineno="74"><highlight class="normal"></highlight></codeline> <codeline lineno="75"><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="76"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1afecbe8ea2cfebfb4d1a0aa7b6ebcac2c" kindref="member">back_link</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="77"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a1017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="78"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a26d03018de8c122451661bfe9d030541" kindref="member">ss0</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="79"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ad5ef8867200562fd8262f70312beff4d" kindref="member">esp1</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="80"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a6abf05d9a8f6356860a5606ffbadc989" kindref="member">ss1</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="81"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a60c88f3cd3f2110cb24be62444f42cfb" kindref="member">esp2</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="82"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a5a79ace5652b01cc25fc5ba7ff45bfa8" kindref="member">ss2</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="83"><highlight class="normal"><sp/><sp/>newProcess-><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="84"><highlight class="normal"><sp/><sp/>newProcess-><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="85"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1aa85f1fbaf622e0c6a39963da27de0194" kindref="member">eflags</ref><sp/>=<sp/>0x206;</highlight></codeline> <codeline lineno="86"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a85412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref><sp/>=<sp/>stack;</highlight></codeline> <codeline lineno="87"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ac2d32620149e07c40ee87696ef2509c2" kindref="member">ebp</ref><sp/>=<sp/>stack;</highlight></codeline> <codeline lineno="88"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8beab5808aad776957d4544f6b139d4e" kindref="member">esi</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="89"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1aa52b515706cd37e166c8eba348d5e68b" kindref="member">edi</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="90"><highlight class="normal"></highlight></codeline> <codeline lineno="91"><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="92"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="93"><highlight class="comment"><sp/><sp/><sp/>newProcess->tss.es<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="94"><highlight class="comment"><sp/><sp/><sp/>newProcess->tss.cs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x28+3;</highlight></codeline> <codeline lineno="95"><highlight class="comment"><sp/><sp/><sp/>newProcess->tss.ss<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="96"><highlight class="comment"><sp/><sp/><sp/>newProcess->tss.ds<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="97"><highlight class="comment"><sp/><sp/><sp/>newProcess->tss.fs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="98"><highlight class="comment"><sp/><sp/><sp/>newProcess->tss.gs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="99"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="100"><highlight class="normal"></highlight></codeline> <codeline lineno="101"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1acd97dd6f6eabd83c0b819b6058b7041d" kindref="member">es</ref><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="102"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a6d9085ec5af0fa1fe1de7015ad99c9e3" kindref="member">cs</ref><sp/>=<sp/>0x08;</highlight></codeline> <codeline lineno="103"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a340a29782d3306ba84176c543725d70a" kindref="member">ss</ref><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="104"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a01ee01c7f45c9b9ee2ad8338c21e6d33" kindref="member">ds</ref><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="105"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8114a585123181ec835f8db3e029d390" kindref="member">fs</ref><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="106"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8dfa44423504293405785371d0e7b076" kindref="member">gs</ref><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="107"><highlight class="normal"></highlight></codeline> <codeline lineno="108"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ad7b6a367e1c2a38e1ee6c8e5dad955f7" kindref="member">ldt</ref><sp/>=<sp/>0x18;</highlight></codeline> <codeline lineno="109"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a52ac0b54c6b2c71450c62d7fc911f2e2" kindref="member">trace_bitmap</ref><sp/>=<sp/>0x0000;</highlight></codeline> <codeline lineno="110"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a611a0a044f99f092ace469ce2381bb33" kindref="member">io_map</ref><sp/>=<sp/>0x8000;</highlight></codeline> <codeline lineno="111"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>0x6400000;</highlight></codeline> <codeline lineno="112"><highlight class="normal"></highlight></codeline> <codeline lineno="113"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//newProcess->imageFd<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="114"><highlight class="normal"></highlight></codeline> <codeline lineno="115"><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="116"><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="117"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"pusha<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/><sp/><sp/>%%esp,%%ecx<sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/><sp/><sp/>%1,%%eax<sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/><sp/><sp/>%%eax,%%esp<sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"pushl<sp/><sp/>%%ebx<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"pushl<sp/><sp/>%%ebx<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"pushl<sp/><sp/>%%ebx<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/><sp/><sp/>%%esp,%%eax<sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/><sp/><sp/>%%eax,%1<sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/><sp/><sp/>%%ecx,%%esp<sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"popa<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/>:</highlight></codeline> <codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/>:<sp/></highlight><highlight class="stringliteral">"b"</highlight><highlight class="normal"><sp/>(arg),</highlight><highlight class="stringliteral">"m"</highlight><highlight class="normal"><sp/>(newProcess-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a85412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref>)</highlight></codeline> <codeline lineno="130"><highlight class="normal"><sp/><sp/>);</highlight></codeline> <codeline lineno="131"><highlight class="normal"></highlight></codeline> <codeline lineno="132"><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="133"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a2cbadd034400c65dbd11fd4892ddf26e" kindref="member">sched_setStatus</ref>(newProcess-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/><ref refid="sched_8h_1a3fb333b67375561d327e9b5a8ffa03b9a6564f2f3e15be06b670547bbcaaf0798" kindref="member">READY</ref>);</highlight></codeline> <codeline lineno="134"><highlight class="normal"></highlight></codeline> <codeline lineno="135"><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="136"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>((<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref>)<sp/>newProcess);</highlight></codeline> <codeline lineno="137"><highlight class="normal">}</highlight></codeline> <codeline lineno="138"><highlight class="normal"></highlight></codeline> <codeline lineno="139"><highlight class="normal"></highlight><highlight class="comment">/*****************************************************************************************</highlight></codeline> <codeline lineno="140"><highlight class="comment"></highlight></codeline> <codeline lineno="141"><highlight class="comment"><sp/>Function:<sp/>void<sp/>execFile(char<sp/>*file);</highlight></codeline> <codeline lineno="142"><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="143"><highlight class="comment"><sp/>Having<sp/>To<sp/>Fork</highlight></codeline> <codeline lineno="144"><highlight class="comment"><sp/>Notes:</highlight></codeline> <codeline lineno="145"><highlight class="comment"></highlight></codeline> <codeline lineno="146"><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="147"><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="148"><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="149"><highlight class="comment"><sp/>The<sp/>Program<sp/>Exits</highlight></codeline> <codeline lineno="150"><highlight class="comment"></highlight></codeline> <codeline lineno="151"><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="152"><highlight class="comment"><sp/>The<sp/>Freshly<sp/>Allocated<sp/>Pages<sp/>With<sp/>The<sp/>Correct<sp/>Permissions</highlight></codeline> <codeline lineno="153" refid="exec_8c_1af80d4412d42ed1b5bf9a1b9774230f33" refkind="member"><highlight class="comment"></highlight></codeline> <codeline lineno="154"><highlight class="comment"><sp/>*****************************************************************************************/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="155"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="exec_8c_1af80d4412d42ed1b5bf9a1b9774230f33" 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">int</highlight><highlight class="normal"><sp/>argc,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argv,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>console)<sp/>{</highlight></codeline> <codeline lineno="156"><highlight class="normal"></highlight></codeline> <codeline lineno="157"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="158"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="159"><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="160"><highlight class="normal"></highlight></codeline> <codeline lineno="161"><highlight class="normal"><sp/><sp/><ref refid="structfileDescriptor" kindref="compound">fileDescriptor</ref><sp/>*tmpFd<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="162"><highlight class="normal"><sp/><sp/>elfHeader<sp/>*binaryHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="163"><highlight class="normal"><sp/><sp/>elfProgramHeader<sp/>*programHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="164"><highlight class="normal"></highlight></codeline> <codeline lineno="165"><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="166"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref><sp/>=<sp/><ref refid="armv6_2sched_8c_1a92458df2063761371869cdfe0c9b4ee3" kindref="member">schedNewTask</ref>();</highlight></codeline> <codeline lineno="167"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>);</highlight></codeline> <codeline lineno="168"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1aa9363ba2e18b68870b9a7bd42a012fc3" kindref="member">gid</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="169"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a2d4f1664132da8b58cc4dfb25ac3509a" kindref="member">uid</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="170"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><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="171"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" kindref="member">term</ref><sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Error:<sp/>invalid<sp/>console\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="173"><highlight class="normal"></highlight></codeline> <codeline lineno="174"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>tty<sp/>ownership<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="175"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4563a310626d4f4ea885f4532356abb3" kindref="member">term</ref>-><ref refid="structtty__termNode_1af8e2ad49f523044768d8e768bfe531e4" kindref="member">owner</ref><sp/>=<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>;</highlight></codeline> <codeline lineno="176"><highlight class="normal"></highlight></codeline> <codeline lineno="177"><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="178"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8d312ed3dd0ea7a0f801c08a8cc4afd0" kindref="member">cr3</ref><sp/>=<sp/>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref>)<sp/>vmmCreateVirtualSpace(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>);</highlight></codeline> <codeline lineno="179"><highlight class="normal"></highlight></codeline> <codeline lineno="180"><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="181"><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="182"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/>%0,%%eax<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/>%%eax,%%cr3<sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/>:<sp/>:<sp/></highlight><highlight class="stringliteral">"d"</highlight><highlight class="normal"><sp/>((<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>*)(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8d312ed3dd0ea7a0f801c08a8cc4afd0" kindref="member">cr3</ref>))</highlight></codeline> <codeline lineno="185"><highlight class="normal"><sp/><sp/>);</highlight></codeline> <codeline lineno="186"><highlight class="normal"></highlight></codeline> <codeline lineno="187"><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="188"><highlight class="normal"><sp/><sp/>tmpFd<sp/>=<sp/><ref refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" kindref="member">fopen</ref>(<ref refid="structfile" kindref="compound">file</ref>,<sp/></highlight><highlight class="stringliteral">"r"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="189"><highlight class="normal"></highlight></codeline> <codeline lineno="190"><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="191"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmpFd<sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable.\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="194"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="195"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="196"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmpFd-><ref refid="structfileDescriptor_1aaf1c61f69cb312867bcdf95896a74bdc" kindref="member">perms</ref><sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable.\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="198"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="200"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="201"><highlight class="normal"></highlight></codeline> <codeline lineno="202"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>ELF<sp/>Header<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="203"><highlight class="normal"><sp/><sp/>binaryHeader<sp/>=<sp/>(elfHeader<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfHeader));</highlight></codeline> <codeline lineno="204"><highlight class="normal"></highlight></codeline> <codeline lineno="205"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf(">a:%i:0x%X:0x%X<",sizeof(elfHeader),binaryHeader,tmpFd);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="206"><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">(elfHeader),<sp/>1,<sp/>tmpFd);</highlight></codeline> <codeline lineno="207"><highlight class="normal"></highlight></codeline> <codeline lineno="208"><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="209"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader->eIdent[1]<sp/>!=<sp/></highlight><highlight class="charliteral">'E'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader->eIdent[2]<sp/>!=<sp/></highlight><highlight class="charliteral">'L'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader->eIdent[3]<sp/>!=<sp/></highlight><highlight class="charliteral">'F'</highlight><highlight class="normal">))<sp/>{</highlight></codeline> <codeline lineno="210"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable.\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="214"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="215"><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->eType<sp/>!=<sp/>2)<sp/>{</highlight></codeline> <codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable.\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="220"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="221"><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->eEntry<sp/>==<sp/>0x300000)<sp/>{</highlight></codeline> <codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable.\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="225"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="226"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="227"><highlight class="normal"></highlight></codeline> <codeline lineno="228"><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="229"><highlight class="normal"><sp/><sp/>programHeader<sp/>=<sp/>(elfProgramHeader<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfProgramHeader)<sp/>*<sp/>binaryHeader->ePhnum);</highlight></codeline> <codeline lineno="230"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(tmpFd,<sp/>binaryHeader->ePhoff,<sp/>0);</highlight></codeline> <codeline lineno="231"><highlight class="normal"></highlight></codeline> <codeline lineno="232"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf(">c:%i:0x%X:0x%X<",sizeof(elfProgramHeader)*binaryHeader->ePhnum,programHeader,tmpFd);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="233"><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">(elfProgramHeader)<sp/>*<sp/>binaryHeader->ePhnum),<sp/>1,<sp/>tmpFd);</highlight></codeline> <codeline lineno="234"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf(">d<");</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="235"><highlight class="normal"></highlight></codeline> <codeline lineno="236"><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="237"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>binaryHeader->ePhnum;<sp/>i++)<sp/>{</highlight></codeline> <codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(programHeader[i].phType<sp/>==<sp/>1)<sp/>{</highlight></codeline> <codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="240"><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="241"><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="242"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="243"><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/><<sp/>(programHeader[i].phMemsz);<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="244"><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="245"><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>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/>((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/><ref refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>)<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="246"><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">"Remap<sp/>Page<sp/>Failed"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="247"><highlight class="normal"></highlight></codeline> <codeline lineno="248"><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].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/>0x0,<sp/>0x1000);</highlight></codeline> <codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>0x80000000;</highlight></codeline> <codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>(programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000);</highlight></codeline> <codeline lineno="252"><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="253"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(tmpFd,<sp/>programHeader[i].phOffset,<sp/>0);</highlight></codeline> <codeline lineno="254"><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].phVaddr,<sp/>programHeader[i].phFilesz,<sp/>1,<sp/>tmpFd);</highlight></codeline> <codeline lineno="255"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader[i].phFlags<sp/>&<sp/>0x2)<sp/>!=<sp/>0x2)<sp/>{</highlight></codeline> <codeline lineno="256"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"pH:<sp/>[0x%X]\n"</highlight><highlight class="normal">,<sp/>programHeader[i].phMemsz);</highlight></codeline> <codeline lineno="257"><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/><<sp/>(programHeader[i].phMemsz);<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="258"><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].phVaddr<sp/>&<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="259"><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">"Error:<sp/>vmm_setPageAttributes<sp/>failed,<sp/>File:<sp/>%s,<sp/>Line:<sp/>%i\n"</highlight><highlight class="normal">,<sp/>__FILE__,<sp/>__LINE__);</highlight></codeline> <codeline lineno="260"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="261"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="263"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="264"><highlight class="normal"></highlight></codeline> <codeline lineno="265"><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="266"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>0x80000000;</highlight></codeline> <codeline lineno="267"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>(programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000);</highlight></codeline> <codeline lineno="268"><highlight class="normal"></highlight></codeline> <codeline lineno="269"><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="270"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>1;<sp/>x<sp/><<sp/>100;<sp/>x++)<sp/>{</highlight></codeline> <codeline lineno="271"><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>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><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>);</highlight></codeline> <codeline lineno="272"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="273"><highlight class="normal"></highlight></codeline> <codeline lineno="274"><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="275"><highlight class="normal"><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>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/>0x5BC000,<sp/><ref refid="paging_8h_1a8b838cda4f0bc79ab8d07eb19dd35420" kindref="member">KERNEL_PAGE_DEFAULT</ref><sp/>|<sp/><ref refid="paging_8h_1a1532db17068ba8d409b8ffe066414af2" kindref="member">PAGE_STACK</ref>);</highlight></codeline> <codeline lineno="276"><highlight class="normal"><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>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/>0x5BB000,<sp/><ref refid="paging_8h_1a8b838cda4f0bc79ab8d07eb19dd35420" kindref="member">KERNEL_PAGE_DEFAULT</ref><sp/>|<sp/><ref refid="paging_8h_1a1532db17068ba8d409b8ffe066414af2" kindref="member">PAGE_STACK</ref>);</highlight></codeline> <codeline lineno="277"><highlight class="normal"></highlight></codeline> <codeline lineno="278"><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="279"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1afecbe8ea2cfebfb4d1a0aa7b6ebcac2c" kindref="member">back_link</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="280"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a1017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/>=<sp/>0x5BC000;</highlight></codeline> <codeline lineno="281"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a26d03018de8c122451661bfe9d030541" kindref="member">ss0</ref><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="282"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ad5ef8867200562fd8262f70312beff4d" kindref="member">esp1</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="283"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a6abf05d9a8f6356860a5606ffbadc989" kindref="member">ss1</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="284"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a60c88f3cd3f2110cb24be62444f42cfb" kindref="member">esp2</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="285"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a5a79ace5652b01cc25fc5ba7ff45bfa8" kindref="member">ss2</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="286"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a3e758f2138799d63fc803f7e4db4f5b4" kindref="member">eip</ref><sp/>=<sp/>(long)<sp/>binaryHeader->eEntry;</highlight></codeline> <codeline lineno="287"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1aa85f1fbaf622e0c6a39963da27de0194" kindref="member">eflags</ref><sp/>=<sp/>0x206;</highlight></codeline> <codeline lineno="288"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><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/>12;</highlight></codeline> <codeline lineno="289"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ac2d32620149e07c40ee87696ef2509c2" kindref="member">ebp</ref><sp/>=<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>;</highlight></codeline> <codeline lineno="290"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8beab5808aad776957d4544f6b139d4e" kindref="member">esi</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="291"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1aa52b515706cd37e166c8eba348d5e68b" kindref="member">edi</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="292"><highlight class="normal"></highlight></codeline> <codeline lineno="293"><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="294"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><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="295"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><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="296"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><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="297"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><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="298"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><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="299"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a8dfa44423504293405785371d0e7b076" kindref="member">gs</ref><sp/>=<sp/>0x30<sp/>+<sp/>3;</highlight></codeline> <codeline lineno="300"><highlight class="normal"></highlight></codeline> <codeline lineno="301"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1ad7b6a367e1c2a38e1ee6c8e5dad955f7" kindref="member">ldt</ref><sp/>=<sp/>0x18;</highlight></codeline> <codeline lineno="302"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a52ac0b54c6b2c71450c62d7fc911f2e2" kindref="member">trace_bitmap</ref><sp/>=<sp/>0x0000;</highlight></codeline> <codeline lineno="303"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a611a0a044f99f092ace469ce2381bb33" kindref="member">io_map</ref><sp/>=<sp/>0x8000;</highlight></codeline> <codeline lineno="304"><highlight class="normal"></highlight></codeline> <codeline lineno="305"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a2cbadd034400c65dbd11fd4892ddf26e" kindref="member">sched_setStatus</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/><ref refid="sched_8h_1a3fb333b67375561d327e9b5a8ffa03b9a6564f2f3e15be06b670547bbcaaf0798" kindref="member">READY</ref>);</highlight></codeline> <codeline lineno="306"><highlight class="normal"></highlight></codeline> <codeline lineno="307"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="308"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(programHeader);</highlight></codeline> <codeline lineno="309"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="310"><highlight class="normal"></highlight></codeline> <codeline lineno="311"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>*)<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a4c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a1017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/>-<sp/>5;</highlight></codeline> <codeline lineno="312"><highlight class="normal"><sp/><sp/>tmp[0]<sp/>=<sp/>binaryHeader->eEntry;</highlight></codeline> <codeline lineno="313"><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="314"><highlight class="normal"></highlight></codeline> <codeline lineno="315"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>*)<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/>2;</highlight></codeline> <codeline lineno="316"><highlight class="normal"></highlight></codeline> <codeline lineno="317"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref><sp/>><sp/>4)</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">"argv[0]:<sp/>[%s]\n"</highlight><highlight class="normal">,<sp/>argv[0]);</highlight></codeline> <codeline lineno="319"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"argv:<sp/>[0x%X]\n"</highlight><highlight class="normal">,<sp/>argv);</highlight></codeline> <codeline lineno="320"><highlight class="normal"><sp/><sp/>tmp[0]<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/>argv;</highlight></codeline> <codeline lineno="321"><highlight class="normal"><sp/><sp/>tmp[1]<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/>argv;</highlight></codeline> <codeline lineno="322"><highlight class="normal"></highlight></codeline> <codeline lineno="323"><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="324"><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="325"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/>%0,%%eax<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">"movl<sp/>%%eax,%%cr3<sp/><sp/><sp/><sp/><sp/><sp/><sp/>\n"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/>:<sp/>:<sp/></highlight><highlight class="stringliteral">"d"</highlight><highlight class="normal"><sp/>((<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>*)(<ref refid="paging_8h_1a7c58070dedac2ee9e1c73d8c8206b923" kindref="member">kernelPageDirectory</ref>))</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/></highlight><highlight class="comment">/*<sp/>Finally<sp/>Return<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="331"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="332"><highlight class="normal">}</highlight></codeline> <codeline lineno="333"><highlight class="normal"></highlight></codeline> <codeline lineno="334"><highlight class="normal"></highlight><highlight class="comment">/*****************************************************************************************</highlight></codeline> <codeline lineno="335"><highlight class="comment"></highlight></codeline> <codeline lineno="336"><highlight class="comment"><sp/>Function:<sp/>void<sp/>sysExec();</highlight></codeline> <codeline lineno="337"><highlight class="comment"><sp/>Description:<sp/>This<sp/>Is<sp/>The<sp/>System<sp/>Call<sp/>To<sp/>Execute<sp/>A<sp/>New<sp/>Task</highlight></codeline> <codeline lineno="338"><highlight class="comment"></highlight></codeline> <codeline lineno="339"><highlight class="comment"><sp/>Notes:</highlight></codeline> <codeline lineno="340" refid="exec_8c_1a219681612352232186a0f568457d851d" refkind="member"><highlight class="comment"><sp/>04-22-03<sp/>-<sp/>It<sp/>Now<sp/>Loads<sp/>Sections<sp/>Not<sp/>The<sp/>Full<sp/>File</highlight></codeline> <codeline lineno="341"><highlight class="comment"></highlight></codeline> <codeline lineno="342"><highlight class="comment"><sp/>*****************************************************************************************/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="343"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="exec_8c_1a219681612352232186a0f568457d851d" kindref="member">sysExec</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/>*ap)<sp/>{</highlight></codeline> <codeline lineno="344"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="345"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="346"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>argc<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="347"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>*tmp<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="348"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>ldAddr<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="349"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>seg_size<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="350"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>seg_addr<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="351"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*interp<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="352"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argv<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="353"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argvNew<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="354"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*args<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="355"><highlight class="normal"></highlight></codeline> <codeline lineno="356"><highlight class="normal"><sp/><sp/><ref refid="structfileDescriptor" kindref="compound">fileDescriptor</ref><sp/>*tmpFd<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="357"><highlight class="normal"><sp/><sp/>elfHeader<sp/>*binaryHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="358"><highlight class="normal"><sp/><sp/>elfProgramHeader<sp/>*programHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="359"><highlight class="normal"><sp/><sp/>elfSectionHeader<sp/>*sectionHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="360"><highlight class="normal"><sp/><sp/>elfDynamic<sp/>*elfDynamicS<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="361"><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="362"><highlight class="normal"></highlight></codeline> <codeline lineno="363"><highlight class="normal"><sp/><sp/>tmpFd<sp/>=<sp/><ref refid="file_8c_1a249f3bc0af043dc5ac3c9aa8646986af" kindref="member">fopen</ref>(<ref refid="structfile" kindref="compound">file</ref>,<sp/></highlight><highlight class="stringliteral">"r"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="364"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]<sp/>=<sp/>tmpFd;</highlight></codeline> <codeline lineno="365"><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="366"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmpFd<sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="367"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="368"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="369"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmpFd-><ref refid="structfileDescriptor_1aaf1c61f69cb312867bcdf95896a74bdc" kindref="member">perms</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline> <codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable.\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="373"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="374"><highlight class="normal"></highlight></codeline> <codeline lineno="375"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>ELF<sp/>Header<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="376"><highlight class="normal"></highlight></codeline> <codeline lineno="377"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader<sp/>=<sp/>(elfHeader<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfHeader)))<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="endtask_8h_1a152c1859ada097cc21071f471bfa2e67" kindref="member">endTask</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>);</highlight></codeline> <codeline lineno="379"><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">(elfHeader),<sp/>1,<sp/>tmpFd);</highlight></codeline> <codeline lineno="380"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>sectionHeader<sp/>To<sp/>Point<sp/>To<sp/>Loaded<sp/>Binary<sp/>To<sp/>We<sp/>Can<sp/>Gather<sp/>Info<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">/*<sp/>Check<sp/>If<sp/>App<sp/>Is<sp/>A<sp/>Real<sp/>Application<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="383"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader->eIdent[1]<sp/>!=<sp/></highlight><highlight class="charliteral">'E'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader->eIdent[2]<sp/>!=<sp/></highlight><highlight class="charliteral">'L'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader->eIdent[3]<sp/>!=<sp/></highlight><highlight class="charliteral">'F'</highlight><highlight class="normal">))<sp/>{</highlight></codeline> <codeline lineno="384"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable.\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="387"><highlight class="normal"></highlight></codeline> <codeline lineno="388"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="389"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="390"><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->eType<sp/>!=<sp/>2)<sp/>{</highlight></codeline> <codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable.\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="394"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="395"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="396"><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->eEntry<sp/>==<sp/>0x300000)<sp/>{</highlight></codeline> <codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Exec<sp/>Format<sp/>Error:<sp/>Binary<sp/>File<sp/>Not<sp/>Executable.\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="398"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="399"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="400"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="401"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="402"><highlight class="normal"></highlight></codeline> <codeline lineno="403"><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="404"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader<sp/>=<sp/>(elfProgramHeader<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfProgramHeader)<sp/>*<sp/>binaryHeader->ePhnum))<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="405"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="endtask_8h_1a152c1859ada097cc21071f471bfa2e67" kindref="member">endTask</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>);</highlight></codeline> <codeline lineno="406"><highlight class="normal"></highlight></codeline> <codeline lineno="407"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(programHeader);</highlight></codeline> <codeline lineno="408"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(tmpFd,<sp/>binaryHeader->ePhoff,<sp/>0);</highlight></codeline> <codeline lineno="409"><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">(elfProgramHeader)<sp/>*<sp/>binaryHeader->ePhnum),<sp/>1,<sp/>tmpFd);</highlight></codeline> <codeline lineno="410"><highlight class="normal"></highlight></codeline> <codeline lineno="411"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((sectionHeader<sp/>=<sp/>(elfSectionHeader<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfSectionHeader)<sp/>*<sp/>binaryHeader->eShnum))<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="412"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="endtask_8h_1a152c1859ada097cc21071f471bfa2e67" kindref="member">endTask</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>);</highlight></codeline> <codeline lineno="413"><highlight class="normal"></highlight></codeline> <codeline lineno="414"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1ad6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(sectionHeader);</highlight></codeline> <codeline lineno="415"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(tmpFd,<sp/>binaryHeader->eShoff,<sp/>0);</highlight></codeline> <codeline lineno="416"><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">(elfSectionHeader)<sp/>*<sp/>binaryHeader->eShnum,<sp/>1,<sp/>tmpFd);</highlight></codeline> <codeline lineno="417"><highlight class="normal"></highlight></codeline> <codeline lineno="418"><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="419"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>binaryHeader->ePhnum;<sp/>i++)<sp/>{</highlight></codeline> <codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(programHeader[i].phType)<sp/>{</highlight></codeline> <codeline lineno="421"><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="422"><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].phVaddr);</highlight></codeline> <codeline lineno="423"><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].phMemsz<sp/>+<sp/>programHeader[i].phVaddr<sp/>-<sp/>seg_addr);</highlight></codeline> <codeline lineno="424"><highlight class="normal"></highlight></codeline> <codeline lineno="425"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="426"><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="427"><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="428"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="429"><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/><<sp/>(programHeader[i].phMemsz);<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="430"><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="431"><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>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/>((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/><ref refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>)<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="432"><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">"Error:<sp/>Remap<sp/>Page<sp/>Failed"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="433"><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].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/>0x0,<sp/>0x1000);</highlight></codeline> <codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="435"><highlight class="normal"></highlight></codeline> <codeline lineno="436"><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="437"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(tmpFd,<sp/>programHeader[i].phOffset,<sp/>0);</highlight></codeline> <codeline lineno="438"><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].phVaddr,<sp/>programHeader[i].phFilesz,<sp/>1,<sp/>tmpFd);</highlight></codeline> <codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader[i].phFlags<sp/>&<sp/>0x2)<sp/>!=<sp/>0x2)<sp/>{</highlight></codeline> <codeline lineno="440"><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/><<sp/>(programHeader[i].phMemsz);<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="441"><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].phVaddr<sp/>&<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="442"><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">"Error:<sp/>vmm_setPageAttributes<sp/>failed,<sp/>File:<sp/>%s,Line:<sp/>%i\n"</highlight><highlight class="normal">,<sp/>__FILE__,<sp/>__LINE__);</highlight></codeline> <codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="444"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="445"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"setting<sp/>daddr\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="446"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(binaryHeader->eEntry<sp/>>=<sp/>programHeader[i].phVaddr<sp/>&&<sp/>binaryHeader->eEntry<sp/><<sp/>(programHeader[i].phVaddr<sp/>+<sp/>programHeader[i].phMemsz))<sp/>{</highlight></codeline> <codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We're<sp/>suposed<sp/>to<sp/>do<sp/>something<sp/>here?<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="449"><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="450"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ac5ce95b5be4422e5f5a61f081547d425" kindref="member">vm_dsize</ref><sp/>=<sp/>seg_size<sp/>>><sp/><ref refid="paging_8h_1a850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline> <codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>seg_addr;</highlight></codeline> <codeline lineno="452"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="453"><highlight class="normal"></highlight></codeline> <codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>0xA900000);</highlight></codeline> <codeline lineno="455"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="456"><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="457"><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="458"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>elfDynamicS<sp/>=<sp/>(elfDynamic<sp/>*)<sp/>programHeader[i].phVaddr;</highlight></codeline> <codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(tmpFd,<sp/>programHeader[i].phOffset,<sp/>0);</highlight></codeline> <codeline lineno="460"><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].phVaddr,<sp/>programHeader[i].phFilesz,<sp/>1,<sp/>tmpFd);</highlight></codeline> <codeline lineno="461"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="462"><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="463"><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].phFilesz);</highlight></codeline> <codeline lineno="464"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(tmpFd,<sp/>programHeader[i].phOffset,<sp/>0);</highlight></codeline> <codeline lineno="465"><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].phFilesz,<sp/>1,<sp/>tmpFd);</highlight></codeline> <codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Interp:<sp/>[%s]\n"</highlight><highlight class="normal">,<sp/>interp);</highlight></codeline> <codeline lineno="467"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ldAddr<sp/>=<sp/><ref refid="ld_8h_1ab0622e93915d1824df770950e425875f" kindref="member">ldEnable</ref>();</highlight></codeline> <codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline> <codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="471"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="472"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="473"><highlight class="normal"></highlight></codeline> <codeline lineno="474"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>What<sp/>is<sp/>this<sp/>doing?<sp/>11/23/06<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="475"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(elfDynamicS<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="476"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>12;<sp/>i++)<sp/>{</highlight></codeline> <codeline lineno="477"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(elfDynamicS[i].dynVal<sp/>==<sp/>0x3)<sp/>{</highlight></codeline> <codeline lineno="478"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp<sp/>=<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<sp/>elfDynamicS[i].dynPtr;</highlight></codeline> <codeline lineno="479"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmp<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="480"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">"tmp:<sp/>NULL\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="481"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp[2]<sp/>=<sp/>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref>)<sp/>ldAddr;</highlight></codeline> <codeline lineno="482"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp[1]<sp/>=<sp/>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref>)<sp/>tmpFd;</highlight></codeline> <codeline lineno="483"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="484"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="485"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="486"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>else<sp/>{</highlight></codeline> <codeline lineno="487"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>kprintf("dyn_val:<sp/>%i",elfDynamicS[i].dynVal);</highlight></codeline> <codeline lineno="488"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="489"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="490"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="491"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="492"><highlight class="normal"></highlight></codeline> <codeline lineno="493"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ac5ce95b5be4422e5f5a61f081547d425" kindref="member">vm_dsize</ref><sp/>=<sp/>seg_size<sp/>>><sp/><ref refid="paging_8h_1a850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline> <codeline lineno="494"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>seg_addr;</highlight></codeline> <codeline lineno="495"><highlight class="normal"></highlight></codeline> <codeline lineno="496"><highlight class="normal"><sp/><sp/>argv<sp/>=<sp/>&ap;</highlight></codeline> <codeline lineno="497"><highlight class="normal"></highlight></codeline> <codeline lineno="498"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(argv[1]<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/>argc<sp/>=<sp/>(int)<sp/>argv[0];</highlight></codeline> <codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/>args<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>vmmGetFreeVirtualPage(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>1,<sp/><ref refid="paging_8h_1a59a518704bf2f0b56603476bcb1eebbf" kindref="member">VM_TASK</ref>);</highlight></codeline> <codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(args,<sp/>0x0,<sp/>0x1000);</highlight></codeline> <codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/>x<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="503"><highlight class="normal"><sp/><sp/><sp/><sp/>argvNew<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><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);</highlight></codeline> <codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0x0;<sp/>i<sp/><<sp/>argc;<sp/>i++)<sp/>{</highlight></codeline> <codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1a55e123beb3d7f96e25e024a13582d987" kindref="member">strcpy</ref>(args<sp/>+<sp/>x,<sp/>argv[i<sp/>+<sp/>1]);</highlight></codeline> <codeline lineno="506"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>argvNew[i]<sp/>=<sp/>args<sp/>+<sp/>x;</highlight></codeline> <codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x<sp/>+=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(argv[i<sp/>+<sp/>1])<sp/>+<sp/>1;</highlight></codeline> <codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//args[x]<sp/>=<sp/>'\0';</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="509"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//x++;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/>argv<sp/>=<sp/>argvNew;</highlight></codeline> <codeline lineno="512"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="513"><highlight class="normal"></highlight></codeline> <codeline lineno="515"><highlight class="normal"><sp/><sp/><ref refid="paging_8h_1adf104ab2196331b538186550cb7ada3e" kindref="member">vmm_cleanVirtualSpace</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>+<sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ac5ce95b5be4422e5f5a61f081547d425" kindref="member">vm_dsize</ref><sp/><<<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>));</highlight></codeline> <codeline lineno="516"><highlight class="normal"></highlight></codeline> <codeline lineno="518"><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>-><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="519"><highlight class="normal"><sp/><sp/>iFrame-><ref refid="structi386__frame_1a41628a27790fd3a5e7841964e2cfb567" kindref="member">ebp</ref><sp/>=<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>;</highlight></codeline> <codeline lineno="520"><highlight class="normal"><sp/><sp/>iFrame-><ref refid="structi386__frame_1a031746b975400ea26eac2e8dcbc2bb13" kindref="member">eip</ref><sp/>=<sp/>binaryHeader->eEntry;</highlight></codeline> <codeline lineno="521"><highlight class="normal"><sp/><sp/>iFrame-><ref refid="structi386__frame_1aae0679acc1998f636b00761b546ed656" kindref="member">user_esp</ref><sp/>=<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/>12;</highlight></codeline> <codeline lineno="522"><highlight class="normal"></highlight></codeline> <codeline lineno="523"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//if<sp/>(_current->id<sp/>><sp/>3)<sp/>{</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="524"><highlight class="normal"></highlight></codeline> <codeline lineno="525"><highlight class="normal"><sp/><sp/>iFrame-><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/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/>*<sp/>(argc<sp/>+<sp/>3));</highlight></codeline> <codeline lineno="526"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<sp/>iFrame-><ref refid="structi386__frame_1aae0679acc1998f636b00761b546ed656" kindref="member">user_esp</ref>;</highlight></codeline> <codeline lineno="527"><highlight class="normal"></highlight></codeline> <codeline lineno="529"><highlight class="normal"><sp/><sp/>tmp[0]<sp/>=<sp/>argc;</highlight></codeline> <codeline lineno="530"><highlight class="normal"><sp/><sp/>for<sp/>(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>argc;<sp/>i++)<sp/>{</highlight></codeline> <codeline lineno="531"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp[i<sp/>+<sp/>1]<sp/>=<sp/>(<ref refid="include_2sys_2types_8h_1ac319c165d52643e43249fe003e18bdf3" kindref="member">u_int</ref>)<sp/>argv[i];</highlight></codeline> <codeline lineno="532"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="533"><highlight class="normal"><sp/><sp/>tmp[argc<sp/>+<sp/>1]<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="534"><highlight class="normal"><sp/><sp/>tmp[argc<sp/>+<sp/>2]<sp/>=<sp/>0x1;</highlight></codeline> <codeline lineno="535"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//}</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="536"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//else<sp/>{</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="537"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//tmp<sp/>=<sp/>(uint32_t<sp/>*)STACK_ADDR<sp/>-<sp/>2;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="538"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//tmp[0]<sp/>=<sp/>0x1;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="539"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//tmp[1]<sp/>=<sp/>0x0;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="540"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//tmp[1]<sp/>=<sp/>(uint32_t)argv;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="541"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//}</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="542"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(argvNew);</highlight></codeline> <codeline lineno="543"><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="544"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="545"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(programHeader);</highlight></codeline> <codeline lineno="546"><highlight class="normal"></highlight></codeline> <codeline lineno="547"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="548"><highlight class="normal">}</highlight></codeline> <codeline lineno="549"><highlight class="normal"></highlight></codeline> <codeline lineno="554"><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="exec_8c_1a094c23346b6d226a03866a54b755ed64" kindref="member">sys_exec</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/>*ap)<sp/>{</highlight></codeline> <codeline lineno="555"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>error<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="556"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="557"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="558"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>argc<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="559"><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="560"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>seg_size<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="561"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>seg_addr<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="562"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>addr<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="563"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/><ref refid="structi386__frame_1a031746b975400ea26eac2e8dcbc2bb13" kindref="member">eip</ref><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="564"><highlight class="normal"><sp/><sp/><ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref><sp/>proghdr<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="565"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*args<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="566"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*interp<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="567"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argv<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="568"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argvNew<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="569"><highlight class="normal"><sp/><sp/>elfHeader<sp/>*binaryHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="570"><highlight class="normal"><sp/><sp/>elfProgramHeader<sp/>*programHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="571"><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="572"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//Elf_Auxargs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*auxargs<sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="573"><highlight class="normal"></highlight></codeline> <codeline lineno="574"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><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">"r"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="575"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="576"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;<sp/></highlight><highlight class="comment">//We<sp/>Need<sp/>To<sp/>Set<sp/>errno</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="577"><highlight class="normal"></highlight></codeline> <codeline lineno="578"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>the<sp/>ELF<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="579"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader<sp/>=<sp/>(elfHeader<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfHeader)))<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="580"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">"malloc<sp/>failed!"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="581"><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">(elfHeader),<sp/>1,<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline> <codeline lineno="582"><highlight class="normal"></highlight></codeline> <codeline lineno="583"><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="584"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((binaryHeader->eIdent[1]<sp/>!=<sp/></highlight><highlight class="charliteral">'E'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader->eIdent[2]<sp/>!=<sp/></highlight><highlight class="charliteral">'L'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader->eIdent[3]<sp/>!=<sp/></highlight><highlight class="charliteral">'F'</highlight><highlight class="normal">))<sp/>||<sp/>(binaryHeader->eType<sp/>!=<sp/><ref refid="elf__common_8h_1a942478985eb016311380dee473cc8c3e" kindref="member">ET_EXEC</ref>))<sp/>{</highlight></codeline> <codeline lineno="585"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aaa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="586"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8c_1a62ac32695420234cb7ccbcfc6cabd4a4" kindref="member">fclose</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline> <codeline lineno="587"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;<sp/></highlight><highlight class="comment">//We<sp/>Need<sp/>To<sp/>Set<sp/>errno</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="588"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="589"><highlight class="normal"></highlight></codeline> <codeline lineno="590"><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="591"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader<sp/>=<sp/>(elfProgramHeader<sp/>*)<sp/><ref refid="kmalloc_8h_1a150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfProgramHeader)<sp/>*<sp/>binaryHeader->ePhnum))<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="592"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1aa5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">"malloc<sp/>failed!"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="593"><highlight class="normal"><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0],<sp/>binaryHeader->ePhoff,<sp/>0);</highlight></codeline> <codeline lineno="594"><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">(elfProgramHeader)<sp/>*<sp/>binaryHeader->ePhnum),<sp/>1,<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline> <codeline lineno="595"><highlight class="normal"></highlight></codeline> <codeline lineno="596"><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="597"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0x0;<sp/>i<sp/><<sp/>binaryHeader->ePhnum;<sp/>i++)<sp/>{</highlight></codeline> <codeline lineno="598"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(programHeader[i].phType)<sp/>{</highlight></codeline> <codeline lineno="599"><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="600"><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].phVaddr);</highlight></codeline> <codeline lineno="601"><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].phMemsz<sp/>+<sp/>programHeader[i].phVaddr<sp/>-<sp/>seg_addr);</highlight></codeline> <codeline lineno="602"><highlight class="normal"></highlight></codeline> <codeline lineno="603"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="604"><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="605"><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="606"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="607"><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/><<sp/>(programHeader[i].phMemsz);<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="608"><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="609"><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>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<sp/>((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/><ref refid="paging_8h_1af0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>)<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="610"><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">"Error:<sp/>Remap<sp/>Page<sp/>Failed"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="611"><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].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),<sp/>0x0,<sp/>0x1000);</highlight></codeline> <codeline lineno="612"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="613"><highlight class="normal"></highlight></codeline> <codeline lineno="614"><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="615"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0],<sp/>programHeader[i].phOffset,<sp/>0);</highlight></codeline> <codeline lineno="616"><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].phVaddr,<sp/>programHeader[i].phFilesz,<sp/>1,<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline> <codeline lineno="617"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader[i].phFlags<sp/>&<sp/>0x2)<sp/>!=<sp/>0x2)<sp/>{</highlight></codeline> <codeline lineno="618"><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/><<sp/>(programHeader[i].phMemsz);<sp/>x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="619"><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].phVaddr<sp/>&<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="620"><highlight class="normal"><sp/><sp/><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">"vmm_setPageAttributes<sp/>failed"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</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/>(binaryHeader->eEntry<sp/>>=<sp/>programHeader[i].phVaddr<sp/>&&<sp/>binaryHeader->eEntry<sp/><<sp/>(programHeader[i].phVaddr<sp/>+<sp/>programHeader[i].phMemsz))<sp/>{</highlight></codeline> <codeline lineno="624"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We're<sp/>suposed<sp/>to<sp/>do<sp/>something<sp/>here?<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="625"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="626"><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="627"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ac5ce95b5be4422e5f5a61f081547d425" kindref="member">vm_dsize</ref><sp/>=<sp/>seg_size<sp/>>><sp/><ref refid="paging_8h_1a850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline> <codeline lineno="628"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>seg_addr;</highlight></codeline> <codeline lineno="629"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="630"><highlight class="normal"></highlight></codeline> <codeline lineno="631"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a0933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_1a2833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>0xA900000);</highlight></codeline> <codeline lineno="632"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="633"><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="634"><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].phFilesz);</highlight></codeline> <codeline lineno="635"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(interp<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="636"><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">"malloc<sp/>failed"</highlight><highlight class="normal">)</highlight></codeline> <codeline lineno="637"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>;</highlight></codeline> <codeline lineno="638"><highlight class="normal"></highlight></codeline> <codeline lineno="639"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8c_1aac4e345a7fcee61422a6b35b54f22def" kindref="member">fseek</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0],<sp/>programHeader[i].phOffset,<sp/>0);</highlight></codeline> <codeline lineno="640"><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].phFilesz,<sp/>1,<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a8900c1caf1b8c278e981464a68b0e53f" kindref="member">files</ref>[0]);</highlight></codeline> <codeline lineno="641"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Interp:<sp/>[%s]\n"</highlight><highlight class="normal">,<sp/>interp);</highlight></codeline> <codeline lineno="642"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//ldAddr<sp/>=<sp/>ldEnable();</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="643"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="644"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf__common_8h_1a58ff00be749ca4000074f9b9066a1056" kindref="member">PT_PHDR</ref>:</highlight></codeline> <codeline lineno="645"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>proghdr<sp/>=<sp/>programHeader[i].phVaddr;</highlight></codeline> <codeline lineno="646"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="647"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline> <codeline lineno="648"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="649"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="650"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="651"><highlight class="normal"></highlight></codeline> <codeline lineno="652"><highlight class="normal"><sp/><sp/>addr<sp/>=<sp/><ref refid="kmod_8h_1af4d6f389174a00e0de80e1ea0e23e956" kindref="member">LD_START</ref>;</highlight></codeline> <codeline lineno="653"><highlight class="normal"></highlight></codeline> <codeline lineno="654"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(interp<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="655"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//kprintf("TEST");</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="656"><highlight class="normal"><sp/><sp/><sp/><sp/>elf_loadfile(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>,<sp/>interp,<sp/>&addr,<sp/>&<ref refid="structi386__frame_1a031746b975400ea26eac2e8dcbc2bb13" kindref="member">eip</ref>);</highlight></codeline> <codeline lineno="657"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="658"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf("[0x%X][0x%X]\n",eip,addr);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="659"><highlight class="normal"></highlight></codeline> <codeline lineno="660"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ac5ce95b5be4422e5f5a61f081547d425" kindref="member">vm_dsize</ref><sp/>=<sp/>seg_size<sp/>>><sp/><ref refid="paging_8h_1a850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline> <codeline lineno="661"><highlight class="normal"><sp/><sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>seg_addr;</highlight></codeline> <codeline lineno="662"><highlight class="normal"></highlight></codeline> <codeline lineno="664"><highlight class="normal"><sp/><sp/>argv<sp/>=<sp/>ap;</highlight></codeline> <codeline lineno="665"><highlight class="normal"></highlight></codeline> <codeline lineno="666"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(argv[1]<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="667"><highlight class="normal"><sp/><sp/><sp/><sp/>argc<sp/>=<sp/>argv[0];</highlight></codeline> <codeline lineno="668"><highlight class="normal"><sp/><sp/><sp/><sp/>args<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>vmmGetFreeVirtualPage(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>1,<sp/><ref refid="paging_8h_1a59a518704bf2f0b56603476bcb1eebbf" kindref="member">VM_TASK</ref>);</highlight></codeline> <codeline lineno="669"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(args,<sp/>0x0,<sp/>0x1000);</highlight></codeline> <codeline lineno="670"><highlight class="normal"><sp/><sp/><sp/><sp/>x<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="671"><highlight class="normal"><sp/><sp/><sp/><sp/>argvNew<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><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);</highlight></codeline> <codeline lineno="672"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0x0;<sp/>i<sp/><<sp/>argc;<sp/>i++)<sp/>{</highlight></codeline> <codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1a55e123beb3d7f96e25e024a13582d987" kindref="member">strcpy</ref>(args<sp/>+<sp/>x,<sp/>argv[i<sp/>+<sp/>1]);</highlight></codeline> <codeline lineno="674"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>argvNew[i]<sp/>=<sp/>args<sp/>+<sp/>x;</highlight></codeline> <codeline lineno="675"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x<sp/>+=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(argv[i<sp/>+<sp/>1])<sp/>+<sp/>1;</highlight></codeline> <codeline lineno="676"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="677"><highlight class="normal"><sp/><sp/><sp/><sp/>argv<sp/>=<sp/>argvNew;</highlight></codeline> <codeline lineno="678"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="679"><highlight class="normal"></highlight></codeline> <codeline lineno="681"><highlight class="normal"><sp/><sp/><ref refid="paging_8h_1adf104ab2196331b538186550cb7ada3e" kindref="member">vmm_cleanVirtualSpace</ref>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ae4165d082b98f27dab6bfeeefb76e060" kindref="member">vm_daddr</ref><sp/>+<sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1ac5ce95b5be4422e5f5a61f081547d425" kindref="member">vm_dsize</ref><sp/><<<sp/><ref refid="paging_8h_1a7d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>));</highlight></codeline> <codeline lineno="682"><highlight class="normal"></highlight></codeline> <codeline lineno="684"><highlight class="normal"><sp/><sp/>iFrame<sp/>=<sp/><ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><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<sp/></highlight><highlight class="normal"><ref refid="structi386__frame" kindref="compound">i386_frame</ref>);</highlight></codeline> <codeline lineno="685"><highlight class="normal"><sp/><sp/>iFrame-><ref refid="structi386__frame_1a41628a27790fd3a5e7841964e2cfb567" kindref="member">ebp</ref><sp/>=<sp/><ref refid="exec_8c_1ad93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>;</highlight></codeline> <codeline lineno="686"><highlight class="normal"><sp/><sp/>iFrame-><ref refid="structi386__frame_1a031746b975400ea26eac2e8dcbc2bb13" kindref="member">eip</ref><sp/>=<sp/><ref refid="structi386__frame_1a031746b975400ea26eac2e8dcbc2bb13" kindref="member">eip</ref>;</highlight></codeline> <codeline lineno="687"><highlight class="normal"></highlight></codeline> <codeline lineno="688"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//if<sp/>(_current->id<sp/>><sp/>3)<sp/>{</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="689"><highlight class="normal"></highlight></codeline> <codeline lineno="690"><highlight class="normal"><sp/><sp/>iFrame-><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/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="include_2sys_2types_8h_1a0238af00180b6d9278fa1c6aa790fdf4" kindref="member">uint32_t</ref>)<sp/>*<sp/>(argc<sp/>+<sp/>4));<sp/></highlight><highlight class="comment">//<sp/>+<sp/>(sizeof(Elf_Auxargs)<sp/>*<sp/>2)));</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="691"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"\n\n\nuser_esp:<sp/>[0x%X]\n"</highlight><highlight class="normal">,<sp/>iFrame-><ref refid="structi386__frame_1aae0679acc1998f636b00761b546ed656" kindref="member">user_esp</ref>);</highlight></codeline> <codeline lineno="692"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>iFrame-><ref refid="structi386__frame_1aae0679acc1998f636b00761b546ed656" kindref="member">user_esp</ref>;</highlight></codeline> <codeline lineno="693"><highlight class="normal"></highlight></codeline> <codeline lineno="695"><highlight class="normal"><sp/><sp/>tmp[0]<sp/>=<sp/>argc;</highlight></codeline> <codeline lineno="696"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>argc;<sp/>i++)<sp/>{</highlight></codeline> <codeline lineno="697"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp[i<sp/>+<sp/>1]<sp/>=<sp/>argv[i];</highlight></codeline> <codeline lineno="698"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="700"><highlight class="normal"><sp/><sp/>args<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>vmmGetFreeVirtualPage(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<sp/>1,<sp/><ref refid="paging_8h_1a59a518704bf2f0b56603476bcb1eebbf" kindref="member">VM_TASK</ref>);</highlight></codeline> <codeline lineno="701"><highlight class="normal"><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(args,<sp/>0x0,<sp/>0x1000);</highlight></codeline> <codeline lineno="702"><highlight class="normal"><sp/><sp/><ref refid="string_8h_1a55e123beb3d7f96e25e024a13582d987" kindref="member">strcpy</ref>(args,<sp/></highlight><highlight class="stringliteral">"LIBRARY_PATH=/lib"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="703"><highlight class="normal"><sp/><sp/>tmp[argc<sp/>+<sp/>2]<sp/>=<sp/>args;</highlight></codeline> <codeline lineno="704"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"env:<sp/>[0x%X][0x%X]\n"</highlight><highlight class="normal">,<sp/>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref>)<sp/>tmp<sp/>+<sp/>argc<sp/>+<sp/>2,<sp/>tmp[argc<sp/>+<sp/>2]);</highlight></codeline> <codeline lineno="705"><highlight class="normal"><sp/><sp/>tmp[argc<sp/>+<sp/>3]<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="706"><highlight class="normal"><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"env:<sp/>[0x%X][0x%X]\n"</highlight><highlight class="normal">,<sp/>(<ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref>)<sp/>tmp<sp/>+<sp/>argc<sp/>+<sp/>2,<sp/>tmp[argc<sp/>+<sp/>2]);</highlight></codeline> <codeline lineno="707"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//auxargs<sp/>=<sp/>iFrame->user_esp<sp/>+<sp/>argc<sp/>+<sp/><sp/>3;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="708"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>iFrame-><ref refid="structi386__frame_1aae0679acc1998f636b00761b546ed656" kindref="member">user_esp</ref>;</highlight></codeline> <codeline lineno="709"><highlight class="normal"><sp/><sp/>tmp<sp/>+=<sp/>argc<sp/>+<sp/>4;</highlight></codeline> <codeline lineno="710"><highlight class="normal"></highlight></codeline> <codeline lineno="711"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="712"><highlight class="comment"><sp/><sp/><sp/>auxargs->execfd<sp/>=<sp/>-1;</highlight></codeline> <codeline lineno="713"><highlight class="comment"><sp/><sp/><sp/>auxargs->phdr<sp/><sp/><sp/>=<sp/>proghdr;</highlight></codeline> <codeline lineno="714"><highlight class="comment"><sp/><sp/><sp/>auxargs->phent<sp/><sp/>=<sp/>binaryHeader->ePhentsize;</highlight></codeline> <codeline lineno="715"><highlight class="comment"><sp/><sp/><sp/>auxargs->phnum<sp/><sp/>=<sp/>binaryHeader->ePhnum;</highlight></codeline> <codeline lineno="716"><highlight class="comment"><sp/><sp/><sp/>auxargs->pagesz<sp/>=<sp/>PAGE_SIZE;</highlight></codeline> <codeline lineno="717"><highlight class="comment"><sp/><sp/><sp/>auxargs->base<sp/><sp/><sp/>=<sp/>addr;</highlight></codeline> <codeline lineno="718"><highlight class="comment"><sp/><sp/><sp/>auxargs->flags<sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="719"><highlight class="comment"><sp/><sp/><sp/>auxargs->entry<sp/><sp/>=<sp/>binaryHeader->eEntry;</highlight></codeline> <codeline lineno="720"><highlight class="comment"><sp/><sp/><sp/>auxargs->trace<sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="721"><highlight class="comment"></highlight></codeline> <codeline lineno="722"><highlight class="comment"><sp/><sp/><sp/>AUXARGS_ENTRY(tmp,<sp/>AT_PHDR,<sp/>auxargs->phdr);</highlight></codeline> <codeline lineno="723"><highlight class="comment"><sp/><sp/><sp/>AUXARGS_ENTRY(tmp,<sp/>AT_PHENT,<sp/>auxargs->phent);</highlight></codeline> <codeline lineno="724"><highlight class="comment"><sp/><sp/><sp/>AUXARGS_ENTRY(tmp,<sp/>AT_PHNUM,<sp/>auxargs->phnum);</highlight></codeline> <codeline lineno="725"><highlight class="comment"><sp/><sp/><sp/>AUXARGS_ENTRY(tmp,<sp/>AT_PAGESZ,<sp/>auxargs->pagesz);</highlight></codeline> <codeline lineno="726"><highlight class="comment"><sp/><sp/><sp/>AUXARGS_ENTRY(tmp,<sp/>AT_FLAGS,<sp/>auxargs->flags);</highlight></codeline> <codeline lineno="727"><highlight class="comment"><sp/><sp/><sp/>AUXARGS_ENTRY(tmp,<sp/>AT_ENTRY,<sp/>auxargs->entry);</highlight></codeline> <codeline lineno="728"><highlight class="comment"><sp/><sp/><sp/>AUXARGS_ENTRY(tmp,<sp/>AT_BASE,<sp/>auxargs->base);</highlight></codeline> <codeline lineno="729"><highlight class="comment"><sp/><sp/><sp/>AUXARGS_ENTRY(tmp,<sp/>AT_NULL,<sp/>0);</highlight></codeline> <codeline lineno="730"><highlight class="comment"></highlight></codeline> <codeline lineno="731"><highlight class="comment"><sp/><sp/><sp/>kprintf("AT_BASE:<sp/>[0x%X]\n",auxargs->base);</highlight></codeline> <codeline lineno="732"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="733"><highlight class="normal"></highlight></codeline> <codeline lineno="734"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//iFrame->ebx<sp/>=<sp/>0x0;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="735"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//iFrame->ebx<sp/>=<sp/>0x0;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="736"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//iFrame->eip<sp/>=<sp/>binaryHeader->eEntry;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="737"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf("\n\nDOH:<sp/>[0x%X]\n\n",iFrame->eip);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="738"><highlight class="normal"></highlight><highlight class="comment">//while<sp/>(1);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="739"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//while<sp/>(1);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="740"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="741"><highlight class="comment"><sp/><sp/><sp/>error<sp/>=<sp/>elf_loadfile(_current,file,0x0,0x0);</highlight></codeline> <codeline lineno="742"><highlight class="comment"><sp/><sp/><sp/>if<sp/>(error)</highlight></codeline> <codeline lineno="743"><highlight class="comment"><sp/><sp/><sp/>K_PANIC("elf_loadfile<sp/>failed");</highlight></codeline> <codeline lineno="744"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="745"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="746"><highlight class="normal">}</highlight></codeline> <codeline lineno="747"><highlight class="normal"></highlight></codeline> <codeline lineno="748"><highlight class="normal"></highlight><highlight class="comment">/***</highlight></codeline> <codeline lineno="749"><highlight class="comment"><sp/>END</highlight></codeline> <codeline lineno="750"><highlight class="comment"><sp/>***/</highlight><highlight class="normal"></highlight></codeline> </programlisting> <location file="C:/Dev/git/UbixOS/sys/arch/armv6/exec.c"/> </compounddef> </doxygen>