of.cc Source File

Back to the index.

of.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2012 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  * COMMENT: OpenFirmware emulation
29  *
30  * NOTE: This module is/was a quick hack, with the purpose of getting
31  * NetBSD/macppc to boot. If anything else boots using this hackish
32  * implementation of OpenFirmware, then that is a bonus.
33  *
34  ******************************************************************************
35  *
36  * NOTE: OpenFirmware is used on quite a variety of different hardware archs,
37  * at least POWER/PowerPC, ARM, and SPARC, so the code in this module
38  * must always remain architecture agnostic.
39  *
40  * NOTE: Some things, e.g. 32-bit integers as returned by the "getprop"
41  * service, are always fixed to big-endian. (According to the standard.)
42  *
43  * TODO: o) 64-bit OpenFirmware?
44  * o) More devices...
45  */
46 
47 #include <stdio.h>
48 #include <stdlib.h>
49 #include <string.h>
50 #include <sys/types.h>
51 
52 #define OF_C
53 
54 #include "console.h"
55 #include "cpu.h"
56 #include "device.h"
57 #include "devices.h"
58 #include "diskimage.h"
59 #include "machine.h"
60 #include "memory.h"
61 #include "misc.h"
62 #include "of.h"
63 
64 
65 /* #define debug fatal */
66 
67 extern int quiet_mode;
68 extern int verbose;
69 
70 
71 /*
72  * readstr():
73  *
74  * Helper function to read a string from emulated memory.
75  */
76 static void readstr(struct cpu *cpu, uint64_t addr, char *strbuf,
77  int bufsize)
78 {
79  int i;
80  for (i=0; i<bufsize; i++) {
81  unsigned char ch;
82  cpu->memory_rw(cpu, cpu->mem, addr + i,
83  &ch, sizeof(ch), MEM_READ, CACHE_DATA | NO_EXCEPTIONS);
84  strbuf[i] = '\0';
85  if (ch >= 1 && ch < 32)
86  ch = 0;
87  strbuf[i] = ch;
88  if (strbuf[i] == '\0')
89  break;
90  }
91 
92  strbuf[bufsize - 1] = '\0';
93 }
94 
95 
96 /*
97  * of_store_32bit_in_host():
98  *
99  * Store big-endian. OpenFirmware properties returned by getprop etc are
100  * always big-endian, even on little-endian machines.
101  */
102 static void of_store_32bit_in_host(unsigned char *d, uint32_t x)
103 {
104  d[0] = x >> 24; d[1] = x >> 16;
105  d[2] = x >> 8; d[3] = x;
106 }
107 
108 
109 /*
110  * find_device_handle():
111  *
112  * name may consist of multiple names, separated with slashes.
113  */
114 static int find_device_handle(struct of_data *ofd, const char *name)
115 {
116  int handle = 1, cur_parent = 1;
117 
118  if (name[0] == 0)
119  return 0;
120 
121  for (;;) {
122  struct of_device *od = ofd->of_devices;
123  char tmp[200];
124  int i;
125 
126  while (name[0] == '/')
127  name++;
128  if (name[0] == '\0')
129  break;
130  snprintf(tmp, sizeof(tmp), "%s", name);
131  i = 0;
132  while (tmp[i] != '\0' && tmp[i] != '/')
133  i++;
134  tmp[i] = '\0';
135 
136  OF_FIND(od, strcmp(od->name, tmp) == 0 &&
137  od->parent == cur_parent);
138  if (od == NULL)
139  return -1;
140 
141  handle = cur_parent = od->handle;
142  name += strlen(tmp);
143  }
144 
145  return handle;
146 }
147 
148 
149 /*****************************************************************************/
150 
151 
152 OF_SERVICE(call_method_2_2)
153 {
154  fatal("[ of: call_method_2_2('%s'): TODO ]\n", arg[0]);
155  return -1;
156 }
157 
158 
159 OF_SERVICE(call_method_3_4)
160 {
161  fatal("[ of: call_method_3_4('%s'): TODO ]\n", arg[0]);
162  return -1;
163 }
164 
165 
166 OF_SERVICE(call_method_5_2)
167 {
168  if (strcmp(arg[0], "set-colors") == 0) {
169  /* Used by OpenBSD/macppc: */
170  struct vfb_data *v = cpu->machine->md.of_data->vfb_data;
171  int color = OF_GET_ARG(3);
172  uint64_t ptr = OF_GET_ARG(4);
173  unsigned char rgb[3];
174  cpu->memory_rw(cpu, cpu->mem, ptr, rgb, 3, MEM_READ,
176  if (v != NULL) {
177  memcpy(v->rgb_palette + 3 * color, rgb, 3);
178  v->update_x1 = v->update_y1 = 0;
179  v->update_x2 = v->xsize - 1;
180  v->update_y2 = v->ysize - 1;
181  }
182  } else {
183  fatal("[ of: call_method_5_2('%s'): TODO ]\n", arg[0]);
184  return -1;
185  }
186  return 0;
187 }
188 
189 
190 OF_SERVICE(call_method_6_1)
191 {
192  fatal("[ of: call_method_6_1('%s'): TODO ]\n", arg[0]);
193  return -1;
194 }
195 
196 
197 OF_SERVICE(call_method_6_2)
198 {
199  fatal("[ of: call_method_6_2('%s'): TODO ]\n", arg[0]);
200  return -1;
201 }
202 
203 
205 {
206  struct of_device *od = cpu->machine->md.of_data->of_devices;
207  int handle = OF_GET_ARG(0);
208  OF_FIND(od, od->parent == handle);
209  store_32bit_word(cpu, base + retofs, od == NULL? 0 : od->handle);
210  return 0;
211 }
212 
213 
215 {
216  // Arguments: virtualaddr, size, alignment
217  // Returns: pointer to claimed memory
218 
219  // TODO: This is just a dummy.
220  fatal("[ of: claim(0x%x,0x%x,0x%x): TODO ]\n",
221  OF_GET_ARG(0), OF_GET_ARG(1), OF_GET_ARG(2));
222 
223  store_32bit_word(cpu, base + retofs, OF_GET_ARG(0));
224  return 0;
225 }
226 
227 
229 {
230  cpu->running = 0;
231  return 0;
232 }
233 
234 
235 OF_SERVICE(finddevice)
236 {
237  int h = find_device_handle(cpu->machine->md.of_data, arg[0]);
238  store_32bit_word(cpu, base + retofs, h);
239  return h>0? 0 : -1;
240 }
241 
242 
243 OF_SERVICE(getprop)
244 {
245  struct of_device *od = cpu->machine->md.of_data->of_devices;
246  struct of_device_property *pr;
247  int handle = OF_GET_ARG(0), i, len_returned = 0;
248  uint64_t buf = OF_GET_ARG(2);
249  uint64_t max = OF_GET_ARG(3);
250 
251  OF_FIND(od, od->handle == handle);
252  if (od == NULL) {
253  fatal("[ of: WARNING: getprop handle=%i; no such handle ]\n",
254  handle);
255  return -1;
256  }
257 
258  pr = od->properties;
259  OF_FIND(pr, strcmp(pr->name, arg[1]) == 0);
260  if (pr == NULL) {
261  fatal("[ of: WARNING: getprop: no property '%s' at handle"
262  " %i (device '%s') ]\n", arg[1], handle, od->name);
263  return -1;
264  }
265 
266  if (pr->data == NULL) {
267  fatal("[ of: WARNING: property '%s' of '%s' has no data! ]\n",
268  arg[1], od->name);
269  goto ret;
270  }
271 
272  /* Return the property into emulated RAM: */
273  len_returned = pr->len <= max? pr->len : max;
274 
275  for (i=0; i<len_returned; i++) {
276  if (!cpu->memory_rw(cpu, cpu->mem, buf + i, pr->data + i,
278  fatal("[ of: getprop memory_rw() error ]\n");
279  exit(1);
280  }
281  }
282 
283 ret:
284  store_32bit_word(cpu, base + retofs, len_returned);
285  return 0;
286 }
287 
288 
289 OF_SERVICE(getproplen)
290 {
291  struct of_device *od = cpu->machine->md.of_data->of_devices;
292  struct of_device_property *pr;
293  int handle = OF_GET_ARG(0);
294 
295  OF_FIND(od, od->handle == handle);
296  if (od == NULL) {
297  fatal("[ of: TODO: getproplen handle=%i; no such handle ]\n",
298  handle);
299  return -1;
300  }
301 
302  pr = od->properties;
303  OF_FIND(pr, strcmp(pr->name, arg[1]) == 0);
304  if (pr == NULL) {
305  fatal("[ of: TODO: getproplen: no property '%s' at handle"
306  " %i (device '%s') ]\n", arg[1], handle, od->name);
307  return -1;
308  }
309 
310  store_32bit_word(cpu, base + retofs, pr->len);
311  return 0;
312 }
313 
314 
315 OF_SERVICE(instance_to_package)
316 {
317  int handle = OF_GET_ARG(0);
318  /* TODO: actually do something here? :-) */
319  store_32bit_word(cpu, base + retofs, handle);
320  return 0;
321 }
322 
323 
324 OF_SERVICE(interpret_1)
325 {
326  if (strcmp(arg[0], "#lines 2 - to line#") == 0) {
327  } else {
328  fatal("[ of: interpret_1('%s'): TODO ]\n", arg[0]);
329  return -1;
330  }
331  return 0;
332 }
333 
334 
335 OF_SERVICE(interpret_2)
336 {
337  store_32bit_word(cpu, base + retofs, 0); /* ? TODO */
338  if (strcmp(arg[0], "#columns") == 0) {
339  store_32bit_word(cpu, base + retofs + 4, 80);
340  } else if (strcmp(arg[0], "#lines") == 0) {
341  store_32bit_word(cpu, base + retofs + 4, 40);
342  } else if (strcmp(arg[0], "char-height") == 0) {
343  store_32bit_word(cpu, base + retofs + 4, 15);
344  } else if (strcmp(arg[0], "char-width") == 0) {
345  store_32bit_word(cpu, base + retofs + 4, 10);
346  } else if (strcmp(arg[0], "line#") == 0) {
347  store_32bit_word(cpu, base + retofs + 4, 0);
348  } else if (strcmp(arg[0], "font-adr") == 0) {
349  store_32bit_word(cpu, base + retofs + 4, 0);
350  } else {
351  fatal("[ of: interpret_2('%s'): TODO ]\n", arg[0]);
352  return -1;
353  }
354  return 0;
355 }
356 
357 
358 OF_SERVICE(package_to_path)
359 {
360  fatal("[ of: package-to-path: TODO ]\n");
361  return -1;
362 }
363 
364 
365 OF_SERVICE(parent)
366 {
367  struct of_device *od = cpu->machine->md.of_data->of_devices;
368  int handle = OF_GET_ARG(0);
369  OF_FIND(od, od->handle == handle);
370  store_32bit_word(cpu, base + retofs, od == NULL? 0 : od->parent);
371  return 0;
372 }
373 
374 
376 {
377  struct of_device *od = cpu->machine->md.of_data->of_devices;
378  int handle = OF_GET_ARG(0), parent = 0, peer = 0, seen_self = 1;
379 
380  if (handle == 0) {
381  /* Return the handle of the root node (1): */
382  store_32bit_word(cpu, base + retofs, 1);
383  return 0;
384  }
385 
386  OF_FIND(od, od->handle == handle);
387  if (od == NULL) {
388  fatal("[ of: TODO: peer(): can't find handle %i ]\n", handle);
389  exit(1);
390  }
391  parent = od->parent;
392  seen_self = 0;
393 
394  od = cpu->machine->md.of_data->of_devices;
395 
396  while (od != NULL) {
397  if (od->parent == parent) {
398  if (seen_self) {
399  peer = od->handle;
400  break;
401  }
402  if (od->handle == handle)
403  seen_self = 1;
404  }
405  od = od->next;
406  }
407  store_32bit_word(cpu, base + retofs, peer);
408  return 0;
409 }
410 
411 
413 {
414  // TODO.
415  uint64_t ptr = OF_GET_ARG(0);
416 
417  string s;
418 
419  int i = 0;
420  while (true) {
421  unsigned char ch;
422  if (!cpu->memory_rw(cpu, cpu->mem, ptr + i, &ch,
424  fatal("[ of: TODO: write: memory_rw() error ]\n");
425  exit(1);
426  }
427 
428  if (ch == 0)
429  break;
430 
431  s += ch;
432  ++ i;
433  }
434 
435  if (s != "") {
436  cout << "Unimplemented OF_SERVICE(open) with name: '" << s << "'\n";
437  exit(1);
438  }
439 
440  return 0;
441 }
442 
443 
445 {
446  /* int handle = OF_GET_ARG(0); */
447  uint64_t ptr = OF_GET_ARG(1);
448  /* int len = OF_GET_ARG(2); */
449  int c;
450  unsigned char ch;
451 
452  /* TODO: check handle! This just reads chars from the console! */
453  /* TODO: This is blocking! */
454 
456  ch = c;
457  if (!cpu->memory_rw(cpu, cpu->mem, ptr, &ch, 1, MEM_WRITE,
459  fatal("[ of: TODO: read: memory_rw() error ]\n");
460  exit(1);
461  }
462 
463  store_32bit_word(cpu, base + retofs, c == -1? 0 : 1);
464  return c == -1? -1 : 0;
465 }
466 
467 
469 {
470  /* int handle = OF_GET_ARG(0); */
471  uint64_t ptr = OF_GET_ARG(1);
472  int n_written = 0, i, len = OF_GET_ARG(2);
473 
474  /* TODO: check handle! This just dumps the data to the console! */
475 
476  for (i=0; i<len; i++) {
477  unsigned char ch;
478  if (!cpu->memory_rw(cpu, cpu->mem, ptr + i, &ch,
480  fatal("[ of: TODO: write: memory_rw() error ]\n");
481  exit(1);
482  }
483  if (ch != 7)
485  n_written ++;
486  }
487 
488  store_32bit_word(cpu, base + retofs, n_written);
489  return 0;
490 }
491 
492 
493 /*****************************************************************************/
494 
495 
496 /*
497  * of_get_unused_device_handle():
498  *
499  * Returns an unused device handle number (1 or higher).
500  */
501 static int of_get_unused_device_handle(struct of_data *of_data)
502 {
503  int max_handle = 0;
504  struct of_device *od = of_data->of_devices;
505 
506  while (od != NULL) {
507  if (od->handle > max_handle)
508  max_handle = od->handle;
509  od = od->next;
510  }
511 
512  return max_handle + 1;
513 }
514 
515 
516 /*
517  * of_add_device():
518  *
519  * Adds a device.
520  */
521 static struct of_device *of_add_device(struct of_data *of_data, const char *name,
522  const char *parentname)
523 {
524  struct of_device *od;
525 
526  CHECK_ALLOCATION(od = (struct of_device *) malloc(sizeof(struct of_device)));
527  memset(od, 0, sizeof(struct of_device));
528 
529  CHECK_ALLOCATION(od->name = strdup(name));
530 
531  od->handle = of_get_unused_device_handle(of_data);
532  od->parent = find_device_handle(of_data, parentname);
533  if (od->parent < 0) {
534  fatal("of_add_device(): adding '%s' to parent '%s' failed: "
535  "parent not found!\n", name, parentname);
536  exit(1);
537  }
538 
539  od->next = of_data->of_devices;
540  of_data->of_devices = od;
541 
542  return od;
543 }
544 
545 
546 /*
547  * of_add_prop():
548  *
549  * Adds a property to a device.
550  */
551 static void of_add_prop(struct of_data *of_data, const char *devname,
552  const char *propname, unsigned char *data, uint32_t len, int flags)
553 {
554  struct of_device_property *pr;
555  struct of_device *od = of_data->of_devices;
556  int h = find_device_handle(of_data, devname);
557 
558  CHECK_ALLOCATION(pr = (struct of_device_property *) malloc(sizeof(struct of_device_property)));
559  memset(pr, 0, sizeof(struct of_device_property));
560 
561  OF_FIND(od, od->handle == h);
562  if (od == NULL) {
563  fatal("of_add_prop(): device '%s' not registered\n", devname);
564  exit(1);
565  }
566 
567  CHECK_ALLOCATION(pr->name = strdup(propname));
568  pr->data = data;
569  pr->len = len;
570  pr->flags = flags;
571 
572  pr->next = od->properties;
573  od->properties = pr;
574 }
575 
576 
577 /*
578  * of_add_service():
579  *
580  * Adds a service.
581  */
582 static void of_add_service(struct of_data *of_data, const char *name,
583  int (*f)(OF_SERVICE_ARGS), int n_args, int n_ret_args)
584 {
585  struct of_service *os;
586 
587  CHECK_ALLOCATION(os = (struct of_service *) malloc(sizeof(struct of_service)));
588  memset(os, 0, sizeof(struct of_service));
589 
590  CHECK_ALLOCATION(os->name = strdup(name));
591 
592  os->f = f;
593  os->n_args = n_args;
594  os->n_ret_args = n_ret_args;
595 
596  os->next = of_data->of_services;
597  of_data->of_services = os;
598 }
599 
600 
601 /*
602  * of_dump_devices():
603  *
604  * Debug dump helper.
605  */
606 static void of_dump_devices(struct of_data *ofd, int parent)
607 {
608  int iadd = DEBUG_INDENTATION;
609  struct of_device *od = ofd->of_devices;
610 
611  while (od != NULL) {
612  struct of_device_property *pr = od->properties;
613  if (od->parent != parent) {
614  od = od->next;
615  continue;
616  }
617 
618  debug("\"%s\"", od->name);
619  debug(" (handle %i)\n", od->handle);
620  debug_indentation(iadd);
621 
622  while (pr != NULL) {
623  debug("(%s: ", pr->name);
624  if (pr->flags == OF_PROP_STRING)
625  debug("\"%s\"", pr->data);
626  else
627  debug("%i bytes", pr->len);
628  debug(")\n");
629  pr = pr->next;
630  }
631 
632  of_dump_devices(ofd, od->handle);
633  debug_indentation(-iadd);
634  od = od->next;
635  }
636 }
637 
638 
639 /*
640  * of_dump_all():
641  *
642  * Debug dump.
643  */
644 static void of_dump_all(struct of_data *ofd)
645 {
646  int iadd = DEBUG_INDENTATION;
647  struct of_service *os;
648 
649  debug("openfirmware debug dump:\n");
650  debug_indentation(iadd);
651 
652  /* Devices: */
653  of_dump_devices(ofd, 0);
654 
655  /* Services: */
656  os = ofd->of_services;
657  while (os != NULL) {
658  debug("service '%s'", os->name);
659  if (os->n_ret_args > 0 || os->n_args > 0) {
660  debug(" (");
661  if (os->n_args > 0) {
662  debug("%i arg%s", os->n_args,
663  os->n_args > 1? "s" : "");
664  if (os->n_ret_args > 0)
665  debug(", ");
666  }
667  if (os->n_ret_args > 0)
668  debug("%i return value%s", os->n_ret_args,
669  os->n_ret_args > 1? "s" : "");
670  debug(")");
671  }
672  debug("\n");
673  os = os->next;
674  }
675 
676  debug_indentation(-iadd);
677 }
678 
679 
680 /*
681  * of_add_prop_int32():
682  *
683  * Helper function.
684  */
685 static void of_add_prop_int32(struct of_data *ofd,
686  const char *devname, const char *propname, uint32_t x)
687 {
688  unsigned char *p;
689 
690  CHECK_ALLOCATION(p = (unsigned char *) malloc(sizeof(int32_t)));
691 
692  of_store_32bit_in_host(p, x);
693  of_add_prop(ofd, devname, propname, p, sizeof(int32_t),
694  OF_PROP_INT);
695 }
696 
697 
698 /*
699  * of_add_prop_str():
700  *
701  * Helper function.
702  */
703 static void of_add_prop_str(struct machine *machine, struct of_data *ofd,
704  const char *devname, const char *propname, const char *data)
705 {
706  char *p;
707 
708  CHECK_ALLOCATION(p = strdup(data));
709 
710  of_add_prop(ofd, devname, propname, (unsigned char *)p, strlen(p) + 1,
711  OF_PROP_STRING);
712 }
713 
714 
715 /*
716  * of_emul_init_isa():
717  */
719 {
720  struct of_data *ofd = machine->md.of_data;
721  unsigned char *isa_ranges;
722 
723  of_add_device(ofd, "isa", "/");
724 
725  CHECK_ALLOCATION(isa_ranges = (unsigned char *) malloc(32));
726  memset(isa_ranges, 0, 32);
727 
728  /* 2 *: isa_phys_hi, isa_phys_lo, parent_phys_start, size */
729  /* MEM space: */
730  of_store_32bit_in_host(isa_ranges + 0, 0);
731  of_store_32bit_in_host(isa_ranges + 4, 0xc0000000);
732  /* I/O space: low bit if isa_phys_hi set */
733  of_store_32bit_in_host(isa_ranges + 16, 1);
734  of_store_32bit_in_host(isa_ranges + 20, 0xd0000000);
735 
736  of_add_prop(ofd, "/isa", "ranges", isa_ranges, 32, 0);
737 }
738 
739 
740 /*
741  * of_emul_init_adb():
742  */
744 {
745  struct of_data *ofd = machine->md.of_data;
746  unsigned char *adb_interrupts, *adb_reg;
747 
748  CHECK_ALLOCATION(adb_interrupts = (unsigned char *) malloc(4 * sizeof(uint32_t)));
749  CHECK_ALLOCATION(adb_reg = (unsigned char *) malloc(8 * sizeof(uint32_t)));
750 
751  of_add_device(ofd, "adb", "/bandit/gc");
752  of_add_prop_str(machine, ofd, "/bandit/gc/adb", "name", "via-cuda");
753  of_store_32bit_in_host(adb_interrupts + 0, 25);
754  of_store_32bit_in_host(adb_interrupts + 4, 0);
755  of_store_32bit_in_host(adb_interrupts + 8, 0);
756  of_store_32bit_in_host(adb_interrupts + 12, 0);
757  of_add_prop(ofd, "/bandit/gc/adb", "interrupts", adb_interrupts,
758  4*sizeof(uint32_t), 0);
759  of_store_32bit_in_host(adb_reg + 0, 0x16000);
760  of_store_32bit_in_host(adb_reg + 4, 0x2000);
761  of_store_32bit_in_host(adb_reg + 8, 0);
762  of_store_32bit_in_host(adb_reg + 12, 0);
763  of_store_32bit_in_host(adb_reg + 16, 0);
764  of_store_32bit_in_host(adb_reg + 20, 0);
765  of_store_32bit_in_host(adb_reg + 24, 0);
766  of_store_32bit_in_host(adb_reg + 28, 0);
767  of_add_prop(ofd, "/bandit/gc/adb", "reg", adb_reg,
768  8*sizeof(uint32_t), 0);
769 }
770 
771 
772 /*
773  * of_emul_init_zs():
774  */
776 {
777  struct of_data *ofd = machine->md.of_data;
778  unsigned char *zs_interrupts, *zs_reg;
779 
780  CHECK_ALLOCATION(zs_reg = (unsigned char *) malloc(6 * sizeof(uint32_t)));
781 
782  /* The controller: */
783  of_add_device(ofd, "zs", "/bandit/gc");
784  of_add_prop_str(machine, ofd, "/bandit/gc/zs", "device_type", "serial");
785  of_add_prop_str(machine, ofd, "/bandit/gc/zs", "name", "escc");
786  of_store_32bit_in_host(zs_reg + 0, 0x13000);
787  of_store_32bit_in_host(zs_reg + 4, 0x40);
788  of_store_32bit_in_host(zs_reg + 8, 0x100);
789  of_store_32bit_in_host(zs_reg + 12, 0x100);
790  of_store_32bit_in_host(zs_reg + 16, 0x200);
791  of_store_32bit_in_host(zs_reg + 20, 0x100);
792  of_add_prop(ofd, "/bandit/gc/zs", "reg", zs_reg, 6*sizeof(uint32_t), 0);
793 
794  /* Port 1: */
795  CHECK_ALLOCATION(zs_interrupts = (unsigned char *) malloc(3 * sizeof(uint32_t)));
796  CHECK_ALLOCATION(zs_reg = (unsigned char *) malloc(6 * sizeof(uint32_t)));
797 
798  of_add_device(ofd, "zstty1", "/bandit/gc/zs");
799  of_add_prop_str(machine, ofd, "/bandit/gc/zs/zstty1", "name", "ch-a");
800  of_store_32bit_in_host(zs_interrupts + 0, 16);
801  of_store_32bit_in_host(zs_interrupts + 4, 0);
802  of_store_32bit_in_host(zs_interrupts + 8, 0);
803  of_add_prop(ofd, "/bandit/gc/zs/zstty1", "interrupts", zs_interrupts,
804  3*sizeof(uint32_t), 0);
805  of_store_32bit_in_host(zs_reg + 0, 0x13800);
806  of_store_32bit_in_host(zs_reg + 4, 0x100);
807  of_store_32bit_in_host(zs_reg + 8, 0x100);
808  of_store_32bit_in_host(zs_reg + 12, 0x100);
809  of_store_32bit_in_host(zs_reg + 16, 0x200);
810  of_store_32bit_in_host(zs_reg + 20, 0x100);
811  of_add_prop(ofd, "/bandit/gc/zs/zstty1",
812  "reg", zs_reg, 6*sizeof(uint32_t), 0);
813 
814  /* Port 0: */
815  CHECK_ALLOCATION(zs_interrupts = (unsigned char *) malloc(3 * sizeof(uint32_t)));
816  CHECK_ALLOCATION(zs_reg = (unsigned char *) malloc(6 * sizeof(uint32_t)));
817 
818  of_add_device(ofd, "zstty0", "/bandit/gc/zs");
819  of_add_prop_str(machine, ofd, "/bandit/gc/zs/zstty0", "name", "ch-b");
820  of_store_32bit_in_host(zs_interrupts + 0, 15);
821  of_store_32bit_in_host(zs_interrupts + 4, 0);
822  of_store_32bit_in_host(zs_interrupts + 8, 0);
823  of_add_prop(ofd, "/bandit/gc/zs/zstty0", "interrupts", zs_interrupts,
824  3*sizeof(uint32_t), 0);
825  of_store_32bit_in_host(zs_reg + 0, 0x13400);
826  of_store_32bit_in_host(zs_reg + 4, 0x100);
827  of_store_32bit_in_host(zs_reg + 8, 0x100);
828  of_store_32bit_in_host(zs_reg + 12, 0x100);
829  of_store_32bit_in_host(zs_reg + 16, 0x200);
830  of_store_32bit_in_host(zs_reg + 20, 0x100);
831  of_add_prop(ofd, "/bandit/gc/zs/zstty0",
832  "reg", zs_reg, 6*sizeof(uint32_t), 0);
833 }
834 
835 
836 /*
837  * of_emul_init_uninorth():
838  */
840 {
841  struct of_data *ofd = machine->md.of_data;
842  unsigned char *uninorth_reg, *uninorth_bus_range, *uninorth_ranges;
843  unsigned char *macio_aa, *ata_interrupts, *ata_reg;
844  struct of_device *ic;
845  const char *n = "pci@e2000000";
846  const char *macio = "mac-io";
847 
848  of_add_device(ofd, n, "/");
849  of_add_prop_str(machine, ofd, n, "name", "pci");
850  of_add_prop_str(machine, ofd, n, "device_type", "pci");
851  of_add_prop_str(machine, ofd, n, "compatible", "uni-north");
852 
853  CHECK_ALLOCATION(uninorth_reg = (unsigned char *) malloc(2 * sizeof(uint32_t)));
854  CHECK_ALLOCATION(uninorth_bus_range = (unsigned char *) malloc(2 * sizeof(uint32_t)));
855  CHECK_ALLOCATION(uninorth_ranges = (unsigned char *) malloc(12 * sizeof(uint32_t)));
856  CHECK_ALLOCATION(macio_aa = (unsigned char *) malloc(5 * sizeof(uint32_t)));
857  CHECK_ALLOCATION(ata_interrupts = (unsigned char *) malloc(6 * sizeof(uint32_t)));
858  CHECK_ALLOCATION(ata_reg = (unsigned char *) malloc(8 * sizeof(uint32_t)));
859 
860  of_store_32bit_in_host(uninorth_reg + 0, 0xe2000000);
861  of_store_32bit_in_host(uninorth_reg + 4, 0); /* not used? */
862  of_add_prop(ofd, n, "reg", uninorth_reg, 2*sizeof(uint32_t), 0);
863 
864  of_store_32bit_in_host(uninorth_bus_range + 0, 0);
865  of_store_32bit_in_host(uninorth_bus_range + 4, 0);
866  of_add_prop(ofd, n, "bus-range", uninorth_bus_range,
867  2*sizeof(uint32_t), 0);
868 
869  /* MEM: */
870  of_store_32bit_in_host(uninorth_ranges + 0, 0x02000000);
871  of_store_32bit_in_host(uninorth_ranges + 4, 0);
872  of_store_32bit_in_host(uninorth_ranges + 8, 0);
873  of_store_32bit_in_host(uninorth_ranges + 12, 0xd0000000);
874  of_store_32bit_in_host(uninorth_ranges + 16, 0);
875  of_store_32bit_in_host(uninorth_ranges + 20, 0x04000000);
876  /* IO: */
877  of_store_32bit_in_host(uninorth_ranges + 24, 0x01000000);
878  of_store_32bit_in_host(uninorth_ranges + 28, 0);
879  of_store_32bit_in_host(uninorth_ranges + 32, 0);
880  of_store_32bit_in_host(uninorth_ranges + 36, 0xe2000000);
881  of_store_32bit_in_host(uninorth_ranges + 40, 0);
882  of_store_32bit_in_host(uninorth_ranges + 44, 0x01000000);
883  of_add_prop(ofd, n, "ranges", uninorth_ranges,
884  12*sizeof(uint32_t), 0);
885 
886  ic = of_add_device(ofd, macio, "/");
887  memset(macio_aa, 0, 20);
888  of_store_32bit_in_host(macio_aa + 0, 15 << 11); /* pci tag */
889  of_store_32bit_in_host(macio_aa + 8, 0xf3000000);
890  of_add_prop(ofd, macio, "assigned-addresses", macio_aa,
891  5*sizeof(uint32_t), 0);
892 /* of_add_prop(ofd, n, "assigned-addresses", macio_aa,
893  5*sizeof(uint32_t), 0); */
894  of_add_prop_int32(ofd, "/chosen", "interrupt-controller", ic->handle);
895 
896  of_add_device(ofd, "bandit", "/");
897  of_add_device(ofd, "gc", "/bandit");
898  of_add_prop(ofd, "/bandit/gc", "assigned-addresses", macio_aa,
899  5*sizeof(uint32_t), 0);
900 
903  char tmpstr[400];
904  of_add_device(ofd, "ata", "/bandit/gc");
905  of_add_prop_str(machine, ofd, "/bandit/gc/ata", "name", "ata");
906  of_add_prop_str(machine, ofd, "/bandit/gc/ata", "compatible",
907  "heathrow-ata");
908  of_store_32bit_in_host(ata_interrupts + 0, 13);
909  of_store_32bit_in_host(ata_interrupts + 4, 0);
910  of_store_32bit_in_host(ata_interrupts + 8, 0);
911  of_store_32bit_in_host(ata_interrupts + 12, 0);
912  of_store_32bit_in_host(ata_interrupts + 16, 0);
913  of_store_32bit_in_host(ata_interrupts + 20, 0);
914  of_add_prop(ofd, "/bandit/gc/ata", "interrupts", ata_interrupts,
915  6*sizeof(uint32_t), 0);
916  of_store_32bit_in_host(ata_reg + 0, 0x20000);
917  of_store_32bit_in_host(ata_reg + 4, 0);
918  of_store_32bit_in_host(ata_reg + 8, 0x21000);
919  of_store_32bit_in_host(ata_reg + 12, 0x22000);
920  of_store_32bit_in_host(ata_reg + 16, 0);
921  of_store_32bit_in_host(ata_reg + 20, 0);
922  of_store_32bit_in_host(ata_reg + 24, 0);
923  of_store_32bit_in_host(ata_reg + 28, 0);
924  of_add_prop(ofd, "/bandit/gc/ata", "reg", ata_reg,
925  8*sizeof(uint32_t), 0);
926 
927  snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0xf3020000 "
928  "irq=%s.cpu[%i].gc.lo.21 addr_mult=0x10", machine->path,
930  device_add(machine, tmpstr);
931  }
932 }
933 
934 
935 /*
936  * of_emul_init():
937  *
938  * This function creates an OpenFirmware emulation instance.
939  */
940 struct of_data *of_emul_init(struct machine *machine, struct vfb_data *vfb_data,
941  uint64_t fb_addr, int fb_xsize, int fb_ysize)
942 {
943  unsigned char *memory_reg, *memory_av;
944  unsigned char *root_address_cells, *root_size_cells;
945  unsigned char *zs_assigned_addresses;
946  struct of_device *memory_dev, *mmu, *devstdout, *devstdin;
947  struct of_data *ofd;
948  int i;
949 
950  CHECK_ALLOCATION(ofd = (struct of_data *) malloc(sizeof(struct of_data)));
951  memset(ofd, 0, sizeof(struct of_data));
952 
953  ofd->vfb_data = vfb_data;
954 
955  /* Devices: */
956 
957  /* Root = device 1 */
958  of_add_device(ofd, "", "");
959  of_add_prop_str(machine, ofd, "/", "model", "GXemul OpenFirmware machine");
960 
961  CHECK_ALLOCATION(root_address_cells = (unsigned char *) malloc(1 * sizeof(uint32_t)));
962  of_store_32bit_in_host(root_address_cells, 0);
963  of_add_prop(ofd, "/", "#address-cells", root_address_cells, 1 * sizeof(uint32_t), 0);
964 
965  CHECK_ALLOCATION(root_size_cells = (unsigned char *) malloc(1 * sizeof(uint32_t)));
966  of_store_32bit_in_host(root_size_cells, 0);
967  of_add_prop(ofd, "/", "#size-cells", root_size_cells, 1 * sizeof(uint32_t), 0);
968 
969  of_add_device(ofd, "io", "/");
970  devstdin = of_add_device(ofd, "stdin", "/io");
971  devstdout = of_add_device(ofd, "stdout", "/io");
972 
973  if (machine->x11_md.in_use) {
974  fatal("!\n! TODO: keyboard + framebuffer for MacPPC\n!\n");
975 
976  of_add_prop_str(machine, ofd, "/io/stdin", "name",
977  "keyboard");
978  of_add_prop_str(machine, ofd, "/io", "name", "adb");
979 
980  of_add_prop_str(machine, ofd, "/io/stdout", "device_type",
981  "display");
982  of_add_prop_int32(ofd, "/io/stdout", "width", fb_xsize);
983  of_add_prop_int32(ofd, "/io/stdout", "height", fb_ysize);
984  of_add_prop_int32(ofd, "/io/stdout", "linebytes", fb_xsize * 1);
985  of_add_prop_int32(ofd, "/io/stdout", "depth", 8);
986  of_add_prop_int32(ofd, "/io/stdout", "address", fb_addr);
987  } else {
988  CHECK_ALLOCATION(zs_assigned_addresses = (unsigned char *) malloc(12));
989  memset(zs_assigned_addresses, 0, 12);
990 
991  of_add_prop_str(machine, ofd, "/io/stdin", "name", "ch-b");
992  of_add_prop_str(machine, ofd, "/io/stdin", "device_type",
993  "serial");
994  of_add_prop_int32(ofd, "/io/stdin", "reg", 0xf3013000);
995  of_add_prop(ofd, "/io/stdin", "assigned-addresses",
996  zs_assigned_addresses, 12, 0);
997 
998  of_add_prop_str(machine, ofd, "/io/stdout", "device_type",
999  "serial");
1000  }
1001 
1002  of_add_device(ofd, "cpus", "/");
1003  for (i=0; i<machine->ncpus; i++) {
1004  char tmp[50];
1005  snprintf(tmp, sizeof(tmp), "@%x", i);
1006  of_add_device(ofd, tmp, "/cpus");
1007  snprintf(tmp, sizeof(tmp), "/cpus/@%x", i);
1008  of_add_prop_str(machine, ofd, tmp, "device_type", "cpu");
1009  of_add_prop_int32(ofd, tmp, "timebase-frequency",
1010  machine->emulated_hz / 4);
1011  of_add_prop_int32(ofd, tmp, "clock-frequency",
1012  machine->emulated_hz);
1013  of_add_prop_int32(ofd, tmp, "reg", i);
1014  }
1015 
1016  mmu = of_add_device(ofd, "mmu", "/");
1017 
1018  /* TODO: */
1019  of_add_prop(ofd, "/mmu", "translations", NULL, 0, 0);
1020 
1021  of_add_device(ofd, "chosen", "/");
1022  of_add_prop_int32(ofd, "/chosen", "mmu", mmu->handle);
1023  of_add_prop_int32(ofd, "/chosen", "stdin", devstdin->handle);
1024  of_add_prop_int32(ofd, "/chosen", "stdout", devstdout->handle);
1025 
1026  memory_dev = of_add_device(ofd, "memory", "/");
1027  CHECK_ALLOCATION(memory_reg = (unsigned char *) malloc(2 * sizeof(uint32_t)));
1028  CHECK_ALLOCATION(memory_av = (unsigned char *) malloc(2 * sizeof(uint32_t)));
1029 
1030  of_store_32bit_in_host(memory_reg + 0, 0);
1031  of_store_32bit_in_host(memory_reg + 4, machine->physical_ram_in_mb<<20);
1032  of_store_32bit_in_host(memory_av + 0, 10 << 20);
1033  of_store_32bit_in_host(memory_av + 4, (machine->physical_ram_in_mb - 10) << 20);
1034  of_add_prop(ofd, "/memory", "reg", memory_reg, 2 * sizeof(uint32_t), 0);
1035  of_add_prop(ofd, "/memory", "available", memory_av, 2*sizeof(uint32_t),0);
1036  of_add_prop_str(machine, ofd, "/memory", "name", "memory");
1037  of_add_prop_str(machine, ofd, "/memory","device_type","memory"/*?*/);
1038 
1039  of_add_prop_int32(ofd, "/chosen", "memory", memory_dev->handle);
1040 
1041  /* Services: */
1042  of_add_service(ofd, "call-method", of__call_method_2_2, 2, 2);
1043  of_add_service(ofd, "call-method", of__call_method_3_4, 3, 4);
1044  of_add_service(ofd, "call-method", of__call_method_5_2, 5, 2);
1045  of_add_service(ofd, "call-method", of__call_method_6_1, 6, 1);
1046  of_add_service(ofd, "call-method", of__call_method_6_2, 6, 2);
1047  of_add_service(ofd, "child", of__child, 1, 1);
1048  of_add_service(ofd, "claim", of__claim, 3, 1);
1049  of_add_service(ofd, "exit", of__exit, 0, 0);
1050  of_add_service(ofd, "finddevice", of__finddevice, 1, 1);
1051  of_add_service(ofd, "getprop", of__getprop, 4, 1);
1052  of_add_service(ofd, "getproplen", of__getproplen, 2, 1);
1053  of_add_service(ofd, "instance-to-package",
1054  of__instance_to_package, 1, 1);
1055  of_add_service(ofd, "interpret", of__interpret_1, 1, 1);
1056  of_add_service(ofd, "interpret", of__interpret_2, 1, 2);
1057  of_add_service(ofd, "package-to-path", of__package_to_path, 3, 1);
1058  of_add_service(ofd, "parent", of__parent, 1, 1);
1059  of_add_service(ofd, "peer", of__peer, 1, 1);
1060  of_add_service(ofd, "open", of__open, 1, 1);
1061  of_add_service(ofd, "read", of__read, 3, 1);
1062  of_add_service(ofd, "write", of__write, 3, 1);
1063 
1064  if (verbose >= 2)
1065  of_dump_all(ofd);
1066 
1067  machine->md.of_data = ofd;
1068 
1069  return ofd;
1070 }
1071 
1072 
1073 /*
1074  * of_emul():
1075  *
1076  * OpenFirmware call emulation.
1077  */
1078 int of_emul(struct cpu *cpu)
1079 {
1080  int i, nargs, nret, ofs, retval = 0;
1081  char service[50];
1082  char *arg[OF_N_MAX_ARGS];
1083  uint64_t base, ptr;
1084  struct of_service *os;
1085  struct of_data *of_data = cpu->machine->md.of_data;
1086 
1087  if (of_data == NULL) {
1088  fatal("of_emul(): no of_data struct?\n");
1089  exit(1);
1090  }
1091 
1092  /*
1093  * The first argument register points to "prom_args":
1094  *
1095  * char *service; (probably 32 bit)
1096  * int nargs;
1097  * int nret;
1098  * char *args[10];
1099  */
1100 
1101  switch (cpu->machine->arch) {
1102  case ARCH_ARM:
1103  base = cpu->cd.arm.r[0];
1104  break;
1105  case ARCH_PPC:
1106  base = cpu->cd.ppc.gpr[3];
1107  break;
1108  default:fatal("of_emul(): unimplemented arch (TODO)\n");
1109  exit(1);
1110  }
1111 
1112  /* TODO: how about 64-bit OpenFirmware? */
1113  ptr = load_32bit_word(cpu, base);
1114  nargs = load_32bit_word(cpu, base + 4);
1115  nret = load_32bit_word(cpu, base + 8);
1116 
1117  readstr(cpu, ptr, service, sizeof(service));
1118 
1119  debug("[ of: %s(", service);
1120  ofs = 12;
1121  for (i=0; i<nargs; i++) {
1122  int x;
1123  if (i > 0)
1124  debug(", ");
1125  if (i >= OF_N_MAX_ARGS) {
1126  fatal("TOO MANY ARGS!");
1127  continue;
1128  }
1129 
1130  ptr = load_32bit_word(cpu, base + ofs);
1131 
1132  CHECK_ALLOCATION(arg[i] = (char *) malloc(OF_ARG_MAX_LEN + 1));
1133  memset(arg[i], 0, OF_ARG_MAX_LEN + 1);
1134 
1135  x = ptr;
1136  if (x > -256 && x < 256) {
1137  debug("%i", x);
1138  } else {
1139  readstr(cpu, ptr, arg[i], OF_ARG_MAX_LEN);
1140  if (arg[i][0])
1141  debug("\"%s\"", arg[i]);
1142  else
1143  debug("0x%x", x);
1144  }
1145  ofs += sizeof(uint32_t);
1146  }
1147  debug(") ]\n");
1148 
1149  /* Note: base + ofs points to the first return slot. */
1150 
1151  os = of_data->of_services;
1152  while (os != NULL) {
1153  if (strcmp(service, os->name) == 0 &&
1154  nargs == os->n_args && nret == os->n_ret_args) {
1155  retval = os->f(cpu, arg, base, ofs);
1156  break;
1157  }
1158  os = os->next;
1159  }
1160 
1161  if (os == NULL) {
1162  quiet_mode = 0;
1163  cpu_register_dump(cpu->machine, cpu, 1, 0);
1164  printf("\n");
1165  fatal("[ of: unimplemented service \"%s\" with %i input "
1166  "args and %i output values ]\n", service, nargs, nret);
1167  cpu->running = 0;
1168  exit(1);
1169  }
1170 
1171  for (i=0; i<nargs; i++)
1172  free(arg[i]);
1173 
1174  /* Return: */
1175  switch (cpu->machine->arch) {
1176  case ARCH_ARM:
1177  cpu->cd.arm.r[0] = retval;
1178  break;
1179  case ARCH_PPC:
1180  cpu->cd.ppc.gpr[3] = retval;
1181  break;
1182  default:fatal("of_emul(): TODO: unimplemented arch (Retval)\n");
1183  exit(1);
1184  }
1185 
1186  return 1;
1187 }
1188 
data
u_short data
Definition: siireg.h:79
cpu_register_dump
void cpu_register_dump(struct machine *m, struct cpu *cpu, int gprs, int coprocs)
Definition: cpu.cc:203
of_emul_init_adb
void of_emul_init_adb(struct machine *machine)
Definition: of.cc:743
machine::bootstrap_cpu
int bootstrap_cpu
Definition: machine.h:136
ARCH_PPC
#define ARCH_PPC
Definition: machine.h:204
f
void f(int s, int func, int only_name)
Definition: generate_arm_r.c:45
verbose
int verbose
Definition: main.cc:77
console_putchar
void console_putchar(int handle, int ch)
Definition: console.cc:405
cpu::running
uint8_t running
Definition: cpu.h:353
diskimage.h
vfb_data::rgb_palette
unsigned char rgb_palette[256 *3]
Definition: devices.h:223
debug
#define debug
Definition: dev_adb.cc:57
machine::physical_ram_in_mb
int physical_ram_in_mb
Definition: machine.h:147
vfb_data::update_x2
int update_x2
Definition: devices.h:220
MEM_READ
#define MEM_READ
Definition: memory.h:116
vfb_data::xsize
int xsize
Definition: devices.h:204
vfb_data::update_y1
int update_y1
Definition: devices.h:220
console.h
addr
uint32_t addr
Definition: tmp_arm_multi.cc:52
quiet_mode
int quiet_mode
Definition: main.cc:78
of_emul_init_zs
void of_emul_init_zs(struct machine *machine)
Definition: of.cc:775
device.h
MEM_WRITE
#define MEM_WRITE
Definition: memory.h:117
of_emul
int of_emul(struct cpu *cpu)
Definition: of.cc:1078
strlen
void COMBINE() strlen(struct cpu *cpu, struct arm_instr_call *ic, int low_addr)
Definition: cpu_arm_instr.cc:2333
fatal
void fatal(const char *fmt,...)
Definition: main.cc:152
of_emul_init
struct of_data * of_emul_init(struct machine *machine, struct vfb_data *vfb_data, uint64_t fb_addr, int fb_xsize, int fb_ysize)
Definition: of.cc:940
x11_md::in_use
int in_use
Definition: machine.h:82
misc.h
cpu::cd
union cpu::@1 cd
device_add
void * device_add(struct machine *machine, const char *name_and_params)
Definition: device.cc:252
machine.h
machine
Definition: machine.h:97
machine::main_console_handle
int main_console_handle
Definition: machine.h:128
console_readchar
int console_readchar(int handle)
Definition: console.cc:385
ic
struct arm_instr_call * ic
Definition: tmp_arm_multi.cc:50
of.h
CACHE_DATA
#define CACHE_DATA
Definition: memory.h:121
arm_cpu::r
uint32_t r[N_ARM_REGS]
Definition: cpu_arm.h:155
machine::x11_md
struct x11_md x11_md
Definition: machine.h:179
cpu.h
machine::path
char * path
Definition: machine.h:108
cpu::ppc
struct ppc_cpu ppc
Definition: cpu.h:444
cpu::mem
struct memory * mem
Definition: cpu.h:362
cpu::machine
struct machine * machine
Definition: cpu.h:328
vfb_data::update_x1
int update_x1
Definition: devices.h:220
NO_EXCEPTIONS
#define NO_EXCEPTIONS
Definition: memory.h:125
cpu::arm
struct arm_cpu arm
Definition: cpu.h:441
store_32bit_word
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32)
Definition: memory.cc:783
load_32bit_word
uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr)
Definition: memory.cc:902
of_emul_init_isa
void of_emul_init_isa(struct machine *machine)
Definition: of.cc:718
of_emul_init_uninorth
void of_emul_init_uninorth(struct machine *machine)
Definition: of.cc:839
machine::emulated_hz
int emulated_hz
Definition: machine.h:165
DEBUG_INDENTATION
#define DEBUG_INDENTATION
Definition: misc.h:212
ARCH_ARM
#define ARCH_ARM
Definition: machine.h:206
DISKIMAGE_IDE
#define DISKIMAGE_IDE
Definition: diskimage.h:41
ppc_cpu::gpr
uint64_t gpr[PPC_NGPRS]
Definition: cpu_ppc.h:124
vfb_data::ysize
int ysize
Definition: devices.h:205
devices.h
cpu
Definition: cpu.h:326
machine::of_data
struct of_data * of_data
Definition: machine.h:185
machine::md
union machine::@2 md
cpu::memory_rw
int(* memory_rw)(struct cpu *cpu, struct memory *mem, uint64_t vaddr, unsigned char *data, size_t len, int writeflag, int cache_flags)
Definition: cpu.h:365
vfb_data
Definition: devices.h:198
OF_SERVICE
OF_SERVICE(call_method_2_2)
Definition: of.cc:152
machine::arch
int arch
Definition: machine.h:110
memory.h
debug_indentation
void debug_indentation(int diff)
Definition: main.cc:120
diskimage_exist
int diskimage_exist(struct machine *machine, int id, int type)
Definition: diskimage.cc:106
vfb_data::update_y2
int update_y2
Definition: devices.h:220
machine::ncpus
int ncpus
Definition: machine.h:139
CHECK_ALLOCATION
#define CHECK_ALLOCATION(ptr)
Definition: misc.h:239

Generated on Tue Mar 24 2020 14:04:48 for GXemul by doxygen 1.8.17