Newer
Older
UbixOS / doc / html / bioscall_8c-source.html
<!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/bioscall.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&nbsp;Page</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;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>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</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&nbsp;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>&nbsp;&raquo&nbsp;<a class="el" href="dir_832905b1f7f5feaf61a306b40c0ac817.html">sys</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_7efffd2b1fae7bb6f2aa85845c863494.html">kernel</a></div>
<h1>bioscall.c</h1><a href="bioscall_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: bioscall_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 &lt;<a class="code" href="tss_8h.html">sys/tss.h</a>&gt;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;<a class="code" href="sched_8h.html">ubixos/sched.h</a>&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;<a class="code" href="vmm_8h.html">vmm/vmm.h</a>&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;<a class="code" href="kmalloc_8h.html">lib/kmalloc.h</a>&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;<a class="code" href="bioscall_8h.html">lib/bioscall.h</a>&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;<a class="code" href="lib_2string_8h.html">lib/string.h</a>&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;<a class="code" href="video_8h.html">sys/video.h</a>&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;<a class="code" href="assert_8h.html">assert.h</a>&gt;</span>
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="keyword">asm</span>(
<a name="l00041"></a>00041   <span class="stringliteral">".globl bios16Code\n"</span>
<a name="l00042"></a>00042   <span class="stringliteral">".code16          \n"</span>
<a name="l00043"></a>00043   <span class="stringliteral">"bios16Code:      \n"</span>
<a name="l00044"></a>00044   <span class="stringliteral">"int $0x10        \n"</span>
<a name="l00045"></a>00045   <span class="stringliteral">"int $0x69        \n"</span>
<a name="l00046"></a>00046   <span class="stringliteral">".code32          \n"</span>
<a name="l00047"></a>00047   );
<a name="l00048"></a>00048 
<a name="l00049"></a>00049   
<a name="l00050"></a><a class="code" href="bioscall_8c.html#56a172d2268fc10811a0bb180d7c3f49">00050</a> <span class="keywordtype">void</span> <a class="code" href="bioscall_8h.html#56a172d2268fc10811a0bb180d7c3f49">biosCall</a>(<span class="keywordtype">int</span> biosInt,<span class="keywordtype">int</span> <a class="code" href="start_8S.html#99c8741e5f964a3b896c5d21808dd942">eax</a>,<span class="keywordtype">int</span> <a class="code" href="ap-boot_8S.html#8771927de13b84dd7f9deec6024f83df">ebx</a>,<span class="keywordtype">int</span> ecx,<span class="keywordtype">int</span> <a class="code" href="timer_8S.html#15bdf6d1016b28a29ed53c35bcc6113b">edx</a>,<span class="keywordtype">int</span> esi,<span class="keywordtype">int</span> <a class="code" href="start_8S.html#f701de0cc799320aaf54092dda7b54d2">edi</a>,<span class="keywordtype">int</span> es,<span class="keywordtype">int</span> ds) {
<a name="l00051"></a>00051   <span class="keywordtype">short</span> segment = 0x0,offset = 0x0;
<a name="l00052"></a>00052   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> tmpAddr = (<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)&amp;<a class="code" href="bioscall_8h.html#df2fd035ba4b30f8a71326f4685959d6">bios16Code</a>;
<a name="l00053"></a>00053   <a class="code" href="structtaskStruct.html">kTask_t</a> *newProcess = 0x0;
<a name="l00054"></a>00054 
<a name="l00055"></a>00055   offset = tmpAddr &amp; 0xF;  <span class="comment">// lower 4 bits</span>
<a name="l00056"></a>00056   segment = tmpAddr &gt;&gt; 4;
<a name="l00057"></a>00057   
<a name="l00058"></a>00058   newProcess = <a class="code" href="sched_8h.html#92458df2063761371869cdfe0c9b4ee3">schedNewTask</a>();
<a name="l00059"></a>00059   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(newProcess);
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 
<a name="l00062"></a>00062   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#fecbe8ea2cfebfb4d1a0aa7b6ebcac2c">back_link</a>    = 0x0;
<a name="l00063"></a>00063   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#1017372aed82d7305586c330fa222b3b">esp0</a>         = (<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(0<a class="code" href="start_8S.html#d95bd4ee2ca78187e68aa0746a24e64d">x2000</a>)+0x2000;
<a name="l00064"></a>00064   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#26d03018de8c122451661bfe9d030541">ss0</a>          = 0x10;
<a name="l00065"></a>00065   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#d5ef8867200562fd8262f70312beff4d">esp1</a>         = 0x0;
<a name="l00066"></a>00066   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#6abf05d9a8f6356860a5606ffbadc989">ss1</a>          = 0x0;
<a name="l00067"></a>00067   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#60c88f3cd3f2110cb24be62444f42cfb">esp2</a>         = 0x0;
<a name="l00068"></a>00068   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#5a79ace5652b01cc25fc5ba7ff45bfa8">ss2</a>          = 0x0;
<a name="l00069"></a>00069   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#8d312ed3dd0ea7a0f801c08a8cc4afd0">cr3</a>          = (<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)<a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#8d312ed3dd0ea7a0f801c08a8cc4afd0">cr3</a>;<span class="comment">//(uInt32)vmmCreateVirtualSpace(newProcess-&gt;id);</span>
<a name="l00070"></a>00070   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#3e758f2138799d63fc803f7e4db4f5b4">eip</a>          =  offset &amp; 0xFFFF;
<a name="l00071"></a>00071   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#a85f1fbaf622e0c6a39963da27de0194">eflags</a>       = 2 | <a class="code" href="bioscall_8h.html#9e06d707701fc3d835d8d0d366476d77">EFLAG_IF</a> | <a class="code" href="bioscall_8h.html#c853c10e3eb19188c6b3b8d3ff6914e2">EFLAG_VM</a>;
<a name="l00072"></a>00072   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#6f6c9fdd54cd0da7f2331dc35f7d8fc7">eax</a>          =     eax &amp; 0xFFFF;
<a name="l00073"></a>00073   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#d0df6b4fe61e708d94656809727747cb">ebx</a>          =     ebx &amp; 0xFFFF;
<a name="l00074"></a>00074   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#7ba37dceca6d9363ea799091138d4601">ecx</a>          =     ecx &amp; 0xFFFF;
<a name="l00075"></a>00075   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#75825d1693047c99df1911b3af4d613f">edx</a>          =     edx &amp; 0xFFFF;
<a name="l00076"></a>00076   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#85412a87dbdb8eda612c77bce8055a2c">esp</a>          =  0<a class="code" href="ap-boot_8S.html#f78b91f02427adef14bb8b28aa93baa5">x1000</a> &amp; 0xFFFF;
<a name="l00077"></a>00077   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#c2d32620149e07c40ee87696ef2509c2">ebp</a>          =  0<a class="code" href="ap-boot_8S.html#f78b91f02427adef14bb8b28aa93baa5">x1000</a> &amp; 0xFFFF;
<a name="l00078"></a>00078   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#8beab5808aad776957d4544f6b139d4e">esi</a>          =     esi &amp; 0xFFFF;
<a name="l00079"></a>00079   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#a52b515706cd37e166c8eba348d5e68b">edi</a>          =     edi &amp; 0xFFFF;
<a name="l00080"></a>00080   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#cd97dd6f6eabd83c0b819b6058b7041d">es</a>           =      es &amp; 0xFFFF;
<a name="l00081"></a>00081   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#6d9085ec5af0fa1fe1de7015ad99c9e3">cs</a>           = segment &amp; 0xFFFF;
<a name="l00082"></a>00082   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#340a29782d3306ba84176c543725d70a">ss</a>           =  0<a class="code" href="ap-boot_8S.html#f78b91f02427adef14bb8b28aa93baa5">x1000</a> &amp; 0xFFFF;
<a name="l00083"></a>00083   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#01ee01c7f45c9b9ee2ad8338c21e6d33">ds</a>           =      ds &amp; 0xFFFF;
<a name="l00084"></a>00084   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#8114a585123181ec835f8db3e029d390">fs</a>           =     0x0 &amp; 0xFFFF;
<a name="l00085"></a>00085   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#8dfa44423504293405785371d0e7b076">gs</a>           =     0x0 &amp; 0xFFFF;
<a name="l00086"></a>00086   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#d7b6a367e1c2a38e1ee6c8e5dad955f7">ldt</a>          =     0x0 &amp; 0xFFFF;
<a name="l00087"></a>00087   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#52ac0b54c6b2c71450c62d7fc911f2e2">trace_bitmap</a> =     0x0 &amp; 0xFFFF;
<a name="l00088"></a>00088   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#611a0a044f99f092ace469ce2381bb33">io_map</a>       =     0x0 &amp; 0xFFFF;
<a name="l00089"></a>00089   newProcess-&gt;<a class="code" href="structtaskStruct.html#4c8accd7c0d5bb5ce426dc982bfc8519">tss</a>.<a class="code" href="structtssStruct.html#611a0a044f99f092ace469ce2381bb33">io_map</a>       = <span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structtssStruct.html">tssStruct</a>)-8192;
<a name="l00090"></a>00090   newProcess-&gt;<a class="code" href="structtaskStruct.html#0933c70230d4ac8bc9953640c979f8d7">oInfo</a>.<a class="code" href="structosInfo.html#befa906e51d2b28b2475a74e16219ded">v86Task</a>    = 0x1;
<a name="l00091"></a>00091 
<a name="l00092"></a>00092   newProcess-&gt;<a class="code" href="structtaskStruct.html#b085a40e09975d9ebf55b393f9549710">state</a> = <a class="code" href="sched_8h.html#3fb333b67375561d327e9b5a8ffa03b96564f2f3e15be06b670547bbcaaf0798">READY</a>;
<a name="l00093"></a>00093 
<a name="l00094"></a>00094   <span class="keywordflow">while</span> (newProcess-&gt;<a class="code" href="structtaskStruct.html#b085a40e09975d9ebf55b393f9549710">state</a> &gt; 0);
<a name="l00095"></a>00095 
<a name="l00096"></a>00096   <span class="keywordflow">return</span>;
<a name="l00097"></a>00097   }    
<a name="l00098"></a>00098 
<a name="l00099"></a>00099 <span class="comment">/***</span>
<a name="l00100"></a>00100 <span class="comment"> END</span>
<a name="l00101"></a>00101 <span class="comment"> ***/</span>
<a name="l00102"></a>00102 
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Dec 15 11:18:55 2006 for UbixOS V2 by&nbsp;
<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>