diff options
Diffstat (limited to 'zap/source/amd64/mem/fill.s')
-rw-r--r-- | zap/source/amd64/mem/fill.s | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/zap/source/amd64/mem/fill.s b/zap/source/amd64/mem/fill.s index 0abd2be..f4022d0 100644 --- a/zap/source/amd64/mem/fill.s +++ b/zap/source/amd64/mem/fill.s @@ -7,45 +7,29 @@ .globl zap_fill zap_fill: - # zap_i8 val1; - # zap_i04 val8; - - movzx rax,sil # val8 = val; - shl rax,0x8 # val8 <<= 0x8u; - mov al,sil # val8 |= val; - shl rax,0x8 # val8 <<= 0x8u; - mov al,sil # val8 |= val; - shl rax,0x8 # val8 <<= 0x8u; - mov al,sil # val8 |= val; - shl rax,0x8 # val8 <<= 0x8u; - mov al,sil # val8 |= val; - shl rax,0x8 # val8 <<= 0x8u; - mov al,sil # val8 |= val; - shl rax,0x8 # val8 <<= 0x8u; - mov al,sil # val8 |= val; - shl rax,0x8 # val8 <<= 0x8u; - mov al,sil # val8 |= val; - # val1 = val8; - -.wrdfill: # wrdfill:; + movzx rsi,sil # zap_i04 extval = val; + mov rax,0x0101010101010101 # zap_i04 val = 0x0101010101010101u; + imul rax,rsi # val *= extval; + +.wrdfill: # wrdfill:; cmp rdx,0x8 - jl .bytefill # if (num < 0x8u) goto bytefill; + jl short .bytefill # if (num < 0x8u) goto bytefill; - mov [rdi],rax # *dest = val8; + mov [rdi],rax # *dest = val8; - add rdi,0x8 # dest += 0x8u; - sub rdx,0x8 # num -= 0x8u; - jmp .wrdfill # goto wrdfill + add rdi,0x8 # dest += 0x8u; + sub rdx,0x8 # num -= 0x8u; + jmp short .wrdfill # goto wrdfill -.bytefill: # bytefill:; - test rdx,rdx # if (rem == 0x0) - jz .done # goto done +.bytefill: # bytefill:; + test rdx,rdx # if (rem == 0x0) + jz short .done # goto done - mov [rsi],al # *dest = val1; + mov [rsi],al # *dest = val1; - inc rdi # ++dest; - dec rdx # --rem; - jmp .bytefill # goto bytefill; + inc rdi # ++dest; + dec rdx # --rem; + jmp short .bytefill # goto bytefill; .done: - ret # return + ret # return |