- Timestamp:
- May 20, 2016 4:43:12 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PGMR3DbgA.asm
r57126 r61110 64 64 mov rax, [rdx] ; *(uint64_t *)pvNeedle 65 65 %elifdef RT_ARCH_X86 66 mov edx, edi ; save it 66 push ebp 67 mov ebp, esp 68 push edi ; save it 67 69 mov edi, [ebp + 08h] ; pbHaystack 68 70 mov ecx, [ebp + 0ch] ; cbHaystack 69 71 mov eax, [ebp + 10h] ; pvNeedle 70 mov eax, [eax] ; *(uint64_t *)pvNeedle 71 %else 72 %error "Unsupported arch!" 73 %endif 74 SEH64_END_PROLOGUE 75 76 cmp ecx, 8 77 jb .return_null 72 mov edx, [eax + 4] ; ((uint32_t *)pvNeedle)[1] 73 mov eax, [eax] ; ((uint32_t *)pvNeedle)[0] 74 %else 75 %error "Unsupported arch!" 76 %endif 77 SEH64_END_PROLOGUE 78 78 79 %ifdef RT_ARCH_X86 80 ; 81 ; No string instruction to help us here. Do a simple tight loop instead. 82 ; 83 shr ecx, 3 84 jz .return_null 79 85 .again: 80 86 cmp [edi], eax 81 je .return_edi 87 je .needle_check 88 .continue: 89 add edi, 8 82 90 dec ecx 83 91 jnz .again 84 92 jmp .return_null 85 .return_edi: 86 ;; @todo check the whole needle. 93 94 ; Check the needle 2nd dword, caller can do the rest. 95 .needle_check: 96 cmp edx, [edi + 4] 97 jne .continue 98 99 .return_edi: 87 100 mov eax, edi 88 101 89 %else ; RT_ARCH_AMD64 102 %else ; RT_ARCH_AMD64 103 cmp ecx, 8 104 jb .return_null 90 105 .continue: 91 106 shr ecx, 3 … … 94 109 ; check more of the needle if we can. 95 110 mov r11d, 8 111 shl ecx, 3 96 112 .needle_check: 97 113 cmp cbNeedle, r11d 98 114 je .return_edi 99 cmp ecx, r11d ; don't bother converting ecx to bytes.100 jb .return_edi 115 cmp ecx, r11d 116 jb .return_edi ; returns success here as we've might've lost stuff while shifting ecx around. 101 117 mov bTmp, [pvNeedle + r11] 102 118 cmp bTmp, [xDI + r11 - 8] … … 107 123 .return_edi: 108 124 lea xAX, [xDI - 8] 109 %endif 110 .return: 111 %ifdef ASM_CALL64_MSC 112 mov rdi, r10 113 %elifdef RT_ARCH_X86 114 mov edi, edx 125 %endif ; RT_ARCH_AMD64 126 127 .return: 128 %ifdef ASM_CALL64_MSC 129 mov rdi, r10 130 %elifdef RT_ARCH_X86 131 pop edi 132 leave 115 133 %endif 116 134 ret
Note:
See TracChangeset
for help on using the changeset viewer.