Changeset 60657 in vbox for trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemChr.asm
- Timestamp:
- Apr 22, 2016 3:57:22 PM (9 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemChr.asm
r60585 r60657 1 1 ; $Id$ 2 2 ;; @file 3 ; BS3Kit - Bs3Mem Zero.3 ; BS3Kit - Bs3MemChr. 4 4 ; 5 5 6 6 ; 7 ; Copyright (C) 2007-201 5Oracle Corporation7 ; Copyright (C) 2007-2016 Oracle Corporation 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 29 29 ;; 30 ; @cproto BS3_ DECL(void) Bs3MemZero_c16(void BS3_FAR *pvDst, size_t cbDst);30 ; @cproto BS3_CMN_PROTO_NOSB(void BS3_FAR *, Bs3MemChr,(void BS3_FAR const *pvHaystack, uint8_t bNeedle, size_t cbHaystack)); 31 31 ; 32 BS3_PROC_BEGIN_CMN Bs3MemZero, BS3_PBC_HYBRID 33 %ifdef RT_ARCH_AMD64 34 push rdi 32 BS3_PROC_BEGIN_CMN Bs3MemChr, BS3_PBC_HYBRID 33 push xBP 34 mov xBP, xSP 35 push xDI 36 TONLY16 push es 35 37 36 mov rdi, rcx ; rdi = pvDst 37 mov rcx, rdx ; rcx = cbDst 38 shr rcx, 3 ; calc qword count. 39 xor eax, eax ; rax = 0 (filler qword) 38 %if TMPL_BITS == 64 39 40 mov rdi, rcx ; rdi = pvHaystack 41 mov rcx, r8 ; rcx = cbHaystack 42 mov al, dl ; bNeedle 43 mov rcx, r8 44 45 %elif TMPL_BITS == 16 46 mov di, [bp + 2 + cbCurRetAddr] ; pvHaystack.off 47 mov es, [bp + 2 + cbCurRetAddr + 2] ; pvHaystack.sel 48 mov al, [bp + 2 + cbCurRetAddr + 4] ; bNeedle 49 mov cx, [bp + 2 + cbCurRetAddr + 6] ; cbHaystack 50 51 %elif TMPL_BITS == 32 52 mov edi, [ebp + 8] ; pvHaystack 53 mov al, byte [ebp + 4 + cbCurRetAddr + 4] ; bNeedle 54 mov ecx, [ebp + 4 + cbCurRetAddr + 8] ; cbHaystack 55 %else 56 %error "TMPL_BITS!" 57 %endif 58 40 59 cld 41 rep stosq 60 repne scasb 61 je .found 42 62 43 mov rcx, rdx ; cbDst 44 and rcx, 7 ; calc trailing byte count. 45 rep stosb 63 xor xAX, xAX 64 TONLY16 xor dx, dx 46 65 47 pop rdi 66 .return: 67 TONLY16 pop es 68 pop xDI 69 pop xBP 48 70 BS3_HYBRID_RET 49 71 50 %elif ARCH_BITS == 16 51 push bp 52 mov bp, sp 53 push di 54 push es 72 .found: 73 lea xAX, [xDI - 1] 74 TONLY16 mov dx, es 75 jmp .return 55 76 56 mov di, [bp + 2 + cbCurRetAddr] ; pvDst.off 57 mov dx, [bp + 2 + cbCurRetAddr + 2] ; pvDst.sel 58 mov es, dx 59 mov cx, [bp + 2 + cbCurRetAddr + 4] ; cbDst 60 shr cx, 1 ; calc dword count. 61 xor ax, ax 62 rep stosw 77 BS3_PROC_END_CMN Bs3MemChr 63 78 64 mov cx, [bp + 2 + cbCurRetAddr + 4] ; cbDst65 and cx, 1 ; calc tailing byte count.66 rep stosb67 68 pop es69 pop di70 pop bp71 BS3_HYBRID_RET72 73 %elif ARCH_BITS == 3274 push edi75 76 mov edi, [esp + 8] ; pvDst77 mov ecx, [esp + 8 + 4] ; cbDst78 shr cx, 2 ; calc dword count.79 xor eax, eax80 rep stosd81 82 mov ecx, [esp + 8 + 4] ; cbDst83 and ecx, 3 ; calc tailing byte count.84 rep stosb85 86 pop edi87 BS3_HYBRID_RET88 89 %else90 %error "Unknown bitness."91 %endif92 BS3_PROC_END_CMN Bs3MemZero93
Note:
See TracChangeset
for help on using the changeset viewer.