/[gxemul]/trunk/src/devices/dev_sgi_ip19.c
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/src/devices/dev_sgi_ip19.c

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

revision 41 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_sgi_ip19.c,v 1.18 2006/12/30 13:30:59 debug Exp $   *  $Id: dev_sgi_ip19.c,v 1.19 2007/06/15 19:57:34 debug Exp $
29   *     *  
30   *  SGI IP19 (and IP25) stuff.  The stuff in here is mostly guesswork.   *  COMMENT: SGI IP19 (and IP25) stuff
31     *
32     *  NOTE/TODO: The stuff in here is mostly guesswork.
33   */   */
34    
35  #include <stdio.h>  #include <stdio.h>
# Line 48  struct sgi_ip19_data { Line 50  struct sgi_ip19_data {
50  };  };
51    
52    
 /*  
  *  dev_sgi_ip19_access():  
  */  
53  DEVICE_ACCESS(sgi_ip19)  DEVICE_ACCESS(sgi_ip19)
54  {  {
55          struct sgi_ip19_data *d = (struct sgi_ip19_data *) extra;          struct sgi_ip19_data *d = extra;
56          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
57          int regnr;          int regnr;
58    
# Line 63  DEVICE_ACCESS(sgi_ip19) Line 62  DEVICE_ACCESS(sgi_ip19)
62          regnr = relative_addr / sizeof(uint32_t);          regnr = relative_addr / sizeof(uint32_t);
63    
64          switch (relative_addr) {          switch (relative_addr) {
65    
66          case 0x08:      /*  cpu id  */          case 0x08:      /*  cpu id  */
67                  if (writeflag == MEM_WRITE) {                  if (writeflag == MEM_WRITE) {
68                          debug("[ sgi_ip19: unimplemented write to address "                          debug("[ sgi_ip19: unimplemented write to address "
# Line 72  DEVICE_ACCESS(sgi_ip19) Line 72  DEVICE_ACCESS(sgi_ip19)
72                          odata = cpu->cpu_id;    /*  ?  TODO  */                          odata = cpu->cpu_id;    /*  ?  TODO  */
73                  }                  }
74                  break;                  break;
75    
76          case 0x200:     /*  cpu available mask?  */          case 0x200:     /*  cpu available mask?  */
77                  if (writeflag == MEM_WRITE) {                  if (writeflag == MEM_WRITE) {
78                          debug("[ sgi_ip19: unimplemented write to address "                          debug("[ sgi_ip19: unimplemented write to address "
# Line 82  DEVICE_ACCESS(sgi_ip19) Line 83  DEVICE_ACCESS(sgi_ip19)
83                          odata = ((1 << cpu->machine->ncpus) - 1) << 16;                          odata = ((1 << cpu->machine->ncpus) - 1) << 16;
84                  }                  }
85                  break;                  break;
86    
87          case 0x20000:   /*  cycle counter or clock  */          case 0x20000:   /*  cycle counter or clock  */
88                  if (writeflag == MEM_WRITE) {                  if (writeflag == MEM_WRITE) {
89                          debug("[ sgi_ip19: unimplemented write to address "                          debug("[ sgi_ip19: unimplemented write to address "
# Line 93  DEVICE_ACCESS(sgi_ip19) Line 95  DEVICE_ACCESS(sgi_ip19)
95                  }                  }
96    
97                  break;                  break;
98    
99          default:          default:
100                  if (writeflag == MEM_WRITE) {                  if (writeflag == MEM_WRITE) {
101                          debug("[ sgi_ip19: unimplemented write to address "                          debug("[ sgi_ip19: unimplemented write to address "
# Line 113  DEVICE_ACCESS(sgi_ip19) Line 116  DEVICE_ACCESS(sgi_ip19)
116    
117  DEVINIT(sgi_ip19)  DEVINIT(sgi_ip19)
118  {  {
119          struct sgi_ip19_data *d = malloc(sizeof(struct sgi_ip19_data));          struct sgi_ip19_data *d;
120          if (d == NULL) {  
121                  fprintf(stderr, "out of memory\n");          CHECK_ALLOCATION(d = malloc(sizeof(struct sgi_ip19_data)));
                 exit(1);  
         }  
122          memset(d, 0, sizeof(struct sgi_ip19_data));          memset(d, 0, sizeof(struct sgi_ip19_data));
123    
124          memory_device_register(devinit->machine->memory, devinit->name,          memory_device_register(devinit->machine->memory, devinit->name,

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

  ViewVC Help
Powered by ViewVC 1.1.26