__assert_func(const char *file, int line, const char *func, const char *failed_expr) { static char buf[4096]; static struct cons cons; static uint16_t blcs_color[] = { 0x80E0 /* Color green */ }; (void)snprintf(buf, 4096, "[2J[HAssertion \"%s\" failed: file \"%s\", line %d%s%s\n", failed_expr, file, line, (func ? ", function: " : ""), (func ? func : "")); /* Reset the VDP2 */ vdp2_init(); vdp2_tvmd_blcs_set(/* lcclmd = */ false, VRAM_ADDR_4MBIT(3, 0x1FFFE), blcs_color, 0); cons_vdp2_init(&cons); cons_write(&cons, buf); abort(); }
void logo_exit(void) { #ifdef DEBUG cons_write(&cons, "[10;2HDesinit Logo"); #endif vdp2_scrn_display_clear(); }
static void format(struct cpu_registers *regs, const char *exception_name) { static char buf[1024]; (void)sprintf(buf, "[1;44mException occurred:[m\n\t[1;44m%s[m\n\n" "\t r0 = 0x%08X r11 = 0x%08X\n" "\t r1 = 0x%08X r12 = 0x%08X\n" "\t r2 = 0x%08X r13 = 0x%08X\n" "\t r3 = 0x%08X r14 = 0x%08X\n" "\t r4 = 0x%08X sp = 0x%08X\n" "\t r5 = 0x%08X sr = 0x%08X\n" "\t r6 = 0x%08X gbr = 0x%08X\n" "\t r7 = 0x%08X vbr = 0x%08X\n" "\t r8 = 0x%08X mach = 0x%08X\n" "\t r9 = 0x%08X macl = 0x%08X\n" "\tr10 = 0x%08X pr = 0x%08X\n" " pc = 0x%08X\n", exception_name, (uintptr_t)regs->r[0], (uintptr_t)regs->r[11], (uintptr_t)regs->r[1], (uintptr_t)regs->r[12], (uintptr_t)regs->r[2], (uintptr_t)regs->r[13], (uintptr_t)regs->r[3], (uintptr_t)regs->r[14], (uintptr_t)regs->r[4], (uintptr_t)regs->sp, (uintptr_t)regs->r[5], (uintptr_t)regs->sr, (uintptr_t)regs->r[6], (uintptr_t)regs->gbr, (uintptr_t)regs->r[7], (uintptr_t)regs->vbr, (uintptr_t)regs->r[8], (uintptr_t)regs->mach, (uintptr_t)regs->r[9], (uintptr_t)regs->macl, (uintptr_t)regs->r[10], (uintptr_t)regs->pr, (uintptr_t)regs->pc); /* Reset the VDP1 */ vdp1_init(); /* Reset the VDP2 */ vdp2_init(); vdp2_tvmd_display_res_set(TVMD_INTERLACE_DOUBLE, TVMD_HORZ_HIRESO_A, TVMD_VERT_240); vdp2_scrn_back_screen_color_set(VRAM_ADDR_4MBIT(0, 0x01FFFE), COLOR_RGB555(0, 224, 0)); cons_init(CONS_DRIVER_VDP2, 80, 60); cons_write(buf); }
void logo_draw(void) { #ifdef DEBUG cons_write(&cons, "[09;2HDrawing Logo"); #endif }
void logo_update(void) { #ifdef DEBUG cons_write(&cons, "[08;2HUpdating Logo"); #endif }
void logo_init(void) { #ifdef DEBUG cons_write(&cons, "[07;2HUIniting Logo"); #endif }
void start_bootloader (void) { static char mem[4096]; static char buffer[1024]; unsigned long off; int fd, i; struct disk_req req; struct disk_stat stat; struct elfhdr *elf; struct elf_phdr *elf_phdr; /* program header */ unsigned long e_entry, e_phoff, e_phnum; register struct ia64_boot_param *bp; char *kpath, *args; long arglen = 0; ssc(0, 0, 0, 0, SSC_CONSOLE_INIT); /* * S.Eranian: extract the commandline argument from the simulator * * The expected format is as follows: * * kernelname args... * * Both are optional but you can't have the second one without the first. */ arglen = ssc((long) buffer, 0, 0, 0, SSC_GET_ARGS); kpath = "vmlinux"; args = buffer; if (arglen > 0) { kpath = buffer; while (*args != ' ' && *args != '\0') ++args, --arglen; if (*args == ' ') *args++ = '\0', --arglen; } if (arglen <= 0) { args = ""; arglen = 1; } fd = ssc((long) kpath, 1, 0, 0, SSC_OPEN); if (fd < 0) { cons_write(kpath); cons_write(": file not found, reboot now\n"); for(;;); } stat.fd = fd; off = 0; req.len = sizeof(mem); req.addr = (long) mem; ssc(fd, 1, (long) &req, off, SSC_READ); ssc((long) &stat, 0, 0, 0, SSC_WAIT_COMPLETION); elf = (struct elfhdr *) mem; if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) != 0) { cons_write("not an ELF file\n"); return; } if (elf->e_type != ET_EXEC) { cons_write("not an ELF executable\n"); return; } if (!elf_check_arch(elf)) { cons_write("kernel not for this processor\n"); return; } e_entry = elf->e_entry; e_phnum = elf->e_phnum; e_phoff = elf->e_phoff; cons_write("loading "); cons_write(kpath); cons_write("...\n"); for (i = 0; i < e_phnum; ++i) { req.len = sizeof(*elf_phdr); req.addr = (long) mem; ssc(fd, 1, (long) &req, e_phoff, SSC_READ); ssc((long) &stat, 0, 0, 0, SSC_WAIT_COMPLETION); if (stat.count != sizeof(*elf_phdr)) { cons_write("failed to read phdr\n"); return; } e_phoff += sizeof(*elf_phdr); elf_phdr = (struct elf_phdr *) mem; if (elf_phdr->p_type != PT_LOAD) continue; req.len = elf_phdr->p_filesz; req.addr = __pa(elf_phdr->p_paddr); ssc(fd, 1, (long) &req, elf_phdr->p_offset, SSC_READ); ssc((long) &stat, 0, 0, 0, SSC_WAIT_COMPLETION); memset((char *)__pa(elf_phdr->p_paddr) + elf_phdr->p_filesz, 0, elf_phdr->p_memsz - elf_phdr->p_filesz); } ssc(fd, 0, 0, 0, SSC_CLOSE); cons_write("starting kernel...\n"); /* fake an I/O base address: */ ia64_setreg(_IA64_REG_AR_KR0, 0xffffc000000UL); bp = sys_fw_init(args, arglen); ssc(0, (long) kpath, 0, 0, SSC_LOAD_SYMBOLS); debug_break(); jmp_to_kernel((unsigned long) bp, e_entry); cons_write("kernel returned!\n"); ssc(-1, 0, 0, 0, SSC_EXIT); }