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.

106 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. frag32.c
  5. Abstract:
  6. Instuction fragments which operate on 32-bit DWORDS, shared with CCPU
  7. Author:
  8. 12-Jun-1995 BarryBo
  9. Revision History:
  10. --*/
  11. #include <nt.h>
  12. #include <ntrtl.h>
  13. #include <nturtl.h>
  14. #include <windows.h>
  15. #include <stdio.h>
  16. #include "fragp.h"
  17. #include "frag32.h"
  18. #include "optfrag.h"
  19. // set up to include common functions
  20. #define MSB 0x80000000
  21. #define LMB 31 // Left Most Bit
  22. #define UTYPE unsigned long
  23. #define STYPE signed long
  24. #define GET_VAL GET_LONG
  25. #define PUT_VAL PUT_LONG
  26. #define PUSH_VAL PUSH_LONG
  27. #define POP_VAL POP_LONG
  28. #define FRAGCOMMON0(fn) FRAG0(fn ## 32)
  29. #define FRAGCOMMON1(fn) FRAG1(fn ## 32, UTYPE)
  30. #define FRAGCOMMON1IMM(fn) FRAG1IMM( fn ## 32, UTYPE)
  31. #define FRAGCOMMON2(fn) FRAG2(fn ## 32, UTYPE)
  32. #define FRAGCOMMON2IMM(fn) FRAG2IMM( fn ## 32, UTYPE, UTYPE)
  33. #define FRAGCOMMON2REF(fn) FRAG2REF(fn ## 32, UTYPE)
  34. #define FRAGCOMMON3(fn) FRAG3(fn ## 32, UTYPE, UTYPE, UTYPE)
  35. #define AREG eax
  36. #define BREG ebx
  37. #define CREG ecx
  38. #define DREG edx
  39. #define SPREG esp
  40. #define BPREG ebp
  41. #define SIREG esi
  42. #define DIREG edi
  43. #define SET_FLAGS_ADD SET_FLAGS_ADD32
  44. #define SET_FLAGS_SUB SET_FLAGS_SUB32
  45. #define SET_FLAGS_INC SET_FLAGS_INC32
  46. #define SET_FLAGS_DEC SET_FLAGS_DEC32
  47. #define GET_BYTE(addr) (*(UNALIGNED unsigned char *)(addr))
  48. #define GET_SHORT(addr) (*(UNALIGNED unsigned short *)(addr))
  49. #define GET_LONG(addr) (*(UNALIGNED unsigned long *)(addr))
  50. #define PUT_BYTE(addr,dw) {GET_BYTE(addr)=dw;}
  51. #define PUT_SHORT(addr,dw) {GET_SHORT(addr)=dw;}
  52. #define PUT_LONG(addr,dw) {GET_LONG(addr)=dw;}
  53. // include the common functions with 8/16/32 flavors
  54. #include "shared.c"
  55. // include the common functions with 16/32 flavors
  56. #include "shr1632.c"
  57. // include the common unaligned functions with 8/16/32 flavors
  58. #include "shareda.c"
  59. // include the common unaligned functions with 16/32 flavors
  60. #include "shr1632a.c"
  61. #undef FRAGCOMMON0
  62. #undef FRAGCOMMON1
  63. #undef FRAGCOMMON1IMM
  64. #undef FRAGCOMMON2
  65. #undef FRAGCOMMON2IMM
  66. #undef FRAGCOMMON2REF
  67. #undef FRAGCOMMON3
  68. #undef GET_BYTE
  69. #undef GET_SHORT
  70. #undef GET_LONG
  71. #if MSCPU
  72. #define FRAGCOMMON0(fn) FRAG0(fn ## 32A)
  73. #define FRAGCOMMON1(fn) FRAG1(fn ## 32A,UTYPE)
  74. #define FRAGCOMMON1IMM(fn) FRAG1IMM( fn ## 32A, UTYPE)
  75. #define FRAGCOMMON2(fn) FRAG2(fn ## 32A, UTYPE)
  76. #define FRAGCOMMON2IMM(fn) FRAG2IMM( fn ## 32A, UTYPE, UTYPE)
  77. #define FRAGCOMMON2REF(fn) FRAG2REF(fn ## 32A, UTYPE)
  78. #define FRAGCOMMON3(fn) FRAG3(fn ## 32A, UTYPE, UTYPE, UTYPE)
  79. #define GET_BYTE(addr) (*(unsigned char *)(addr))
  80. #define GET_SHORT(addr) (*(unsigned short *)(addr))
  81. #define GET_LONG(addr) (*(unsigned long *)(addr))
  82. // include the common aligned functions with 8/16/32 flavors
  83. #include "shareda.c"
  84. // include the common aligned functions with 16/32 flavors
  85. #include "shr1632a.c"
  86. #endif