2 pcboot - bootable PC demo/game kernel
3 Copyright (C) 2018-2023 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY, without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
24 struct all_registers {
25 uint32_t eax, ebx, ecx, edx;
26 uint32_t esp, ebp, esi, edi;
28 uint32_t cs, ss, ds, es, fs, gs;
29 uint32_t cr0, cr1, cr2, cr3;
32 /* defined in regs.S */
33 void get_regs(struct all_registers *regs);
35 void panic(const char *fmt, ...)
38 struct all_registers regs;
43 memset(®s, 0, sizeof regs);
48 printf("~~~~~ pcboot panic ~~~~~\n");
53 printf("\nRegisters:\n");
54 printf("eax: %x, ebx: %x, ecx: %x, edx: %x\n", regs.eax, regs.ebx, regs.ecx, regs.edx);
55 printf("esp: %x, ebp: %x, esi: %x, edi: %x\n", regs.esp, regs.ebp, regs.esi, regs.edi);
56 printf("eip: %x, eflags: %x\n", eip, regs.eflags);
57 printf("cr0: %x, cr1: %x, cr2: %x, cr3: %x\n", regs.cr0, regs.cr1, regs.cr2, regs.cr3);
58 printf("cs: %x (%d|%d)\n", regs.cs, regs.cs >> 3, regs.cs & 3);
59 printf("ss: %x (%d|%d)\n", regs.ss, regs.ss >> 3, regs.ss & 3);
60 printf("ds: %x (%d|%d)\n", regs.ds, regs.ds >> 3, regs.ds & 3);
61 printf("es: %x (%d|%d)\n", regs.es, regs.es >> 3, regs.es & 3);
62 printf("fs: %x (%d|%d)\n", regs.fs, regs.fs >> 3, regs.fs & 3);
63 printf("gs: %x (%d|%d)\n", regs.gs, regs.gs >> 3, regs.gs & 3);
72 int ien = get_intr_flag();
78 printf("%d: %p\n", lvl++, (void*)frmptr[1]);
79 frmptr = (uint32_t*)*frmptr;