Skip to content

Commit

Permalink
output unique debug number on systems that do have a post code display
Browse files Browse the repository at this point in the history
(booting dbvmuefi now works on asus mainboards as well)
  • Loading branch information
cheat-engine committed Mar 14, 2020
1 parent 10e76b1 commit 837ce36
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 98 deletions.
6 changes: 3 additions & 3 deletions dbvm/vmm/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ void exit(int status)
{
sendstringf("Exited DBVM with status %d\n", status);
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xc0);
}

void abort(void)
{
sendstringf("Exited DBVM\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xc1);
}


Expand Down Expand Up @@ -1097,7 +1097,7 @@ void csLeave(PcriticalSection CS)
{
sendstringf("csLeave called for a non-locked or non-owned critical section\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xc2);
}
}

Expand Down
2 changes: 1 addition & 1 deletion dbvm/vmm/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stddef.h>


#define DELAYEDSERIAL
//#define DELAYEDSERIAL

#ifdef DELAYEDSERIAL
extern int useserial;
Expand Down
2 changes: 1 addition & 1 deletion dbvm/vmm/epthandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2352,7 +2352,7 @@ QWORD EPTMapPhysicalMemory(pcpuinfo currentcpuinfo, QWORD physicalAddress, int f
{
sendstring("Assertion Fail: fullmap is false for a 1 page range");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xc3);
}

//memtype=0;
Expand Down
2 changes: 1 addition & 1 deletion dbvm/vmm/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void addresslist_add(PAddressList l, QWORD address, void *data)
{
//error, already in the list
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xc4);

}

Expand Down
17 changes: 7 additions & 10 deletions dbvm/vmm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ int cinthandler(unsigned long long *stack, int intnr) //todo: move to it's own s
{
sendstringf("Invalid FS base during exception\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1) ;
while (1) outportb(0x80,0xc5);
}

pcpuinfo cpuinfo=getcpuinfo();
Expand Down Expand Up @@ -273,7 +273,7 @@ int cinthandler(unsigned long long *stack, int intnr) //todo: move to it's own s

sendstringf("longjmp just went through...\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xc6);
}

if (cpuinfo->OnInterrupt.RIP)
Expand Down Expand Up @@ -913,7 +913,7 @@ void vmm_entry(void)
{
vmm_entry2();
sendstringf("vmm_entry2 has PHAILED!!!!");
while (1);
while (1) outportb(0x80,0xc7);
}
isAP=1; //all other entries will be an AP

Expand Down Expand Up @@ -1243,7 +1243,7 @@ void vmm_entry(void)
{
sendstring("Memory allocation failed\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1) ;
while (1) outportb(0x80,0xc8);
}

sendstringf("Allocated GDT_BASE %6\n", GDT_BASE);
Expand Down Expand Up @@ -2737,10 +2737,7 @@ void startvmx(pcpuinfo currentcpuinfo)
launchVMX(currentcpuinfo);

sendstring("launchVMX returned\n");
while (1)
{

}
while (1) outportb(0x80,0xc9);


}
Expand Down Expand Up @@ -2831,7 +2828,7 @@ void startvmx(pcpuinfo currentcpuinfo)
{
sendstringf(">>>>>>>>>>>>>>>>>>>>vmxon allocation has failed<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xca);
}

zeromemory(currentcpuinfo->vmxon_region,4096);
Expand All @@ -2846,7 +2843,7 @@ void startvmx(pcpuinfo currentcpuinfo)
{
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
sendstringf(">>>>>>>>>>>>>>>>>>>>vmcs_region allocation has failed<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
while (1);
while (1) outportb(0x80,0xcb);
}


Expand Down
14 changes: 7 additions & 7 deletions dbvm/vmm/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ void unmapPhysicalMemoryGlobal(void *virtualaddress, int size)
{
sendstringf("invalid global address (%6) given to unmapPhysicalMemoryGlobal\n",virtualaddress);
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xcd);
}


Expand All @@ -611,7 +611,7 @@ void unmapPhysicalMemory(void *virtualaddress, int size)
{
sendstringf("%d: invalid address given to unmapPhysicalMemory (%6)\n",c->cpunr, virtualaddress);
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xce);
}

int i;
Expand Down Expand Up @@ -747,7 +747,7 @@ void *addPhysicalPageToDBVM(QWORD address)
{
sendstringf("Assertion failure. Virtual address %6 was already present\n", VirtualAddress);
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xcf);
}

*(QWORD *)pagetableentry=address;
Expand Down Expand Up @@ -980,8 +980,8 @@ void *malloc2(unsigned int size)
sendstring("OUT OF MEMORY\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);

while (1)
jtagbp();
while (1) outportb(0x80,0xd0);


return NULL; //still here so no memory allocated
}
Expand Down Expand Up @@ -1124,7 +1124,7 @@ void *realloc(void *old, size_t size)
{
sendstringf("realloc error\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1) ;
while (1) outportb(0x80,0xd1);
}
}

Expand Down Expand Up @@ -1235,7 +1235,7 @@ void InitializeMM(UINT64 FirstFreeVirtualAddress)
{
sendstring("Assertion failed. pagedirlvl4[pml4index].P is not 0. It should be\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xd1);
}
*(QWORD*)(&pagedirlvl4[pml4index])=getCR3();
pagedirlvl4[pml4index].P=1;
Expand Down
4 changes: 2 additions & 2 deletions dbvm/vmm/vmcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ int _handleVMCall(pcpuinfo currentcpuinfo, VMRegisters *vmregisters)
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
if (r)
{
while (1);
while (1) outportb(0x80,0xd2);
}
return 0;
}
Expand Down Expand Up @@ -2175,7 +2175,7 @@ int handleVMCall(pcpuinfo currentcpuinfo, VMRegisters *vmregisters)
{
sendstringf("no jtag available\n");
ddDrawRectangle(0,DDVerticalResolution-100,100,100,0xff0000);
while (1);
while (1) outportb(0x80,0xd3);
}
tryend

Expand Down
14 changes: 10 additions & 4 deletions dbvm/vmm/vmevent_invalidstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ VMSTATUS handleInvalidEntryState(pcpuinfo currentcpuinfo,VMRegisters *vmregister

// outportb(0x80,0xc2);

while (1) outportb(0x80,0xd4); //todo: remove on release


if (((guestrflags.TF) || (vmread(vm_guest_IA32_DEBUGCTL) & (1<<1))) && ((vmread(vm_pending_debug_exceptions) & (1<<14))==0))
{
//TF or BTF is set
/*
while (1)
outportb(0x80,0xc3);
outportb(0x80,0xc3);*/

sendstring("Setting pending debug exception\n\r");
vmwrite(vm_pending_debug_exceptions, vmread(vm_pending_debug_exceptions) | (1<<14) );
Expand All @@ -80,8 +83,9 @@ VMSTATUS handleInvalidEntryState(pcpuinfo currentcpuinfo,VMRegisters *vmregister

if (fixInterruptabilityState())
{
/*
while (1)
outportb(0x80,0xc4);
outportb(0x80,0xc4);*/


return VM_OK;
Expand All @@ -93,19 +97,21 @@ VMSTATUS handleInvalidEntryState(pcpuinfo currentcpuinfo,VMRegisters *vmregister
int result;



outportb(0x80,0xc5);



sendstring("Inside realmode. Trying to emulate instructions\n\r");
result=FALSE; //emulateRealMode(currentcpuinfo, vmregisters)==0;
result=emulateRealMode(currentcpuinfo, vmregisters)==0;

sendstringf("emulateRealMode(...) returned %d\n\r",result);

if (result==TRUE)
{
/*
while (1)
outportb(0x80,0xc6);
outportb(0x80,0xc6);*/
sendstring("emulation was handled properly\n");

return VM_OK; //handled at least one instruction
Expand Down
Loading

0 comments on commit 837ce36

Please sign in to comment.