<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>UbixOS V2: src/sys/kernel/syscall.c Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.4.7 --> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="classes.html"><span>Data Structures</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li> <form action="search.php" method="get"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td><label> <u>S</u>earch for </label></td> <td><input type="text" name="query" value="" size="20" accesskey="s"/></td> </tr> </table> </form> </li> </ul></div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul></div> <div class="nav"> <a class="el" href="dir_897b6a2d7bab147dd1db58381aad3984.html">src</a> » <a class="el" href="dir_832905b1f7f5feaf61a306b40c0ac817.html">sys</a> » <a class="el" href="dir_7efffd2b1fae7bb6f2aa85845c863494.html">kernel</a></div> <h1>syscall.c</h1><a href="syscall_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************************************</span> <a name="l00002"></a>00002 <span class="comment"> Copyright (c) 2002-2004 The UbixOS Project</span> <a name="l00003"></a>00003 <span class="comment"> All rights reserved.</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment"> Redistribution and use in source and binary forms, with or without modification, are</span> <a name="l00006"></a>00006 <span class="comment"> permitted provided that the following conditions are met:</span> <a name="l00007"></a>00007 <span class="comment"></span> <a name="l00008"></a>00008 <span class="comment"> Redistributions of source code must retain the above copyright notice, this list of</span> <a name="l00009"></a>00009 <span class="comment"> conditions, the following disclaimer and the list of authors. Redistributions in binary</span> <a name="l00010"></a>00010 <span class="comment"> form must reproduce the above copyright notice, this list of conditions, the following</span> <a name="l00011"></a>00011 <span class="comment"> disclaimer and the list of authors in the documentation and/or other materials provided</span> <a name="l00012"></a>00012 <span class="comment"> with the distribution. Neither the name of the UbixOS Project nor the names of its</span> <a name="l00013"></a>00013 <span class="comment"> contributors may be used to endorse or promote products derived from this software</span> <a name="l00014"></a>00014 <span class="comment"> without specific prior written permission.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment"> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY</span> <a name="l00017"></a>00017 <span class="comment"> EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF</span> <a name="l00018"></a>00018 <span class="comment"> MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL</span> <a name="l00019"></a>00019 <span class="comment"> THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span> <a name="l00020"></a>00020 <span class="comment"> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT</span> <a name="l00021"></a>00021 <span class="comment"> OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span> <a name="l00022"></a>00022 <span class="comment"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR</span> <a name="l00023"></a>00023 <span class="comment"> TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span> <a name="l00024"></a>00024 <span class="comment"> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span> <a name="l00025"></a>00025 <span class="comment"></span> <a name="l00026"></a>00026 <span class="comment"> $Id: syscall_8c-source.html 88 2016-01-12 00:11:29Z reddawg $</span> <a name="l00027"></a>00027 <span class="comment"></span> <a name="l00028"></a>00028 <span class="comment">*****************************************************************************************/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include <<a class="code" href="syscall_8h.html">ubixos/syscall.h</a>></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <<a class="code" href="syscalls_8h.html">ubixos/syscalls.h</a>></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="sched_8h.html">ubixos/sched.h</a>></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="types_8h.html">ubixos/types.h</a>></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <<a class="code" href="exec_8h.html">ubixos/exec.h</a>></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <<a class="code" href="elf_8h.html">ubixos/elf.h</a>></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <<a class="code" href="endtask_8h.html">ubixos/endtask.h</a>></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <<a class="code" href="time_8h.html">ubixos/time.h</a>></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <<a class="code" href="video_8h.html">sys/video.h</a>></span> <a name="l00039"></a>00039 <span class="preprocessor">#include <<a class="code" href="trap_8h.html">sys/trap.h</a>></span> <a name="l00040"></a>00040 <span class="preprocessor">#include <<a class="code" href="file_8h.html">vfs/file.h</a>></span> <a name="l00041"></a>00041 <span class="preprocessor">#include <<a class="code" href="ubixfs_8h.html">ubixfs/ubixfs.h</a>></span> <a name="l00042"></a>00042 <span class="preprocessor">#include <<a class="code" href="lib_2string_8h.html">lib/string.h</a>></span> <a name="l00043"></a>00043 <span class="preprocessor">#include <<a class="code" href="kprintf_8h.html">lib/kprintf.h</a>></span> <a name="l00044"></a>00044 <span class="preprocessor">#include <<a class="code" href="kmalloc_8h.html">lib/kmalloc.h</a>></span> <a name="l00045"></a>00045 <span class="preprocessor">#include <<a class="code" href="vitals_8h.html">ubixos/vitals.h</a>></span> <a name="l00046"></a>00046 <span class="comment">/* #include <sde/sde.h> */</span> <a name="l00047"></a>00047 <span class="preprocessor">#include <<a class="code" href="mpi_8h.html">mpi/mpi.h</a>></span> <a name="l00048"></a>00048 <span class="preprocessor">#include <<a class="code" href="vmm_8h.html">vmm/vmm.h</a>></span> <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="keywordtype">long</span> <a class="code" href="syscall_8c.html#145582743a4b91df2d954dbde7a667f4">fuword</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *base); <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="syscall_8c.html#4290727c1924758744edacd57ff00def">sdeTestThread</a>(); <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="keyword">asm</span>( <a name="l00055"></a>00055 <span class="stringliteral">".globl _sysCallNew \n"</span> <a name="l00056"></a>00056 <span class="stringliteral">"_sysCallNew: \n"</span> <a name="l00057"></a>00057 <span class="stringliteral">" pusha \n"</span> <a name="l00058"></a>00058 <span class="stringliteral">" push %ss \n"</span> <a name="l00059"></a>00059 <span class="stringliteral">" push %ds \n"</span> <a name="l00060"></a>00060 <span class="stringliteral">" push %es \n"</span> <a name="l00061"></a>00061 <span class="stringliteral">" push %fs \n"</span> <a name="l00062"></a>00062 <span class="stringliteral">" push %gs \n"</span> <a name="l00063"></a>00063 <span class="stringliteral">" cmpl totalCalls,%eax \n"</span> <a name="l00064"></a>00064 <span class="stringliteral">" jae invalidSysCallNew \n"</span> <a name="l00065"></a>00065 <span class="stringliteral">" mov %esp,%ebx \n"</span> <a name="l00066"></a>00066 <span class="stringliteral">" add $12,%ebx \n"</span> <a name="l00067"></a>00067 <span class="stringliteral">" push (%ebx) \n"</span> <a name="l00068"></a>00068 <span class="stringliteral">" call *systemCalls(,%eax,4) \n"</span> <a name="l00069"></a>00069 <span class="stringliteral">" add $4,%esp \n"</span> <a name="l00070"></a>00070 <span class="stringliteral">" jmp doneNew \n"</span> <a name="l00071"></a>00071 <span class="stringliteral">"invalidSysCallNew: \n"</span> <a name="l00072"></a>00072 <span class="stringliteral">" call InvalidSystemCall \n"</span> <a name="l00073"></a>00073 <span class="stringliteral">"doneNew: \n"</span> <a name="l00074"></a>00074 <span class="stringliteral">" pop %gs \n"</span> <a name="l00075"></a>00075 <span class="stringliteral">" pop %fs \n"</span> <a name="l00076"></a>00076 <span class="stringliteral">" pop %es \n"</span> <a name="l00077"></a>00077 <span class="stringliteral">" pop %ds \n"</span> <a name="l00078"></a>00078 <span class="stringliteral">" pop %ss \n"</span> <a name="l00079"></a>00079 <span class="stringliteral">" popa \n"</span> <a name="l00080"></a>00080 <span class="stringliteral">" iret \n"</span> <a name="l00081"></a>00081 ); <a name="l00082"></a>00082 <a name="l00083"></a><a class="code" href="syscall_8c.html#f7052cfb833f292be2fd73436e4c96b6">00083</a> <span class="keywordtype">void</span> <a class="code" href="syscall_8c.html#f7052cfb833f292be2fd73436e4c96b6">InvalidSystemCall</a>() <a name="l00084"></a>00084 { <a name="l00085"></a>00085 <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"attempt was made to an invalid system call\n"</span>); <a name="l00086"></a>00086 <span class="keywordflow">return</span>; <a name="l00087"></a>00087 } <a name="l00088"></a>00088 <a name="l00089"></a><a class="code" href="syscall_8c.html#2aebf5c0d98c1cc7bdaffd745e6b1ca2">00089</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__UbixUser.html">_UbixUser</a> <a class="code" href="syscall_8c.html#2aebf5c0d98c1cc7bdaffd745e6b1ca2">UbixUser</a>; <a name="l00090"></a><a class="code" href="struct__UbixUser.html">00090</a> <span class="keyword">struct </span><a class="code" href="struct__UbixUser.html">_UbixUser</a> <a name="l00091"></a>00091 { <a name="l00092"></a><a class="code" href="struct__UbixUser.html#759468c4ab67b1251e94c1d9ac1c4b9f">00092</a> <span class="keywordtype">char</span> *<a class="code" href="struct__UbixUser.html#759468c4ab67b1251e94c1d9ac1c4b9f">username</a>; <a name="l00093"></a><a class="code" href="struct__UbixUser.html#21648dbd731b4320943eff8de2084f5a">00093</a> <span class="keywordtype">char</span> *<a class="code" href="struct__UbixUser.html#21648dbd731b4320943eff8de2084f5a">password</a>; <a name="l00094"></a><a class="code" href="struct__UbixUser.html#8d21d76e84a85aa49edf8109c138dfe9">00094</a> <span class="keywordtype">int</span> <a class="code" href="struct__UbixUser.html#8d21d76e84a85aa49edf8109c138dfe9">uid</a>; <a name="l00095"></a><a class="code" href="struct__UbixUser.html#a0779ab57c9c43976b09c01c2eaab5cb">00095</a> <span class="keywordtype">int</span> <a class="code" href="struct__UbixUser.html#a0779ab57c9c43976b09c01c2eaab5cb">gid</a>; <a name="l00096"></a><a class="code" href="struct__UbixUser.html#a4f6a9076bbd4555c8f395d14d82eb7d">00096</a> <span class="keywordtype">char</span> *<a class="code" href="struct__UbixUser.html#a4f6a9076bbd4555c8f395d14d82eb7d">home</a>; <a name="l00097"></a><a class="code" href="struct__UbixUser.html#8311b0ea0ff08f86dc899128987f0274">00097</a> <span class="keywordtype">char</span> *<a class="code" href="struct__UbixUser.html#8311b0ea0ff08f86dc899128987f0274">shell</a>; <a name="l00098"></a>00098 }; <a name="l00099"></a>00099 <a name="l00100"></a><a class="code" href="syscall_8c.html#f53171b36a238440fc8e757c0d00a91f">00100</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#9680bfc8a1e734b484f941001ccb3623">sysAuth</a>(<a class="code" href="syscall_8c.html#2aebf5c0d98c1cc7bdaffd745e6b1ca2">UbixUser</a> *uu) <a name="l00101"></a>00101 { <a name="l00102"></a>00102 <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"authenticating user %s\n"</span>, uu-><a class="code" href="struct__UbixUser.html#759468c4ab67b1251e94c1d9ac1c4b9f">username</a>); <a name="l00103"></a>00103 <span class="keywordflow">if</span>(uu-><a class="code" href="struct__UbixUser.html#759468c4ab67b1251e94c1d9ac1c4b9f">username</a> == <span class="stringliteral">"root"</span> && uu-><a class="code" href="struct__UbixUser.html#21648dbd731b4320943eff8de2084f5a">password</a> == <span class="stringliteral">"user"</span>) <a name="l00104"></a>00104 { <a name="l00105"></a>00105 uu-><a class="code" href="struct__UbixUser.html#8d21d76e84a85aa49edf8109c138dfe9">uid</a> = 0; <a name="l00106"></a>00106 uu-><a class="code" href="struct__UbixUser.html#a0779ab57c9c43976b09c01c2eaab5cb">gid</a> = 0; <a name="l00107"></a>00107 } <a name="l00108"></a>00108 uu-><a class="code" href="struct__UbixUser.html#8d21d76e84a85aa49edf8109c138dfe9">uid</a> = -1; <a name="l00109"></a>00109 uu-><a class="code" href="struct__UbixUser.html#a0779ab57c9c43976b09c01c2eaab5cb">gid</a> = -1; <a name="l00110"></a>00110 <span class="keywordflow">return</span>; <a name="l00111"></a>00111 } <a name="l00112"></a>00112 <a name="l00113"></a><a class="code" href="syscall_8c.html#87ae7b6cdc0230fbdf65c167a776e9ad">00113</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#cedb04f8af77c9c29305438d57099133">sysPasswd</a>(<span class="keywordtype">char</span> *passwd) <a name="l00114"></a>00114 { <a name="l00115"></a>00115 <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"changing user password for user %d\n"</span>, <a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#1f9e02ebf24ff1cd76fab75e4c6b0fe1">uid</a>); <a name="l00116"></a>00116 <span class="keywordflow">return</span>; <a name="l00117"></a>00117 } <a name="l00118"></a>00118 <a name="l00119"></a><a class="code" href="syscall_8c.html#5242d291fc024663a9035376f70a9938">00119</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#5242d291fc024663a9035376f70a9938">sysAddModule</a>() <a name="l00120"></a>00120 { <a name="l00121"></a>00121 <span class="keywordflow">return</span>; <a name="l00122"></a>00122 } <a name="l00123"></a>00123 <a name="l00124"></a><a class="code" href="syscall_8c.html#15cbe3f603b53d632faf25bce7f0a7ce">00124</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#15cbe3f603b53d632faf25bce7f0a7ce">sysRmModule</a>() <a name="l00125"></a>00125 { <a name="l00126"></a>00126 <span class="keywordflow">return</span>; <a name="l00127"></a>00127 } <a name="l00128"></a>00128 <a name="l00129"></a><a class="code" href="syscall_8c.html#850d08e73e21c01850eea87fbe334fb6">00129</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#4fb278cb4dd09b77ba260d04f2a41456">sysGetpid</a>(<span class="keywordtype">int</span> *pid) <a name="l00130"></a>00130 { <a name="l00131"></a>00131 <span class="keywordflow">if</span> (pid) <a name="l00132"></a>00132 *pid = <a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#30966587a60db6b40c8be6c387e11d81">id</a>; <a name="l00133"></a>00133 <span class="keywordflow">return</span>; <a name="l00134"></a>00134 } <a name="l00135"></a>00135 <a name="l00136"></a><a class="code" href="syscall_8c.html#20b15028f242e382e441fff69880b55b">00136</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#80fc8211f2e3bc35fdde3224f764cd33">sysGetUid</a>(<span class="keywordtype">int</span> *uid) { <a name="l00137"></a>00137 <span class="keywordflow">if</span> (uid) <a name="l00138"></a>00138 *uid = <a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#1f9e02ebf24ff1cd76fab75e4c6b0fe1">uid</a>; <a name="l00139"></a>00139 <span class="keywordflow">return</span>; <a name="l00140"></a>00140 } <a name="l00141"></a>00141 <a name="l00142"></a><a class="code" href="syscall_8c.html#e96a621ca025dd8af6bc3c8288cc0cb7">00142</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#2de82ca63c0a95cc80cb77693a87d2dc">sysGetGid</a>(<span class="keywordtype">int</span> *gid) { <a name="l00143"></a>00143 <span class="keywordflow">if</span> (gid) <a name="l00144"></a>00144 *gid = <a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#3cf9920106f9b0d96dff475faf7aa0d6">gid</a>; <a name="l00145"></a>00145 <span class="keywordflow">return</span>; <a name="l00146"></a>00146 } <a name="l00147"></a>00147 <a name="l00148"></a><a class="code" href="syscall_8c.html#201b5066c18eb41f32293f2f0338264b">00148</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#856c89e41713c0b568a4909c9f82c34c">sysSetUid</a>(<span class="keywordtype">int</span> uid,<span class="keywordtype">int</span> *<a class="code" href="fdc_8c.html#e2746d1bf47d4f690105d083b966fa82">status</a>) { <a name="l00149"></a>00149 <span class="keywordflow">if</span> (<a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#1f9e02ebf24ff1cd76fab75e4c6b0fe1">uid</a> == 0x0) { <a name="l00150"></a>00150 <a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#1f9e02ebf24ff1cd76fab75e4c6b0fe1">uid</a> = uid; <a name="l00151"></a>00151 <span class="keywordflow">if</span> (status) <a name="l00152"></a>00152 *status = 0x0; <a name="l00153"></a>00153 } <a name="l00154"></a>00154 <span class="keywordflow">else</span> { <a name="l00155"></a>00155 <span class="keywordflow">if</span> (status) <a name="l00156"></a>00156 *status = 1; <a name="l00157"></a>00157 } <a name="l00158"></a>00158 <span class="keywordflow">return</span>; <a name="l00159"></a>00159 } <a name="l00160"></a>00160 <a name="l00161"></a><a class="code" href="syscall_8c.html#c21d2c80c103093157c7929814b23265">00161</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#6535c97d0fce8b2bb3dec26e7bfa4833">sysSetGid</a>(<span class="keywordtype">int</span> gid,<span class="keywordtype">int</span> *<a class="code" href="fdc_8c.html#e2746d1bf47d4f690105d083b966fa82">status</a>) { <a name="l00162"></a>00162 <span class="keywordflow">if</span> (<a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#3cf9920106f9b0d96dff475faf7aa0d6">gid</a> == 0x0) { <a name="l00163"></a>00163 <a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#3cf9920106f9b0d96dff475faf7aa0d6">gid</a> = gid; <a name="l00164"></a>00164 <span class="keywordflow">if</span> (status) <a name="l00165"></a>00165 *status = 0x0; <a name="l00166"></a>00166 } <a name="l00167"></a>00167 <span class="keywordflow">else</span> { <a name="l00168"></a>00168 <span class="keywordflow">if</span> (status) <a name="l00169"></a>00169 *status = 1; <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <span class="keywordflow">return</span>; <a name="l00172"></a>00172 } <a name="l00173"></a>00173 <a name="l00174"></a><a class="code" href="syscall_8c.html#fe946867553f08182c48bb1dac56f1ca">00174</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#eebd2b785b9e3499937a27b83d54adb3">sysExit</a>(<span class="keywordtype">int</span> <a class="code" href="fdc_8c.html#e2746d1bf47d4f690105d083b966fa82">status</a>) <a name="l00175"></a>00175 { <a name="l00176"></a>00176 <a class="code" href="endtask_8h.html#152c1859ada097cc21071f471bfa2e67">endTask</a>(<a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#30966587a60db6b40c8be6c387e11d81">id</a>); <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <a name="l00179"></a><a class="code" href="syscall_8c.html#618ade9098959166434c56fedf05f71a">00179</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#174e0378ada12f961fadf4e4bce0e985">sysCheckPid</a>(<span class="keywordtype">int</span> pid,<span class="keywordtype">int</span> *ptr) <a name="l00180"></a>00180 { <a name="l00181"></a>00181 <a class="code" href="structtaskStruct.html">kTask_t</a> *tmpTask = <a class="code" href="sched_8h.html#9cf37ade4c1f6184b33014ac2015e8ed">schedFindTask</a>(pid); <a name="l00182"></a>00182 <span class="keywordflow">if</span> ((tmpTask != 0x0) && (ptr != 0x0)) <a name="l00183"></a>00183 *ptr = tmpTask-><a class="code" href="structtaskStruct.html#b085a40e09975d9ebf55b393f9549710">state</a>; <a name="l00184"></a>00184 <span class="keywordflow">else</span> <a name="l00185"></a>00185 *ptr = 0x0; <a name="l00186"></a>00186 <span class="keywordflow">return</span>; <a name="l00187"></a>00187 } <a name="l00188"></a>00188 <a name="l00189"></a>00189 <span class="comment">/************************************************************************</span> <a name="l00190"></a>00190 <span class="comment"></span> <a name="l00191"></a>00191 <span class="comment">Function: void sysGetFreePage();</span> <a name="l00192"></a>00192 <span class="comment">Description: Allocs A Page To The Users VM Space</span> <a name="l00193"></a>00193 <span class="comment">Notes:</span> <a name="l00194"></a>00194 <span class="comment"></span> <a name="l00195"></a>00195 <span class="comment">************************************************************************/</span> <a name="l00196"></a><a class="code" href="syscall_8c.html#1db3bfbad534c2fa75c02646fcf80a90">00196</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#33eb6110c8584f43637d317a979d3d48">sysGetFreePage</a>(<span class="keywordtype">long</span> *ptr,<span class="keywordtype">int</span> count,<span class="keywordtype">int</span> type) { <a name="l00197"></a>00197 <span class="keywordflow">if</span> (ptr) { <a name="l00198"></a>00198 <span class="keywordflow">if</span> (type == 2) <a name="l00199"></a>00199 *ptr = (long) <a class="code" href="paging_8h.html#4b324672c4b25064eb8db1e3419337b1">vmmGetFreeVirtualPage</a>(<a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#30966587a60db6b40c8be6c387e11d81">id</a>,count,<a class="code" href="paging_8h.html#4ede4e8b3e149ef94678acdae7de0e18">VM_THRD</a>); <a name="l00200"></a>00200 <span class="keywordflow">else</span> <a name="l00201"></a>00201 *ptr = (long) <a class="code" href="paging_8h.html#4b324672c4b25064eb8db1e3419337b1">vmmGetFreeVirtualPage</a>(<a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#30966587a60db6b40c8be6c387e11d81">id</a>,count,<a class="code" href="paging_8h.html#59a518704bf2f0b56603476bcb1eebbf">VM_TASK</a>); <a name="l00202"></a>00202 } <a name="l00203"></a>00203 <span class="keywordflow">return</span>; <a name="l00204"></a>00204 } <a name="l00205"></a>00205 <a name="l00206"></a><a class="code" href="syscall_8c.html#8bdd527e2c5a0fe7ea30685196ce3323">00206</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#d3fba35894d9b2e491af366070a98856">sysGetDrives</a>(<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> *ptr) <a name="l00207"></a>00207 { <a name="l00208"></a>00208 <span class="keywordflow">if</span> (ptr) <a name="l00209"></a>00209 *ptr = 0x0;<span class="comment">//(uInt32)devices;</span> <a name="l00210"></a>00210 <span class="keywordflow">return</span>; <a name="l00211"></a>00211 } <a name="l00212"></a>00212 <a name="l00213"></a><a class="code" href="syscall_8c.html#7c8a6dad2e6968015b21357c795bccc0">00213</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#6eb6cfba94f3cd7edc2d20fb97f63aca">sysGetUptime</a>(<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> *ptr) <a name="l00214"></a>00214 { <a name="l00215"></a>00215 <span class="keywordflow">if</span> (ptr) <a name="l00216"></a>00216 *ptr = <a class="code" href="vitals_8h.html#67aae71be472453526fc1a0bfbf80280">systemVitals</a>-><a class="code" href="structvitalsStruct.html#4f8bcc103c132edae3eb7ed47e6ee024">sysTicks</a>; <a name="l00217"></a>00217 <span class="keywordflow">return</span>; <a name="l00218"></a>00218 } <a name="l00219"></a>00219 <a name="l00220"></a><a class="code" href="syscall_8c.html#c0997ac7ac4b4bdb6f8565f2b7f0c74a">00220</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#55aa396fbf042df1eedcf30f368b243a">sysGetTime</a>(<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> *ptr) <a name="l00221"></a>00221 { <a name="l00222"></a>00222 <span class="keywordflow">if</span> (ptr) <a name="l00223"></a>00223 *ptr = <a class="code" href="vitals_8h.html#67aae71be472453526fc1a0bfbf80280">systemVitals</a>-><a class="code" href="structvitalsStruct.html#d4f37dedcce6dcf9d87e1f01221c5b71">sysUptime</a> + <a class="code" href="vitals_8h.html#67aae71be472453526fc1a0bfbf80280">systemVitals</a>-><a class="code" href="structvitalsStruct.html#c407388b447996ea3bad97aebbb5e1a6">timeStart</a>; <a name="l00224"></a>00224 <span class="keywordflow">return</span>; <a name="l00225"></a>00225 } <a name="l00226"></a>00226 <a name="l00227"></a>00227 <a name="l00228"></a><a class="code" href="syscall_8c.html#a1858601da45332a2cd7d43bb3bcb80d">00228</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#346de7f91280ba7856d11e1ae095cbe2">sysGetCwd</a>(<span class="keywordtype">char</span> *data,<span class="keywordtype">int</span> len) <a name="l00229"></a>00229 { <a name="l00230"></a>00230 <span class="keywordflow">if</span> (data) <a name="l00231"></a>00231 <a class="code" href="lib_2string_8h.html#c38cd16373d98782e1465bd3d5aba470">sprintf</a>(data,<span class="stringliteral">"%s"</span>, <a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-><a class="code" href="structtaskStruct.html#0933c70230d4ac8bc9953640c979f8d7">oInfo</a>.<a class="code" href="structosInfo.html#e9411eaa7df66cd0148237248848bbdf">cwd</a>); <a name="l00232"></a>00232 <span class="keywordflow">return</span>; <a name="l00233"></a>00233 } <a name="l00234"></a>00234 <a name="l00235"></a><a class="code" href="syscall_8c.html#4fe050b57d00373f9f9810f1934244e7">00235</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#4fe050b57d00373f9f9810f1934244e7">sysSchedYield</a>() { <a name="l00236"></a>00236 <a class="code" href="sched_8h.html#08933fe6d593a1c78b9080359f15a0b7">sched_yield</a>(); <a name="l00237"></a>00237 } <a name="l00238"></a>00238 <a name="l00239"></a><a class="code" href="syscall_8c.html#fb14ed929bdc2c68714da3685e650c6c">00239</a> <span class="keywordtype">void</span> <a class="code" href="syscalls_8h.html#fb14ed929bdc2c68714da3685e650c6c">sysStartSDE</a>() { <a name="l00240"></a>00240 <span class="keywordtype">int</span> i = 0x0; <a name="l00241"></a>00241 <span class="keywordflow">for</span> (i=0;i<1400;i++) { <a name="l00242"></a>00242 <span class="keyword">asm</span>(<span class="stringliteral">"hlt"</span>); <a name="l00243"></a>00243 } <a name="l00244"></a>00244 <span class="comment">//execThread(sdeThread,(uInt32)(kmalloc(0x2000)+0x2000),0x0);</span> <a name="l00245"></a>00245 <span class="keywordflow">for</span> (i=0;i<1400;i++) { <a name="l00246"></a>00246 <span class="keyword">asm</span>(<span class="stringliteral">"hlt"</span>); <a name="l00247"></a>00247 } <a name="l00248"></a>00248 <span class="keywordflow">return</span>; <a name="l00249"></a>00249 } <a name="l00250"></a>00250 <a name="l00251"></a><a class="code" href="syscall_8c.html#98fb463aa3c38a140b47e594bf9603d6">00251</a> <span class="keywordtype">void</span> <a class="code" href="syscall_8h.html#9e2ae445f23217d134a21e636a16b101">invalidCall</a>(<span class="keywordtype">int</span> sys_call) { <a name="l00252"></a>00252 <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"Invalid System Call #[%i]\n"</span>,sys_call); <a name="l00253"></a>00253 <span class="keywordflow">return</span>; <a name="l00254"></a>00254 } <a name="l00255"></a>00255 <a name="l00256"></a>00256 <span class="comment">/***</span> <a name="l00257"></a>00257 <span class="comment"> END</span> <a name="l00258"></a>00258 <span class="comment"> ***/</span> <a name="l00259"></a>00259 </pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Dec 15 11:18:55 2006 for UbixOS V2 by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address> </body> </html>