Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 1.4 KB

README.md

File metadata and controls

46 lines (37 loc) · 1.4 KB

HackJit

What

HackJit aims to add useful x64 (only for now, no x86 since I'm lazy). The method is based on a hack shown by @JeroenFrijters of IKVM.NET fame: How to Hack Your Own JIT Intrinsic

The intrinsincs are exposed through a class called JIT where each intrinsics is implemented as a "method".

The reason I refer to these implementations as methods with quotation marks is that they are not normal methods in the common sense.

When the method is first executed, it patches the caller's code to use the x64 assembly instead of calling the method. So in reality the first call to the "method" from each call site actually triggers a code path that modifies the code into using said intrinsics.

Supported Initrinsics

The supported intrinsics currently are:

  • BSWAP32 (signed/unsigned)
  • BSWAP64 (signed/unsigned) Note: Not currently working
  • BSR32 (signed/unsigned)
  • BSF32 (signed/unsigned)
  • BSR64 (signed/unsigned)
  • BSF64 (signed/unsigned)
  • RDTSC (with memory barrier)
  • RDTSCP
  • CPUID

Todo

  • AES*
  • MFENCE
  • SFENCE
  • WBINVD
  • CLFLUSH
  • BTS
  • BTR
  • BT
  • BTC
  • INVD
  • RDRAND
  • PREFETCH0/1/2/NTA
  • POPCNT
  • PAUSE
  • CMPXCHNG8B/CMPXCHNG16B