Skip to content

Commit

Permalink
[x86] Fix for Large Pages
Browse files Browse the repository at this point in the history
Reload rcx register prior to calling OS_VirtualAlloc.

This patch should prevent the rcx register from getting clobbered and therefore restore the functionality of LP in asmFish. See discussion at issue #160  for more details.

Thanks to Moha for this correction.
  • Loading branch information
CounterPly committed Apr 27, 2018
1 parent 38da55b commit 2464294
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Binary file modified fasmg
Binary file not shown.
Binary file modified fasmg.exe
Binary file not shown.
8 changes: 6 additions & 2 deletions x86/Hash.asm
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,19 @@ MainHash_ReadOptions:
@1:
; free current
call MainHash_Free
imul rcx, rsi, 32
; rcx = number of bytes in hash table
test ebx, 1
jz .NoLP
.LP:
imul rcx, rsi, 32 ; rcx = number of bytes in hash table
call Os_VirtualAlloc_LargePages
test rax, rax
jnz .Done
; Note by Moha:
; Os_VirtualAlloc_LargePages
; obviously may clobber rcx ;
; so reload it before calling Os_VirtualAlloc
.NoLP:
imul rcx, rsi, 32 ; rcx = number of bytes in hash table
call Os_VirtualAlloc
xor edx, edx
.Done:
Expand Down

0 comments on commit 2464294

Please sign in to comment.