;
; NOTE: this helper will probe at least one page below the one pointed by rsp.
- lea rax, [rsp - PAGE_SIZE] ; rax points to some byte on the first unprobed page
- or rax, (PAGE_SIZE - 1) ; rax points to the **highest address** on the first unprobed page
+ mov rax, rsp ; rax points to some byte on the last probed page
+ and rax, -PAGE_SIZE ; rax points to the **lowest address** on the last probed page
; This is done to make the following loop end condition simpler.
ProbeLoop:
- test dword ptr [rax], eax
- sub rax, PAGE_SIZE ; rax points to the highest address of the **next page** to probe
+ sub rax, PAGE_SIZE ; rax points to the lowest address of the **next page** to probe
+ test dword ptr [rax], eax ; rax points to the lowest address on the **last probed** page
cmp rax, r11
- jge ProbeLoop ; if (rax >= r11), then we need to probe the page pointed to by rax.
+ jg ProbeLoop ; If (rax > r11), then we need to probe at least one more page.
ret
END_PROLOGUE
- sub rsp, PAGE_SIZE // rsp points to some byte on the first unprobed page
- or rsp, (PAGE_SIZE - 1) // rsp points to the **highest address** on the first unprobed page
+ and rsp, -PAGE_SIZE // rsp points to the **lowest address** on the last probed page
// This is done to make the following loop end condition simpler.
LOCAL_LABEL(ProbeLoop):
- test dword ptr [rsp], eax
- sub rsp, PAGE_SIZE // rsp points to the highest address of the **next page** to probe
+ sub rsp, PAGE_SIZE // rsp points to the lowest address of the **next page** to probe
+ test dword ptr [rsp], eax // rsp points to the lowest address on the **last probed** page
cmp rsp, r11
- jge LOCAL_LABEL(ProbeLoop) // if (rsp >= r11), then we need to probe the page pointed to by rsp.
+ jg LOCAL_LABEL(ProbeLoop) // if (rsp > r11), then we need to probe at least one more page.
RESET_FRAME_WITH_RBP
ret
PROLOG_BEG
PROLOG_END
- sub esp, PAGE_SIZE // esp points to some byte on the first unprobed page
- or esp, (PAGE_SIZE - 1) // esp points to the **highest address** on the first unprobed page
+ and esp, -PAGE_SIZE // esp points to the **lowest address** on the last probed page
// This is done to make the loop end condition simpler.
LOCAL_LABEL(ProbeLoop):
- test [esp], eax
- sub esp, PAGE_SIZE // esp points to the highest address of the **next page** to probe
+ sub esp, PAGE_SIZE // esp points to the lowest address of the **next page** to probe
+ test [esp], eax // esp points to the lowest address on the **last probed** page
cmp esp, eax
- jge LOCAL_LABEL(ProbeLoop) // if esp >= eax, then we need to probe the page pointed to by esp.
+ jg LOCAL_LABEL(ProbeLoop) // if esp > eax, then we need to probe at least one more page.
EPILOG_BEG
mov esp, ebp
push ebp
mov ebp, esp
- sub esp, PAGE_SIZE ; esp points to some byte on the first unprobed page
- or esp, (PAGE_SIZE - 1) ; esp points to the **highest address** on the first unprobed page
+ and esp, -PAGE_SIZE ; esp points to the **lowest address** on the last probed page
; This is done to make the loop end condition simpler.
ProbeLoop:
- test [esp], eax
- sub esp, PAGE_SIZE ; esp points to the highest address of the **next page** to probe
+ sub esp, PAGE_SIZE ; esp points to the lowest address of the **next page** to probe
+ test [esp], eax ; esp points to the lowest address on the **last probed** page
cmp esp, eax
- jge ProbeLoop ; if esp >= eax, then we need to probe the page pointed to by esp.
+ jg ProbeLoop ; if esp > eax, then we need to probe at least one more page.
mov esp, ebp
pop ebp