/[gxemul]/trunk/doc/experiments.html
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/doc/experiments.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 14 by dpavlin, Mon Oct 8 16:18:51 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 4  Line 4 
4  <table border=0 width=100% bgcolor="#d0d0d0"><tr>  <table border=0 width=100% bgcolor="#d0d0d0"><tr>
5  <td width=100% align=center valign=center><table border=0 width=100%><tr>  <td width=100% align=center valign=center><table border=0 width=100%><tr>
6  <td align="left" valign=center bgcolor="#d0efff"><font color="#6060e0" size="6">  <td align="left" valign=center bgcolor="#d0efff"><font color="#6060e0" size="6">
7  <b>Gavare's eXperimental Emulator:&nbsp;&nbsp;&nbsp;</b></font>  <b>Gavare's eXperimental Emulator:</b></font><br>
8  <font color="#000000" size="6"><b>Experimenting with GXemul</b>  <font color="#000000" size="6"><b>Experimenting with GXemul</b>
9  </font></td></tr></table></td></tr></table><p>  </font></td></tr></table></td></tr></table><p>
10    
11  <!--  <!--
12    
13  $Id: experiments.html,v 1.92 2005/09/18 19:54:12 debug Exp $  $Id: experiments.html,v 1.110 2007/06/15 18:07:08 debug Exp $
14    
15  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.  Copyright (C) 2003-2007  Anders Gavare.  All rights reserved.
16    
17  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
18  modification, are permitted provided that the following conditions are met:  modification, are permitted provided that the following conditions are met:
# Line 65  that you do two things: Line 65  that you do two things:
65    
66  <p>  <p>
67  <ul>  <ul>
68    <li>Build and install a cross-compiler for MIPS.    <li>Build and install a cross-compiler for your chosen target,
69    <li>Compile this hello world program, and run it in the emulator.          e.g. <tt>mips64-unknown-elf</tt>.
70  </ul>          GCC is usually a good compiler choice, because it is portable
71            and in wide-spread use. (Other compilers should work too.)
 <p>  
 <table border="0"><tr><td width="40">&nbsp;</td><td>  
 <pre>  
 <font color=#f00000>/*  Hello world for GXemul  */  
   
 /*  Note: The cast to a signed int causes the address to be sign-extended  
     correctly to 0xffffffffb00000xx when compiled in 64-bit mode  */  
 </font><font color=#a0a0a0>#define      PUTCHAR_ADDRESS         ((signed int)0xb0000000)  
 #define HALT_ADDRESS            ((signed int)0xb0000010)  
   
 </font><font color=#c000c0>void </font><font color=#000000><a name="printchar">printchar</a>(</font><font color=#c000c0>char </font><font color=#000000>ch)  
 {  
         *((</font><font color=#c000c0>volatile unsigned char </font><font color=#000000>*) PUTCHAR_ADDRESS) = ch;  
 }  
   
 </font><font color=#c000c0>void </font><font color=#000000><a name="halt">halt</a>(</font><font color=#c000c0>void</font><font color=#000000>)  
 {  
         *((</font><font color=#c000c0>volatile unsigned char </font><font color=#000000>*) HALT_ADDRESS) = 0;  
 }  
   
 </font><font color=#c000c0>void </font><font color=#000000><a name="printstr">printstr</a>(</font><font color=#c000c0>char </font><font color=#000000>*s)  
 {  
         </font><font color=#c000c0>while </font><font color=#000000>(*s)  
                 printchar(*s++);  
 }  
   
 </font><font color=#c000c0>void </font><font color=#000000>f(</font><font color=#c000c0>void</font><font color=#000000>)  
 {  
         printstr(</font><font color=#00c000>"Hello world\n"</font><font color=#000000>);  
         halt();  
 }  
 </font></pre>  
 </td></tr></table>  
   
 <p>(This hello world program is available here as well:  
 <a href="hello_mips.c"><tt>hello_mips.c</tt></a>)  
   
 <p>I recommend that you build a GCC cross compiler for the  
 <b>mips64-unknown-elf</b> target, and install it. Other compilers could  
 work too, but GCC is good because of its portability. Then try to compile  
 and link the hello world program:  
 <pre>  
         $ <b>mips64-unknown-elf-gcc -O2 hello_mips.c -mips4 -mabi=64 -c</b>  
         $ <b>mips64-unknown-elf-ld -Ttext 0xa800000000030000 -e f hello_mips.o -o hello_mips --oformat=elf64-bigmips</b>  
         $ <b>file hello_mips</b>  
         hello_mips: ELF 64-bit MSB mips-4 executable, MIPS R3000_BE, version 1 (SYSV), statically linked, not stripped  
         $ <b>gxemul -q -E testmips hello_mips</b>  
         Hello world  
   
         $ <b>mips64-unknown-elf-gcc -O2 hello_mips.c -c</b>  
         $ <b>mips64-unknown-elf-ld -Ttext 0x80030000 -e f hello_mips.o -o hello_mips</b>  
         $ <b>file hello_mips</b>  
         hello_mips: ELF 32-bit MSB mips-3 executable, MIPS R3000_BE, version 1 (SYSV), statically linked, not stripped  
         $ <b>gxemul -q -E testmips hello_mips</b>  
         Hello world  
 </pre>  
72    
73  <p>    <p>
74  As you can see above, a GCC configured for mips64-unknown-elf can produce    <li>Compile the Hello World demo program for your chosen target, and run
75  both 64-bit and 32-bit binaries. If you don't want to run the entire          it in the emulator.
76  Hello World program, but want to single-step through the execution to  </ul>
 learn more about how MIPS programs run, then add -V to the command line:  
77    
78  <p>  <p>The Hello World demo program is included in the GXemul source
79  <pre>  code distribution, in the <a href="../demos/hello/"><tt>demos/hello/</tt></a>
80          $ <b>gxemul -V -E testmips hello_mips</b>  subdirectory. The README files in the demo directories have several
81          ..  examples of how the demo programs can be built.
         GXemul&gt; <b>r</b>  
         cpu0:    pc = a800000000030078    <f>  
         cpu0:    hi = 0000000000000000    lo = 0000000000000000  
         cpu0:    zr = 0000000000000000    at = 0000000000000000  
         cpu0:    v0 = 0000000000000000    v1 = 0000000000000000  
         ..  
         cpu0:    gp = a8000000000780c0    sp = ffffffffa0007f00  
         cpu0:    fp = 0000000000000000    ra = 0000000000000000  
         GXemul&gt; <b>s 15</b>  
         &lt;f&gt;  
         a800000000030078: 67bdfff0      daddiu  sp,sp,-16  
         a80000000003007c: 3c04a800      lui     a0,0xa800  
         a800000000030080: 3c010003      lui     at,0x3  
         a800000000030084: 64840000      daddiu  a0,a0,0  
         a800000000030088: 642100b8      daddiu  at,at,184  
         a80000000003008c: 0004203c      dsll32  a0,a0,0  
         a800000000030090: 0081202d      daddu   a0,a0,at  
         a800000000030094: ffbf0000      sd      ra,0(sp)  [0xffffffffa0007ef0, data=0x0000000000000000]  
         a800000000030098: 0c00c00a      jal     0xa800000000030028 &lt;printstr&gt;  
         a80000000003009c: 00000000 (d)  nop  
           &lt;printstr("Hello world\n",0,0,0,..)&gt;  
         &lt;printstr&gt;  
         a800000000030028: 67bdfff0      daddiu  sp,sp,-16  
         a80000000003002c: ffb00000      sd      s0,0(sp)  [0xffffffffa0007ee0, data=0x0000000000000000]  
         a800000000030030: ffbf0008      sd      ra,8(sp)  [0xffffffffa0007ee8, data=0xa8000000000300a0]  
         a800000000030034: 90820000      lbu     v0,0(a0)  [0xa8000000000300b8 = $LC0, data=0x48]  
         a800000000030038: 00021600      sll     v0,v0,24  
         GXemul&gt; <b>print v0</b>  
         v0 = 0x0000000048000000  
         GXemul&gt; <b>_</b>  
 </pre>  
   
 <p>The syntax of the single-step debugger shouldn't be too hard to grasp.  
 Type "<tt>s</tt>" to single-step one instruction. For some commands (e.g.  
 the single-step command), just pressing enter on a blank line will cause  
 the last command to be repeated. Type "<tt>quit</tt>" to quit.  
82    
83  <p>  <p>Hopefully this is enough to get you inspired. :-)
 Hopefully this is enough to get you inspired. :-)  
84    
85    
86    
# Line 198  following experimental devices: Line 104  following experimental devices:
104    
105    <tr>    <tr>
106      <td align="left" valign="top" width="200">      <td align="left" valign="top" width="200">
107          <b><tt>cons</tt>:</b>          <a name="expdevices_cons"><b><tt>cons</tt>:</b></a>
108          <p>A simple console device, for writing          <p>A simple console device, for writing
109          characters to the controlling terminal          characters to the controlling terminal
110          and receiving keypresses.          and receiving keypresses.
111          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_cons.c</tt></font>          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_cons.c</tt></font>
112            <p>Include file:&nbsp;&nbsp;<font color="#0000f0"><tt>dev_cons.h</tt></font>
113          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x10000000</font>          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x10000000</font>
114      </td>      </td>
115      <td align="left" valign="top" width="25">&nbsp;</td>      <td align="left" valign="top" width="25">&nbsp;</td>
# Line 234  following experimental devices: Line 141  following experimental devices:
141    
142    <tr>    <tr>
143      <td align="left" valign="top">      <td align="left" valign="top">
144          <b><tt>mp</tt>:</b>          <a name="expdevices_mp"><b><tt>mp</tt>:</b></a>
145          <p>This device controls the behaviour of CPUs in an emulated          <p>This device controls the behaviour of CPUs in an emulated
146          multi-processor system.          multi-processor system.
147          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_mp.c</tt></font>          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_mp.c</tt></font>
148            <p>Include file:&nbsp;&nbsp;<font color="#0000f0"><tt>dev_mp.h</tt></font>
149          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x11000000</font>          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x11000000</font>
150      </td>      </td>
151      <td></td>      <td></td>
# Line 271  following experimental devices: Line 179  following experimental devices:
179            <tr>            <tr>
180              <td align="left" valign="top"><tt>0x0040</tt></td>              <td align="left" valign="top"><tt>0x0040</tt></td>
181              <td align="left" valign="top">Write: <b><tt>pause_addr(addr)</tt></b>.              <td align="left" valign="top">Write: <b><tt>pause_addr(addr)</tt></b>.
182                  Sets the pause address. (TODO: This is not                  Sets the pause address. (NOTE: This is not
183                  used anymore?)</td>                  used anymore.)</td>
184            </tr>            </tr>
185            <tr>            <tr>
186              <td align="left" valign="top"><tt>0x0050</tt></td>              <td align="left" valign="top"><tt>0x0050</tt></td>
187              <td align="left" valign="top">Write: <b><tt>pause_cpu(i)</tt></b>.              <td align="left" valign="top">Write: <b><tt>pause_cpu(i)</tt></b>.
188                  Stops all CPUs <i>except</i> CPU i.</td>                  Pauses all CPUs <i>except</i> CPU i.</td>
189            </tr>            </tr>
190            <tr>            <tr>
191              <td align="left" valign="top"><tt>0x0060</tt></td>              <td align="left" valign="top"><tt>0x0060</tt></td>
192              <td align="left" valign="top">Write: <b><tt>unpause_cpu(i)</tt></b>.              <td align="left" valign="top">Write: <b><tt>unpause_cpu(i)</tt></b>.
193                  Unpauses all CPUs <i>except</i> CPU i.</td>                  Unpauses CPU i.</td>
194            </tr>            </tr>
195            <tr>            <tr>
196              <td align="left" valign="top"><tt>0x0070</tt></td>              <td align="left" valign="top"><tt>0x0070</tt></td>
# Line 313  following experimental devices: Line 221  following experimental devices:
221                  the specified one.</td>                  the specified one.</td>
222            </tr>            </tr>
223            <tr>            <tr>
224              <td align="left" valign="top">0x00c0</tt></td>              <td align="left" valign="top"><tt>0x00c0</tt></td>
225              <td align="left" valign="top">Read: <b><tt>ipi_read()</tt></b>.              <td align="left" valign="top">Read: <b><tt>ipi_read()</tt></b>.
226                  Returns the next pending IPI. 0 is returned if there is no                  Returns the next pending IPI. 0 is returned if there is no
227                  pending IPI (so 0 shouldn't be used for valid IPIs).                  pending IPI (so 0 shouldn't be used for valid IPIs).
# Line 322  following experimental devices: Line 230  following experimental devices:
230                  Clears the IPI queue, discarding any pending IPIs.</td>                  Clears the IPI queue, discarding any pending IPIs.</td>
231            </tr>            </tr>
232            <tr>            <tr>
233              <td align="left" valign="top">0x00d0</tt></td>              <td align="left" valign="top"><tt>0x00d0</tt></td>
234              <td align="left" valign="top">Read: <b><tt>ncycles()</tt></b>.              <td align="left" valign="top">Read: <b><tt>ncycles()</tt></b>.
235                  Returns approximately the number of cycles executed.                  Returns approximately the number of cycles executed on
236                  Note: this value is not updated for every instruction,                  this CPU. Note: this value is not updated for every instruction,
237                  so it cannot be used for small measurements.</td>                  so it cannot be used for small measurements.</td>
238            </tr>            </tr>
239          </table>          </table>
# Line 338  following experimental devices: Line 246  following experimental devices:
246    
247    <tr>    <tr>
248      <td align="left" valign="top">      <td align="left" valign="top">
249          <b><tt>fb</tt>:</b>          <a name="expdevices_fb"><b><tt>fb</tt>:</b></a>
250          <p>A simple linear framebuffer, for graphics output.          <p>A simple linear framebuffer, for graphics output.
251          640 x 480 pixels, 3 bytes per pixel (red, green, blue, 8 bits each).          640 x 480 pixels, 3 bytes per pixel (red, green, blue, 8 bits each).
252          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_fb.c</tt></font>          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_fb.c</tt></font>
253            <p>Include file:&nbsp;&nbsp;<font color="#0000f0"><tt>dev_fb.h</tt></font>
254          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x12000000</font>          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x12000000</font>
255      </td>      </td>
256      <td></td>      <td></td>
# Line 366  following experimental devices: Line 275  following experimental devices:
275    
276    <tr>    <tr>
277      <td align="left" valign="top">      <td align="left" valign="top">
278          <b><tt>disk</tt>:</b>          <a name="expdevices_disk"><b><tt>disk</tt>:</b></a>
279          <p>Disk controller, which can read from and write          <p>Disk controller, which can read from and write
280          to disk images. It does not use interrupts; read and          to emulated IDE disks. It does not use interrupts; read and
281          write operations finish instantaneously.          write operations finish instantaneously.
282          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_disk.c</tt></font>          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_disk.c</tt></font>
283            <p>Include file:&nbsp;&nbsp;<font color="#0000f0"><tt>dev_disk.h</tt></font>
284          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x13000000</font>          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x13000000</font>
285      </td>      </td>
286      <td></td>      <td></td>
# Line 387  following experimental devices: Line 297  following experimental devices:
297            </tr>            </tr>
298            <tr>            <tr>
299              <td align="left" valign="top"><tt>0x0010</tt></td>              <td align="left" valign="top"><tt>0x0010</tt></td>
300              <td align="left" valign="top">Write: Select the SCSI ID to be used in the next              <td align="left" valign="top">Write: Select the IDE ID to be used in the next
301                  read/write operation.</td>                  read/write operation.</td>
302            </tr>            </tr>
303            <tr>            <tr>
# Line 415  following experimental devices: Line 325  following experimental devices:
325    
326    <tr>    <tr>
327      <td align="left" valign="top">      <td align="left" valign="top">
328          <b><tt>ether</tt>:</b>          <a name="expdevices_ether"><b><tt>ether</tt>:</b></a>
329          <p>A simple ethernet controller, enough to send          <p>A simple ethernet controller, enough to send
330          and receive packets on a simulated network.          and receive packets on a simulated network.
331          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_ether.c</tt></font>          <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_ether.c</tt></font>
332            <p>Include file:&nbsp;&nbsp;<font color="#0000f0"><tt>dev_ether.h</tt></font>
333          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x14000000</font>          <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x14000000</font>
334      </td>      </td>
335      <td></td>      <td></td>
# Line 457  following experimental devices: Line 368  following experimental devices:
368      </td>      </td>
369    </tr>    </tr>
370    
371      <tr height="15">
372        <td height="15">&nbsp;</td>
373      </tr>
374    
375      <tr>
376        <td align="left" valign="top">
377            <a name="expdevices_rtc"><b><tt>rtc</tt>:</b></a>
378            <p>A Real-Time Clock, used to retrieve the current time
379            and to cause periodic interrupts.
380            <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_rtc.c</tt></font>
381            <p>Include file:&nbsp;&nbsp;<font color="#0000f0"><tt>dev_rtc.h</tt></font>
382            <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x15000000</font>
383        </td>
384        <td></td>
385        <td align="left" valign="top">
386            <table border="0">
387              <tr>
388                <td align="left" valign="top"><i><u>Offset:</u></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
389                <td align="left" valign="top"><i><u>Effect:</u></i></td>
390              </tr>
391              <tr>
392                <td align="left" valign="top"><tt>0x0000</tt></td>
393                <td align="left" valign="top">Read or Write: Trigger a clock update (a gettimeofday() on the host).</td>
394              </tr>
395              <tr>
396                <td align="left" valign="top"><tt>0x0010</tt></td>
397                <td align="left" valign="top">Read: Seconds since 1st January 1970</td>
398              </tr>
399              <tr>
400                <td align="left" valign="top"><tt>0x0020</tt></td>
401                <td align="left" valign="top">Read: Microseconds</td>
402              </tr>
403              <tr>
404                <td align="left" valign="top"><tt>0x0100</tt></td>
405                <td align="left" valign="top">Read: Get the current
406                    timer interrupt frequency.<br>Write: Set the timer
407                    interrupt frequency. (Writing 0 disables the timer.)</td>
408              </tr>
409              <tr>
410                <td align="left" valign="top"><tt>0x0110</tt></td>
411                <td align="left" valign="top">Read or Write: Acknowledge
412                    one timer interrupt. (Note that if multiple interrupts
413                    are pending, only one is acknowledged.)</td>
414              </tr>
415            </table>
416        </td>
417      </tr>
418    
419      <tr height="15">
420        <td height="15">&nbsp;</td>
421      </tr>
422    
423      <tr>
424        <td align="left" valign="top">
425            <a name="expdevices_irqc"><b><tt>irqc</tt>:</b></a>
426            <p>An Interrupt Controller. (Note: Not used for the MIPS test machine.)
427            <p>Source code:&nbsp;&nbsp;<font color="#0000f0"><tt>src/devices/dev_irqc.c</tt></font>
428            <p>Include file:&nbsp;&nbsp;<font color="#0000f0"><tt>dev_irqc.h</tt></font>
429            <br>Default physical address:&nbsp&nbsp;<font color="#0000f0">0x16000000</font>
430        </td>
431        <td></td>
432        <td align="left" valign="top">
433            <table border="0">
434              <tr>
435                <td align="left" valign="top"><i><u>Offset:</u></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
436                <td align="left" valign="top"><i><u>Effect:</u></i></td>
437              </tr>
438              <tr>
439                <td align="left" valign="top"><tt>0x0</tt></td>
440                <td align="left" valign="top">Read: IRQ status as a 32-bit word, one bit per interrupt source.</td>
441              </tr>
442              <tr>
443                <td align="left" valign="top"><tt>0x4</tt></td>
444                <td align="left" valign="top">Write: Mask one interrupt source. Value should be an integer 0..31.</td>
445              </tr>
446              <tr>
447                <td align="left" valign="top"><tt>0x8</tt></td>
448                <td align="left" valign="top">Write: Unmask one interrupt source. Value should be an integer 0..31.</td>
449              </tr>
450            </table>
451        </td>
452      </tr>
453    
454  </table></center>  </table></center>
455    
456  <p>  <p>The include files for the test machine devices are found in
457  While these devices may resemble real-world hardware, they are  <a href="../src/include/testmachine/"><tt>src/include/testmachine/</tt></a>.
458    
459    <p>While these devices may resemble real-world hardware, they are
460  intentionally made simpler to use. (An exception is the framebuffer;  intentionally made simpler to use. (An exception is the framebuffer;
461  some machines actually have simple linear framebuffers like this.)  some machines actually have simple linear framebuffers like this.)
462    
# Line 470  means that it can be accessed at virtual Line 466  means that it can be accessed at virtual
466  <tt>0xffffffff90000000</tt> too, but devices should usually be accessed in  <tt>0xffffffff90000000</tt> too, but devices should usually be accessed in
467  a non-cached manner.)  a non-cached manner.)
468    
469  <p> (When using the PPC test machine (<tt>testppc</tt>), the addresses are  <p>When using the ARM or PPC test machines, the addresses are
470  <tt>0x10000000</tt>, <tt>0x11000000</tt> etc., so no need to add any  <tt>0x10000000</tt>, <tt>0x11000000</tt> etc., so no need to add any
471  virtual displacement.)  virtual displacement.
472    
473  <p>The <b><tt>mp</tt></b>, <b><tt>disk</tt></b>, and <b><tt>ether</tt></b>  <p>The <tt>mp</tt>, <tt>disk</tt>, and <tt>ether</tt> devices are agnostic
474  devices are agnostic when it comes to word-length. For example, when  when it comes to word-length. For example, when reading offset
475  reading offset <tt>0x0000</tt> of the <b><tt>mp</tt></b>  <tt>0x0000</tt> of the <tt>mp</tt> device, you may use any kind of read
476  device, you may use any kind of read (an 8-bit read will work just as well  (an 8-bit read will work just as well as a 64-bit read, although the value
477  as a 64-bit read, although the value will be truncated to 8 bits in the  will be truncated to 8 bits in the first case). You can <i>not</i>,
478  first case). You can <i>not</i>, however, read one byte from <tt>0x0000</tt>  however, read one byte from <tt>0x0000</tt> and one from <tt>0x0001</tt>,
479  and one from <tt>0x0001</tt>, and combine the result. The read from  and combine the result. The read from <tt>0x0001</tt> will be invalid.
 <tt>0x0001</tt> will be invalid.  
480    
481  <p>The <b><tt>cons</tt></b> device should be accessed using 8-bit reads  <p>The <tt>cons</tt> device should be accessed using 8-bit reads
482  and writes. Doing a getchar() (ie reading from offset <tt>0x00</tt>)    and writes. Doing a getchar() (ie reading from offset <tt>0x00</tt>)  
483  returns <tt>0</tt> if no character was available.  returns <tt>0</tt> if no character was available. Whenever a character is
484    available, the <tt>cons</tt> device' interrupt is asserted. When there are
485  <p>On MIPS, the <b><tt>cons</tt></b> device is hardwired to interrupt 2  no more available characters, the interrupt is deasserted. (Remember that
486  (the lowest hardware interrupt). Whenever a character is available, the  the interrupt has to be unmasked to be able to actually cause an
487  interrupt is asserted. When there are no more available characters, the  interrupt.)
488  interrupt is deasserted. (Remember that the interrupt has to be enabled in  
489  the status register of the system coprocessor.)  <p>IPIs (inter-processor interrupts) are controlled by the <tt>mp</tt>
490    device. Whenever an IPI is "sent" from a source to one or more target
491  <p>The <b><tt>ether</tt></b> device is hardwired to interrupt 3.  CPUs, the interrupt is asserted on the target CPUs, and the IPI number is
492    added last in the IPI queue for each of the target CPUs. It is then up to
493  <p>The IPIs controlled by the <b><tt>mp</tt></b> device are hardwired to  those CPUs to individually read from offset <tt>0x00c0</tt>, to figure out
494  interrupt 6. Whenever an IPI is "sent", interrupt 6 is asserted on the  what kind of IPI it was.
 target CPU(s), and the IPI number is added last in the IPI queue for that  
 CPU. It is then up to that CPU to read from offset <tt>0x00c0</tt>, to  
 figure out what kind of IPI it was.  
   
 <p>A simple tutorial on how to use the <tt>disk</tt> device, if not clear  
 from the description above, can be found here: <a  
 href="test_disk.c"><tt>test_disk.c</tt></a>  
   
495    
496    
497    
498    <p>Interrupt mappings are as follows:
499    
500    <p><center>
501    <table border="1">
502            <tr><td align="center">
503                    <b><tt>testmips</tt></b> (as native MIPS interrupts)
504            </td></tr>
505            <tr><td>
506                    <table border="0">
507                    <tr><td align="center">IRQ:</td><td>&nbsp;</td>
508                            <td>Used for:</td></tr>
509                    <tr><td align="center">7</td><td></td>
510                            <td>MIPS count/compare interrupt</td></tr>
511                    <tr><td align="center">6</td><td></td>
512                            <td><tt>mp</tt> (inter-processor interrupts)</td></tr>
513                    <tr><td align="center">4</td><td></td>
514                            <td><tt>rtc</tt></td></tr>
515                    <tr><td align="center">3</td><td></td>
516                            <td><tt>ether</tt></td></tr>
517                    <tr><td align="center">2</td><td></td>
518                            <td><tt>cons</tt></td></tr>
519                    </table>
520            </td></tr>
521    </table>
522    
523    <p><table border="1">
524            <tr><td align="center">
525                    <b><tt>testarm</tt> and others</b> (via the <tt>irqc</tt> device)
526            </td></tr>
527            <tr><td>
528                    <table border="0">
529                    <tr><td align="center">IRQ:</td><td>&nbsp;</td>
530                            <td>Used for:</td></tr>
531                    <tr><td align="center">6</td><td></td>
532                            <td><tt>mp</tt> (inter-processor interrupts)</td></tr>
533                    <tr><td align="center">4</td><td></td>
534                            <td><tt>rtc</tt></td></tr>
535                    <tr><td align="center">3</td><td></td>
536                            <td><tt>ether</tt></td></tr>
537                    <tr><td align="center">2</td><td></td>
538                            <td><tt>cons</tt></td></tr>
539                    </table>
540            </td></tr>
541    </table>
542    </center>
543    
544    
545    
546    <p><br>
   
 <!--  
   
       <li><a href="http://www-2.cs.cmu.edu/afs/cs/project/mach/public/www/mach.html">Mach</a>:  
         <br>Important! Run <b><tt>./configure --caches; make</tt></b>  
         <br>Also important: This is broken right now. :-(  
         <br>Download <a href="http://lost-contact.mit.edu/afs/athena/user/d/a/daveg/Info/Links/Mach/src/release/">http://lost-contact.mit.edu/afs/athena/user/d/a/daveg/Info/Links/Mach/src/release</a>/<a href="http://lost-contact.mit.edu/afs/athena/user/d/a/daveg/Info/Links/Mach/src/release/pmax.tar.Z">pmax.tar.Z</a>  
         <br><tt><b>tar xfvz pmax.tar.Z pmax_mach/special/mach.boot.MK83.STD+ANY</b></tt>  
         <br><tt><b>gxemul -e 3max -X pmax_mach/special/mach.boot.MK83.STD+ANY</b></tt>  
     </ul>  
   </li>  
   
   <p>  
   
   <li>SGI:  
       <li>Linux/SGI:  
         <br>Some kernels are available here: <a href="http://www.linux-mips.org/~glaurung/">http://www.linux-mips.org/~glaurung/</a>  
         <br>Try running with <b><tt>-e ip32 -X</tt></b> for a graphical framebuffer, or  
                 <b><tt>-e ip32 -o 'console=ttyS0'</tt></b> for serial console.  
         <br>Adding <b><tt>-b</tt></b> (bintrans) might work sometimes.  
         <br>(You need to add <b><tt>-CR5000</tt></b> if you're trying to run  
                 a kernel compiled for R5000, because Linux doesn't autodetect  
                 the CPU type at runtime.)  
         <br>Also: <a href="http://www.tal.org/~milang/o2/kernels/">http://www.tal.org/~milang/o2/kernels</a>/<a href="http://home.tal.org/~milang/o2/kernels/vmlinux64-2.6.8.1-IP32">vmlinux64-2.6.8.1-IP32</a>  
         <br>Try <b><tt>-e ip32 -X -CR5000 vmlinux64-2.6.8.1-IP32</tt></b>.  
         <br>And also some IP27 kernels:  
                 <a href="http://www.total-knowledge.com/progs/mips/kernels/vmlinux.ip27-20040428">http://www.total-knowledge.com/progs/mips/kernels/vmlinux.ip27-20040428</a>  
                 and  
                 <a href="http://www.total-knowledge.com/progs/mips/kernels/vmlinux.ip27-20040528.bz2">http://www.total-knowledge.com/progs/mips/kernels/vmlinux.ip27-20040528.bz2</a>  
                 (but unfortunately these lack symbols).  
         <br>Try the IP27 kernels with <b><tt>-e ip27 -t</tt></b>.  
       <p>  
       <li><a href="http://www.openbsd.org/sgi.html">OpenBSD/sgi</a>:  
         <br><a href="ftp://ftp.openbsd.org/pub/OpenBSD/3.7/sgi/bsd.rd">ftp://ftp.openbsd.org/pub/OpenBSD/3.7/sgi/bsd.rd</a>  
         <br>More recent snapshots can be found at <a href="ftp://ftp.OpenBSD.org/pub/OpenBSD/snapshots/sgi/">ftp://ftp.OpenBSD.org/pub/OpenBSD/snapshots/sgi/</a>.  
         <br>Try <b><tt>gxemul -e ip32 bsd.rd</tt></b>  
       <p>  
       <li><a href="http://www.freebsd.org/platforms/mips.html">FreeBSD/MIPS</a>:  
                 I don't think public binary snapshots are available yet.  
       <p>  
       <li>arcdiag:  
         <br>The NetBSD people have also made available an "arcdiag" for SGI-IP22:  
         <br><a href="ftp://ftp.netbsd.org/pub/NetBSD/arch/sgimips/arcdiag.ip22">ftp://ftp.netbsd.org/pub/NetBSD/arch/sgimips/arcdiag.ip22</a>  
         <br>Try running <tt><b>gxemul -e ip22 -x arcdiag.ip22</b></tt>.  
     </ul>  
   </li>  
   
   
   <li>ARC:  
       <li>Linux:  
         <br><a href="ftp://ftp.linux-mips.org/pub/linux/mips/mipsel-linux/boot/vmlinux-m700-2.1.131.gz">ftp://ftp.linux-mips.org/pub/linux/mips/mipsel-linux/boot/vmlinux-m700-2.1.131.gz</a>  
         <br>gunzip, and run with <b><tt>-v -J -X -N -e m700</tt></b> (Olivetti M700)  
         <br>(This probably doesn't work anymore.)  
       <p>  
       <li>Pandora:  
         <br><a href="ftp://ftp.linux-mips.org/pub/linux/mips/ancient/milo/">ftp://ftp.linux-mips.org/pub/linux/mips/ancient/milo</a>/<a href="ftp://ftp.linux-mips.org/pub/linux/mips/ancient/milo/milo-0.27.1.tar.gz">milo-0.27.1.tar.gz</a>  
         <br>A generic test/diagnostics program for ARC-based machines.  
         <br>Run with <b><tt>-e r94 milo-0.27.1/pandora</tt></b>  
       <p>  
       <li>arcdiag:  
         <br>Precompiled binary:<a href="ftp://ftp.netbsd.org/pub/NetBSD/arch/arc/arcdiag">ftp://ftp.netbsd.org/pub/NetBSD/arch/arc/arcdiag</a>  
         <br>(alternative: <a href="http://www.sensi.org/~alec/mips/arcdiag">http://www.sensi.org/~alec/mips/arcdiag</a>)  
         <br>A generic test/diagnostics program for ARC-based machines.  
         <br>Run with <b><tt>-e pica arcdiag</tt></b> (or some other ARC mode).  
         <br>Example arcdiag output (from real machines):  
         <br><a href="http://mail-index.netbsd.org/port-arc/2000/10/18/0001.html">http://mail-index.netbsd.org/port-arc/2000/10/18/0001.html</a> (Olivetti M700-10)  
         <br><a href="http://www.sensi.org/~alec/mips/arcdiag.txt">http://www.sensi.org/~alec/mips/arcdiag.txt</a> (PICA-61)  
         <br><a href="http://mail-index.netbsd.org/port-arc/2000/10/14/0000.html">http://mail-index.netbsd.org/port-arc/2000/10/14/0000.html</a> (Deskstation Tyne)  
         <br><a href="http://mail-index.netbsd.org/port-arc/2004/02/01/0001.html">http://mail-index.netbsd.org/port-arc/2004/02/01/0001.html</a> (NEC RISCserver 4200)  
         <br><a href="http://mirror.aarnet.edu.au/pub/NetBSD/misc/chs/arcdiag.out">http://mirror.aarnet.edu.au/pub/NetBSD/misc/chs/arcdiag.out</a> (NEC-R96)  
         <br>For some machines, such as <tt><b>-e pica</b></tt>, you can  
                 add <b><tt>-X</tt></b> to boot with a graphical VGA-style  
                 console. This however is probably a bit unstable and/or  
                 broken right now.  
       <p>  
       <li>Windows NT:  
         <br>Put a "Windows NT 4.0 for MIPS" CDROM (or similar) into  
                 your CDROM drive. (On FreeBSD systems, it is usually called  
                 /dev/cd0c or similar. Change that to whatever the CDROM  
                 is called on your system, or the name of a raw .iso image.)  
         <br>I have tried this with the Swedish version, but it might  
                 work with other versions too.<pre>  
         $ <b><tt>dd if=/dev/zero of=winnt_test.img bs=1024 count=1 seek=999000</tt></b>  
         $ <b><tt>gxemul -X -e pica -d winnt_test.img -d bc6:/dev/cd0c -j MIPS\\ARCINST</tt></b>  
         $ <b><tt>gxemul -X -e pica -d winnt_test.img -d bc6:/dev/cd0c -j MIPS\\SETUPLDR</tt></b>  
 </pre>  <br><tt>ARCINST</tt> tries to prepare the disk image for installation. (It <i>almost</i> works.)  
         <br><tt>SETUPLDR</tt> should load some drivers from the cdrom, but then it crashes with a bluescreen.  
     </ul>  
   </li>  
   
   <p>  
   
   <li>HPCmips:  
       <li>Linux for BE300:  
         <br><a href="http://www.linux4.be/2004/linux4be20040908.zip">http://www.linux4.be/2004/linux4be20040908.zip</a>  
         <br>Try <b><tt>gxemul -X -e be300 vmlinux</tt></b>  
       <p>  
       <li>Linux for Agenda VR3:  
         <br>Download <a href="http://agenda-snow.sourceforge.net/kernel-old-versions/binary/">http://agenda-snow.sourceforge.net/kernel-old-versions/binary</a>/<a href="http://agenda-snow.sourceforge.net/kernel-old-versions/binary/root1.2.6.kernel-8.00">root1.2.6.kernel-8.00</a>  
         <br>and <a href="http://vr3.uid0.sk/cd/Software/VR3_Distributions/H2O/">http://vr3.uid0.sk/cd/Software/VR3_Distributions/H2O</a>/<a href="http://vr3.uid0.sk/cd/Software/VR3_Distributions/H2O/root1.2.6.cramfs">root1.2.6.cramfs</a>.  
         <br>(or <a href="http://www.ipsec.info/~www/agenda/dream-1-noxip.cramfs">http://www.ipsec.info/~www/agenda/dream-1-noxip.cramfs</a>)  
         <br>Try <b><tt>gxemul -X -e vr3 -x 0xbf200000:root1.2.6.cramfs 0xbf000000:0:0xbf0005e0:root1.2.6.kernel-8.00</tt></b>  
         <br>(or replace root1.2.6.cramfs with dream-1-noxip.cramfs)  
         <br>Remove <b><tt>-X</tt></b> to try with serial console instead of X, and  
                 remove <b><tt>-b</tt></b> to try without (old) bintrans.  
         <br>Add <b><tt>-o 'init=/bin/sh'</tt></b> to boot into a single-user shell.  
         <br>Add <b><tt>-o 'init=/sbin/restore_defaults'</tt></b> to run  
                 a <tt>/sbin/restore_defaults</tt> (attempt to initialize the  
                 flash memory).  
       <p>  
       <li>Linux for MobilePro etc.:  
         <br><a href="http://pc1.peanuts.gr.jp/~kei/Hard-Float/Kernels/">http://pc1.peanuts.gr.jp/~kei/Hard-Float/Kernels/</a>  
         <br>Uncompress the archive to get a kernel, vmlinux-800 for example.  
         <br>Try <b><tt>./gxemul -X -o 'root=/dev/hda1' -d r:disk.img -d r:disk.img -e mobilepro800 vmlinux-800</tt></b>  
         <br>where disk.img is an ext2fs filesystem with contents from  
         <a href="http://pc1.peanuts.gr.jp/~kei/Hard-Float/Miniroots/miniroot-20010330.tar.bz2">http://pc1.peanuts.gr.jp/~kei/Hard-Float/Miniroots/miniroot-20010330.tar.bz2</a>  
         <br>(Note the double disk arguments.)  
         <br>Note 2: This doesn't work yet.  
       <p>  
       <li><a href="http://www.disorder.ru/openbsd/be300/">OpenBSD/be300</a>:  
         <br><a href="http://www.disorder.ru/openbsd/be300/bsd.rd">http://www.disorder.ru/openbsd/be300/bsd.rd</a>  
         <br>Try <b><tt>gxemul -X -e be300 bsd.rd</tt></b>  
         <br>Note: bintrans might be buggy, so you can try with -B if you want to.  
     </ul>  
   </li>  
   
   <p>  
   
       <li>Linux:  
         <br><a href="http://people.debian.org/~pm/mips-cobalt/nfsroot/vmlinux_raq-2800.gz">http://people.debian.org/~pm/mips-cobalt/nfsroot/vmlinux_raq-2800.gz</a>  
         <br>gunzip, and run with <b><tt>-E cobalt</tt></b>  
         <p>  
         <br><a href="http://dev.gentoo.org/~kumba/mips/cobalt/netboot/cobalt-netboot-20040428.img.gz">http://dev.gentoo.org/~kumba/mips/</a>  
         <br>    <a href="http://dev.gentoo.org/~kumba/mips/cobalt/netboot/cobalt-netboot-20040428.img.gz">cobalt/netboot/cobalt-netboot-20040428.img.gz</a>  
         <br><b><tt>gxemul -E cobalt cobalt-netboot-20040428.img.gz</tt></b>  
       <p>  
       <li>CoLo:  
         <br><a href="http://www.colonel-panic.org/cobalt-mips/colo/colo-1.19.tar.gz">http://www.colonel-panic.org/cobalt-mips/colo/colo-1.19.tar.gz</a>  
         <br><tt><b>tar zxvf colo-1.19.tar.gz colo-1.19/binaries/colo-rom-image.bin</b></tt>  
         <br><tt><b>gxemul -Q -Ecobalt -v 0xbfc00000:colo-1.19/binaries/colo-rom-image.bin</b></tt>  
         <br>(This doesn't work yet.)  
   
       <p>  
       <li>Linux:  
         <br>A Linux kernel (2.2.21-pre1-xr7) is available from  
         <a href="http://playstation2-linux.com/projects/xrhino-kernel/">http://playstation2-linux.com/projects/xrhino-kernel/</a>  
         <br>Try running with <b><tt>-X -E playstation2</tt></b>  (<b><tt>-X</tt></b> is required, for the framebuffer).  
     </ul>  
   </li>  
   
   <p>  
   
   
   
 meshcube Linux:  
         <br>A Linux kernel is available from  
         <a href="http://www.meshcube.org/feed/stable/">http://www.meshcube.org/feed/stable</a>/<a href="http://www.meshcube.org/feed/stable/kernel-image-mtx_2.4.24-3_mipsel.ipk">kernel-image-mtx_2.4.24-3_mipsel.ipk</a>  
         <br>(This is a Debian package, you can use <tt><b>ar</b></tt> and  
                 <tt><b>tar</b></tt> to extract kernel.img from it.)  
         <br>Try running with <b><tt>-E meshcube 0x80800000:kernel.img</tt></b>.  
   
   <li><a href="http://www.seattlewireless.net/index.cgi/NetgearWG602">NetGear WG602</a>:  
       <li>Linux:  
         <br>A Linux kernel is available from  
         <a href="ftp://downloads.netgear.com/files/wg602_v1715.zip">ftp://downloads.netgear.com/files/wg602_v1715.zip</a>  
         <br>(Unzip wg602_v1715.zip to get WG602_V1715.img.)  
         <br>Try running with <b><tt>-E netgear 0xbfc80000:0x40:WG602_V1715.img</tt></b>.  
         <br>(It takes some time to decompress the kernel, so be patient.)  
         <br>(This doesn't really work yet.)  
   
   
       <li>Linux:  
         <br><a href="http://jocelyn.mayer.free.fr/qemu-ppc/linux_images/2.4.25-PPC/vmlinux">http://jocelyn.mayer.free.fr/qemu-ppc/linux_images/2.4.25-PPC/vmlinux</a>  
         <br><tt><b>gxemul -E prep -v -t vmlinux</b></tt>  
   
       <li><a href="http://www.bebox.nu/os.php?s=os/linux/index">Linux/bebox</a>:  
         <br><a href="http://www.bebox.nu/files/linux/BeBox-scsi-980610.gz">http://www.bebox.nu/files/linux/BeBox-scsi-980610.gz</a>  
         <br><tt><b>gunzip BeBox-scsi-980610.gz</b></tt>  
         <br><tt><b>gxemul -E bebox 0x3100:0x400:BeBox-scsi-980610</b></tt>  
   
 -->  
   
547    
548    
549    

Legend:
Removed from v.14  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26