Fixed in asm

This commit is contained in:
Egor Sheremetov 2024-04-09 22:46:48 +03:00 committed by Roman Venediktov
parent 3b54121ca8
commit 234c76963b

View file

@ -1,22 +1,22 @@
.data .data
.global Lprintf .global _Lprintf
.extern Bprintf .extern Bprintf
.global Lfprintf .global _Lfprintf
.extern Bfprintf .extern Bfprintf
.global Lsprintf .global _Lsprintf
.extern Bsprintf .extern Bsprintf
.global Lfailure .global _Lfailure
.extern failure .extern failure
.extern cnt_percentage_sign .extern cnt_percentage_sign
.text .text
Lprintf: _Lprintf:
# save return address # save return address
popq %r14 popq %r14
@ -28,22 +28,22 @@ Lprintf:
movq %rsp, %rax movq %rsp, %rax
# rdi --- format string # rdi --- format string
# r11 --- number of arguments except format string # r11 --- number of arguments except format string
Lprintf_loop: _Lprintf_loop:
movq $0, %r12 movq $0, %r12
cmpq %r11, %r12 cmpq %r11, %r12
jz Lprintf_continue jz _Lprintf_continue
decq %r11 decq %r11
movq (%rax), %r10 movq (%rax), %r10
testq $1, %r10 testq $1, %r10
jz Lprintf_loop_end jz _Lprintf_loop_end
# unbox value # unbox value
sarq %r10 sarq %r10
movq %r10, (%rax) movq %r10, (%rax)
Lprintf_loop_end: _Lprintf_loop_end:
addq $8, %rax addq $8, %rax
jmp Lprintf_loop jmp _Lprintf_loop
Lprintf_continue: _Lprintf_continue:
popq %rsi popq %rsi
popq %rdx popq %rdx
popq %rcx popq %rcx
@ -53,7 +53,7 @@ Lprintf_continue:
pushq %r14 pushq %r14
jmp Bprintf jmp Bprintf
Lfprintf: _Lfprintf:
# save return address # save return address
popq %r14 popq %r14
@ -65,22 +65,22 @@ Lfprintf:
# rdi --- FILE* # rdi --- FILE*
# rsi --- format string # rsi --- format string
# r11 --- number of arguments except format string # r11 --- number of arguments except format string
Lfprintf_loop: _Lfprintf_loop:
movq $0, %r12 movq $0, %r12
cmpq %r11, %r12 cmpq %r11, %r12
jz Lfprintf_continue jz _Lfprintf_continue
decq %r11 decq %r11
movq (%rax), %r10 movq (%rax), %r10
testq $1, %r10 testq $1, %r10
jz Lfprintf_loop_end jz _Lfprintf_loop_end
# unbox value # unbox value
sarq %r10 sarq %r10
movq %r10, (%rax) movq %r10, (%rax)
Lfprintf_loop_end: _Lfprintf_loop_end:
addq $8, %rax addq $8, %rax
jmp Lfprintf_loop jmp _Lfprintf_loop
Lfprintf_continue: _Lfprintf_continue:
popq %rdx popq %rdx
popq %rcx popq %rcx
popq %r8 popq %r8
@ -89,7 +89,7 @@ Lfprintf_continue:
pushq %r14 pushq %r14
jmp Bfprintf jmp Bfprintf
Lsprintf: _Lsprintf:
# save return address # save return address
popq %r14 popq %r14
@ -101,22 +101,22 @@ Lsprintf:
movq %rsp, %rax movq %rsp, %rax
# rdi --- format string # rdi --- format string
# r11 --- number of arguments except format string # r11 --- number of arguments except format string
Lsprintf_loop: _Lsprintf_loop:
movq $0, %r12 movq $0, %r12
cmpq %r11, %r12 cmpq %r11, %r12
jz Lsprintf_continue jz _Lsprintf_continue
decq %r11 decq %r11
movq (%rax), %r10 movq (%rax), %r10
testq $1, %r10 testq $1, %r10
jz Lsprintf_loop_end jz _Lsprintf_loop_end
# unbox value # unbox value
sarq %r10 sarq %r10
movq %r10, (%rax) movq %r10, (%rax)
Lsprintf_loop_end: _Lsprintf_loop_end:
addq $8, %rax addq $8, %rax
jmp Lsprintf_loop jmp _Lsprintf_loop
Lsprintf_continue: _Lsprintf_continue:
popq %rsi popq %rsi
popq %rdx popq %rdx
popq %rcx popq %rcx
@ -126,7 +126,7 @@ Lsprintf_continue:
pushq %r14 pushq %r14
jmp Bsprintf jmp Bsprintf
Lfailure: _Lfailure:
# save return address # save return address
popq %r14 popq %r14
@ -138,22 +138,22 @@ Lfailure:
movq %rsp, %rax movq %rsp, %rax
# rdi --- format string # rdi --- format string
# r11 --- number of arguments except format string # r11 --- number of arguments except format string
Lfailure_loop: _Lfailure_loop:
movq $0, %r12 movq $0, %r12
cmpq %r11, %r12 cmpq %r11, %r12
jz Lfailure_continue jz _Lfailure_continue
decq %r11 decq %r11
movq (%rax), %r10 movq (%rax), %r10
testq $1, %r10 testq $1, %r10
jz Lfailure_loop_end jz _Lfailure_loop_end
# unbox value # unbox value
sarq %r10 sarq %r10
movq %r10, (%rax) movq %r10, (%rax)
Lfailure_loop_end: _Lfailure_loop_end:
addq $8, %rax addq $8, %rax
jmp Lfailure_loop jmp _Lfailure_loop
Lfailure_continue: _Lfailure_continue:
popq %rsi popq %rsi
popq %rdx popq %rdx
popq %rcx popq %rcx