/[gxemul]/trunk/doc/technical.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/technical.html

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

revision 19 by dpavlin, Mon Oct 8 16:18:51 2007 UTC revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC
# Line 10  Line 10 
10    
11  <!--  <!--
12    
13  $Id: technical.html,v 1.63 2005/10/07 15:10:00 debug Exp $  $Id: technical.html,v 1.67 2005/11/24 12:32:10 debug Exp $
14    
15  Copyright (C) 2004-2005  Anders Gavare.  All rights reserved.  Copyright (C) 2004-2005  Anders Gavare.  All rights reserved.
16    
# Line 112  different kinds of emulation, so these m Line 112  different kinds of emulation, so these m
112          not use host-specific backends, so it is not "recompilation" or          not use host-specific backends, so it is not "recompilation" or
113          anything like that.) Speed is slower than real binary translation,          anything like that.) Speed is slower than real binary translation,
114          but faster than traditional interpretation, and with some tricks          but faster than traditional interpretation, and with some tricks
115          it will hopefully still give reasonable speed. ARM emulation uses          it will hopefully still give reasonable speed. The ARM and PowerPC
116          this kind of translation, for example.          emulation modes uses this kind of translation.
117  </ul>  </ul>
118    
119    
# Line 318  a CDROM ISO image. You can use a read-wr Line 318  a CDROM ISO image. You can use a read-wr
318  files in both directions, but then you should be aware of the  files in both directions, but then you should be aware of the
319  fragmentation issue mentioned above.  fragmentation issue mentioned above.
320    
 <p>TODO: Write a section on how to connect multiple emulator instances.  
 (Using the <tt>local_port</tt> and <tt>add_remote</tt> configuration file  
 commands.)  
321    
322    
323    
# Line 331  commands.) Line 328  commands.)
328  <a name="devices"></a>  <a name="devices"></a>
329  <h3>Emulation of hardware devices</h3>  <h3>Emulation of hardware devices</h3>
330    
331  Each file in the <tt>src/device/</tt> directory is responsible for one  Each file called <tt>dev_*.c</tt> in the <tt>src/device/</tt> directory is
332  hardware device. These are used from <tt>src/machine.c</tt>, when  responsible for one hardware device. These are used from
333  initializing which hardware a particular machine model will be using, or  <tt>src/machine.c</tt>, when initializing which hardware a particular
334  when adding devices to a machine using the <tt>device()</tt> command in  machine model will be using, or when adding devices to a machine using the
335  configuration files.  <tt>device()</tt> command in configuration files.
   
 <p><font color="#ff0000">NOTE: The device registry subsystem is currently  
 in a state of flux, as it is being redesigned.</font>  
336    
337  <p>(I'll be using the name "<tt>foo</tt>" as the name of the device in all  <p>(I'll be using the name "<tt>foo</tt>" as the name of the device in all
338  these examples.  This is pseudo code, it might need some modification to  these examples.  This is pseudo code, it might need some modification to
# Line 374  actually compile and run.) Line 368  actually compile and run.)
368                    
369                  memory_device_register(devinit->machine->memory, devinit->name,                  memory_device_register(devinit->machine->memory, devinit->name,
370                      devinit->addr, DEV_FOO_LENGTH,                      devinit->addr, DEV_FOO_LENGTH,
371                      dev_foo_access, (void *)d, MEM_DEFAULT, NULL);                      dev_foo_access, (void *)d, DM_DEFAULT, NULL);
372                    
373                  /*  This should only be here if the device                  /*  This should only be here if the device
374                      has a tick function:  */                      has a tick function:  */
# Line 394  actually compile and run.) Line 388  actually compile and run.)
388                  /*  ...  */                  /*  ...  */
389          }          }
390  </pre><br>  </pre><br>
391            (There is an exception to this rule; ugly hacks which allow
392            code in <tt>src/machine.c</tt> to use some structures makes it
393            necessary to place the <tt>struct foo_data</tt> in
394            <tt>src/include/devices.h</tt> instead of in <tt>dev_foo.c</tt>
395            itself. This is useful for example for interrupt controllers.)
396      <p>
397    <li>If <tt>foo</tt> has a tick function (that is, something that needs to be    <li>If <tt>foo</tt> has a tick function (that is, something that needs to be
398          run at regular intervals) then <tt>FOO_TICKSHIFT</tt> and a tick          run at regular intervals) then <tt>FOO_TICKSHIFT</tt> and a tick
399          function need to be defined as well:          function need to be defined as well:
400  <pre>  <pre>
401          #define FOO_TICKSHIFT           10          #define FOO_TICKSHIFT           14
402    
403          void dev_foo_tick(struct cpu *cpu, void *extra)          void dev_foo_tick(struct cpu *cpu, void *extra)
404          {          {
# Line 412  actually compile and run.) Line 411  actually compile and run.)
411          }          }
412  </pre><br>  </pre><br>
413    
414      <li>Does this device belong to a standard bus?
415            <ul>
416              <li>If this device should be detectable as a PCI device, then
417                    glue code should be added to
418                    <tt>src/devices/bus_pci.c</tt>.
419              <li>If this is a legacy ISA device which should be usable by
420                    any machine which has an ISA bus, then the device should
421                    be added to <tt>src/devices/bus_isa.c</tt>.
422            </ul>
423      <p>
424    <li>And last but not least, the device should have an access function.    <li>And last but not least, the device should have an access function.
425          The access function is called whenever there is a load or store          The access function is called whenever there is a load or store
426          to an address which is in the device' memory mapped region.          to an address which is in the device' memory mapped region.

Legend:
Removed from v.19  
changed lines
  Added in v.20

  ViewVC Help
Powered by ViewVC 1.1.26