dec_prom.cc Source File
Back to the index.
Go to the documentation of this file.
37 #include <sys/types.h>
39 #include <sys/resource.h>
66 static unsigned char mem_readchar(
struct cpu *
cpu,
int regbase,
int offset)
99 static int file_opened = 0;
100 static int current_file_offset = 0;
125 fatal(
"\ndec_jumptable_func(): opening more than one "
126 "file isn't supported yet.\n");
137 unsigned char *tmp_buf;
154 current_file_offset +=
166 fatal(
"WARNING! Unimplemented whence in "
167 "dec_jumptable_func()\n");
180 printf(
"a0 points to: ");
181 for (i=0; i<40; i++) {
182 unsigned char ch =
'\0';
186 if (ch >=
' ' && ch < 126)
189 printf(
"[%02x]", ch);
192 fatal(
"PROM emulation: unimplemented JUMP TABLE vector "
193 "0x%x (decimal function %i)\n", vector, vector/8);
231 int i, j, ch, argreg, argdata;
232 int vector =
cpu->
pc & 0xfff;
233 int callback = (
cpu->
pc & 0xf000)? 1 : 0;
234 unsigned char buf[100];
235 unsigned char ch1, ch2, ch3;
236 uint64_t tmpaddr, slot_base = 0x10000000, slot_size = 0;
253 }
while (ch1 == ch2 && ch1 !=
'\0');
258 if ((
signed char)ch1 > (
signed char)ch2)
260 if ((
signed char)ch1 < (
signed char)ch2)
293 main_console_handle, ch2);
295 main_console_handle,
' ');
297 main_console_handle, ch2);
301 main_console_handle, ch2);
308 }
else if (ch !=
'\b') {
318 }
while (ch2 !=
'\n');
339 debug(
"PROM printf(0x%08lx): \n",
344 char printfbuf[8000];
347 printfbuf[0] = printfbuf[
sizeof(printfbuf)-1] =
'\0';
353 while (ch >=
'0' && ch <=
'9')
354 ch = mem_readchar(
cpu,
359 strlcpy(printfbuf,
"%%",
372 strlcpy(printfbuf,
"[...]\n",
375 printf(
"[ decstation_prom_emul"
376 "(): too many arguments ]");
389 snprintf(printfbuf,
sizeof(
390 printfbuf),
"%c", ch2);
393 snprintf(printfbuf,
sizeof(
394 printfbuf),
"%d", argdata);
397 snprintf(printfbuf,
sizeof(
398 printfbuf),
"%x", argdata);
404 ch2 = mem_readchar(
cpu,
424 printf(
"[ unknown printf format char"
431 snprintf(printfbuf,
sizeof(printfbuf),
435 printfbuf[
sizeof(printfbuf)-1] =
'\0';
437 for (x=0; x<
strlen(printfbuf); x++)
439 main_console_handle, printfbuf[x]);
461 debug(
"[ DEC PROM bootread(0x%x, 0x%08x, 0x%x) ]\n",
471 unsigned char *tmp_buf;
485 if (dst < 0x80000000ULL)
499 for (i=0; i<(int)
sizeof(buf); i++)
503 buf[
sizeof(buf)-1] =
'\0';
504 debug(
"[ DEC PROM getenv(\"%s\") ]\n", buf);
505 for (i=0; i<0x1000; i++) {
508 for (j=0; j<(int32_t)
strlen((
char *)buf); j++) {
517 + i +
strlen((
char *)buf)), &ch2,
sizeof(
char),
519 if (nmatches == (
int)
strlen((
char *)buf) && ch2==
'=') {
527 fatal(
"[ DEC PROM getenv(\"%s\"): WARNING: Not in "
528 "environment! ]\n", buf);
532 debug(
"[ DEC PROM slot_address(%i) ]\n",
539 slot_size = 4*1048576;
542 slot_base = 0x10000000;
543 slot_size = 0x4000000;
546 slot_base = 0x1e000000;
547 slot_size = 0x800000;
550 slot_base = 0x10000000;
551 slot_size = 0x4000000;
554 fatal(
"warning: DEC PROM slot_address() "
555 "unimplemented for this machine type\n");
558 (0x80000000 + slot_base + slot_size *
562 debug(
"[ DEC PROM wbflush(): TODO ]\n");
566 debug(
"[ DEC PROM clear_cache(0x%x,%i) ]\n",
581 debug(
"[ DEC PROM getbitmap(0x%08x) ]\n",
590 debug(
"[ DEC PROM disableintr(): TODO ]\n");
594 debug(
"[ DEC PROM enableintr(): TODO ]\n");
598 debug(
"[ DEC PROM halt() ]\n");
633 debug(
"[ DEC PROM rex('%c') ]\n",
637 debug(
"DEC PROM: rex('h') ==> halt\n");
642 debug(
"DEC PROM: rex('b') ==> reboot: TODO "
643 "(halting CPU instead)\n");
648 fatal(
"DEC prom emulation: unknown rex() a0=0x%" PRIx64
657 printf(
"a0 points to: ");
658 for (i=0; i<40; i++) {
659 unsigned char chTmp =
'\0';
663 if (chTmp >=
' ' && chTmp < 126)
666 printf(
"[%02x]", chTmp);
669 fatal(
"PROM emulation: unimplemented callback vector 0x%x\n",
void cpu_register_dump(struct machine *m, struct cpu *cpu, int gprs, int coprocs)
int diskimage_bootdev(struct machine *machine, int *typep)
void console_putchar(int handle, int ch)
void store_buf(struct cpu *cpu, uint64_t addr, const char *s, size_t len)
int diskimage_access(struct machine *machine, int id, int type, int writeflag, off_t offset, unsigned char *buf, size_t len)
int decstation_prom_emul(struct cpu *cpu)
void COMBINE() strlen(struct cpu *cpu, struct arm_instr_call *ic, int low_addr)
struct dec_memmap * memmap
void fatal(const char *fmt,...)
#define MACHINE_DEC_3MIN_5000
int console_readchar(int handle)
struct machine_pmax * pmax
int dec_jumptable_func(struct cpu *cpu, int vector)
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32)
#define KN02_PHYS_TC_0_START
uint64_t gpr[N_MIPS_GPRS]
#define MACHINE_DEC_3MAXPLUS_5000
#define MACHINE_DEC_3MAX_5000
#define MACHINE_DEC_MAXINE_5000
int exit_without_entering_debugger
int(* memory_rw)(struct cpu *cpu, struct memory *mem, uint64_t vaddr, unsigned char *data, size_t len, int writeflag, int cache_flags)
#define CHECK_ALLOCATION(ptr)
Generated on Tue Aug 25 2020 19:25:06 for GXemul by
1.8.18