Files
TempleOS-Rijn/LT/ACCOUNTS/FAULT.CPZ
T
2018-09-08 21:45:17 +02:00

55 lines
1.2 KiB
Plaintext

/* When a fault occurs, a child process is
spawned running this file and the parent
gets suspended. You can modify what gets
displayed during faults to assist debugging.
If you modify this file, you should place it
into your HOME directory. This version is the
default for accounts without a version in HOME.
*/
TssStruct *tss=Fs->parent_tss;
U4 *esp_ptr=&tss->esp,*esp=tss->esp,
*eip_ptr=&tss->eip,*eip=tss->eip;
switch (Fs->user_aux0)
{
case 0: //if divide except
//push eip as param to ThrowDivide
esp-=8;
*esp_ptr=esp;
esp[1]=eip;
esp[2]=0;
*eip_ptr=&ThrowDivide;
Btr(&tss->task_flags,TSSf_SUSPENDED);
Exit;
case 0x19:
//push eip as param to ThrowDivide
esp-=8;
*esp_ptr=esp;
esp[1]=eip;
esp[2]=0;
*eip_ptr=&ThrowFloating;
Btr(&tss->task_flags,TSSf_SUSPENDED);
Exit;
}
/*
Raw(ON);
coutln "Faulting TSS:",tss," IRQ#",Fs->user_aux0;
PrintF("Fault Location:%P\r\n",*eip);
Raw(OFF);
*/
UseConsoleLtf(NULL);
Bts(&Fs->crt_flags,CRTf_SHOW);
coutln "Faulting TSS:",tss," IRQ#",Fs->user_aux0;
//MachineRegsRep;
StackRep(esp);
coutln "$$LK,\"See HOME/FAULT.CPZ\",\"FI:HOME/FAULT.CPZ\"$$";
TssRep(tss);
Dasm(eip-0x20,0x20);