Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.0 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) Microsoft Corporation, 1997-2002.
  4. //
  5. //----------------------------------------------------------------------------
  6. #ifndef _ADDR_H_
  7. #define _ADDR_H_
  8. typedef struct _ADDR
  9. {
  10. USHORT type;
  11. USHORT seg;
  12. ULONG64 off;
  13. ULONG64 flat;
  14. } ADDR, *PADDR;
  15. #define ADDRFLAT(paddr, x) { \
  16. (paddr)->type = ADDR_FLAT; \
  17. (paddr)->seg = 0; \
  18. (paddr)->off = (x); \
  19. ComputeFlatAddress((paddr), NULL); \
  20. }
  21. #define ADDR_NONE ((USHORT)0)
  22. #define ADDR_UNKNOWN ((USHORT)0x0001)
  23. #define ADDR_V86 ((USHORT)0x0002)
  24. #define ADDR_16 ((USHORT)0x0004)
  25. #define ADDR_FLAT ((USHORT)0x0008)
  26. #define ADDR_1632 ((USHORT)0x0010)
  27. #define FLAT_COMPUTED ((USHORT)0x0020)
  28. #define INSTR_POINTER ((USHORT)0x0040)
  29. #define ADDR_1664 ((USHORT)0x0080)
  30. #define FLAT_BASIS ((USHORT)0x0100)
  31. #define NO_DEFAULT 0xFFFF
  32. #define fnotFlat(x) (!(((x).type) & FLAT_COMPUTED))
  33. #define fFlat(x) (((x).type) & FLAT_COMPUTED)
  34. #define fInstrPtr(x) (((x).type) & INSTR_POINTER)
  35. #define AddrEqu(x,y) ((x).flat == (y).flat)
  36. #define AddrLt(x,y) ((x).flat < (y).flat)
  37. #define AddrGt(x,y) ((x).flat > (y).flat)
  38. #define AddrDiff(x,y) ((x).flat - (y).flat)
  39. #define Flat(x) ((x).flat)
  40. #define Off(x) ((x).off)
  41. #define Type(x) ((x).type)
  42. #define NotFlat(x) ((x).type &= ~FLAT_COMPUTED)
  43. extern SHORT g_LastSelector;
  44. extern ULONG64 g_LastBaseOffset;
  45. extern void ComputeFlatAddress(PADDR Addr, PDESCRIPTOR64 Desc);
  46. extern void ComputeNativeAddress(PADDR Addr);
  47. extern PADDR AddrAdd(PADDR Addr, ULONG64 Scalar);
  48. extern PADDR AddrSub(PADDR, ULONG64 Scalar);
  49. void dprintAddr(IN PADDR Addr);
  50. void sprintAddr(IN OUT PSTR* Buffer, IN PADDR Addr);
  51. void MaskOutAddr(ULONG Mask, PADDR Addr);
  52. #define ClearAddr(Addr) \
  53. ZeroMemory(Addr, sizeof(ADDR))
  54. #endif // #ifndef _ADDR_H_