📄 nkmips.h
字号:
/*++ BUILD Version: 0015 Increment this if a change has global effects
Copyright (c) 1990-2000 Microsoft Corporation. All rights reserved.
Module Name:
ntmips.h
Abstract:
User-mode visible Mips specific structures and constants
--*/
#ifndef _NTMIPS_
#define _NTMIPS_
#include "mipsinst.h"
#if defined(MIPS16SUPPORT)
#include "m16inst.h"
#endif
// begin_ntddk begin_nthal
#if defined(_MIPS_)
//
// Define system time structure.
//
typedef struct _KSYSTEM_TIME {
ULONG LowPart;
LONG High1Time;
LONG High2Time;
} KSYSTEM_TIME, *PKSYSTEM_TIME;
//
// Define unsupported "keywords".
//
#define _cdecl
// begin_windbgkd
#if defined(_MIPS_)
// end_ntddk end_nthal
//
// Define MIPS specific kernel debugger information.
//
// The following structure contains machine specific data passed to
// the host system kernel debugger in a wait state change message.
//
#define DBGKD_MAXSTREAM 16
typedef struct _DBGKD_CONTROL_REPORT {
ULONG InstructionCount;
UCHAR InstructionStream[DBGKD_MAXSTREAM];
} DBGKD_CONTROL_REPORT, *PDBGKD_CONTROL_REPORT;
//
// The following structure contains information that the host system
// kernel debugger wants to set on every continue operation and avoids
// the need to send extra packets of information.
//
typedef ULONG DBGKD_CONTROL_SET, *PDBGKD_CONTROL_SET;
#endif // ntddk nthal
// end_windbgkd
//
// Define breakpoint codes.
//
#define USER_BREAKPOINT 0 // user breakpoint
#define KERNEL_BREAKPOINT 1 // kernel breakpoint
#define BREAKIN_BREAKPOINT 2 // break into kernel debugger
#define BRANCH_TAKEN_BREAKPOINT 3 // branch taken breakpoint
#define BRANCH_NOT_TAKEN_BREAKPOINT 4 // branch not taken breakpoint
#define SINGLE_STEP_BREAKPOINT 5 // single step breakpoint
#define DIVIDE_OVERFLOW_BREAKPOINT 6 // divide overflow breakpoint
#define DIVIDE_BY_ZERO_BREAKPOINT 7 // divide by zero breakpoint
#define RANGE_CHECK_BREAKPOINT 8 // range check breakpoint
#define STACK_OVERFLOW_BREAKPOINT 9 // MIPS code
#define MULTIPLY_OVERFLOW_BREAKPOINT 10 // multiply overflow breakpoint
#define DEBUG_PRINT_BREAKPOINT 20 // debug print breakpoint
#define DEBUG_PROMPT_BREAKPOINT 21 // debug prompt breakpoint
#define DEBUG_STOP_BREAKPOINT 22 // debug stop breakpoint
#define DEBUG_LOAD_SYMBOLS_BREAKPOINT 23 // load symbols breakpoint
#define DEBUG_UNLOAD_SYMBOLS_BREAKPOINT 24 // unload symbols breakpoint
//
// Define length of exception code dispatch vector.
//
#define XCODE_VECTOR_LENGTH 32
// begin_winnt
#if defined(_MIPS_)
//
// Integer Context Frame
//
// This frame is used to store a limited processor context into the
// Thread structure for CPUs which have no floating point support.
//
typedef struct _ICONTEXT {
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_INTEGER.
//
// N.B. The registers gp, sp, and ra are defined in this section, but are
// considered part of the control context rather than part of the integer
// context.
//
// N.B. Register zero is not stored in the frame.
//
ULONG BadVAddr;
///ULONG IntZero;
ULONG IntAt;
ULONG IntV0;
ULONG IntV1;
ULONG IntA0;
ULONG IntA1;
ULONG IntA2;
ULONG IntA3;
ULONG IntT0;
ULONG IntT1;
ULONG IntT2;
ULONG IntT3;
ULONG IntT4;
ULONG IntT5;
ULONG IntT6;
ULONG IntT7;
ULONG IntS0;
ULONG IntS1;
ULONG IntS2;
ULONG IntS3;
ULONG IntS4;
ULONG IntS5;
ULONG IntS6;
ULONG IntS7;
ULONG IntT8;
ULONG IntT9;
ULONG IntK0;
ULONG IntK1;
ULONG IntGp;
ULONG IntSp;
ULONG IntS8;
ULONG IntRa;
ULONG IntLo;
ULONG IntHi;
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_FLOATING_POINT.
//
ULONG Fsr;
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_CONTROL.
//
// N.B. The registers gp, sp, and ra are defined in the integer section,
// but are considered part of the control context rather than part of
// the integer context.
//
ULONG Fir;
ULONG Psr;
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a thread's context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
ULONG ContextFlags;
#ifdef MIPS_HAS_FPU
DWORD FltF0;
DWORD FltF1;
DWORD FltF2;
DWORD FltF3;
DWORD FltF4;
DWORD FltF5;
DWORD FltF6;
DWORD FltF7;
DWORD FltF8;
DWORD FltF9;
DWORD FltF10;
DWORD FltF11;
DWORD FltF12;
DWORD FltF13;
DWORD FltF14;
DWORD FltF15;
DWORD FltF16;
DWORD FltF17;
DWORD FltF18;
DWORD FltF19;
DWORD FltF20;
DWORD FltF21;
DWORD FltF22;
DWORD FltF23;
DWORD FltF24;
DWORD FltF25;
DWORD FltF26;
DWORD FltF27;
DWORD FltF28;
DWORD FltF29;
DWORD FltF30;
DWORD FltF31;
#endif
} ICONTEXT, *PICONTEXT;
#define CPUCONTEXT ICONTEXT /* only need integer context */
#define retValue ctx.IntV0
#define ARG0 ctx.IntA0
#define SetThreadIP(pth, addr) ((pth)->ctx.Fir = (ULONG)(addr))
#define GetThreadIP(pth) ((pth)->ctx.Fir)
/* Macros for handling stack shrinkage. */
#define MDTestStack(pth) (((pth)->ctx.IntSp < 0x80000000 \
&& ((pth)->dwStackBound>>VA_PAGE) < (((pth)->ctx.IntSp-32)>>VA_PAGE)) \
? (pth)->dwStackBound : 0)
#define MDShrinkStack(pth) ((pth)->dwStackBound += PAGE_SIZE)
#include "mem_mips.h"
#endif // MIPS
// end_winnt
#define CONTEXT_TO_PROGRAM_COUNTER(Context) ((Context)->Fir)
#define CONTEXT_LENGTH (sizeof(CONTEXT))
#define CONTEXT_ALIGN (sizeof(ULONG))
#define CONTEXT_ROUND (CONTEXT_ALIGN - 1)
// begin_nthal
//
// Define R4000 system coprocessor registers.
//
// Define index register fields.
//
typedef struct _INDEX {
ULONG INDEX : 6;
ULONG X1 : 25;
ULONG P : 1;
} INDEX;
//
// Define random register fields.
//
typedef struct _RANDOM {
ULONG INDEX : 6;
ULONG X1 : 26;
} RANDOM;
//
// Define TB entry low register fields.
//
typedef struct _ENTRYLO {
ULONG G : 1;
ULONG V : 1;
ULONG D : 1;
ULONG C : 3;
ULONG PFN : 24;
ULONG X1 : 2;
} ENTRYLO, *PENTRYLO;
//
// Define R4000 PTE format for memory management.
//
// N.B. This must map exactly over the entrylo register.
//
typedef struct _HARDWARE_PTE {
ULONG Global : 1;
ULONG Valid : 1;
ULONG Dirty : 1;
ULONG CachePolicy : 3;
ULONG PageFrameNumber : 24;
ULONG Write : 1;
ULONG CopyOnWrite : 1;
} HARDWARE_PTE, *PHARDWARE_PTE;
//
// Define R4000 macro to initialize page directory table base.
//
#define INITIALIZE_DIRECTORY_TABLE_BASE(dirbase, pfn) \
((HARDWARE_PTE *)(dirbase))->PageFrameNumber = pfn; \
((HARDWARE_PTE *)(dirbase))->Global = 0; \
((HARDWARE_PTE *)(dirbase))->Valid = 1; \
((HARDWARE_PTE *)(dirbase))->Dirty = 1; \
((HARDWARE_PTE *)(dirbase))->CachePolicy = PCR->CachePolicy
//
// Define page mask register fields.
//
typedef struct _PAGEMASK {
ULONG X1 : 13;
ULONG PAGEMASK : 12;
ULONG X2 : 7;
} PAGEMASK, *PPAGEMASK;
//
// Define wired register fields.
//
typedef struct _WIRED {
ULONG NUMBER : 6;
ULONG X1 : 26;
} WIRED;
//
// Define TB entry high register fields.
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -