<?xml version='1.0' encoding='iso-8859-1' standalone='no'?> <doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.4.7"> <compounddef id="exec_8c" kind="file"> <compoundname>exec.c</compoundname> <includes refid="exec_8h" local="no">ubixos/exec.h</includes> <includes refid="elf_8h" local="no">ubixos/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 refid="lib_2string_8h" local="no">lib/string.h</includes> <includes refid="assert_8h" local="no">assert.h</includes> <incdepgraph> <node id="5251"> <label>sys/thread.h</label> <link refid="thread_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5254"> <label>ubixos/kpanic.h</label> <link refid="kpanic_8h"/> </node> <node id="5245"> <label>ubixos/sched.h</label> <link refid="sched_8h"/> <childnode refid="5243" relation="include"> </childnode> <childnode refid="5246" relation="include"> </childnode> <childnode refid="5247" relation="include"> </childnode> <childnode refid="5250" relation="include"> </childnode> <childnode refid="5251" relation="include"> </childnode> </node> <node id="5255"> <label>ubixos/endtask.h</label> <link refid="endtask_8h"/> <childnode refid="5243" relation="include"> </childnode> <childnode refid="5245" relation="include"> </childnode> </node> <node id="5243"> <label>ubixos/types.h</label> <link refid="types_8h"/> <childnode refid="5244" relation="include"> </childnode> </node> <node id="5244"> <label>sys/_types.h</label> <link refid="__types_8h"/> </node> <node id="5262"> <label>lib/string.h</label> <link refid="lib_2string_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5257"> <label>vmm/paging.h</label> <link refid="paging_8h"/> <childnode refid="5243" relation="include"> </childnode> <childnode refid="5258" relation="include"> </childnode> <childnode refid="5251" relation="include"> </childnode> </node> <node id="5247"> <label>vfs/file.h</label> <link refid="file_8h"/> <childnode refid="5243" relation="include"> </childnode> <childnode refid="5248" relation="include"> </childnode> <childnode refid="5249" relation="include"> </childnode> </node> <node id="5250"> <label>sys/tss.h</label> <link refid="tss_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5260"> <label>lib/kmalloc.h</label> <link refid="kmalloc_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5256"> <label>vmm/vmm.h</label> <link refid="vmm_8h"/> <childnode refid="5257" relation="include"> </childnode> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5249"> <label>vfs/mount.h</label> <link refid="mount_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5261"> <label>lib/kprintf.h</label> <link refid="kprintf_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5253"> <label>ubixos/ld.h</label> <link refid="ld_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5263"> <label>assert.h</label> <link refid="assert_8h"/> </node> <node id="5248"> <label>ubixfs/dirCache.h</label> <link refid="dirCache_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5242"> <label>ubixos/exec.h</label> <link refid="exec_8h"/> <childnode refid="5243" relation="include"> </childnode> <childnode refid="5245" relation="include"> </childnode> </node> <node id="5258"> <label>sys/sysproto.h</label> <link refid="sysproto_8h"/> <childnode refid="5259" relation="include"> </childnode> <childnode refid="5251" relation="include"> </childnode> </node> <node id="5252"> <label>ubixos/elf.h</label> <link refid="elf_8h"/> <childnode refid="5243" relation="include"> </childnode> <childnode refid="5245" relation="include"> </childnode> </node> <node id="5259"> <label>sys/signal.h</label> <link refid="signal_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5246"> <label>ubixos/tty.h</label> <link refid="tty_8h"/> <childnode refid="5243" relation="include"> </childnode> </node> <node id="5241"> <label>src/sys/kernel/exec.c</label> <link refid="exec.c"/> <childnode refid="5242" relation="include"> </childnode> <childnode refid="5252" relation="include"> </childnode> <childnode refid="5253" relation="include"> </childnode> <childnode refid="5254" relation="include"> </childnode> <childnode refid="5255" relation="include"> </childnode> <childnode refid="5256" relation="include"> </childnode> <childnode refid="5260" relation="include"> </childnode> <childnode refid="5261" relation="include"> </childnode> <childnode refid="5262" relation="include"> </childnode> <childnode refid="5263" relation="include"> </childnode> </node> </incdepgraph> <sectiondef kind="define"> <memberdef kind="define" id="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" prot="public" static="no"> <name>STACK_ADDR</name> <initializer>0xC800000</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" line="42" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" bodystart="42" bodyend="-1"/> <referencedby refid="exec_8c_1f80d4412d42ed1b5bf9a1b9774230f33" compoundref="exec_8c" startline="143" endline="323">execFile</referencedby> <referencedby refid="exec_8c_1219681612352232186a0f568457d851d" compoundref="exec_8c" startline="334" endline="546">sysExec</referencedby> </memberdef> </sectiondef> <sectiondef kind="func"> <memberdef kind="function" id="exec_8c_1f80d4412d42ed1b5bf9a1b9774230f33" 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="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" line="143" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" bodystart="143" bodyend="323"/> <references refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" compoundref="sched_8c" startline="51">_current</references> <references refid="assert_8h_1d6d5aaa966ca7424f7cb9bd01f2c838b" compoundref="assert_8h" startline="64">assert</references> <references refid="structtssStruct_1fecbe8ea2cfebfb4d1a0aa7b6ebcac2c" compoundref="tss_8h" startline="36">tssStruct::back_link</references> <references refid="structtssStruct_18d312ed3dd0ea7a0f801c08a8cc4afd0" compoundref="tss_8h" startline="47">tssStruct::cr3</references> <references refid="structtssStruct_16d9085ec5af0fa1fe1de7015ad99c9e3" compoundref="tss_8h" startline="57">tssStruct::cs</references> <references refid="structtssStruct_101ee01c7f45c9b9ee2ad8338c21e6d33" compoundref="tss_8h" startline="61">tssStruct::ds</references> <references refid="structtssStruct_1c2d32620149e07c40ee87696ef2509c2" compoundref="tss_8h" startline="52">tssStruct::ebp</references> <references refid="structtssStruct_1a52b515706cd37e166c8eba348d5e68b" compoundref="tss_8h" startline="54">tssStruct::edi</references> <references refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" compoundref="elf_8h" startline="102">elfHeader::eEntry</references> <references refid="structtssStruct_1a85f1fbaf622e0c6a39963da27de0194" compoundref="tss_8h" startline="49">tssStruct::eflags</references> <references refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" compoundref="elf_8h" startline="98">elfHeader::eIdent</references> <references refid="structtssStruct_13e758f2138799d63fc803f7e4db4f5b4" compoundref="tss_8h" startline="48">tssStruct::eip</references> <references refid="structelfHeader_14635401868104caa04fcb5bb60840df6" compoundref="elf_8h" startline="108">elfHeader::ePhnum</references> <references refid="structelfHeader_1aff1ff2cb64932f1e1a1f6cf3b881787" compoundref="elf_8h" startline="103">elfHeader::ePhoff</references> <references refid="structtssStruct_1cd97dd6f6eabd83c0b819b6058b7041d" compoundref="tss_8h" startline="55">tssStruct::es</references> <references refid="structtssStruct_18beab5808aad776957d4544f6b139d4e" compoundref="tss_8h" startline="53">tssStruct::esi</references> <references refid="structtssStruct_185412a87dbdb8eda612c77bce8055a2c" compoundref="tss_8h" startline="51">tssStruct::esp</references> <references refid="structtssStruct_11017372aed82d7305586c330fa222b3b" compoundref="tss_8h" startline="38">tssStruct::esp0</references> <references refid="structtssStruct_1d5ef8867200562fd8262f70312beff4d" compoundref="tss_8h" startline="41">tssStruct::esp1</references> <references refid="structtssStruct_160c88f3cd3f2110cb24be62444f42cfb" compoundref="tss_8h" startline="44">tssStruct::esp2</references> <references refid="structelfHeader_134e52f945d79cca21dc50a8aef79f9e8" compoundref="elf_8h" startline="99">elfHeader::eType</references> <references refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" compoundref="file_8c" startline="398" endline="425">fclose</references> <references refid="file_8h_1d6a41ac88a7d46d574e8a675fdde136c" compoundref="file_8c" startline="274" endline="389">fopen</references> <references refid="file_8h_13b06878a03209e88c008c77234b89359" compoundref="file_8c" startline="178" endline="198">fread</references> <references refid="structtssStruct_18114a585123181ec835f8db3e029d390" compoundref="tss_8h" startline="63">tssStruct::fs</references> <references refid="file_8h_180528d8335cd52755f5d6a92e4f08391" compoundref="file_8c" startline="208" endline="211">fseek</references> <references refid="structtaskStruct_13cf9920106f9b0d96dff475faf7aa0d6" compoundref="sched_8h" startline="63">taskStruct::gid</references> <references refid="structtssStruct_18dfa44423504293405785371d0e7b076" compoundref="tss_8h" startline="65">tssStruct::gs</references> <references refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" compoundref="sched_8h" startline="55">taskStruct::id</references> <references refid="structtssStruct_1611a0a044f99f092ace469ce2381bb33" compoundref="tss_8h" startline="70">tssStruct::io_map</references> <references refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" compoundref="kpanic_8h" startline="33">K_PANIC</references> <references refid="paging_8h_18b838cda4f0bc79ab8d07eb19dd35420" compoundref="paging_8h" startline="53">KERNEL_PAGE_DEFAULT</references> <references refid="paging_8h_14e81de2626825c90dc6bb3cd7c8b344c" compoundref="paging_8c" startline="40">kernelPageDirectory</references> <references refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="351" endline="391">kfree</references> <references refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="247" endline="339">kmalloc</references> <references refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" compoundref="kpanic_8c" startline="42" endline="60">kpanic</references> <references refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" compoundref="kprintf_8c" startline="38" endline="49">kprintf</references> <references refid="structtssStruct_1d7b6a367e1c2a38e1ee6c8e5dad955f7" compoundref="tss_8h" startline="67">tssStruct::ldt</references> <references refid="lib_2string_8h_1ce4b911463887af5e748326323e99a23" compoundref="memset_8c" startline="37" endline="80">memset</references> <references refid="structtaskStruct_10933c70230d4ac8bc9953640c979f8d7" compoundref="sched_8h" startline="60">taskStruct::oInfo</references> <references refid="structtty__termNode_1f8e2ad49f523044768d8e768bfe531e4" compoundref="tty_8h" startline="43">tty_termNode::owner</references> <references refid="paging_8h_1f0fff7a38cd2c7a32d580787423b94ea" compoundref="paging_8h" startline="52">PAGE_DEFAULT</references> <references refid="paging_8h_1122dfc414a40e260fd35dbe9743db26f" compoundref="paging_8h" startline="49">PAGE_PRESENT</references> <references refid="paging_8h_11532db17068ba8d409b8ffe066414af2" compoundref="paging_8h" startline="47">PAGE_STACK</references> <references refid="paging_8h_12d0253527ea5080d6befe0ee3bde473f" compoundref="paging_8h" startline="51">PAGE_USER</references> <references refid="structfileDescriptorStruct_111626b5d99a5da968f43bc37d2591c5c" compoundref="file_8h" startline="60">fileDescriptorStruct::perms</references> <references refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" compoundref="elf_8h" startline="120">elfProgramHeader::phMemsz</references> <references refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" compoundref="elf_8h" startline="117">elfProgramHeader::phVaddr</references> <references refid="sched_8h_13fb333b67375561d327e9b5a8ffa03b96564f2f3e15be06b670547bbcaaf0798">READY</references> <references refid="sched_8h_151101e12c9236ea1286477695c110482" compoundref="sched_8c" startline="281" endline="287">sched_setStatus</references> <references refid="sched_8h_192458df2063761371869cdfe0c9b4ee3" compoundref="sched_8c" startline="143" endline="172">schedNewTask</references> <references refid="structtssStruct_1340a29782d3306ba84176c543725d70a" compoundref="tss_8h" startline="59">tssStruct::ss</references> <references refid="structtssStruct_126d03018de8c122451661bfe9d030541" compoundref="tss_8h" startline="39">tssStruct::ss0</references> <references refid="structtssStruct_16abf05d9a8f6356860a5606ffbadc989" compoundref="tss_8h" startline="42">tssStruct::ss1</references> <references refid="structtssStruct_15a79ace5652b01cc25fc5ba7ff45bfa8" compoundref="tss_8h" startline="45">tssStruct::ss2</references> <references refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" compoundref="exec_8c" startline="42">STACK_ADDR</references> <references refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" compoundref="sched_8h" startline="67">taskStruct::td</references> <references refid="structtaskStruct_14563a310626d4f4ea885f4532356abb3" compoundref="sched_8h" startline="66">taskStruct::term</references> <references refid="structtssStruct_152ac0b54c6b2c71450c62d7fc911f2e2" compoundref="tss_8h" startline="69">tssStruct::trace_bitmap</references> <references refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" compoundref="sched_8h" startline="58">taskStruct::tss</references> <references refid="tty_8h_14f96ccac7e60296ef496008d8cbed0ff" compoundref="tty_8c" startline="170" endline="172">tty_find</references> <references refid="structtaskStruct_11f9e02ebf24ff1cd76fab75e4c6b0fe1" compoundref="sched_8h" startline="64">taskStruct::uid</references> <references refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" compoundref="thread_8h" startline="40">thread::vm_daddr</references> <references refid="paging_8h_1a05f8d8947fb5bcec87fc6661f83243e" compoundref="paging_8c" startline="160" endline="241">vmm_remapPage</references> <references refid="paging_8h_11913e8607a69ecf446b18fa1cd36c9cc" compoundref="setpageattributes_8c" startline="41" endline="68">vmm_setPageAttributes</references> <references refid="paging_8h_139ac9b6ea58fc8b6f129775642077c99" compoundref="createvirtualspace_8c" startline="81" endline="143">vmmCreateVirtualSpace</references> <references refid="vmm_8h_1976cf3919bf7c77c868021ec9374593b" compoundref="vmm__memory_8c" startline="186" endline="216">vmmFindFreePage</references> <references refid="structosInfo_12833c1fa4a221941b5d1141dfa5beefd" compoundref="sched_8h" startline="47">osInfo::vmStart</references> <references refid="ap-boot_8S_1f78b91f02427adef14bb8b28aa93baa5" compoundref="ap-boot_8S" startline="52">x1000</references> <references refid="start_8S_10c48af311abb843beb7bb6c5e295d1db" compoundref="start_8S" startline="51">x18</references> <references refid="ap-boot_8S_1c2a218176530ced267bbcc8042da1000" compoundref="ap-boot_8S" startline="52">x30</references> <referencedby refid="main_8c_1a099bb67b4698f94150184a0ee8ccffb" compoundref="main_8c" startline="97" endline="152">kmain</referencedby> </memberdef> <memberdef kind="function" id="exec_8c_14b86d28d8fd56197042aef174de2fd58" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type><ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" 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="types_8h_15847ea0262a5aa61eee48cbe95544a78" 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="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" line="55" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" bodystart="55" bodyend="125"/> <references refid="assert_8h_1d6d5aaa966ca7424f7cb9bd01f2c838b" compoundref="assert_8h" startline="64">assert</references> <references refid="structtssStruct_1fecbe8ea2cfebfb4d1a0aa7b6ebcac2c" compoundref="tss_8h" startline="36">tssStruct::back_link</references> <references refid="structtssStruct_18d312ed3dd0ea7a0f801c08a8cc4afd0" compoundref="tss_8h" startline="47">tssStruct::cr3</references> <references refid="structtssStruct_16d9085ec5af0fa1fe1de7015ad99c9e3" compoundref="tss_8h" startline="57">tssStruct::cs</references> <references refid="structtssStruct_101ee01c7f45c9b9ee2ad8338c21e6d33" compoundref="tss_8h" startline="61">tssStruct::ds</references> <references refid="structtssStruct_1c2d32620149e07c40ee87696ef2509c2" compoundref="tss_8h" startline="52">tssStruct::ebp</references> <references refid="structtssStruct_1a52b515706cd37e166c8eba348d5e68b" compoundref="tss_8h" startline="54">tssStruct::edi</references> <references refid="structtssStruct_1a85f1fbaf622e0c6a39963da27de0194" compoundref="tss_8h" startline="49">tssStruct::eflags</references> <references refid="structtssStruct_13e758f2138799d63fc803f7e4db4f5b4" compoundref="tss_8h" startline="48">tssStruct::eip</references> <references refid="structtssStruct_1cd97dd6f6eabd83c0b819b6058b7041d" compoundref="tss_8h" startline="55">tssStruct::es</references> <references refid="structtssStruct_18beab5808aad776957d4544f6b139d4e" compoundref="tss_8h" startline="53">tssStruct::esi</references> <references refid="structtssStruct_185412a87dbdb8eda612c77bce8055a2c" compoundref="tss_8h" startline="51">tssStruct::esp</references> <references refid="structtssStruct_11017372aed82d7305586c330fa222b3b" compoundref="tss_8h" startline="38">tssStruct::esp0</references> <references refid="structtssStruct_1d5ef8867200562fd8262f70312beff4d" compoundref="tss_8h" startline="41">tssStruct::esp1</references> <references refid="structtssStruct_160c88f3cd3f2110cb24be62444f42cfb" compoundref="tss_8h" startline="44">tssStruct::esp2</references> <references refid="structtssStruct_18114a585123181ec835f8db3e029d390" compoundref="tss_8h" startline="63">tssStruct::fs</references> <references refid="structtssStruct_18dfa44423504293405785371d0e7b076" compoundref="tss_8h" startline="65">tssStruct::gs</references> <references refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" compoundref="sched_8h" startline="55">taskStruct::id</references> <references refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" compoundref="sched_8h" startline="61">taskStruct::imageFd</references> <references refid="structtssStruct_1611a0a044f99f092ace469ce2381bb33" compoundref="tss_8h" startline="70">tssStruct::io_map</references> <references refid="paging_8h_14e81de2626825c90dc6bb3cd7c8b344c" compoundref="paging_8c" startline="40">kernelPageDirectory</references> <references refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" compoundref="kpanic_8c" startline="42" endline="60">kpanic</references> <references refid="structtssStruct_1d7b6a367e1c2a38e1ee6c8e5dad955f7" compoundref="tss_8h" startline="67">tssStruct::ldt</references> <references refid="structtaskStruct_10933c70230d4ac8bc9953640c979f8d7" compoundref="sched_8h" startline="60">taskStruct::oInfo</references> <references refid="sched_8h_13fb333b67375561d327e9b5a8ffa03b96564f2f3e15be06b670547bbcaaf0798">READY</references> <references refid="sched_8h_151101e12c9236ea1286477695c110482" compoundref="sched_8c" startline="281" endline="287">sched_setStatus</references> <references refid="sched_8h_192458df2063761371869cdfe0c9b4ee3" compoundref="sched_8c" startline="143" endline="172">schedNewTask</references> <references refid="structtssStruct_1340a29782d3306ba84176c543725d70a" compoundref="tss_8h" startline="59">tssStruct::ss</references> <references refid="structtssStruct_126d03018de8c122451661bfe9d030541" compoundref="tss_8h" startline="39">tssStruct::ss0</references> <references refid="structtssStruct_16abf05d9a8f6356860a5606ffbadc989" compoundref="tss_8h" startline="42">tssStruct::ss1</references> <references refid="structtssStruct_15a79ace5652b01cc25fc5ba7ff45bfa8" compoundref="tss_8h" startline="45">tssStruct::ss2</references> <references refid="structtssStruct_152ac0b54c6b2c71450c62d7fc911f2e2" compoundref="tss_8h" startline="69">tssStruct::trace_bitmap</references> <references refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" compoundref="sched_8h" startline="58">taskStruct::tss</references> <references refid="structosInfo_12833c1fa4a221941b5d1141dfa5beefd" compoundref="sched_8h" startline="47">osInfo::vmStart</references> <referencedby refid="main_8c_1a099bb67b4698f94150184a0ee8ccffb" compoundref="main_8c" startline="97" endline="152">kmain</referencedby> <referencedby refid="ubthread_8c_1a0af177ef44888f3c93883294207328e" compoundref="ubthread_8c" startline="76" endline="79">ubthread_create</referencedby> </memberdef> <memberdef kind="function" id="exec_8c_1094c23346b6d226a03866a54b755ed64" 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>Clean the virtual of COW pages left over from the fork</para><para>Adjust iframe</para><para>build argc and argv[]</para><para>Start of Env </para> </inbodydescription> <location file="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" line="552" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" bodystart="552" bodyend="716"/> <references refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" compoundref="sched_8c" startline="51">_current</references> <references refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" compoundref="elf_8h" startline="102">elfHeader::eEntry</references> <references refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" compoundref="elf_8h" startline="98">elfHeader::eIdent</references> <references refid="structi386__frame_1ef87f1d1d6f1ad030c95773e7eedfa16" compoundref="tss_8h" startline="103">i386_frame::eip</references> <references refid="structelfHeader_14635401868104caa04fcb5bb60840df6" compoundref="elf_8h" startline="108">elfHeader::ePhnum</references> <references refid="structelfHeader_1aff1ff2cb64932f1e1a1f6cf3b881787" compoundref="elf_8h" startline="103">elfHeader::ePhoff</references> <references refid="elf_8h_1942478985eb016311380dee473cc8c3e" compoundref="elf_8h" startline="55">ET_EXEC</references> <references refid="structelfHeader_134e52f945d79cca21dc50a8aef79f9e8" compoundref="elf_8h" startline="99">elfHeader::eType</references> <references refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" compoundref="file_8c" startline="398" endline="425">fclose</references> <references refid="file_8h_1d6a41ac88a7d46d574e8a675fdde136c" compoundref="file_8c" startline="274" endline="389">fopen</references> <references refid="file_8h_13b06878a03209e88c008c77234b89359" compoundref="file_8c" startline="178" endline="198">fread</references> <references refid="file_8h_180528d8335cd52755f5d6a92e4f08391" compoundref="file_8c" startline="208" endline="211">fseek</references> <references refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" compoundref="sched_8h" startline="55">taskStruct::id</references> <references refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" compoundref="sched_8h" startline="61">taskStruct::imageFd</references> <references refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" compoundref="kpanic_8h" startline="33">K_PANIC</references> <references refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="351" endline="391">kfree</references> <references refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="247" endline="339">kmalloc</references> <references refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" compoundref="kprintf_8c" startline="38" endline="49">kprintf</references> <references refid="lib_2string_8h_1ce4b911463887af5e748326323e99a23" compoundref="memset_8c" startline="37" endline="80">memset</references> <references refid="structtaskStruct_10933c70230d4ac8bc9953640c979f8d7" compoundref="sched_8h" startline="60">taskStruct::oInfo</references> <references refid="paging_8h_1f0fff7a38cd2c7a32d580787423b94ea" compoundref="paging_8h" startline="52">PAGE_DEFAULT</references> <references refid="paging_8h_1122dfc414a40e260fd35dbe9743db26f" compoundref="paging_8h" startline="49">PAGE_PRESENT</references> <references refid="paging_8h_1850d80ca2291d26b40dc6b25c419f81a" compoundref="paging_8h" startline="55">PAGE_SHIFT</references> <references refid="paging_8h_12d0253527ea5080d6befe0ee3bde473f" compoundref="paging_8h" startline="51">PAGE_USER</references> <references refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" compoundref="elf_8h" startline="120">elfProgramHeader::phMemsz</references> <references refid="structelfProgramHeader_193a7c0296fe86a429cf58989956d28ff" compoundref="elf_8h" startline="116">elfProgramHeader::phOffset</references> <references refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" compoundref="elf_8h" startline="117">elfProgramHeader::phVaddr</references> <references refid="elf_8h_1bcd3aa15bc567949c1ab6b1abc137710" compoundref="elf_8h" startline="82">PT_INTERP</references> <references refid="elf_8h_184d7768fd6c6ece599d297090900cf92" compoundref="elf_8h" startline="80">PT_LOAD</references> <references refid="elf_8h_158ff00be749ca4000074f9b9066a1056" compoundref="elf_8h" startline="85">PT_PHDR</references> <references refid="paging_8h_12702263fcf2b3b026cb26c6d895cb0ee" compoundref="paging_8h" startline="60">round_page</references> <references refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" compoundref="sched_8h" startline="67">taskStruct::td</references> <references refid="paging_8h_1bd636a9b61ad98f4fc23b1f4a9210d78" compoundref="paging_8h" startline="59">trunc_page</references> <references refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" compoundref="thread_8h" startline="40">thread::vm_daddr</references> <references refid="structthread_14ce0e0e5856efc85e111d2cb8748a0ee" compoundref="thread_8h" startline="41">thread::vm_dsize</references> <references refid="paging_8h_1a05f8d8947fb5bcec87fc6661f83243e" compoundref="paging_8c" startline="160" endline="241">vmm_remapPage</references> <references refid="paging_8h_11913e8607a69ecf446b18fa1cd36c9cc" compoundref="setpageattributes_8c" startline="41" endline="68">vmm_setPageAttributes</references> <references refid="vmm_8h_1976cf3919bf7c77c868021ec9374593b" compoundref="vmm__memory_8c" startline="186" endline="216">vmmFindFreePage</references> <references refid="structosInfo_12833c1fa4a221941b5d1141dfa5beefd" compoundref="sched_8h" startline="47">osInfo::vmStart</references> <references refid="ap-boot_8S_1f78b91f02427adef14bb8b28aa93baa5" compoundref="ap-boot_8S" startline="52">x1000</references> <referencedby refid="exec_8c_1219681612352232186a0f568457d851d" compoundref="exec_8c" startline="334" endline="546">sysExec</referencedby> </memberdef> <memberdef kind="function" id="exec_8c_1219681612352232186a0f568457d851d" 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="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" line="334" bodyfile="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c" bodystart="334" bodyend="546"/> <references refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" compoundref="sched_8c" startline="51">_current</references> <references refid="assert_8h_1d6d5aaa966ca7424f7cb9bd01f2c838b" compoundref="assert_8h" startline="64">assert</references> <references refid="structi386__frame_1dcf6812a951acee52fce378a3c935b1f" compoundref="tss_8h" startline="93">i386_frame::ebp</references> <references refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" compoundref="elf_8h" startline="102">elfHeader::eEntry</references> <references refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" compoundref="elf_8h" startline="98">elfHeader::eIdent</references> <references refid="structi386__frame_1ef87f1d1d6f1ad030c95773e7eedfa16" compoundref="tss_8h" startline="103">i386_frame::eip</references> <references refid="endtask_8h_1152c1859ada097cc21071f471bfa2e67" compoundref="endtask_8c" startline="46" endline="67">endTask</references> <references refid="structelfHeader_14635401868104caa04fcb5bb60840df6" compoundref="elf_8h" startline="108">elfHeader::ePhnum</references> <references refid="structelfHeader_1aff1ff2cb64932f1e1a1f6cf3b881787" compoundref="elf_8h" startline="103">elfHeader::ePhoff</references> <references refid="structelfHeader_1a5b9594ecad96ed7448dbcf95da7895f" compoundref="elf_8h" startline="110">elfHeader::eShnum</references> <references refid="structelfHeader_13d8c518903e5e4db018a336edb6ef204" compoundref="elf_8h" startline="104">elfHeader::eShoff</references> <references refid="structtssStruct_11017372aed82d7305586c330fa222b3b" compoundref="tss_8h" startline="38">tssStruct::esp0</references> <references refid="structelfHeader_134e52f945d79cca21dc50a8aef79f9e8" compoundref="elf_8h" startline="99">elfHeader::eType</references> <references refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" compoundref="file_8c" startline="398" endline="425">fclose</references> <references refid="file_8h_1d6a41ac88a7d46d574e8a675fdde136c" compoundref="file_8c" startline="274" endline="389">fopen</references> <references refid="file_8h_13b06878a03209e88c008c77234b89359" compoundref="file_8c" startline="178" endline="198">fread</references> <references refid="file_8h_180528d8335cd52755f5d6a92e4f08391" compoundref="file_8c" startline="208" endline="211">fseek</references> <references refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" compoundref="sched_8h" startline="55">taskStruct::id</references> <references refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" compoundref="sched_8h" startline="61">taskStruct::imageFd</references> <references refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" compoundref="kpanic_8h" startline="33">K_PANIC</references> <references refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" compoundref="kmalloc_8c" startline="351" endline="391">kfree</references> <references refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" compoundref="kmalloc_8c" startline="247" endline="339">kmalloc</references> <references refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" compoundref="kpanic_8c" startline="42" endline="60">kpanic</references> <references refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" compoundref="kprintf_8c" startline="38" endline="49">kprintf</references> <references refid="ld_8h_1b0622e93915d1824df770950e425875f" compoundref="ld_8c" startline="42" endline="176">ldEnable</references> <references refid="lib_2string_8h_1ce4b911463887af5e748326323e99a23" compoundref="memset_8c" startline="37" endline="80">memset</references> <references refid="structtaskStruct_10933c70230d4ac8bc9953640c979f8d7" compoundref="sched_8h" startline="60">taskStruct::oInfo</references> <references refid="paging_8h_1f0fff7a38cd2c7a32d580787423b94ea" compoundref="paging_8h" startline="52">PAGE_DEFAULT</references> <references refid="paging_8h_1122dfc414a40e260fd35dbe9743db26f" compoundref="paging_8h" startline="49">PAGE_PRESENT</references> <references refid="paging_8h_1850d80ca2291d26b40dc6b25c419f81a" compoundref="paging_8h" startline="55">PAGE_SHIFT</references> <references refid="paging_8h_17d467c1d283fdfa1f2081ba1e0d01b6e" compoundref="paging_8h" startline="56">PAGE_SIZE</references> <references refid="paging_8h_12d0253527ea5080d6befe0ee3bde473f" compoundref="paging_8h" startline="51">PAGE_USER</references> <references refid="structfileDescriptorStruct_111626b5d99a5da968f43bc37d2591c5c" compoundref="file_8h" startline="60">fileDescriptorStruct::perms</references> <references refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" compoundref="elf_8h" startline="120">elfProgramHeader::phMemsz</references> <references refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" compoundref="elf_8h" startline="117">elfProgramHeader::phVaddr</references> <references refid="elf_8h_12121a2f01c51e8462bfd4d47725649d8" compoundref="elf_8h" startline="81">PT_DYNAMIC</references> <references refid="elf_8h_1bcd3aa15bc567949c1ab6b1abc137710" compoundref="elf_8h" startline="82">PT_INTERP</references> <references refid="elf_8h_184d7768fd6c6ece599d297090900cf92" compoundref="elf_8h" startline="80">PT_LOAD</references> <references refid="paging_8h_12702263fcf2b3b026cb26c6d895cb0ee" compoundref="paging_8h" startline="60">round_page</references> <references refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" compoundref="exec_8c" startline="42">STACK_ADDR</references> <references refid="strcpy_8S_19132520cc79236b654666f4ddc1b516c" compoundref="strcpy_8S" startline="3">strcpy</references> <references refid="strlen_8S_10bcafbeba7f59f157715cc462036b8d3" compoundref="strlen_8S" startline="4">strlen</references> <references refid="exec_8h_1094c23346b6d226a03866a54b755ed64" compoundref="exec_8c" startline="552" endline="716">sys_exec</references> <references refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" compoundref="sched_8h" startline="67">taskStruct::td</references> <references refid="paging_8h_1bd636a9b61ad98f4fc23b1f4a9210d78" compoundref="paging_8h" startline="59">trunc_page</references> <references refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" compoundref="sched_8h" startline="58">taskStruct::tss</references> <references refid="structi386__frame_1bbfc7b0ada36bd69608adfa39f5fc133" compoundref="tss_8h" startline="106">i386_frame::user_esp</references> <references refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" compoundref="thread_8h" startline="40">thread::vm_daddr</references> <references refid="structthread_14ce0e0e5856efc85e111d2cb8748a0ee" compoundref="thread_8h" startline="41">thread::vm_dsize</references> <references refid="paging_8h_159a518704bf2f0b56603476bcb1eebbf" compoundref="paging_8h" startline="38">VM_TASK</references> <references refid="paging_8c_10444c8635648fabdbd6e702137aa1723" compoundref="paging_8c" startline="522" endline="559">vmm_cleanVirtualSpace</references> <references refid="paging_8h_1a05f8d8947fb5bcec87fc6661f83243e" compoundref="paging_8c" startline="160" endline="241">vmm_remapPage</references> <references refid="paging_8h_11913e8607a69ecf446b18fa1cd36c9cc" compoundref="setpageattributes_8c" startline="41" endline="68">vmm_setPageAttributes</references> <references refid="vmm_8h_1976cf3919bf7c77c868021ec9374593b" compoundref="vmm__memory_8c" startline="186" endline="216">vmmFindFreePage</references> <references refid="paging_8h_14b324672c4b25064eb8db1e3419337b1" compoundref="getfreevirtualpage_8c" startline="47" endline="159">vmmGetFreeVirtualPage</references> <references refid="structosInfo_12833c1fa4a221941b5d1141dfa5beefd" compoundref="sched_8h" startline="47">osInfo::vmStart</references> <references refid="ap-boot_8S_1f78b91f02427adef14bb8b28aa93baa5" compoundref="ap-boot_8S" startline="52">x1000</references> </memberdef> </sectiondef> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <programlisting> <codeline lineno="1"><highlight class="comment">/*****************************************************************************************</highlight></codeline> <codeline lineno="2"><highlight class="comment"><sp/>Copyright<sp/>(c)<sp/>2002-2004<sp/>The<sp/>UbixOS<sp/>Project</highlight></codeline> <codeline lineno="3"><highlight class="comment"><sp/>All<sp/>rights<sp/>reserved.</highlight></codeline> <codeline lineno="4"><highlight class="comment"></highlight></codeline> <codeline lineno="5"><highlight class="comment"><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</highlight></codeline> <codeline lineno="6"><highlight class="comment"><sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline> <codeline lineno="7"><highlight class="comment"></highlight></codeline> <codeline lineno="8"><highlight class="comment"><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="9"><highlight class="comment"><sp/>conditions,<sp/>the<sp/>following<sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors.<sp/><sp/>Redistributions<sp/>in<sp/>binary</highlight></codeline> <codeline lineno="10"><highlight class="comment"><sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,<sp/>this<sp/>list<sp/>of<sp/>conditions,<sp/>the<sp/>following</highlight></codeline> <codeline lineno="11"><highlight class="comment"><sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors<sp/>in<sp/>the<sp/>documentation<sp/>and/or<sp/>other<sp/>materials<sp/>provided</highlight></codeline> <codeline lineno="12"><highlight class="comment"><sp/>with<sp/>the<sp/>distribution.<sp/>Neither<sp/>the<sp/>name<sp/>of<sp/>the<sp/>UbixOS<sp/>Project<sp/>nor<sp/>the<sp/>names<sp/>of<sp/>its</highlight></codeline> <codeline lineno="13"><highlight class="comment"><sp/>contributors<sp/>may<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products<sp/>derived<sp/>from<sp/>this<sp/>software</highlight></codeline> <codeline lineno="14"><highlight class="comment"><sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.</highlight></codeline> <codeline lineno="15"><highlight class="comment"></highlight></codeline> <codeline lineno="16"><highlight class="comment"><sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>COPYRIGHT<sp/>HOLDERS<sp/>AND<sp/>CONTRIBUTORS<sp/>"AS<sp/>IS"<sp/>AND<sp/>ANY</highlight></codeline> <codeline lineno="17"><highlight class="comment"><sp/>EXPRESS<sp/>OR<sp/>IMPLIED<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF</highlight></codeline> <codeline lineno="18"><highlight class="comment"><sp/>MERCHANTABILITY<sp/>AND<sp/>F</highlight></codeline> <codeline lineno="19"><highlight class="comment">ITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL</highlight></codeline> <codeline lineno="20"><highlight class="comment"><sp/>THE<sp/>COPYRIGHT<sp/>OWNER<sp/>OR<sp/>CONTRIBUTORS<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,</highlight></codeline> <codeline lineno="21"><highlight class="comment"><sp/>SPECIAL,<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT</highlight></codeline> <codeline lineno="22"><highlight class="comment"><sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS<sp/>INTERRUPTION)</highlight></codeline> <codeline lineno="23"><highlight class="comment"><sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR</highlight></codeline> <codeline lineno="24"><highlight class="comment"><sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS</highlight></codeline> <codeline lineno="25"><highlight class="comment"><sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline> <codeline lineno="26"><highlight class="comment"></highlight></codeline> <codeline lineno="27"><highlight class="comment"><sp/>$Id: exec_8c.xml 88 2016-01-12 00:11:29Z reddawg $</highlight></codeline> <codeline lineno="28"><highlight class="comment"></highlight></codeline> <codeline lineno="29"><highlight class="comment">*****************************************************************************************/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="30"><highlight class="normal"></highlight></codeline> <codeline lineno="31"><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="32"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="elf_8h" kindref="compound">ubixos/elf.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="33"><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="34"><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="35"><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="36"><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="37"><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="38"><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="39"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="lib_2string_8h" kindref="compound">lib/string.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="40"><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="41"><highlight class="normal"></highlight></codeline> <codeline lineno="42" refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>STACK_ADDR<sp/>0xC800000</highlight></codeline> <codeline lineno="43"><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="44"><highlight class="normal"></highlight><highlight class="comment">/*****************************************************************************************</highlight></codeline> <codeline lineno="45"><highlight class="comment"></highlight></codeline> <codeline lineno="46"><highlight class="comment"><sp/>Function:<sp/><sp/><sp/>execThread(void<sp/>(*)(void),int,char<sp/>*);</highlight></codeline> <codeline lineno="47"><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="48"><highlight class="comment"></highlight></codeline> <codeline lineno="49"><highlight class="comment"><sp/>Notes:</highlight></codeline> <codeline lineno="50"><highlight class="comment"><sp/></highlight></codeline> <codeline lineno="51"><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="52"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>so<sp/>do<sp/>not<sp/>use<sp/>out<sp/>side<sp/>of<sp/>kernel<sp/>space</highlight></codeline> <codeline lineno="53"><highlight class="comment"></highlight></codeline> <codeline lineno="54"><highlight class="comment">*****************************************************************************************/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="55" refid="exec_8c_14b86d28d8fd56197042aef174de2fd58" refkind="member"><highlight class="normal"><ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/><ref refid="exec_8h_1e9945e606ad208cb00dc9166d06452b4" kindref="member">execThread</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>(*<sp/>tproc)(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">),<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/>stack,</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*arg)<sp/>{</highlight></codeline> <codeline lineno="56"><highlight class="normal"><sp/><sp/><ref refid="structtaskStruct" kindref="compound">kTask_t</ref><sp/>*<sp/>newProcess<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="57"><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="58"><highlight class="normal"><sp/><sp/>newProcess<sp/>=<sp/><ref refid="sched_8h_192458df2063761371869cdfe0c9b4ee3" kindref="member">schedNewTask</ref>();</highlight></codeline> <codeline lineno="59"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1d6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(newProcess);<sp/></highlight></codeline> <codeline lineno="60"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(stack<sp/><<sp/>0x100000)</highlight></codeline> <codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" 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">,stack);</highlight></codeline> <codeline lineno="62"><highlight class="normal"></highlight></codeline> <codeline lineno="63"><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="64"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1fecbe8ea2cfebfb4d1a0aa7b6ebcac2c" kindref="member">back_link</ref><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="65"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_11017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="66"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_126d03018de8c122451661bfe9d030541" kindref="member">ss0</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="67"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1d5ef8867200562fd8262f70312beff4d" kindref="member">esp1</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="68"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_16abf05d9a8f6356860a5606ffbadc989" kindref="member">ss1</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="69"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_160c88f3cd3f2110cb24be62444f42cfb" kindref="member">esp2</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="70"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_15a79ace5652b01cc25fc5ba7ff45bfa8" kindref="member">ss2</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="71"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_18d312ed3dd0ea7a0f801c08a8cc4afd0" kindref="member">cr3</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>(</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/>int)<ref refid="paging_8h_14e81de2626825c90dc6bb3cd7c8b344c" kindref="member">kernelPageDirectory</ref>;</highlight></codeline> <codeline lineno="72"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_13e758f2138799d63fc803f7e4db4f5b4" kindref="member">eip</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>(</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/>int)tproc;</highlight></codeline> <codeline lineno="73"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a85f1fbaf622e0c6a39963da27de0194" kindref="member">eflags</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x206;</highlight></codeline> <codeline lineno="74"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_185412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>stack;</highlight></codeline> <codeline lineno="75"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1c2d32620149e07c40ee87696ef2509c2" kindref="member">ebp</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>stack;</highlight></codeline> <codeline lineno="76"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_18beab5808aad776957d4544f6b139d4e" kindref="member">esi</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="77"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a52b515706cd37e166c8eba348d5e68b" kindref="member">edi</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="78"><highlight class="normal"></highlight></codeline> <codeline lineno="79"><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="80"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="81"><highlight class="comment"><sp/><sp/>newProcess->tss.es<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="82"><highlight class="comment"><sp/><sp/>newProcess->tss.cs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x28+3;</highlight></codeline> <codeline lineno="83"><highlight class="comment"><sp/><sp/>newProcess->tss.ss<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="84"><highlight class="comment"><sp/><sp/>newProcess->tss.ds<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="85"><highlight class="comment"><sp/><sp/>newProcess->tss.fs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="86"><highlight class="comment"><sp/><sp/>newProcess->tss.gs<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x30+3;</highlight></codeline> <codeline lineno="87"><highlight class="comment"><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="88"><highlight class="normal"></highlight></codeline> <codeline lineno="89"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1cd97dd6f6eabd83c0b819b6058b7041d" kindref="member">es</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="90"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_16d9085ec5af0fa1fe1de7015ad99c9e3" kindref="member">cs</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x08;</highlight></codeline> <codeline lineno="91"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1340a29782d3306ba84176c543725d70a" kindref="member">ss</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="92"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_101ee01c7f45c9b9ee2ad8338c21e6d33" kindref="member">ds</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="93"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_18114a585123181ec835f8db3e029d390" kindref="member">fs</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="94"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_18dfa44423504293405785371d0e7b076" kindref="member">gs</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="95"><highlight class="normal"></highlight></codeline> <codeline lineno="96"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1d7b6a367e1c2a38e1ee6c8e5dad955f7" kindref="member">ldt</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x18;</highlight></codeline> <codeline lineno="97"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_152ac0b54c6b2c71450c62d7fc911f2e2" kindref="member">trace_bitmap</ref><sp/>=<sp/>0x0000;</highlight></codeline> <codeline lineno="98"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1611a0a044f99f092ace469ce2381bb33" kindref="member">io_map</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x8000;</highlight></codeline> <codeline lineno="99"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_10933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_12833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/><sp/><sp/><sp/>=<sp/>0x6400000;</highlight></codeline> <codeline lineno="100"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="101"><highlight class="normal"><sp/><sp/>newProcess-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="102"><highlight class="normal"></highlight></codeline> <codeline lineno="103"><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="104"><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="105"><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="106"><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="107"><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="108"><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="109"><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="110"><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="111"><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="112"><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="113"><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="114"><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="115"><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="116"><highlight class="normal"><sp/><sp/><sp/><sp/>:</highlight></codeline> <codeline lineno="117"><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_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_185412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref>)</highlight></codeline> <codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/>);</highlight></codeline> <codeline lineno="119"><highlight class="normal"></highlight></codeline> <codeline lineno="120"><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="121"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_151101e12c9236ea1286477695c110482" kindref="member">sched_setStatus</ref>(newProcess-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<ref refid="sched_8h_13fb333b67375561d327e9b5a8ffa03b96564f2f3e15be06b670547bbcaaf0798" kindref="member">READY</ref>);</highlight></codeline> <codeline lineno="122"><highlight class="normal"></highlight></codeline> <codeline lineno="123"><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="124"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">((<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref>)newProcess);</highlight></codeline> <codeline lineno="125"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="126"><highlight class="normal"></highlight></codeline> <codeline lineno="127"><highlight class="normal"></highlight><highlight class="comment">/*****************************************************************************************</highlight></codeline> <codeline lineno="128"><highlight class="comment"></highlight></codeline> <codeline lineno="129"><highlight class="comment"><sp/>Function:<sp/>void<sp/>execFile(char<sp/>*file);</highlight></codeline> <codeline lineno="130"><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="131"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Having<sp/>To<sp/>Fork</highlight></codeline> <codeline lineno="132"><highlight class="comment"><sp/>Notes:</highlight></codeline> <codeline lineno="133"><highlight class="comment"></highlight></codeline> <codeline lineno="134"><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="135"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><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="136"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><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="137"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>The<sp/>Program<sp/>Exits</highlight></codeline> <codeline lineno="138"><highlight class="comment"></highlight></codeline> <codeline lineno="139"><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="140"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>The<sp/>Freshly<sp/>Allocated<sp/>Pages<sp/>With<sp/>The<sp/>Correct<sp/>Permissions</highlight></codeline> <codeline lineno="141"><highlight class="comment"></highlight></codeline> <codeline lineno="142"><highlight class="comment">*****************************************************************************************/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="143" refid="exec_8c_1f80d4412d42ed1b5bf9a1b9774230f33" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="exec_8h_1f80d4412d42ed1b5bf9a1b9774230f33" kindref="member">execFile</ref>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="structfile" kindref="compound">file</ref>,</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>argc,</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**argv,</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>console)<sp/>{</highlight></codeline> <codeline lineno="144"><highlight class="normal"></highlight></codeline> <codeline lineno="145"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="146"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="147"><highlight class="normal"><sp/><sp/><ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref><sp/>*tmp<sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="148"><highlight class="normal"></highlight></codeline> <codeline lineno="149"><highlight class="normal"><sp/><sp/><ref refid="structfileDescriptorStruct" kindref="compound">fileDescriptor</ref><sp/><sp/><sp/>*tmpFd<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="150"><highlight class="normal"><sp/><sp/><ref refid="structelfHeader" kindref="compound">elfHeader</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*binaryHeader<sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="151"><highlight class="normal"><sp/><sp/><ref refid="structelfProgramHeader" kindref="compound">elfProgramHeader</ref><sp/>*programHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="152"><highlight class="normal"></highlight></codeline> <codeline lineno="153"><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="154"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref><sp/>=<sp/><ref refid="sched_8h_192458df2063761371869cdfe0c9b4ee3" kindref="member">schedNewTask</ref>();</highlight></codeline> <codeline lineno="155"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1d6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>);</highlight></codeline> <codeline lineno="156"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_13cf9920106f9b0d96dff475faf7aa0d6" kindref="member">gid</ref><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="157"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_11f9e02ebf24ff1cd76fab75e4c6b0fe1" kindref="member">uid</ref><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="158"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14563a310626d4f4ea885f4532356abb3" kindref="member">term</ref><sp/>=<sp/><ref refid="tty_8h_14f96ccac7e60296ef496008d8cbed0ff" kindref="member">tty_find</ref>(console);</highlight></codeline> <codeline lineno="159"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14563a310626d4f4ea885f4532356abb3" kindref="member">term</ref><sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Error:<sp/>invalid<sp/>console\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="161"><highlight class="normal"></highlight></codeline> <codeline lineno="162"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>tty<sp/>ownership<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="163"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14563a310626d4f4ea885f4532356abb3" kindref="member">term</ref>-><ref refid="structtty__termNode_1f8e2ad49f523044768d8e768bfe531e4" kindref="member">owner</ref><sp/>=<sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>;</highlight></codeline> <codeline lineno="164"><highlight class="normal"></highlight></codeline> <codeline lineno="165"><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="166"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_18d312ed3dd0ea7a0f801c08a8cc4afd0" kindref="member">cr3</ref><sp/>=<sp/>(<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref>)<ref refid="paging_8h_139ac9b6ea58fc8b6f129775642077c99" kindref="member">vmmCreateVirtualSpace</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>);</highlight></codeline> <codeline lineno="167"><highlight class="normal"></highlight></codeline> <codeline lineno="168"><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="169"><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="170"><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="171"><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="172"><highlight class="normal"><sp/><sp/><sp/><sp/>:<sp/>:<sp/></highlight><highlight class="stringliteral">"d"</highlight><highlight class="normal"><sp/>((<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/>*)(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_18d312ed3dd0ea7a0f801c08a8cc4afd0" kindref="member">cr3</ref>))</highlight></codeline> <codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/>);</highlight></codeline> <codeline lineno="174"><highlight class="normal"></highlight></codeline> <codeline lineno="175"><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="176"><highlight class="normal"><sp/><sp/>tmpFd<sp/>=<sp/><ref refid="file_8h_1d6a41ac88a7d46d574e8a675fdde136c" kindref="member">fopen</ref>(file,</highlight><highlight class="stringliteral">"r"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="177"><highlight class="normal"></highlight></codeline> <codeline lineno="178"><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="179"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmpFd<sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="181"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="182"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="184"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmpFd-><ref refid="structfileDescriptorStruct_111626b5d99a5da968f43bc37d2591c5c" kindref="member">perms</ref><sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="186"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="188"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="189"><highlight class="normal"></highlight></codeline> <codeline lineno="190"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>ELF<sp/>Header<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="191"><highlight class="normal"><sp/><sp/>binaryHeader<sp/>=<sp/>(<ref refid="structelfHeader" kindref="compound">elfHeader</ref><sp/>*)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structelfHeader" kindref="compound">elfHeader</ref>));</highlight></codeline> <codeline lineno="192"><highlight class="normal"></highlight></codeline> <codeline lineno="193"><highlight class="normal"></highlight></codeline> <codeline lineno="194"><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="195"><highlight class="normal"><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>(binaryHeader,</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfHeader),1,tmpFd);</highlight></codeline> <codeline lineno="196"><highlight class="normal"></highlight></codeline> <codeline lineno="197"><highlight class="normal"></highlight></codeline> <codeline lineno="198"><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="199"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader-><ref refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" kindref="member">eIdent</ref>[1]<sp/>!=<sp/></highlight><highlight class="charliteral">'E'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader-><ref refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" kindref="member">eIdent</ref>[2]<sp/>!=<sp/></highlight><highlight class="charliteral">'L'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader-><ref refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" kindref="member">eIdent</ref>[3]<sp/>!=<sp/></highlight><highlight class="charliteral">'F'</highlight><highlight class="normal">))<sp/>{</highlight></codeline> <codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="201"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="202"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="204"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="205"><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-><ref refid="structelfHeader_134e52f945d79cca21dc50a8aef79f9e8" kindref="member">eType</ref><sp/>!=<sp/>2)<sp/>{</highlight></codeline> <codeline lineno="206"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="207"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="210"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="211"><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-><ref refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" kindref="member">eEntry</ref><sp/>==<sp/>0x300000)<sp/>{</highlight></codeline> <codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="213"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="214"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="217"><highlight class="normal"></highlight></codeline> <codeline lineno="218"><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="219"><highlight class="normal"><sp/><sp/>programHeader<sp/>=<sp/>(<ref refid="structelfProgramHeader" kindref="compound">elfProgramHeader</ref><sp/>*)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structelfProgramHeader" kindref="compound">elfProgramHeader</ref>)*binaryHeader-><ref refid="structelfHeader_14635401868104caa04fcb5bb60840df6" kindref="member">ePhnum</ref>);</highlight></codeline> <codeline lineno="220"><highlight class="normal"><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(tmpFd,binaryHeader-><ref refid="structelfHeader_1aff1ff2cb64932f1e1a1f6cf3b881787" kindref="member">ePhoff</ref>,0);</highlight></codeline> <codeline lineno="221"><highlight class="normal"></highlight></codeline> <codeline lineno="222"><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="223"><highlight class="normal"><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>(programHeader,(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfProgramHeader)*binaryHeader-><ref refid="structelfHeader_14635401868104caa04fcb5bb60840df6" kindref="member">ePhnum</ref>),1,tmpFd);</highlight></codeline> <codeline lineno="224"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf(">d<");</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="225"><highlight class="normal"></highlight></codeline> <codeline lineno="226"><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="227"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i<binaryHeader-><ref refid="structelfHeader_14635401868104caa04fcb5bb60840df6" kindref="member">ePhnum</ref>;i++)<sp/>{</highlight></codeline> <codeline lineno="228"><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="229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="230"><highlight class="comment"><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="231"><highlight class="comment"><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="232"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>0x0;x<sp/><<sp/>(programHeader[i].<ref refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" kindref="member">phMemsz</ref>);x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="234"><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="235"><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_1a05f8d8947fb5bcec87fc6661f83243e" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1976cf3919bf7c77c868021ec9374593b" kindref="member">vmmFindFreePage</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),((programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref><sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),<ref refid="paging_8h_1f0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>)<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">"Remap<sp/>Page<sp/>Failed"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="237"><highlight class="normal"></highlight></codeline> <codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lib_2string_8h_1ce4b911463887af5e748326323e99a23" kindref="member">memset</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),0x0,0<ref refid="ap-boot_8S_1f78b91f02427adef14bb8b28aa93baa5" kindref="member">x1000</ref>);</highlight></codeline> <codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_10933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_12833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>0x80000000;</highlight></codeline> <codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)(programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000);</highlight></codeline> <codeline lineno="242"><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="243"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(tmpFd,programHeader[i].phOffset,0);</highlight></codeline> <codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd);</highlight></codeline> <codeline lineno="245"><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="246"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"pH:<sp/>[0x%X]\n"</highlight><highlight class="normal">,programHeader[i].phMemsz);</highlight></codeline> <codeline lineno="247"><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;x<sp/><<sp/>(programHeader[i].<ref refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" kindref="member">phMemsz</ref>);x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="248"><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_11913e8607a69ecf446b18fa1cd36c9cc" kindref="member">vmm_setPageAttributes</ref>((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x,<ref refid="paging_8h_1122dfc414a40e260fd35dbe9743db26f" kindref="member">PAGE_PRESENT</ref><sp/>|<sp/><ref refid="paging_8h_12d0253527ea5080d6befe0ee3bde473f" kindref="member">PAGE_USER</ref>))<sp/>!=<sp/>0x0)</highlight></codeline> <codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" 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">,__FILE__,__LINE__);</highlight></codeline> <codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="254"><highlight class="normal"></highlight></codeline> <codeline lineno="255"><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="256"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_10933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_12833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>0x80000000;</highlight></codeline> <codeline lineno="257"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)(programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000);</highlight></codeline> <codeline lineno="258"><highlight class="normal"></highlight></codeline> <codeline lineno="259"><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="260"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(x<sp/>=<sp/>1;x<sp/><<sp/>100;x++)<sp/>{</highlight></codeline> <codeline lineno="261"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="paging_8h_1a05f8d8947fb5bcec87fc6661f83243e" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1976cf3919bf7c77c868021ec9374593b" kindref="member">vmmFindFreePage</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),<ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/>(x<sp/>*<sp/>0<ref refid="ap-boot_8S_1f78b91f02427adef14bb8b28aa93baa5" kindref="member">x1000</ref>),<ref refid="paging_8h_1f0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref><sp/>|<sp/><ref refid="paging_8h_11532db17068ba8d409b8ffe066414af2" kindref="member">PAGE_STACK</ref>);</highlight></codeline> <codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="263"><highlight class="normal"></highlight></codeline> <codeline lineno="264"><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="265"><highlight class="normal"><sp/><sp/><ref refid="paging_8h_1a05f8d8947fb5bcec87fc6661f83243e" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1976cf3919bf7c77c868021ec9374593b" kindref="member">vmmFindFreePage</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),0x5BC000,<ref refid="paging_8h_18b838cda4f0bc79ab8d07eb19dd35420" kindref="member">KERNEL_PAGE_DEFAULT</ref><sp/>|<sp/><ref refid="paging_8h_11532db17068ba8d409b8ffe066414af2" kindref="member">PAGE_STACK</ref>);</highlight></codeline> <codeline lineno="266"><highlight class="normal"><sp/><sp/><ref refid="paging_8h_1a05f8d8947fb5bcec87fc6661f83243e" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1976cf3919bf7c77c868021ec9374593b" kindref="member">vmmFindFreePage</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),0x5BB000,<ref refid="paging_8h_18b838cda4f0bc79ab8d07eb19dd35420" kindref="member">KERNEL_PAGE_DEFAULT</ref><sp/>|<sp/><ref refid="paging_8h_11532db17068ba8d409b8ffe066414af2" kindref="member">PAGE_STACK</ref>);</highlight></codeline> <codeline lineno="267"><highlight class="normal"></highlight></codeline> <codeline lineno="268"><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="269"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1fecbe8ea2cfebfb4d1a0aa7b6ebcac2c" kindref="member">back_link</ref><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="270"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_11017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x5BC000;</highlight></codeline> <codeline lineno="271"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_126d03018de8c122451661bfe9d030541" kindref="member">ss0</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x10;</highlight></codeline> <codeline lineno="272"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1d5ef8867200562fd8262f70312beff4d" kindref="member">esp1</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="273"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_16abf05d9a8f6356860a5606ffbadc989" kindref="member">ss1</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="274"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_160c88f3cd3f2110cb24be62444f42cfb" kindref="member">esp2</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="275"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_15a79ace5652b01cc25fc5ba7ff45bfa8" kindref="member">ss2</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="276"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_13e758f2138799d63fc803f7e4db4f5b4" kindref="member">eip</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>(long)binaryHeader-><ref refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" kindref="member">eEntry</ref>;</highlight></codeline> <codeline lineno="277"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a85f1fbaf622e0c6a39963da27de0194" kindref="member">eflags</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x206;</highlight></codeline> <codeline lineno="278"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_185412a87dbdb8eda612c77bce8055a2c" kindref="member">esp</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/><ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/>12;</highlight></codeline> <codeline lineno="279"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1c2d32620149e07c40ee87696ef2509c2" kindref="member">ebp</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/><ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>;</highlight></codeline> <codeline lineno="280"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_18beab5808aad776957d4544f6b139d4e" kindref="member">esi</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="281"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1a52b515706cd37e166c8eba348d5e68b" kindref="member">edi</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="282"><highlight class="normal"></highlight></codeline> <codeline lineno="283"><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="284"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1cd97dd6f6eabd83c0b819b6058b7041d" kindref="member">es</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0<ref refid="ap-boot_8S_1c2a218176530ced267bbcc8042da1000" kindref="member">x30</ref>+3;</highlight></codeline> <codeline lineno="285"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_16d9085ec5af0fa1fe1de7015ad99c9e3" kindref="member">cs</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x28+3;</highlight></codeline> <codeline lineno="286"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1340a29782d3306ba84176c543725d70a" kindref="member">ss</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0<ref refid="ap-boot_8S_1c2a218176530ced267bbcc8042da1000" kindref="member">x30</ref>+3;</highlight></codeline> <codeline lineno="287"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_101ee01c7f45c9b9ee2ad8338c21e6d33" kindref="member">ds</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0<ref refid="ap-boot_8S_1c2a218176530ced267bbcc8042da1000" kindref="member">x30</ref>+3;</highlight></codeline> <codeline lineno="288"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_18114a585123181ec835f8db3e029d390" kindref="member">fs</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0<ref refid="ap-boot_8S_1c2a218176530ced267bbcc8042da1000" kindref="member">x30</ref>+3;</highlight></codeline> <codeline lineno="289"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_18dfa44423504293405785371d0e7b076" kindref="member">gs</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0<ref refid="ap-boot_8S_1c2a218176530ced267bbcc8042da1000" kindref="member">x30</ref>+3;</highlight></codeline> <codeline lineno="290"><highlight class="normal"></highlight></codeline> <codeline lineno="291"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1d7b6a367e1c2a38e1ee6c8e5dad955f7" kindref="member">ldt</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0<ref refid="start_8S_10c48af311abb843beb7bb6c5e295d1db" kindref="member">x18</ref>;</highlight></codeline> <codeline lineno="292"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_152ac0b54c6b2c71450c62d7fc911f2e2" kindref="member">trace_bitmap</ref><sp/>=<sp/>0x0000;</highlight></codeline> <codeline lineno="293"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_1611a0a044f99f092ace469ce2381bb33" kindref="member">io_map</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x8000;</highlight></codeline> <codeline lineno="294"><highlight class="normal"></highlight></codeline> <codeline lineno="295"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_151101e12c9236ea1286477695c110482" kindref="member">sched_setStatus</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,<ref refid="sched_8h_13fb333b67375561d327e9b5a8ffa03b96564f2f3e15be06b670547bbcaaf0798" kindref="member">READY</ref>);</highlight></codeline> <codeline lineno="296"><highlight class="normal"></highlight></codeline> <codeline lineno="297"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="298"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(programHeader);</highlight></codeline> <codeline lineno="299"><highlight class="normal"><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="300"><highlight class="normal"></highlight></codeline> <codeline lineno="301"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>(<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/>*)<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_11017372aed82d7305586c330fa222b3b" kindref="member">esp0</ref><sp/>-<sp/>5;</highlight></codeline> <codeline lineno="302"><highlight class="normal"><sp/><sp/>tmp[0]<sp/>=<sp/>binaryHeader-><ref refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" kindref="member">eEntry</ref>;</highlight></codeline> <codeline lineno="303"><highlight class="normal"><sp/><sp/>tmp[3]<sp/>=<sp/><ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/>12;</highlight></codeline> <codeline lineno="304"><highlight class="normal"></highlight></codeline> <codeline lineno="305"><highlight class="normal"><sp/><sp/>tmp<sp/>=<sp/>(<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/>*)<ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/>2;</highlight></codeline> <codeline lineno="306"><highlight class="normal"></highlight></codeline> <codeline lineno="307"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref><sp/>><sp/>4)</highlight></codeline> <codeline lineno="308"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"argv[0]:<sp/>[%s]\n"</highlight><highlight class="normal">,argv[0]);</highlight></codeline> <codeline lineno="309"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"argv:<sp/>[0x%X]\n"</highlight><highlight class="normal">,argv);</highlight></codeline> <codeline lineno="310"><highlight class="normal"><sp/><sp/>tmp[0]<sp/>=<sp/>(<ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref>)argv;</highlight></codeline> <codeline lineno="311"><highlight class="normal"><sp/><sp/>tmp[1]<sp/>=<sp/>(<ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref>)argv;</highlight></codeline> <codeline lineno="312"><highlight class="normal"></highlight></codeline> <codeline lineno="313"><highlight class="normal"></highlight></codeline> <codeline lineno="314"><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="315"><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="316"><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="317"><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="318"><highlight class="normal"><sp/><sp/><sp/><sp/>:<sp/>:<sp/></highlight><highlight class="stringliteral">"d"</highlight><highlight class="normal"><sp/>((<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/>*)(<ref refid="paging_8h_14e81de2626825c90dc6bb3cd7c8b344c" kindref="member">kernelPageDirectory</ref>))</highlight></codeline> <codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/>);</highlight></codeline> <codeline lineno="320"><highlight class="normal"></highlight></codeline> <codeline lineno="321"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Finally<sp/>Return<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="322"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="323"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="324"><highlight class="normal"></highlight></codeline> <codeline lineno="325"><highlight class="normal"></highlight><highlight class="comment">/*****************************************************************************************</highlight></codeline> <codeline lineno="326"><highlight class="comment"></highlight></codeline> <codeline lineno="327"><highlight class="comment"><sp/>Function:<sp/>void<sp/>sysExec();</highlight></codeline> <codeline lineno="328"><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="329"><highlight class="comment"></highlight></codeline> <codeline lineno="330"><highlight class="comment"><sp/>Notes:</highlight></codeline> <codeline lineno="331"><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="332"><highlight class="comment"></highlight></codeline> <codeline lineno="333"><highlight class="comment">*****************************************************************************************/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="334" refid="exec_8c_1219681612352232186a0f568457d851d" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="syscalls_8h_1067d373ad2682affb9b8b093b5e5c97a" kindref="member">sysExec</ref>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="structfile" kindref="compound">file</ref>,</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*ap)<sp/>{</highlight></codeline> <codeline lineno="335"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="336"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="337"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>argc<sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="338"><highlight class="normal"><sp/><sp/><ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/><sp/>*tmp<sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="339"><highlight class="normal"><sp/><sp/><ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/><sp/><sp/>ldAddr<sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="340"><highlight class="normal"><sp/><sp/><ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/><sp/><sp/>seg_size<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="341"><highlight class="normal"><sp/><sp/><ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/><sp/><sp/>seg_addr<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="342"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><sp/><sp/><sp/>*interp<sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="343"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><sp/><sp/>**argv<sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="344"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><sp/><sp/>**argvNew<sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="345"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><sp/><sp/><sp/>*args<sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="346"><highlight class="normal"></highlight></codeline> <codeline lineno="347"><highlight class="normal"><sp/><sp/><ref refid="structfileDescriptorStruct" kindref="compound">fileDescriptor</ref><sp/><sp/><sp/><sp/>*tmpFd<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="348"><highlight class="normal"><sp/><sp/><ref refid="structelfHeader" kindref="compound">elfHeader</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*binaryHeader<sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="349"><highlight class="normal"><sp/><sp/><ref refid="structelfProgramHeader" kindref="compound">elfProgramHeader</ref><sp/><sp/>*programHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="350"><highlight class="normal"><sp/><sp/><ref refid="structelfSectionHeader" kindref="compound">elfSectionHeader</ref><sp/><sp/>*sectionHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="351"><highlight class="normal"><sp/><sp/><ref refid="structelfDynamic" kindref="compound">elfDynamic</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*elfDynamicS<sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="352"><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/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="353"><highlight class="normal"></highlight></codeline> <codeline lineno="354"><highlight class="normal"></highlight></codeline> <codeline lineno="355"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref><sp/>><sp/>4)<sp/>{</highlight></codeline> <codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="exec_8h_1094c23346b6d226a03866a54b755ed64" kindref="member">sys_exec</ref>(file,ap);</highlight></codeline> <codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="358"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="359"><highlight class="normal"></highlight></codeline> <codeline lineno="360"><highlight class="normal"><sp/><sp/>tmpFd<sp/>=<sp/><ref refid="file_8h_1d6a41ac88a7d46d574e8a675fdde136c" kindref="member">fopen</ref>(file,</highlight><highlight class="stringliteral">"r"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="361"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref><sp/>=<sp/>tmpFd;</highlight></codeline> <codeline lineno="362"><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="363"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmpFd<sp/>==<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="364"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="366"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmpFd-><ref refid="structfileDescriptorStruct_111626b5d99a5da968f43bc37d2591c5c" kindref="member">perms</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline> <codeline lineno="367"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="368"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="371"><highlight class="normal"></highlight></codeline> <codeline lineno="372"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Load<sp/>ELF<sp/>Header<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="373"><highlight class="normal"></highlight></codeline> <codeline lineno="374"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader<sp/>=<sp/>(<ref refid="structelfHeader" kindref="compound">elfHeader</ref><sp/>*)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structelfHeader" kindref="compound">elfHeader</ref>)))<sp/>==<sp/>0x0)<sp/></highlight></codeline> <codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="endtask_8h_1152c1859ada097cc21071f471bfa2e67" kindref="member">endTask</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>);</highlight></codeline> <codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>(binaryHeader,</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfHeader),1,tmpFd);</highlight></codeline> <codeline lineno="377"><highlight class="normal"><sp/><sp/><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="378"><highlight class="normal"></highlight></codeline> <codeline lineno="379"><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="380"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader-><ref refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" kindref="member">eIdent</ref>[1]<sp/>!=<sp/></highlight><highlight class="charliteral">'E'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader-><ref refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" kindref="member">eIdent</ref>[2]<sp/>!=<sp/></highlight><highlight class="charliteral">'L'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader-><ref refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" kindref="member">eIdent</ref>[3]<sp/>!=<sp/></highlight><highlight class="charliteral">'F'</highlight><highlight class="normal">))<sp/>{</highlight></codeline> <codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="382"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="383"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="384"><highlight class="normal"></highlight></codeline> <codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="387"><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-><ref refid="structelfHeader_134e52f945d79cca21dc50a8aef79f9e8" kindref="member">eType</ref><sp/>!=<sp/>2)<sp/>{</highlight></codeline> <codeline lineno="388"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="389"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="390"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="393"><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-><ref refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" kindref="member">eEntry</ref><sp/>==<sp/>0x300000)<sp/>{</highlight></codeline> <codeline lineno="394"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" 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="395"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="396"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(tmpFd);</highlight></codeline> <codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="398"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="399"><highlight class="normal"></highlight></codeline> <codeline lineno="400"><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="401"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader<sp/>=<sp/>(<ref refid="structelfProgramHeader" kindref="compound">elfProgramHeader</ref><sp/>*)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structelfProgramHeader" kindref="compound">elfProgramHeader</ref>)*binaryHeader-><ref refid="structelfHeader_14635401868104caa04fcb5bb60840df6" kindref="member">ePhnum</ref>))<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="endtask_8h_1152c1859ada097cc21071f471bfa2e67" kindref="member">endTask</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>);</highlight></codeline> <codeline lineno="403"><highlight class="normal"></highlight></codeline> <codeline lineno="404"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1d6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(programHeader);</highlight></codeline> <codeline lineno="405"><highlight class="normal"><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(tmpFd,binaryHeader-><ref refid="structelfHeader_1aff1ff2cb64932f1e1a1f6cf3b881787" kindref="member">ePhoff</ref>,0);</highlight></codeline> <codeline lineno="406"><highlight class="normal"><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>(programHeader,(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfProgramHeader)*binaryHeader-><ref refid="structelfHeader_14635401868104caa04fcb5bb60840df6" kindref="member">ePhnum</ref>),1,tmpFd);</highlight></codeline> <codeline lineno="407"><highlight class="normal"></highlight></codeline> <codeline lineno="408"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((sectionHeader<sp/>=<sp/>(<ref refid="structelfSectionHeader" kindref="compound">elfSectionHeader</ref><sp/>*)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structelfSectionHeader" kindref="compound">elfSectionHeader</ref>)*binaryHeader-><ref refid="structelfHeader_1a5b9594ecad96ed7448dbcf95da7895f" kindref="member">eShnum</ref>))<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="409"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="endtask_8h_1152c1859ada097cc21071f471bfa2e67" kindref="member">endTask</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>);</highlight></codeline> <codeline lineno="410"><highlight class="normal"></highlight></codeline> <codeline lineno="411"><highlight class="normal"><sp/><sp/><ref refid="assert_8h_1d6d5aaa966ca7424f7cb9bd01f2c838b" kindref="member">assert</ref>(sectionHeader);</highlight></codeline> <codeline lineno="412"><highlight class="normal"><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(tmpFd,binaryHeader-><ref refid="structelfHeader_13d8c518903e5e4db018a336edb6ef204" kindref="member">eShoff</ref>,0);</highlight></codeline> <codeline lineno="413"><highlight class="normal"><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>(sectionHeader,</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfSectionHeader)*binaryHeader-><ref refid="structelfHeader_1a5b9594ecad96ed7448dbcf95da7895f" kindref="member">eShnum</ref>,1,tmpFd);</highlight></codeline> <codeline lineno="414"><highlight class="normal"></highlight></codeline> <codeline lineno="415"><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="416"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i<binaryHeader-><ref refid="structelfHeader_14635401868104caa04fcb5bb60840df6" kindref="member">ePhnum</ref>;i++)<sp/>{</highlight></codeline> <codeline lineno="417"><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="418"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf_8h_184d7768fd6c6ece599d297090900cf92" kindref="member">PT_LOAD</ref>:</highlight></codeline> <codeline lineno="419"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>seg_addr<sp/>=<sp/><ref refid="paging_8h_1bd636a9b61ad98f4fc23b1f4a9210d78" kindref="member">trunc_page</ref>(programHeader[i].phVaddr);</highlight></codeline> <codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>seg_size<sp/>=<sp/><ref refid="paging_8h_12702263fcf2b3b026cb26c6d895cb0ee" kindref="member">round_page</ref>(programHeader[i].phMemsz<sp/>+<sp/>programHeader[i].phVaddr<sp/>-<sp/>seg_addr);</highlight></codeline> <codeline lineno="421"><highlight class="normal"></highlight></codeline> <codeline lineno="422"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="423"><highlight class="comment"><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="424"><highlight class="comment"><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="425"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="426"><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;x<sp/><<sp/>(programHeader[i].<ref refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" kindref="member">phMemsz</ref>);x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="427"><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="428"><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_1a05f8d8947fb5bcec87fc6661f83243e" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1976cf3919bf7c77c868021ec9374593b" kindref="member">vmmFindFreePage</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),((programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref><sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),<ref refid="paging_8h_1f0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>)<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">"Error:<sp/>Remap<sp/>Page<sp/>Failed"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lib_2string_8h_1ce4b911463887af5e748326323e99a23" kindref="member">memset</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),0x0,0<ref refid="ap-boot_8S_1f78b91f02427adef14bb8b28aa93baa5" kindref="member">x1000</ref>);</highlight></codeline> <codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="432"><highlight class="normal"></highlight></codeline> <codeline lineno="433"><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="434"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(tmpFd,programHeader[i].phOffset,0);</highlight></codeline> <codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd);</highlight></codeline> <codeline lineno="436"><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="437"><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;x<sp/><<sp/>(programHeader[i].<ref refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" kindref="member">phMemsz</ref>);x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="438"><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_11913e8607a69ecf446b18fa1cd36c9cc" kindref="member">vmm_setPageAttributes</ref>((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x,<ref refid="paging_8h_1122dfc414a40e260fd35dbe9743db26f" kindref="member">PAGE_PRESENT</ref><sp/>|<sp/><ref refid="paging_8h_12d0253527ea5080d6befe0ee3bde473f" kindref="member">PAGE_USER</ref>))<sp/>!=<sp/>0x0)</highlight></codeline> <codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" 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">,__FILE__,__LINE__);</highlight></codeline> <codeline lineno="440"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="441"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="442"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"setting<sp/>daddr\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(binaryHeader-><ref refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" kindref="member">eEntry</ref><sp/>>=<sp/>programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref><sp/>&&<sp/>binaryHeader-><ref refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" kindref="member">eEntry</ref><sp/><<sp/>(programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref><sp/>+<sp/>programHeader[i].<ref refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" kindref="member">phMemsz</ref>))<sp/>{</highlight></codeline> <codeline lineno="444"><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="445"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="446"><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="447"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_14ce0e0e5856efc85e111d2cb8748a0ee" kindref="member">vm_dsize</ref><sp/>=<sp/>seg_size<sp/>>><sp/><ref refid="paging_8h_1850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline> <codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)seg_addr;</highlight></codeline> <codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="450"><highlight class="normal"></highlight></codeline> <codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_10933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_12833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>((programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref><sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>0xA900000);</highlight></codeline> <codeline lineno="452"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf_8h_12121a2f01c51e8462bfd4d47725649d8" kindref="member">PT_DYNAMIC</ref>:</highlight></codeline> <codeline lineno="454"><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="455"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>elfDynamicS<sp/>=<sp/>(<ref refid="structelfDynamic" kindref="compound">elfDynamic</ref><sp/>*)programHeader[i].phVaddr;</highlight></codeline> <codeline lineno="456"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(tmpFd,programHeader[i].phOffset,0);</highlight></codeline> <codeline lineno="457"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd);</highlight></codeline> <codeline lineno="458"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf_8h_1bcd3aa15bc567949c1ab6b1abc137710" kindref="member">PT_INTERP</ref>:</highlight></codeline> <codeline lineno="460"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>interp<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(programHeader[i].phFilesz);</highlight></codeline> <codeline lineno="461"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(tmpFd,programHeader[i].phOffset,0);</highlight></codeline> <codeline lineno="462"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)interp,programHeader[i].phFilesz,1,tmpFd);</highlight></codeline> <codeline lineno="463"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Interp:<sp/>[%s]\n"</highlight><highlight class="normal">,interp);</highlight></codeline> <codeline lineno="464"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ldAddr<sp/>=<sp/><ref refid="ld_8h_1b0622e93915d1824df770950e425875f" kindref="member">ldEnable</ref>();</highlight></codeline> <codeline lineno="465"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline> <codeline lineno="467"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="470"><highlight class="normal"></highlight></codeline> <codeline lineno="471"><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="472"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(elfDynamicS<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="473"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i<12;i++)<sp/>{</highlight></codeline> <codeline lineno="474"><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="475"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp<sp/>=<sp/>(<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref><sp/>*)elfDynamicS[i].dynPtr;</highlight></codeline> <codeline lineno="476"><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="477"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1db9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">"tmp:<sp/>NULL\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="478"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp[2]<sp/>=<sp/>(<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref>)ldAddr;</highlight></codeline> <codeline lineno="479"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp[1]<sp/>=<sp/>(<ref refid="types_8h_15847ea0262a5aa61eee48cbe95544a78" kindref="member">uInt32</ref>)tmpFd;</highlight></codeline> <codeline lineno="480"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="481"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="482"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="483"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/>else<sp/>{</highlight></codeline> <codeline lineno="484"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>kprintf("dyn_val:<sp/>%i",elfDynamicS[i].dynVal);</highlight></codeline> <codeline lineno="485"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="486"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="487"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="488"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="489"><highlight class="normal"></highlight></codeline> <codeline lineno="490"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_14ce0e0e5856efc85e111d2cb8748a0ee" kindref="member">vm_dsize</ref><sp/>=<sp/>seg_size<sp/>>><sp/><ref refid="paging_8h_1850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline> <codeline lineno="491"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)seg_addr;</highlight></codeline> <codeline lineno="492"><highlight class="normal"></highlight></codeline> <codeline lineno="493"><highlight class="normal"><sp/><sp/>argv<sp/>=<sp/>ap;</highlight></codeline> <codeline lineno="494"><highlight class="normal"></highlight></codeline> <codeline lineno="495"><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="496"><highlight class="normal"><sp/><sp/><sp/><sp/>argc<sp/>=<sp/>argv[0];</highlight></codeline> <codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/>args<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<ref refid="paging_8h_14b324672c4b25064eb8db1e3419337b1" kindref="member">vmmGetFreeVirtualPage</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,1,<ref refid="paging_8h_159a518704bf2f0b56603476bcb1eebbf" kindref="member">VM_TASK</ref>);</highlight></codeline> <codeline lineno="498"><highlight class="normal"><ref refid="lib_2string_8h_1ce4b911463887af5e748326323e99a23" kindref="member">memset</ref>(args,0x0,0<ref refid="ap-boot_8S_1f78b91f02427adef14bb8b28aa93baa5" kindref="member">x1000</ref>);</highlight></codeline> <codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/>x<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/>argvNew<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" 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="501"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0x0;i<sp/><<sp/>argc;i++)<sp/>{</highlight></codeline> <codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="strcpy_8S_19132520cc79236b654666f4ddc1b516c" kindref="member">strcpy</ref>(args<sp/>+<sp/>x,argv[i<sp/>+<sp/>1]);</highlight></codeline> <codeline lineno="503"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>argvNew[i]<sp/>=<sp/>args<sp/>+<sp/>x;</highlight></codeline> <codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x<sp/>+=<sp/><ref refid="strlen_8S_10bcafbeba7f59f157715cc462036b8d3" kindref="member">strlen</ref>(argv[i<sp/>+<sp/>1])<sp/>+<sp/>1;</highlight></codeline> <codeline lineno="505"><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="506"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//x++;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/>argv<sp/>=<sp/>argvNew;</highlight></codeline> <codeline lineno="509"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="510"><highlight class="normal"></highlight></codeline> <codeline lineno="512"><highlight class="normal"><sp/><sp/><ref refid="paging_8c_10444c8635648fabdbd6e702137aa1723" kindref="member">vmm_cleanVirtualSpace</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" kindref="member">vm_daddr</ref><sp/>+<sp/>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_14ce0e0e5856efc85e111d2cb8748a0ee" kindref="member">vm_dsize</ref><sp/><<<sp/><ref refid="paging_8h_17d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>));</highlight></codeline> <codeline lineno="513"><highlight class="normal"></highlight></codeline> <codeline lineno="514"><highlight class="normal"></highlight></codeline> <codeline lineno="516"><highlight class="normal"><sp/><sp/>iFrame<sp/>=<sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_11017372aed82d7305586c330fa222b3b" 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="517"><highlight class="normal"><sp/><sp/>iFrame-><ref refid="structi386__frame_1dcf6812a951acee52fce378a3c935b1f" kindref="member">ebp</ref><sp/>=<sp/><ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>;</highlight></codeline> <codeline lineno="518"><highlight class="normal"><sp/><sp/>iFrame-><ref refid="structi386__frame_1ef87f1d1d6f1ad030c95773e7eedfa16" kindref="member">eip</ref><sp/>=<sp/>binaryHeader-><ref refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" kindref="member">eEntry</ref>;</highlight></codeline> <codeline lineno="519"><highlight class="normal"><sp/><sp/>iFrame-><ref refid="structi386__frame_1bbfc7b0ada36bd69608adfa39f5fc133" kindref="member">user_esp</ref><sp/>=<sp/><ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref><sp/>-<sp/>12;</highlight></codeline> <codeline lineno="520"><highlight class="normal"></highlight></codeline> <codeline lineno="521"><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="522"><highlight class="normal"></highlight></codeline> <codeline lineno="523"><highlight class="normal"><sp/><sp/><sp/><sp/>iFrame-><ref refid="structi386__frame_1bbfc7b0ada36bd69608adfa39f5fc133" kindref="member">user_esp</ref><sp/>=<sp/>((<ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref>)<ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>)<sp/>-<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref>)<sp/>*<sp/>(argc<sp/>+<sp/>3));</highlight></codeline> <codeline lineno="524"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp<sp/>=<sp/>iFrame-><ref refid="structi386__frame_1bbfc7b0ada36bd69608adfa39f5fc133" kindref="member">user_esp</ref>;</highlight></codeline> <codeline lineno="525"><highlight class="normal"></highlight></codeline> <codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp[0]<sp/>=<sp/>argc;</highlight></codeline> <codeline lineno="528"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;i<sp/><<sp/>argc;i++)<sp/>{</highlight></codeline> <codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tmp[i<sp/>+<sp/>1]<sp/>=<sp/>argv[i];</highlight></codeline> <codeline lineno="530"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="531"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp[argc<sp/>+<sp/>1]<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="532"><highlight class="normal"><sp/><sp/><sp/><sp/>tmp[argc<sp/>+<sp/>2]<sp/>=<sp/>0x1;</highlight></codeline> <codeline lineno="533"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//}</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="534"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//else<sp/>{</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="535"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//tmp<sp/>=<sp/>(u_int32_t<sp/>*)STACK_ADDR<sp/>-<sp/>2;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//tmp[0]<sp/>=<sp/>0x1;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="537"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//tmp[1]<sp/>=<sp/>0x0;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="538"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//tmp[1]<sp/>=<sp/>(u_int32_t)argv;</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="539"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//}</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="540"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(argvNew);</highlight></codeline> <codeline lineno="541"><highlight class="normal"><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="542"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="543"><highlight class="normal"><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(programHeader);</highlight></codeline> <codeline lineno="544"><highlight class="normal"></highlight></codeline> <codeline lineno="545"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="546"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="547"><highlight class="normal"></highlight></codeline> <codeline lineno="552" refid="exec_8c_1094c23346b6d226a03866a54b755ed64" refkind="member"><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="exec_8h_1094c23346b6d226a03866a54b755ed64" kindref="member">sys_exec</ref>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="structfile" kindref="compound">file</ref>,</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*ap)<sp/>{</highlight></codeline> <codeline lineno="553"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>error<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="554"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="555"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="556"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>argc<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="557"><highlight class="normal"><sp/><sp/><ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>seg_size<sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="558"><highlight class="normal"><sp/><sp/><ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>seg_addr<sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="559"><highlight class="normal"><sp/><sp/><ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>addr<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="560"><highlight class="normal"><sp/><sp/><ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structi386__frame_1ef87f1d1d6f1ad030c95773e7eedfa16" kindref="member">eip</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="561"><highlight class="normal"><sp/><sp/><ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>proghdr<sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="562"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*args<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="563"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*interp<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="564"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>**argv<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="565"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>**argvNew<sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="566"><highlight class="normal"><sp/><sp/><ref refid="structelfHeader" kindref="compound">elfHeader</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*binaryHeader<sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="567"><highlight class="normal"><sp/><sp/><ref refid="structelfProgramHeader" kindref="compound">elfProgramHeader</ref><sp/><sp/><sp/>*programHeader<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="568"><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/><sp/>*iFrame<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="569"><highlight class="normal"><sp/><sp/><ref refid="structElf__Auxargs" kindref="compound">Elf_Auxargs</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*auxargs<sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="570"><highlight class="normal"></highlight></codeline> <codeline lineno="571"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref><sp/>=<sp/><ref refid="file_8h_1d6a41ac88a7d46d574e8a675fdde136c" kindref="member">fopen</ref>(file,</highlight><highlight class="stringliteral">"r"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="572"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref><sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="573"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(-1);</highlight></codeline> <codeline lineno="574"><highlight class="normal"></highlight></codeline> <codeline lineno="575"><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="576"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((binaryHeader<sp/>=<sp/>(<ref refid="structelfHeader" kindref="compound">elfHeader</ref><sp/>*)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structelfHeader" kindref="compound">elfHeader</ref>)))<sp/>==<sp/>0x0)<sp/></highlight></codeline> <codeline lineno="577"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">"malloc<sp/>failed!"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="578"><highlight class="normal"><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>(binaryHeader,</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfHeader),1,<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref>);</highlight></codeline> <codeline lineno="579"><highlight class="normal"></highlight></codeline> <codeline lineno="580"><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="581"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((binaryHeader-><ref refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" kindref="member">eIdent</ref>[1]<sp/>!=<sp/></highlight><highlight class="charliteral">'E'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader-><ref refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" kindref="member">eIdent</ref>[2]<sp/>!=<sp/></highlight><highlight class="charliteral">'L'</highlight><highlight class="normal">)<sp/>&&<sp/>(binaryHeader-><ref refid="structelfHeader_1ec74b71d266bdbfaed95a9241343c28c" kindref="member">eIdent</ref>[3]<sp/>!=<sp/></highlight><highlight class="charliteral">'F'</highlight><highlight class="normal">))<sp/>||<sp/>(binaryHeader-><ref refid="structelfHeader_134e52f945d79cca21dc50a8aef79f9e8" kindref="member">eType</ref><sp/>!=<sp/><ref refid="elf_8h_1942478985eb016311380dee473cc8c3e" kindref="member">ET_EXEC</ref>))<sp/>{</highlight></codeline> <codeline lineno="582"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kmalloc_8h_1aa9ed6886459604cf73ccdbf6410e487" kindref="member">kfree</ref>(binaryHeader);</highlight></codeline> <codeline lineno="583"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="file_8h_1872c22366b4c63f4bdb10cd3b7980b11" kindref="member">fclose</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref>);</highlight></codeline> <codeline lineno="584"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">(-1);</highlight></codeline> <codeline lineno="585"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="586"><highlight class="normal"></highlight></codeline> <codeline lineno="587"><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="588"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((programHeader<sp/>=<sp/>(<ref refid="structelfProgramHeader" kindref="compound">elfProgramHeader</ref><sp/>*)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structelfProgramHeader" kindref="compound">elfProgramHeader</ref>)*binaryHeader-><ref refid="structelfHeader_14635401868104caa04fcb5bb60840df6" kindref="member">ePhnum</ref>))<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="589"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">"malloc<sp/>failed!"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="590"><highlight class="normal"><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref>,binaryHeader-><ref refid="structelfHeader_1aff1ff2cb64932f1e1a1f6cf3b881787" kindref="member">ePhoff</ref>,0);</highlight></codeline> <codeline lineno="591"><highlight class="normal"><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>(programHeader,(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(elfProgramHeader)*binaryHeader-><ref refid="structelfHeader_14635401868104caa04fcb5bb60840df6" kindref="member">ePhnum</ref>),1,<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref>);</highlight></codeline> <codeline lineno="592"><highlight class="normal"></highlight></codeline> <codeline lineno="593"><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="594"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0x0;i<sp/><<sp/>binaryHeader-><ref refid="structelfHeader_14635401868104caa04fcb5bb60840df6" kindref="member">ePhnum</ref>;i++)<sp/>{</highlight></codeline> <codeline lineno="595"><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="596"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf_8h_184d7768fd6c6ece599d297090900cf92" kindref="member">PT_LOAD</ref>:</highlight></codeline> <codeline lineno="597"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>seg_addr<sp/>=<sp/><ref refid="paging_8h_1bd636a9b61ad98f4fc23b1f4a9210d78" kindref="member">trunc_page</ref>(programHeader[i].phVaddr);</highlight></codeline> <codeline lineno="598"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>seg_size<sp/>=<sp/><ref refid="paging_8h_12702263fcf2b3b026cb26c6d895cb0ee" kindref="member">round_page</ref>(programHeader[i].phMemsz<sp/>+<sp/>programHeader[i].phVaddr<sp/>-<sp/>seg_addr);</highlight></codeline> <codeline lineno="599"><highlight class="normal"></highlight></codeline> <codeline lineno="600"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="601"><highlight class="comment"><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="602"><highlight class="comment"><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="603"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="604"><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;x<sp/><<sp/>(programHeader[i].<ref refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" kindref="member">phMemsz</ref>);x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="605"><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="606"><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_1a05f8d8947fb5bcec87fc6661f83243e" kindref="member">vmm_remapPage</ref>(<ref refid="vmm_8h_1976cf3919bf7c77c868021ec9374593b" kindref="member">vmmFindFreePage</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>),((programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref><sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),<ref refid="paging_8h_1f0fff7a38cd2c7a32d580787423b94ea" kindref="member">PAGE_DEFAULT</ref>)<sp/>==<sp/>0x0)</highlight></codeline> <codeline lineno="607"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">"Error:<sp/>Remap<sp/>Page<sp/>Failed"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="608"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lib_2string_8h_1ce4b911463887af5e748326323e99a23" kindref="member">memset</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x),0x0,0<ref refid="ap-boot_8S_1f78b91f02427adef14bb8b28aa93baa5" kindref="member">x1000</ref>);</highlight></codeline> <codeline lineno="609"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="610"><highlight class="normal"></highlight></codeline> <codeline lineno="611"><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="612"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref>,programHeader[i].<ref refid="structelfProgramHeader_193a7c0296fe86a429cf58989956d28ff" kindref="member">phOffset</ref>,0);</highlight></codeline> <codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref>);</highlight></codeline> <codeline lineno="614"><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="615"><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;x<sp/><<sp/>(programHeader[i].<ref refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" kindref="member">phMemsz</ref>);x<sp/>+=<sp/>0x1000)<sp/>{</highlight></codeline> <codeline lineno="616"><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_11913e8607a69ecf446b18fa1cd36c9cc" kindref="member">vmm_setPageAttributes</ref>((programHeader[i].phVaddr<sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>x,<ref refid="paging_8h_1122dfc414a40e260fd35dbe9743db26f" kindref="member">PAGE_PRESENT</ref><sp/>|<sp/><ref refid="paging_8h_12d0253527ea5080d6befe0ee3bde473f" kindref="member">PAGE_USER</ref>))<sp/>!=<sp/>0x0)</highlight></codeline> <codeline lineno="617"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">"vmm_setPageAttributes<sp/>failed"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="618"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="620"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(binaryHeader-><ref refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" kindref="member">eEntry</ref><sp/>>=<sp/>programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref><sp/>&&<sp/>binaryHeader-><ref refid="structelfHeader_18ff3dd1b27053bc5a2f01afe5403e53b" kindref="member">eEntry</ref><sp/><<sp/>(programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref><sp/>+<sp/>programHeader[i].<ref refid="structelfProgramHeader_1b5a140ab0f0225a8459f88d905995dd0" kindref="member">phMemsz</ref>))<sp/>{</highlight></codeline> <codeline lineno="621"><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="622"><highlight class="normal"><sp/><sp/><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">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> <codeline lineno="624"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_14ce0e0e5856efc85e111d2cb8748a0ee" kindref="member">vm_dsize</ref><sp/>=<sp/>seg_size<sp/>>><sp/><ref refid="paging_8h_1850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline> <codeline lineno="625"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)seg_addr;</highlight></codeline> <codeline lineno="626"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="627"><highlight class="normal"></highlight></codeline> <codeline lineno="628"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_10933c70230d4ac8bc9953640c979f8d7" kindref="member">oInfo</ref>.<ref refid="structosInfo_12833c1fa4a221941b5d1141dfa5beefd" kindref="member">vmStart</ref><sp/>=<sp/>((programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref><sp/>&<sp/>0xFFFFF000)<sp/>+<sp/>0xA900000);</highlight></codeline> <codeline lineno="629"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="630"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf_8h_1bcd3aa15bc567949c1ab6b1abc137710" kindref="member">PT_INTERP</ref>:</highlight></codeline> <codeline lineno="631"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>interp<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" kindref="member">kmalloc</ref>(programHeader[i].phFilesz);</highlight></codeline> <codeline lineno="632"><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="633"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kpanic_8h_1a5193288597f00c4f8e3b2939aa6c0ce" kindref="member">K_PANIC</ref>(</highlight><highlight class="stringliteral">"malloc<sp/>failed"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="634"><highlight class="normal"></highlight></codeline> <codeline lineno="635"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_180528d8335cd52755f5d6a92e4f08391" kindref="member">fseek</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref>,programHeader[i].<ref refid="structelfProgramHeader_193a7c0296fe86a429cf58989956d28ff" kindref="member">phOffset</ref>,0);</highlight></codeline> <codeline lineno="636"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="file_8h_13b06878a03209e88c008c77234b89359" kindref="member">fread</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)interp,programHeader[i].phFilesz,1,<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_17930577bf37a9eb337761a9374def70e" kindref="member">imageFd</ref>);</highlight></codeline> <codeline lineno="637"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"Interp:<sp/>[%s]\n"</highlight><highlight class="normal">,interp);</highlight></codeline> <codeline lineno="638"><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="639"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="640"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="elf_8h_158ff00be749ca4000074f9b9066a1056" kindref="member">PT_PHDR</ref>:</highlight></codeline> <codeline lineno="641"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>proghdr<sp/>=<sp/>programHeader[i].<ref refid="structelfProgramHeader_114f11176e999131fb9be875aeb500447" kindref="member">phVaddr</ref>;<sp/></highlight></codeline> <codeline lineno="642"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="643"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline> <codeline lineno="644"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="645"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="646"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="647"><highlight class="normal"></highlight></codeline> <codeline lineno="648"><highlight class="normal"><sp/><sp/>addr<sp/>=<sp/><ref refid="kmod_8h_1f4d6f389174a00e0de80e1ea0e23e956" kindref="member">LD_START</ref>;</highlight></codeline> <codeline lineno="649"><highlight class="normal"></highlight></codeline> <codeline lineno="650"><highlight class="normal"></highlight></codeline> <codeline lineno="651"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(interp<sp/>!=<sp/>0x0)<sp/>{</highlight></codeline> <codeline lineno="652"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"TEST"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="653"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="elf_8h_1f11ec9e50bcff723428b0c911a177fd0" kindref="member">elf_loadfile</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>,interp,&addr,&<ref refid="structi386__frame_1ef87f1d1d6f1ad030c95773e7eedfa16" kindref="member">eip</ref>);</highlight></codeline> <codeline lineno="654"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="655"><highlight class="normal"><sp/><sp/><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"[0x%X][0x%X]\n"</highlight><highlight class="normal">,<ref refid="structi386__frame_1ef87f1d1d6f1ad030c95773e7eedfa16" kindref="member">eip</ref>,addr);</highlight></codeline> <codeline lineno="656"><highlight class="normal"></highlight></codeline> <codeline lineno="657"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_14ce0e0e5856efc85e111d2cb8748a0ee" kindref="member">vm_dsize</ref><sp/>=<sp/>seg_size<sp/>>><sp/><ref refid="paging_8h_1850d80ca2291d26b40dc6b25c419f81a" kindref="member">PAGE_SHIFT</ref>;</highlight></codeline> <codeline lineno="658"><highlight class="normal"><sp/><sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" kindref="member">vm_daddr</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)seg_addr;</highlight></codeline> <codeline lineno="659"><highlight class="normal"></highlight></codeline> <codeline lineno="660"><highlight class="normal"><sp/><sp/>argv<sp/>=<sp/>ap;</highlight></codeline> <codeline lineno="661"><highlight class="normal"></highlight></codeline> <codeline lineno="662"><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="663"><highlight class="normal"><sp/><sp/><sp/><sp/>argc<sp/>=<sp/>argv[0];</highlight></codeline> <codeline lineno="664"><highlight class="normal"><sp/><sp/><sp/><sp/>args<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<ref refid="paging_8h_14b324672c4b25064eb8db1e3419337b1" kindref="member">vmmGetFreeVirtualPage</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_130966587a60db6b40c8be6c387e11d81" kindref="member">id</ref>,1,<ref refid="paging_8h_159a518704bf2f0b56603476bcb1eebbf" kindref="member">VM_TASK</ref>);</highlight></codeline> <codeline lineno="665"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lib_2string_8h_1ce4b911463887af5e748326323e99a23" kindref="member">memset</ref>(args,0x0,0<ref refid="ap-boot_8S_1f78b91f02427adef14bb8b28aa93baa5" kindref="member">x1000</ref>);</highlight></codeline> <codeline lineno="666"><highlight class="normal"><sp/><sp/><sp/><sp/>x<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="667"><highlight class="normal"><sp/><sp/><sp/><sp/>argvNew<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**)<ref refid="kmalloc_8h_1150eab2ac4ce4553e21ca10e7f441762" 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="668"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0x0;i<sp/><<sp/>argc;i++)<sp/>{</highlight></codeline> <codeline lineno="669"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="strcpy_8S_19132520cc79236b654666f4ddc1b516c" kindref="member">strcpy</ref>(args<sp/>+<sp/>x,argv[i<sp/>+<sp/>1]);</highlight></codeline> <codeline lineno="670"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>argvNew[i]<sp/>=<sp/>args<sp/>+<sp/>x;</highlight></codeline> <codeline lineno="671"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x<sp/>+=<sp/><ref refid="strlen_8S_10bcafbeba7f59f157715cc462036b8d3" kindref="member">strlen</ref>(argv[i<sp/>+<sp/>1])<sp/>+<sp/>1;</highlight></codeline> <codeline lineno="672"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/>argv<sp/>=<sp/>argvNew;</highlight></codeline> <codeline lineno="674"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="675"><highlight class="normal"></highlight></codeline> <codeline lineno="677"><highlight class="normal"><sp/><sp/><ref refid="paging_8c_10444c8635648fabdbd6e702137aa1723" kindref="member">vmm_cleanVirtualSpace</ref>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_1c770300b493b2ea844e634b7c98c4f6a" kindref="member">vm_daddr</ref><sp/>+<sp/>(<ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_1481c2e7084fec272e616d3fb984036e2" kindref="member">td</ref>.<ref refid="structthread_14ce0e0e5856efc85e111d2cb8748a0ee" kindref="member">vm_dsize</ref><sp/><<<sp/><ref refid="paging_8h_17d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>));</highlight></codeline> <codeline lineno="678"><highlight class="normal"></highlight></codeline> <codeline lineno="679"><highlight class="normal"></highlight></codeline> <codeline lineno="681"><highlight class="normal"><sp/><sp/>iFrame<sp/>=<sp/><ref refid="sched_8h_154397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-><ref refid="structtaskStruct_14c8accd7c0d5bb5ce426dc982bfc8519" kindref="member">tss</ref>.<ref refid="structtssStruct_11017372aed82d7305586c330fa222b3b" 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="682"><highlight class="normal"><sp/><sp/>iFrame->ebp<sp/>=<sp/><ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>;</highlight></codeline> <codeline lineno="683"><highlight class="normal"><sp/><sp/>iFrame->eip<sp/>=<sp/><ref refid="structi386__frame_1ef87f1d1d6f1ad030c95773e7eedfa16" kindref="member">eip</ref>;</highlight></codeline> <codeline lineno="684"><highlight class="normal"></highlight></codeline> <codeline lineno="685"><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="686"><highlight class="normal"></highlight></codeline> <codeline lineno="687"><highlight class="normal"><sp/><sp/>iFrame->user_esp<sp/>=<sp/>((<ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref>)<ref refid="exec_8c_1d93dccba62fb5241c0b7cebcd097794a" kindref="member">STACK_ADDR</ref>)<sp/>-<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="types_8h_1ba29fd78d95cce0ecb249c24b58d07da" kindref="member">u_int32_t</ref>)<sp/>*<sp/>(argc<sp/>+<sp/>3<sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structElf__Auxargs" kindref="compound">Elf_Auxargs</ref>)));</highlight></codeline> <codeline lineno="688"><highlight class="normal"><sp/><sp/>args<sp/>=<sp/>iFrame->user_esp;</highlight></codeline> <codeline lineno="689"><highlight class="normal"></highlight></codeline> <codeline lineno="691"><highlight class="normal"><sp/><sp/>args[0]<sp/>=<sp/>argc;</highlight></codeline> <codeline lineno="692"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;i<sp/><<sp/>argc;i++)<sp/>{</highlight></codeline> <codeline lineno="693"><highlight class="normal"><sp/><sp/><sp/><sp/>args[i<sp/>+<sp/>1]<sp/>=<sp/>argv[i];</highlight></codeline> <codeline lineno="694"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="696"><highlight class="normal"><sp/><sp/>args[argc<sp/>+<sp/>2]<sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="697"><highlight class="normal"><sp/><sp/>auxargs<sp/>=<sp/>iFrame->user_esp<sp/>+<sp/>argc<sp/>+<sp/><sp/>2;</highlight></codeline> <codeline lineno="698"><highlight class="normal"><sp/><sp/>auxargs->execfd<sp/>=<sp/>-1;</highlight></codeline> <codeline lineno="699"><highlight class="normal"><sp/><sp/>auxargs->phdr<sp/><sp/><sp/>=<sp/>proghdr;</highlight></codeline> <codeline lineno="700"><highlight class="normal"><sp/><sp/>auxargs->phent<sp/><sp/>=<sp/>binaryHeader->ePhentsize;</highlight></codeline> <codeline lineno="701"><highlight class="normal"><sp/><sp/>auxargs->phnum<sp/><sp/>=<sp/>binaryHeader->ePhnum;</highlight></codeline> <codeline lineno="702"><highlight class="normal"><sp/><sp/>auxargs->pagesz<sp/>=<sp/><ref refid="paging_8h_17d467c1d283fdfa1f2081ba1e0d01b6e" kindref="member">PAGE_SIZE</ref>;</highlight></codeline> <codeline lineno="703"><highlight class="normal"><sp/><sp/>auxargs->base<sp/><sp/><sp/>=<sp/>addr;</highlight></codeline> <codeline lineno="704"><highlight class="normal"><sp/><sp/>auxargs->flags<sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="705"><highlight class="normal"><sp/><sp/>auxargs->entry<sp/><sp/>=<sp/>binaryHeader->eEntry;</highlight></codeline> <codeline lineno="706"><highlight class="normal"><sp/><sp/>auxargs->trace<sp/><sp/>=<sp/>0x0;</highlight></codeline> <codeline lineno="707"><highlight class="normal"><ref refid="kprint_8h_1b2761bdf0cca73ad0fb5880895210cd8" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"\n\nDOH\n\n"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="708"><highlight class="normal"></highlight></codeline> <codeline lineno="709"><highlight class="normal"><sp/></highlight><highlight class="comment">//while<sp/>(1);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="710"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline> <codeline lineno="711"><highlight class="comment"><sp/><sp/>error<sp/>=<sp/>elf_loadfile(_current,file,0x0,0x0);</highlight></codeline> <codeline lineno="712"><highlight class="comment"><sp/><sp/>if<sp/>(error)</highlight></codeline> <codeline lineno="713"><highlight class="comment"><sp/><sp/><sp/><sp/>K_PANIC("elf_loadfile<sp/>failed");</highlight></codeline> <codeline lineno="714"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="715"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="716"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="717"><highlight class="normal"></highlight></codeline> <codeline lineno="718"><highlight class="normal"></highlight><highlight class="comment">/***</highlight></codeline> <codeline lineno="719"><highlight class="comment"><sp/>END</highlight></codeline> <codeline lineno="720"><highlight class="comment"><sp/>***/</highlight><highlight class="normal"></highlight></codeline> </programlisting> <location file="/usr/home/reddawg/source/ubix2/src/sys/kernel/exec.c"/> </compounddef> </doxygen>