Source code of Windows XP (NT5)
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.

70 lines
1.9 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) Microsoft Corporation, 1997-2001.
  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 NO_DEFAULT 0xFFFF
  31. #define fnotFlat(x) (!(((x).type)&FLAT_COMPUTED))
  32. #define fFlat(x) (((x).type)&FLAT_COMPUTED)
  33. #define fInstrPtr(x) (((x).type)&INSTR_POINTER)
  34. #define AddrEqu(x,y) ((x).flat == (y).flat)
  35. #define AddrLt(x,y) ((x).flat < (y).flat)
  36. #define AddrGt(x,y) ((x).flat > (y).flat)
  37. #define AddrDiff(x,y) ((x).flat - (y).flat)
  38. #define Flat(x) ((x).flat)
  39. #define Off(x) ((x).off)
  40. #define Type(x) ((x).type)
  41. #define NotFlat(x) ((x).type&=~FLAT_COMPUTED)
  42. extern SHORT g_LastSelector;
  43. extern ULONG64 g_LastBaseOffset;
  44. extern void ComputeFlatAddress(PADDR, PDESCRIPTOR64);
  45. extern void ComputeNativeAddress(PADDR);
  46. extern PADDR AddrAdd(PADDR, ULONG64);
  47. extern PADDR AddrSub(PADDR, ULONG64);
  48. extern
  49. void dprintAddr(
  50. IN PADDR paddr
  51. );
  52. void
  53. sprintAddr(
  54. IN OUT PSTR *buffer,
  55. IN PADDR paddr
  56. );
  57. void MaskOutAddr(ULONG Mask, PADDR Addr);
  58. #endif // #ifndef _ADDR_H_