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

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

revision 24 by dpavlin, Mon Oct 8 16:19:56 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2007  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: dec_prom.c,v 1.9 2006/06/23 11:47:05 debug Exp $   *  $Id: dec_prom.c,v 1.13 2007/06/15 17:02:40 debug Exp $
29   *   *
30   *  DECstation PROM emulation.   *  DECstation PROM emulation.
31   *   *
# Line 45  Line 45 
45  #include "cpu_mips.h"  #include "cpu_mips.h"
46  #include "diskimage.h"  #include "diskimage.h"
47  #include "machine.h"  #include "machine.h"
48    #include "machine_pmax.h"
49  #include "memory.h"  #include "memory.h"
50  #include "misc.h"  #include "misc.h"
51    
# Line 105  int dec_jumptable_func(struct cpu *cpu, Line 106  int dec_jumptable_func(struct cpu *cpu,
106                  /*  TODO  */                  /*  TODO  */
107                  cpu->machine->exit_without_entering_debugger = 1;                  cpu->machine->exit_without_entering_debugger = 1;
108                  cpu->running = 0;                  cpu->running = 0;
                 cpu->dead = 1;  
109                  break;                  break;
110          case 0x10:      /*  restart()  */          case 0x10:      /*  restart()  */
111                  /*  TODO  */                  /*  TODO  */
112                  cpu->machine->exit_without_entering_debugger = 1;                  cpu->machine->exit_without_entering_debugger = 1;
113                  cpu->running = 0;                  cpu->running = 0;
                 cpu->dead = 1;  
114                  break;                  break;
115          case 0x18:      /*  reinit()  */          case 0x18:      /*  reinit()  */
116                  /*  TODO  */                  /*  TODO  */
# Line 128  int dec_jumptable_func(struct cpu *cpu, Line 127  int dec_jumptable_func(struct cpu *cpu,
127                          fatal("\ndec_jumptable_func(): opening more than one "                          fatal("\ndec_jumptable_func(): opening more than one "
128                              "file isn't supported yet.\n");                              "file isn't supported yet.\n");
129                          cpu->running = 0;                          cpu->running = 0;
                         cpu->dead = 1;  
130                  }                  }
131                  file_opened = 1;                  file_opened = 1;
132                  cpu->cd.mips.gpr[MIPS_GPR_V0] = 1;                  cpu->cd.mips.gpr[MIPS_GPR_V0] = 1;
# Line 140  int dec_jumptable_func(struct cpu *cpu, Line 138  int dec_jumptable_func(struct cpu *cpu,
138                          int res;                          int res;
139                          unsigned char *tmp_buf;                          unsigned char *tmp_buf;
140    
141                          tmp_buf = malloc(cpu->cd.mips.gpr[MIPS_GPR_A2]);                          CHECK_ALLOCATION(tmp_buf =
142                          if (tmp_buf == NULL) {                              malloc(cpu->cd.mips.gpr[MIPS_GPR_A2]));
                                 fprintf(stderr, "[ ***  Out of memory in "  
                                     "dec_prom.c, allocating %i bytes ]\n",  
                                     (int)cpu->cd.mips.gpr[MIPS_GPR_A2]);  
                                 break;  
                         }  
143    
144                          res = diskimage_access(cpu->machine, disk_id,                          res = diskimage_access(cpu->machine, disk_id,
145                              DISKIMAGE_SCSI, 0, current_file_offset, tmp_buf,                              DISKIMAGE_SCSI, 0, current_file_offset, tmp_buf,
# Line 201  int dec_jumptable_func(struct cpu *cpu, Line 194  int dec_jumptable_func(struct cpu *cpu,
194                  fatal("PROM emulation: unimplemented JUMP TABLE vector "                  fatal("PROM emulation: unimplemented JUMP TABLE vector "
195                      "0x%x (decimal function %i)\n", vector, vector/8);                      "0x%x (decimal function %i)\n", vector, vector/8);
196                  cpu->running = 0;                  cpu->running = 0;
                 cpu->dead = 1;  
197          }          }
198    
199          return 0;          return 0;
# Line 480  int decstation_prom_emul(struct cpu *cpu Line 472  int decstation_prom_emul(struct cpu *cpu
472                          int res;                          int res;
473                          unsigned char *tmp_buf;                          unsigned char *tmp_buf;
474    
475                          tmp_buf = malloc(cpu->cd.mips.gpr[MIPS_GPR_A2]);                          CHECK_ALLOCATION(tmp_buf =
476                          if (tmp_buf == NULL) {                              malloc(cpu->cd.mips.gpr[MIPS_GPR_A2]));
                                 fprintf(stderr, "[ ***  Out of memory in "  
                                     "dec_prom.c, allocating %i bytes ]\n",  
                                     (int)cpu->cd.mips.gpr[MIPS_GPR_A2]);  
                                 break;  
                         }  
477    
478                          res = diskimage_access(cpu->machine, disk_id,                          res = diskimage_access(cpu->machine, disk_id,
479                              DISKIMAGE_SCSI, 0,                              DISKIMAGE_SCSI, 0,
# Line 596  int decstation_prom_emul(struct cpu *cpu Line 583  int decstation_prom_emul(struct cpu *cpu
583                  debug("[ DEC PROM getbitmap(0x%08x) ]\n",                  debug("[ DEC PROM getbitmap(0x%08x) ]\n",
584                      (int)cpu->cd.mips.gpr[MIPS_GPR_A0]);                      (int)cpu->cd.mips.gpr[MIPS_GPR_A0]);
585                  store_buf(cpu, cpu->cd.mips.gpr[MIPS_GPR_A0],                  store_buf(cpu, cpu->cd.mips.gpr[MIPS_GPR_A0],
586                      (char *)cpu->machine->md.pmax.memmap,                      (char *)cpu->machine->md.pmax->memmap,
587                      sizeof(struct dec_memmap));                      sizeof(struct dec_memmap));
588                  cpu->cd.mips.gpr[MIPS_GPR_V0] =                  cpu->cd.mips.gpr[MIPS_GPR_V0] =
589                      sizeof(cpu->machine->md.pmax.memmap->bitmap);                      sizeof(cpu->machine->md.pmax->memmap->bitmap);
590                  break;                  break;
591          case 0x88:              /*  disableintr()  */          case 0x88:              /*  disableintr()  */
592                  debug("[ DEC PROM disableintr(): TODO ]\n");                  debug("[ DEC PROM disableintr(): TODO ]\n");
# Line 613  int decstation_prom_emul(struct cpu *cpu Line 600  int decstation_prom_emul(struct cpu *cpu
600                  debug("[ DEC PROM halt() ]\n");                  debug("[ DEC PROM halt() ]\n");
601                  cpu->machine->exit_without_entering_debugger = 1;                  cpu->machine->exit_without_entering_debugger = 1;
602                  cpu->running = 0;                  cpu->running = 0;
                 cpu->dead = 1;  
603                  break;                  break;
604          case 0xa4:              /*  gettcinfo()  */          case 0xa4:              /*  gettcinfo()  */
605                  /*                  /*
# Line 653  int decstation_prom_emul(struct cpu *cpu Line 639  int decstation_prom_emul(struct cpu *cpu
639                          debug("DEC PROM: rex('h') ==> halt\n");                          debug("DEC PROM: rex('h') ==> halt\n");
640                          cpu->machine->exit_without_entering_debugger = 1;                          cpu->machine->exit_without_entering_debugger = 1;
641                          cpu->running = 0;                          cpu->running = 0;
                         cpu->dead = 1;  
642                          break;                          break;
643                  case 'b':                  case 'b':
644                          debug("DEC PROM: rex('b') ==> reboot: TODO "                          debug("DEC PROM: rex('b') ==> reboot: TODO "
645                              "(halting CPU instead)\n");                              "(halting CPU instead)\n");
646                          cpu->machine->exit_without_entering_debugger = 1;                          cpu->machine->exit_without_entering_debugger = 1;
647                          cpu->running = 0;                          cpu->running = 0;
                         cpu->dead = 1;  
648                          break;                          break;
649                  default:                  default:
650                          fatal("DEC prom emulation: unknown rex() a0=0x%"PRIx64                          fatal("DEC prom emulation: unknown rex() a0=0x%"PRIx64
# Line 668  int decstation_prom_emul(struct cpu *cpu Line 652  int decstation_prom_emul(struct cpu *cpu
652                              (int64_t) cpu->cd.mips.gpr[MIPS_GPR_A0],                              (int64_t) cpu->cd.mips.gpr[MIPS_GPR_A0],
653                              (char) cpu->cd.mips.gpr[MIPS_GPR_A0]);                              (char) cpu->cd.mips.gpr[MIPS_GPR_A0]);
654                          cpu->running = 0;                          cpu->running = 0;
                         cpu->dead = 1;  
655                  }                  }
656                  break;                  break;
657          default:          default:
# Line 688  int decstation_prom_emul(struct cpu *cpu Line 671  int decstation_prom_emul(struct cpu *cpu
671                  fatal("PROM emulation: unimplemented callback vector 0x%x\n",                  fatal("PROM emulation: unimplemented callback vector 0x%x\n",
672                      vector);                      vector);
673                  cpu->running = 0;                  cpu->running = 0;
                 cpu->dead = 1;  
674          }          }
675    
676          return 1;          return 1;

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

  ViewVC Help
Powered by ViewVC 1.1.26