my regs struct
Code: Select all
struct regs
{
unsigned int gs, fs, es, ds; /* pushed the segs last */
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; /* pushed by 'pusha' */
unsigned int int_no, err; /* our 'push byte #' and ecodes do this */
unsigned int eip, cs, eflags, useresp, ss; /* pushed by the processor automatically */
};
Code: Select all
.type isr_common,@function
isr_common:
pusha
push %ds
push %es
push %fs
push %gs
call RSOD
sti
iret
Code: Select all
void RSOD(struct regs r)
{
text_color(WHITE,RED);
clrscr();
Puts("ChaoS has encounted a problem\n");
if(r.int_no<19)
{
Printf("%s, interrupt %d, error %d\n",messages[r.int_no],r.int_no,r.err);
}
Puts("Registers:\n");
Printf("eax: %d ebx: %d ecx: %d\n",r.eax,r.ebx,r.ecx);
Printf("edx: %d esi: %d edi: %d\n",r.edx,r.esi,r.edi);
Printf("ebp: %d esp: %d gs: %d\n",r.ebp,r.esp,r.gs);
Printf("fs: %d es: %d ds: %d\n\n",r.fs,r.es,r.ds);
Printf("EFLAGS: %d\neip: %d\ncs: %d\n",r.eflags,r.eip,r.cs);
Printf("ss: %d\n",r.ss);
asm("hlt");
}