Beispiel #1
0
VOID NTAPI HcDispatchHypercall (
  PCPU Cpu,
  PGUEST_REGS GuestRegs
)
{

#ifndef ENABLE_HYPERCALLS

  return;

#else

  ULONG32 HypercallNumber;
  ULONG32 HypercallResult = 0;

  if (!Cpu || !GuestRegs)
    return;

  HypercallNumber = (ULONG32) (GuestRegs->rdx & 0xffff);

  switch (HypercallNumber) {
  case NBP_HYPERCALL_UNLOAD:

    _KdPrint (("HcDispatchHypercall(): NBP_HYPERCALL_UNLOAD\n"));

    GuestRegs->rcx = NBP_MAGIC;
    GuestRegs->rdx = HypercallResult;

    if (Hvm->Architecture == ARCH_SVM)
      Hvm->ArchAdjustRip (Cpu, GuestRegs, 2);

    // disable virtualization, resume guest, don't setup time bomb
    Hvm->ArchShutdown (Cpu, GuestRegs, FALSE);

    // never returns

    _KdPrint (("HcDispatchHypercall(): ArchShutdown() returned\n"));

    break;

  default:

    _KdPrint (("HcDispatchHypercall(): Unsupported hypercall 0x%04X\n", HypercallNumber));
    break;
  }

  GuestRegs->rcx = NBP_MAGIC;
  GuestRegs->rdx = HypercallResult;

#endif
}
Beispiel #2
0
static ULONG64 ChQueueGetFirst (
  PCPU Cpu
)
{
  if (Cpu->ChickenQueueSize == 0) {
    _KdPrint (("Chicken Queue Error: Attempt to get element from empty queue!\n"));
    return -1;
  }
  return Cpu->ChickenQueueTable[Cpu->ChickenQueueHead];
}
Beispiel #3
0
static VOID DumpMemory (
  PUCHAR Addr,
  ULONG64 Len
)
{
  ULONG64 i;
  for (i = 0; i < Len; i++) {
    _KdPrint (("0x%x 0x%x\n", Addr + i, *(Addr + i)));
  }
}
Beispiel #4
0
static ULONG64 ChQueueGetLast (
  PCPU Cpu
)
{
  int indx;
  if (Cpu->ChickenQueueSize == 0) {
    _KdPrint (("Chicken Queue Error: Attempt to get element from empty queue!\n"));
    return -1;
  }
  if (Cpu->ChickenQueueTail == 0)
    indx = CHICKEN_QUEUE_SZ - 1;
  else
    indx = Cpu->ChickenQueueTail - 1;
  return Cpu->ChickenQueueTable[indx];
}
Beispiel #5
0
static VOID ChQueueEnqueue (
  PCPU Cpu,
  ULONG64 x
)
{
  if (Cpu->ChickenQueueSize == CHICKEN_QUEUE_SZ) {
    _KdPrint (("Chicken Queue Error: Attempt to enqueue element to already full queue!\n"));
    return;
  }
  Cpu->ChickenQueueTable[Cpu->ChickenQueueTail] = x;
  if (Cpu->ChickenQueueTail == CHICKEN_QUEUE_SZ - 1)
    Cpu->ChickenQueueTail = 0;
  else
    Cpu->ChickenQueueTail++;
  Cpu->ChickenQueueSize++;
}
Beispiel #6
0
static ULONG64 ChQueueDequeue (
  PCPU Cpu
)
{
  ULONG64 x;
  if (Cpu->ChickenQueueSize == 0) {
    _KdPrint (("Chicken Queue Error: Attempt to dequeue element from empty queue!\n"));
    return -1;
  }
  x = Cpu->ChickenQueueTable[Cpu->ChickenQueueHead];
  if (Cpu->ChickenQueueHead == CHICKEN_QUEUE_SZ - 1)
    Cpu->ChickenQueueHead = 0;
  else
    Cpu->ChickenQueueHead++;

  Cpu->ChickenQueueSize--;
  return x;
}
Beispiel #7
0
NTSTATUS NTAPI HcMakeHypercall (
  ULONG32 HypercallNumber,
  ULONG32 HypercallParameter,
  PULONG32 pHypercallResult
)
{

#ifndef ENABLE_HYPERCALLS

  return STATUS_NOT_SUPPORTED;

#else

  ULONG32 edx = HypercallParameter, ecx;

  if (Hvm->Architecture == ARCH_VMX) {
    VmxVmCall (HypercallNumber);
    return STATUS_SUCCESS;
  }
  // low part contains a hypercall number
  edx = HypercallNumber | (NBP_MAGIC & 0xffff0000);
  ecx = NBP_MAGIC + 1;

  CpuidWithEcxEdx (&ecx, &edx);

  if (ecx != NBP_MAGIC) {
    _KdPrint (("HcMakeHypercall(): No NewBluePill detected on the processor #%d\n", KeGetCurrentProcessorNumber ()));
    return STATUS_NOT_SUPPORTED;
  }

  if (pHypercallResult)
    *pHypercallResult = edx;

  return STATUS_SUCCESS;
#endif
}
Beispiel #8
0
VOID NTAPI VmxCrash (
  PCPU Cpu,
  PGUEST_REGS GuestRegs
)
{
  PHYSICAL_ADDRESS pa;
  NTSTATUS Status;
  _KdPrint (("!!!VMX CRASH!!!\n"));

#if DEBUG_LEVEL>1
  _KdPrint (("rax 0x%llX\n", GuestRegs->rax));
  _KdPrint (("rcx 0x%llX\n", GuestRegs->rcx));
  _KdPrint (("rdx 0x%llX\n", GuestRegs->rdx));
  _KdPrint (("rbx 0x%llX\n", GuestRegs->rbx));
  _KdPrint (("rsp 0x%llX\n", GuestRegs->rsp));
  _KdPrint (("rbp 0x%llX\n", GuestRegs->rbp));
  _KdPrint (("rsi 0x%llX\n", GuestRegs->rsi));
  _KdPrint (("rdi 0x%llX\n", GuestRegs->rdi));

  _KdPrint (("r8 0x%llX\n", GuestRegs->r8));
  _KdPrint (("r9 0x%llX\n", GuestRegs->r9));
  _KdPrint (("r10 0x%llX\n", GuestRegs->r10));
  _KdPrint (("r11 0x%llX\n", GuestRegs->r11));
  _KdPrint (("r12 0x%llX\n", GuestRegs->r12));
  _KdPrint (("r13 0x%llX\n", GuestRegs->r13));
  _KdPrint (("r14 0x%llX\n", GuestRegs->r14));
  _KdPrint (("r15 0x%llX\n", GuestRegs->r15));
  _KdPrint (("Guest MSR_EFER Read 0x%llx \n", Cpu->Vmx.GuestEFER));
  CmGetPagePaByPageVaCr3 (Cpu, VmxRead (GUEST_CR3), VmxRead (GUEST_RIP), &pa);
  _KdPrint (("VmxCrash() IOA: Failed to map PA 0x%p to VA 0x%p\n", pa.QuadPart, Cpu->SparePage));
#endif

#if DEBUG_LEVEL>2
  if (!NT_SUCCESS (Status = CmPatchPTEPhysicalAddress (Cpu->SparePagePTE, Cpu->SparePage, pa))) {
    _KdPrint (("VmxCrash() IOA: Failed to map PA 0x%p to VA 0x%p, status 0x%08hX\n", pa.QuadPart, Cpu->SparePage,
               Status));
  }
  DumpMemory ((PUCHAR)
              (((ULONG64) Cpu->SparePage) | ((VmxRead (GUEST_RIP) - 0x10) & 0xfff)), 0x50);
#endif
  while (1);
}
Beispiel #9
0
VOID NTAPI VmxDumpVmcs (
)
{

  ULONG32 addr;

  _KdPrint (("\n\n\n/*****16-bit Guest-State Fields*****/\n"));
  addr = GUEST_ES_SELECTOR;
  _KdPrint (("GUEST_ES_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_CS_SELECTOR;
  _KdPrint (("GUEST_CS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_SS_SELECTOR;
  _KdPrint (("GUEST_SS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_DS_SELECTOR;
  _KdPrint (("GUEST_DS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_FS_SELECTOR;
  _KdPrint (("GUEST_FS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_GS_SELECTOR;
  _KdPrint (("GUEST_GS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_LDTR_SELECTOR;
  _KdPrint (("GUEST_LDTR_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_TR_SELECTOR;
  _KdPrint (("GUEST_TR_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****16-bit Host-State Fields*****/\n"));
  addr = HOST_ES_SELECTOR;
  _KdPrint (("HOST_ES_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_CS_SELECTOR;
  _KdPrint (("HOST_CS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_SS_SELECTOR;
  _KdPrint (("HOST_SS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_DS_SELECTOR;
  _KdPrint (("HOST_DS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_FS_SELECTOR;
  _KdPrint (("HOST_FS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_GS_SELECTOR;
  _KdPrint (("HOST_GS_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_TR_SELECTOR;
  _KdPrint (("HOST_TR_SELECTOR 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****64-bit Control Fields*****/\n"));
  addr = IO_BITMAP_A;
  _KdPrint (("IO_BITMAP_A 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = IO_BITMAP_A_HIGH;
  _KdPrint (("IO_BITMAP_A_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = IO_BITMAP_B;
  _KdPrint (("IO_BITMAP_B 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = IO_BITMAP_B_HIGH;
  _KdPrint (("IO_BITMAP_B_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = MSR_BITMAP;
  _KdPrint (("MSR_BITMAP 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = MSR_BITMAP_HIGH;
  _KdPrint (("MSR_BITMAP_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_MSR_STORE_ADDR;
  _KdPrint (("VM_EXIT_MSR_STORE_ADDR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_MSR_STORE_ADDR_HIGH;
  _KdPrint (("VM_EXIT_MSR_STORE_ADDR_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_MSR_LOAD_ADDR;
  _KdPrint (("VM_EXIT_MSR_LOAD_ADDR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_MSR_LOAD_ADDR_HIGH;
  _KdPrint (("VM_EXIT_MSR_LOAD_ADDR_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_ENTRY_MSR_LOAD_ADDR;
  _KdPrint (("VM_ENTRY_MSR_LOAD_ADDR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_ENTRY_MSR_LOAD_ADDR_HIGH;
  _KdPrint (("VM_ENTRY_MSR_LOAD_ADDR_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = TSC_OFFSET;
  _KdPrint (("TSC_OFFSET 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = TSC_OFFSET_HIGH;
  _KdPrint (("TSC_OFFSET_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VIRTUAL_APIC_PAGE_ADDR;
  _KdPrint (("VIRTUAL_APIC_PAGE_ADDR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VIRTUAL_APIC_PAGE_ADDR_HIGH;
  _KdPrint (("VIRTUAL_APIC_PAGE_ADDR_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****64-bit Guest-State Fields*****/\n"));
  addr = VMCS_LINK_POINTER;
  _KdPrint (("VMCS_LINK_POINTER 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VMCS_LINK_POINTER_HIGH;
  _KdPrint (("VMCS_LINK_POINTER_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_IA32_DEBUGCTL;
  _KdPrint (("GUEST_IA32_DEBUGCTL 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_IA32_DEBUGCTL_HIGH;
  _KdPrint (("GUEST_IA32_DEBUGCTL_HIGH 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****32-bit Control Fields*****/\n"));
  addr = PIN_BASED_VM_EXEC_CONTROL;
  _KdPrint (("PIN_BASED_VM_EXEC_CONTROL 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = CPU_BASED_VM_EXEC_CONTROL;
  _KdPrint (("CPU_BASED_VM_EXEC_CONTROL 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = EXCEPTION_BITMAP;
  _KdPrint (("EXCEPTION_BITMAP 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = PAGE_FAULT_ERROR_CODE_MASK;
  _KdPrint (("PAGE_FAULT_ERROR_CODE_MASK 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = PAGE_FAULT_ERROR_CODE_MATCH;
  _KdPrint (("PAGE_FAULT_ERROR_CODE_MATCH 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = CR3_TARGET_COUNT;
  _KdPrint (("CR3_TARGET_COUNT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_CONTROLS;
  _KdPrint (("VM_EXIT_CONTROLS 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_MSR_STORE_COUNT;
  _KdPrint (("VM_EXIT_MSR_STORE_COUNT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_MSR_LOAD_COUNT;
  _KdPrint (("VM_EXIT_MSR_LOAD_COUNT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_ENTRY_CONTROLS;
  _KdPrint (("VM_ENTRY_CONTROLS 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_ENTRY_MSR_LOAD_COUNT;
  _KdPrint (("VM_ENTRY_MSR_LOAD_COUNT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_ENTRY_INTR_INFO_FIELD;
  _KdPrint (("VM_ENTRY_INTR_INFO_FIELD 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_ENTRY_EXCEPTION_ERROR_CODE;
  _KdPrint (("VM_ENTRY_EXCEPTION_ERROR_CODE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_ENTRY_INSTRUCTION_LEN;
  _KdPrint (("VM_ENTRY_INSTRUCTION_LEN 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = TPR_THRESHOLD;
  _KdPrint (("TPR_THRESHOLD 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = SECONDARY_VM_EXEC_CONTROL;
  _KdPrint (("SECONDARY_VM_EXEC_CONTROL 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****32-bit RO Data Fields*****/\n"));
  addr = VM_INSTRUCTION_ERROR;
  _KdPrint (("VM_INSTRUCTION_ERROR 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_REASON;
  _KdPrint (("VM_EXIT_REASON 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_INTR_INFO;
  _KdPrint (("VM_EXIT_INTR_INFO 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_INTR_ERROR_CODE;
  _KdPrint (("VM_EXIT_INTR_ERROR_CODE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = IDT_VECTORING_INFO_FIELD;
  _KdPrint (("IDT_VECTORING_INFO_FIELD 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = IDT_VECTORING_ERROR_CODE;
  _KdPrint (("IDT_VECTORING_ERROR_CODE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VM_EXIT_INSTRUCTION_LEN;
  _KdPrint (("VM_EXIT_INSTRUCTION_LEN 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = VMX_INSTRUCTION_INFO;
  _KdPrint (("VMX_INSTRUCTION_INFO 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****32-bit Guest-State Fields*****/\n"));
  addr = GUEST_ES_LIMIT;
  _KdPrint (("GUEST_ES_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_CS_LIMIT;
  _KdPrint (("GUEST_CS_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_SS_LIMIT;
  _KdPrint (("GUEST_SS_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_DS_LIMIT;
  _KdPrint (("GUEST_DS_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_FS_LIMIT;
  _KdPrint (("GUEST_FS_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_GS_LIMIT;
  _KdPrint (("GUEST_GS_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_LDTR_LIMIT;
  _KdPrint (("GUEST_LDTR_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_TR_LIMIT;
  _KdPrint (("GUEST_TR_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_GDTR_LIMIT;
  _KdPrint (("GUEST_GDTR_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_IDTR_LIMIT;
  _KdPrint (("GUEST_IDTR_LIMIT 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_ES_AR_BYTES;
  _KdPrint (("GUEST_ES_AR_BYTES 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_CS_AR_BYTES;
  _KdPrint (("GUEST_CS_AR_BYTES 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_SS_AR_BYTES;
  _KdPrint (("GUEST_SS_AR_BYTES 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_DS_AR_BYTES;
  _KdPrint (("GUEST_DS_AR_BYTES 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_FS_AR_BYTES;
  _KdPrint (("GUEST_FS_AR_BYTES 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_GS_AR_BYTES;
  _KdPrint (("GUEST_GS_AR_BYTES 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_LDTR_AR_BYTES;
  _KdPrint (("GUEST_LDTR_AR_BYTES 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_TR_AR_BYTES;
  _KdPrint (("GUEST_TR_AR_BYTES 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_INTERRUPTIBILITY_INFO;
  _KdPrint (("GUEST_INTERRUPTIBILITY_INFO 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_ACTIVITY_STATE;
  _KdPrint (("GUEST_ACTIVITY_STATE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_SM_BASE;
  _KdPrint (("GUEST_SM_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_SYSENTER_CS;
  _KdPrint (("GUEST_SYSENTER_CS 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****32-bit Host-State Fields*****/\n"));
  addr = HOST_IA32_SYSENTER_CS;
  _KdPrint (("HOST_IA32_SYSENTER_CS 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****Natural 64-bit Control Fields*****/\n"));
  addr = CR0_GUEST_HOST_MASK;
  _KdPrint (("CR0_GUEST_HOST_MASK 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = CR4_GUEST_HOST_MASK;
  _KdPrint (("CR4_GUEST_HOST_MASK 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = CR0_READ_SHADOW;
  _KdPrint (("CR0_READ_SHADOW 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = CR4_READ_SHADOW;
  _KdPrint (("CR4_READ_SHADOW 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = CR3_TARGET_VALUE0;
  _KdPrint (("CR3_TARGET_VALUE0 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = CR3_TARGET_VALUE1;
  _KdPrint (("CR3_TARGET_VALUE1 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = CR3_TARGET_VALUE2;
  _KdPrint (("CR3_TARGET_VALUE2 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = CR3_TARGET_VALUE3;
  _KdPrint (("CR3_TARGET_VALUE3 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****Natural 64-bit RO Data Fields*****/\n"));
  addr = EXIT_QUALIFICATION;
  _KdPrint (("EXIT_QUALIFICATION 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_LINEAR_ADDRESS;
  _KdPrint (("GUEST_LINEAR_ADDRESS 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****Natural 64-bit Guest-State Fields*****/\n"));
  addr = GUEST_CR0;
  _KdPrint (("GUEST_CR0 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_CR3;
  _KdPrint (("GUEST_CR3 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_CR4;
  _KdPrint (("GUEST_CR4 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_ES_BASE;
  _KdPrint (("GUEST_ES_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_CS_BASE;
  _KdPrint (("GUEST_CS_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_SS_BASE;
  _KdPrint (("GUEST_SS_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_DS_BASE;
  _KdPrint (("GUEST_DS_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_FS_BASE;
  _KdPrint (("GUEST_FS_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_GS_BASE;
  _KdPrint (("GUEST_GS_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_LDTR_BASE;
  _KdPrint (("GUEST_LDTR_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_TR_BASE;
  _KdPrint (("GUEST_TR_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_GDTR_BASE;
  _KdPrint (("GUEST_GDTR_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_IDTR_BASE;
  _KdPrint (("GUEST_IDTR_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_DR7;
  _KdPrint (("GUEST_DR7 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_RSP;
  _KdPrint (("GUEST_RSP 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_RIP;
  _KdPrint (("GUEST_RIP 0x%X: 0x%llX\n", addr, VmxRead (addr)));
  addr = GUEST_RFLAGS;
  _KdPrint (("GUEST_RFLAGS 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_PENDING_DBG_EXCEPTIONS;
  _KdPrint (("GUEST_PENDING_DBG_EXCEPTIONS 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_SYSENTER_ESP;
  _KdPrint (("GUEST_SYSENTER_ESP 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = GUEST_SYSENTER_EIP;
  _KdPrint (("GUEST_SYSENTER_EIP 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  _KdPrint (("\n\n\n/*****Natural 64-bit Host-State Fields*****/\n"));
  addr = HOST_CR0;
  _KdPrint (("HOST_CR0 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_CR3;
  _KdPrint (("HOST_CR3 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_CR4;
  _KdPrint (("HOST_CR4 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_FS_BASE;
  _KdPrint (("HOST_FS_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_GS_BASE;
  _KdPrint (("HOST_GS_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_TR_BASE;
  _KdPrint (("HOST_TR_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_GDTR_BASE;
  _KdPrint (("HOST_GDTR_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_IDTR_BASE;
  _KdPrint (("HOST_IDTR_BASE 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_IA32_SYSENTER_ESP;
  _KdPrint (("HOST_IA32_SYSENTER_ESP 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_IA32_SYSENTER_EIP;
  _KdPrint (("HOST_IA32_SYSENTER_EIP 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_RSP;
  _KdPrint (("HOST_RSP 0x%X: 0x%llx\n", addr, VmxRead (addr)));
  addr = HOST_RIP;
  _KdPrint (("HOST_RIP 0x%X: 0x%llx\n", addr, VmxRead (addr)));

  return;
}
Beispiel #10
0
VOID NTAPI InHandleInterrupt (
  PCPU Cpu,
  PTRAP_FRAME TrapFrame,
  ULONG uInterrupt,
  ULONG64 uErrorCode
)
{

  if (uInterrupt == 13) {
    _KdPrint (("InHandleInterrupt(): CPU#%d: #GP, error code %d\n", 0xff,       //Cpu->ProcessorNumber,
               uErrorCode));
  } else {
    _KdPrint (("InHandleInterrupt(): CPU#%d: Interrupt 0x%X, error code %d\n", 0xff,    //Cpu->ProcessorNumber,
               uInterrupt, uErrorCode));
  }

  _KdPrint (("InHandleInterrupt(): rip 0x%p\n", TrapFrame->rip));
  _KdPrint (("InHandleInterrupt(): rflags 0x%p\n", TrapFrame->rflags));

  _KdPrint (("InHandleInterrupt(): rax 0x%p  r8  0x%p\n", TrapFrame->rax, TrapFrame->r8));
  _KdPrint (("InHandleInterrupt(): rbx 0x%p  r9  0x%p\n", TrapFrame->rbx, TrapFrame->r9));
  _KdPrint (("InHandleInterrupt(): rcx 0x%p  r10 0x%p\n", TrapFrame->rcx, TrapFrame->r10));
  _KdPrint (("InHandleInterrupt(): rdx 0x%p  r11 0x%p\n", TrapFrame->rdx, TrapFrame->r11));
  _KdPrint (("InHandleInterrupt(): rsi 0x%p  r12 0x%p\n", TrapFrame->rsi, TrapFrame->r12));
  _KdPrint (("InHandleInterrupt(): rdi 0x%p  r13 0x%p\n", TrapFrame->rdi, TrapFrame->r13));
  _KdPrint (("InHandleInterrupt(): rbp 0x%p  r14 0x%p\n", TrapFrame->rbp, TrapFrame->r14));
  _KdPrint (("InHandleInterrupt(): rsp 0x%p  r15 0x%p\n", TrapFrame->rsp, TrapFrame->r15));

  return;
}
Beispiel #11
0
VOID NTAPI InHandleException (
  PCPU Cpu,
  PTRAP_FRAME TrapFrame,
  ULONG uException,
  ULONG64 uErrorCode
)
{

  if (uException == 13) {
    _KdPrint (("InHandleException(): CPU#%d: #GP, error code %d\n", 0xff,       //Cpu->ProcessorNumber,
               uErrorCode));
  } else {
    _KdPrint (("InHandleException(): CPU#%d: Exception 0x%X, error code %d\n", 0xff,    //Cpu->ProcessorNumber,
               uException, uErrorCode));
  }

  _KdPrint (("InHandleException(): rip 0x%p\n", TrapFrame->rip));
  _KdPrint (("InHandleException(): rflags 0x%p\n", TrapFrame->rflags));

  _KdPrint (("InHandleException(): rax 0x%p  r8  0x%p\n", TrapFrame->rax, TrapFrame->r8));
  _KdPrint (("InHandleException(): rbx 0x%p  r9  0x%p\n", TrapFrame->rbx, TrapFrame->r9));
  _KdPrint (("InHandleException(): rcx 0x%p  r10 0x%p\n", TrapFrame->rcx, TrapFrame->r10));
  _KdPrint (("InHandleException(): rdx 0x%p  r11 0x%p\n", TrapFrame->rdx, TrapFrame->r11));
  _KdPrint (("InHandleException(): rsi 0x%p  r12 0x%p\n", TrapFrame->rsi, TrapFrame->r12));
  _KdPrint (("InHandleException(): rdi 0x%p  r13 0x%p\n", TrapFrame->rdi, TrapFrame->r13));
  _KdPrint (("InHandleException(): rbp 0x%p  r14 0x%p\n", TrapFrame->rbp, TrapFrame->r14));
  _KdPrint (("InHandleException(): rsp 0x%p  r15 0x%p\n", TrapFrame->rsp, TrapFrame->r15));

  TrapFrame->rip += 2;
  TrapFrame->r8 = STATUS_UNSUCCESSFUL;

  return;
}