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

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

revision 2 by dpavlin, Mon Oct 8 16:17:48 2007 UTC revision 10 by dpavlin, Mon Oct 8 16:18:27 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: dec_prom.c,v 1.57 2005/02/22 12:05:19 debug Exp $   *  $Id: dec_prom.c,v 1.60 2005/06/26 11:36:28 debug Exp $
29   *   *
30   *  DECstation PROM emulation.   *  DECstation PROM emulation.
31   */   */
# Line 133  int dec_jumptable_func(struct cpu *cpu, Line 133  int dec_jumptable_func(struct cpu *cpu,
133          case 0x38:      /*  read(handle, ptr, length)  */          case 0x38:      /*  read(handle, ptr, length)  */
134                  cpu->cd.mips.gpr[MIPS_GPR_V0] = -1;                  cpu->cd.mips.gpr[MIPS_GPR_V0] = -1;
135                  if ((int32_t)cpu->cd.mips.gpr[MIPS_GPR_A2] > 0) {                  if ((int32_t)cpu->cd.mips.gpr[MIPS_GPR_A2] > 0) {
136                          int disk_id = diskimage_bootdev(cpu->machine);                          int disk_id = diskimage_bootdev(cpu->machine, NULL);
137                          int res;                          int res;
138                          unsigned char *tmp_buf;                          unsigned char *tmp_buf;
139    
# Line 145  int dec_jumptable_func(struct cpu *cpu, Line 145  int dec_jumptable_func(struct cpu *cpu,
145                                  break;                                  break;
146                          }                          }
147    
148                          res = diskimage_access(cpu->machine, disk_id, 0,                          res = diskimage_access(cpu->machine, disk_id,
149                              current_file_offset, tmp_buf,                              DISKIMAGE_SCSI, 0, current_file_offset, tmp_buf,
150                              cpu->cd.mips.gpr[MIPS_GPR_A2]);                              cpu->cd.mips.gpr[MIPS_GPR_A2]);
151    
152                          /*  If the transfer was successful, transfer the data                          /*  If the transfer was successful, transfer the data
# Line 363  int decstation_prom_emul(struct cpu *cpu Line 363  int decstation_prom_emul(struct cpu *cpu
363    
364                                  switch (ch) {                                  switch (ch) {
365                                  case '%':                                  case '%':
366                                          strcpy(printfbuf, "%%");                                          strlcpy(printfbuf, "%%",
367                                                sizeof(printfbuf));
368                                          break;                                          break;
369                                  case 'c':                                  case 'c':
370                                  case 'd':                                  case 'd':
# Line 375  int decstation_prom_emul(struct cpu *cpu Line 376  int decstation_prom_emul(struct cpu *cpu
376                                                  /*  Linux booters seem to go                                                  /*  Linux booters seem to go
377                                                      over the edge sometimes: */                                                      over the edge sometimes: */
378                                                  ch = '\0';                                                  ch = '\0';
379                                                  strcpy(printfbuf, "[...]\n");                                                  strlcpy(printfbuf, "[...]\n",
380                                                        sizeof(printfbuf));
381  #else  #else
382                                                  printf("[ decstation_prom_emul"                                                  printf("[ decstation_prom_emul"
383                                                      "(): too many arguments ]");                                                      "(): too many arguments ]");
# Line 391  int decstation_prom_emul(struct cpu *cpu Line 393  int decstation_prom_emul(struct cpu *cpu
393    
394                                          switch (ch) {                                          switch (ch) {
395                                          case 'c':                                          case 'c':
396                                                  sprintf(printfbuf, "%c", ch2);                                                  snprintf(printfbuf, sizeof(
397                                                        printfbuf), "%c", ch2);
398                                                  break;                                                  break;
399                                          case 'd':                                          case 'd':
400                                                  sprintf(printfbuf, "%d",                                                  snprintf(printfbuf, sizeof(
401                                                      argdata);                                                      printfbuf), "%d", argdata);
402                                                  break;                                                  break;
403                                          case 'x':                                          case 'x':
404                                                  sprintf(printfbuf, "%x",                                                  snprintf(printfbuf, sizeof(
405                                                      argdata);                                                      printfbuf), "%x", argdata);
406                                                  break;                                                  break;
407                                          case 's':                                          case 's':
408                                                  /*  Print a "%s" string.  */                                                  /*  Print a "%s" string.  */
# Line 432  int decstation_prom_emul(struct cpu *cpu Line 435  int decstation_prom_emul(struct cpu *cpu
435                          case '\0':                          case '\0':
436                                  break;                                  break;
437                          default:                          default:
438                                  sprintf(printfbuf, "%c", ch);                                  snprintf(printfbuf, sizeof(printfbuf),
439                                        "%c", ch);
440                          }                          }
441    
442                          printfbuf[sizeof(printfbuf)-1] = '\0';                          printfbuf[sizeof(printfbuf)-1] = '\0';
# Line 469  int decstation_prom_emul(struct cpu *cpu Line 473  int decstation_prom_emul(struct cpu *cpu
473                  cpu->cd.mips.gpr[MIPS_GPR_V0] = 0;                  cpu->cd.mips.gpr[MIPS_GPR_V0] = 0;
474    
475                  if ((int32_t)cpu->cd.mips.gpr[MIPS_GPR_A2] > 0) {                  if ((int32_t)cpu->cd.mips.gpr[MIPS_GPR_A2] > 0) {
476                          int disk_id = diskimage_bootdev(cpu->machine);                          int disk_id = diskimage_bootdev(cpu->machine, NULL);
477                          int res;                          int res;
478                          unsigned char *tmp_buf;                          unsigned char *tmp_buf;
479    
# Line 481  int decstation_prom_emul(struct cpu *cpu Line 485  int decstation_prom_emul(struct cpu *cpu
485                                  break;                                  break;
486                          }                          }
487    
488                          res = diskimage_access(cpu->machine, disk_id, 0,                          res = diskimage_access(cpu->machine, disk_id,
489                                DISKIMAGE_SCSI, 0,
490                              cpu->cd.mips.gpr[MIPS_GPR_A0] * 512, tmp_buf,                              cpu->cd.mips.gpr[MIPS_GPR_A0] * 512, tmp_buf,
491                              cpu->cd.mips.gpr[MIPS_GPR_A2]);                              cpu->cd.mips.gpr[MIPS_GPR_A2]);
492    

Legend:
Removed from v.2  
changed lines
  Added in v.10

  ViewVC Help
Powered by ViewVC 1.1.26