This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
OS_Project/Part4/10_scheduler/string.s

999 lines
15 KiB
ArmAsm
Raw Permalink Normal View History

2023-11-29 19:19:51 +00:00
.file "string.c"
.text
.Ltext0:
.globl int_to_ascii
.type int_to_ascii, @function
int_to_ascii:
.LFB0:
.file 1 "./libc/string.c"
.loc 1 6 0
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
pushl %ebx
subl $20, %esp
.cfi_offset 3, -12
.loc 1 8 0
movl 8(%ebp), %eax
movl %eax, -16(%ebp)
cmpl $0, -16(%ebp)
jns .L2
.loc 1 8 0 is_stmt 0 discriminator 1
negl 8(%ebp)
.L2:
.loc 1 9 0 is_stmt 1
movl $0, -12(%ebp)
.L3:
.loc 1 11 0 discriminator 1
movl -12(%ebp), %eax
leal 1(%eax), %edx
movl %edx, -12(%ebp)
movl %eax, %edx
movl 12(%ebp), %eax
leal (%edx,%eax), %ebx
movl 8(%ebp), %ecx
movl $1717986919, %edx
movl %ecx, %eax
imull %edx
sarl $2, %edx
movl %ecx, %eax
sarl $31, %eax
subl %eax, %edx
movl %edx, %eax
sall $2, %eax
addl %edx, %eax
addl %eax, %eax
subl %eax, %ecx
movl %ecx, %edx
movl %edx, %eax
addl $48, %eax
movb %al, (%ebx)
.loc 1 12 0 discriminator 1
movl 8(%ebp), %ecx
movl $1717986919, %edx
movl %ecx, %eax
imull %edx
sarl $2, %edx
movl %ecx, %eax
sarl $31, %eax
subl %eax, %edx
movl %edx, %eax
movl %eax, 8(%ebp)
cmpl $0, 8(%ebp)
jg .L3
.loc 1 14 0
cmpl $0, -16(%ebp)
jns .L4
.loc 1 14 0 is_stmt 0 discriminator 1
movl -12(%ebp), %eax
leal 1(%eax), %edx
movl %edx, -12(%ebp)
movl %eax, %edx
movl 12(%ebp), %eax
addl %edx, %eax
movb $45, (%eax)
.L4:
.loc 1 15 0 is_stmt 1
movl -12(%ebp), %edx
movl 12(%ebp), %eax
addl %edx, %eax
movb $0, (%eax)
.loc 1 17 0
subl $12, %esp
pushl 12(%ebp)
call reverse
addl $16, %esp
.loc 1 18 0
nop
movl -4(%ebp), %ebx
leave
.cfi_restore 5
.cfi_restore 3
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE0:
.size int_to_ascii, .-int_to_ascii
.globl hex_to_ascii
.type hex_to_ascii, @function
hex_to_ascii:
.LFB1:
.loc 1 20 0
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
subl $24, %esp
.loc 1 21 0
movl 12(%ebp), %eax
movb $0, (%eax)
.loc 1 22 0
subl $8, %esp
pushl $48
pushl 12(%ebp)
call append
addl $16, %esp
.loc 1 23 0
subl $8, %esp
pushl $120
pushl 12(%ebp)
call append
addl $16, %esp
.loc 1 24 0
movb $0, -9(%ebp)
.loc 1 28 0
movl $28, -16(%ebp)
jmp .L6
.L10:
.loc 1 29 0
movl -16(%ebp), %eax
movl 8(%ebp), %edx
movl %eax, %ecx
sarl %cl, %edx
movl %edx, %eax
andl $15, %eax
movl %eax, -20(%ebp)
.loc 1 30 0
cmpl $0, -20(%ebp)
jne .L7
.loc 1 30 0 is_stmt 0 discriminator 1
cmpb $0, -9(%ebp)
je .L14
.L7:
.loc 1 31 0 is_stmt 1
movb $1, -9(%ebp)
.loc 1 32 0
cmpl $10, -20(%ebp)
jle .L9
.loc 1 32 0 is_stmt 0 discriminator 1
movl -20(%ebp), %eax
addl $87, %eax
movsbl %al, %eax
subl $8, %esp
pushl %eax
pushl 12(%ebp)
call append
addl $16, %esp
jmp .L8
.L9:
.loc 1 33 0 is_stmt 1
movl -20(%ebp), %eax
addl $48, %eax
movsbl %al, %eax
subl $8, %esp
pushl %eax
pushl 12(%ebp)
call append
addl $16, %esp
jmp .L8
.L14:
.loc 1 30 0
nop
.L8:
.loc 1 28 0 discriminator 2
subl $4, -16(%ebp)
.L6:
.loc 1 28 0 is_stmt 0 discriminator 1
cmpl $0, -16(%ebp)
jg .L10
.loc 1 36 0 is_stmt 1
movl 8(%ebp), %eax
andl $15, %eax
movl %eax, -20(%ebp)
.loc 1 37 0
cmpl $9, -20(%ebp)
jle .L11
.loc 1 37 0 is_stmt 0 discriminator 1
movl -20(%ebp), %eax
addl $87, %eax
movsbl %al, %eax
subl $8, %esp
pushl %eax
pushl 12(%ebp)
call append
addl $16, %esp
.loc 1 40 0 is_stmt 1 discriminator 1
jmp .L5
.L11:
.loc 1 38 0
movl -20(%ebp), %eax
addl $48, %eax
movsbl %al, %eax
subl $8, %esp
pushl %eax
pushl 12(%ebp)
call append
addl $16, %esp
.loc 1 40 0
nop
.L5:
.loc 1 41 0
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE1:
.size hex_to_ascii, .-hex_to_ascii
.globl reverse
.type reverse, @function
reverse:
.LFB2:
.loc 1 44 0
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
subl $24, %esp
.loc 1 46 0
movl $0, -12(%ebp)
subl $12, %esp
pushl 8(%ebp)
call strlen
addl $16, %esp
subl $1, %eax
movl %eax, -16(%ebp)
jmp .L16
.L17:
.loc 1 47 0 discriminator 3
movl -12(%ebp), %edx
movl 8(%ebp), %eax
addl %edx, %eax
movzbl (%eax), %eax
movsbl %al, %eax
movl %eax, -20(%ebp)
.loc 1 48 0 discriminator 3
movl -12(%ebp), %edx
movl 8(%ebp), %eax
addl %eax, %edx
movl -16(%ebp), %ecx
movl 8(%ebp), %eax
addl %ecx, %eax
movzbl (%eax), %eax
movb %al, (%edx)
.loc 1 49 0 discriminator 3
movl -16(%ebp), %edx
movl 8(%ebp), %eax
addl %edx, %eax
movl -20(%ebp), %edx
movb %dl, (%eax)
.loc 1 46 0 discriminator 3
addl $1, -12(%ebp)
subl $1, -16(%ebp)
.L16:
.loc 1 46 0 is_stmt 0 discriminator 1
movl -12(%ebp), %eax
cmpl -16(%ebp), %eax
jl .L17
.loc 1 51 0 is_stmt 1
nop
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE2:
.size reverse, .-reverse
.globl strlen
.type strlen, @function
strlen:
.LFB3:
.loc 1 54 0
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
subl $16, %esp
.loc 1 55 0
movl $0, -4(%ebp)
.loc 1 56 0
jmp .L19
.L20:
.loc 1 56 0 is_stmt 0 discriminator 2
addl $1, -4(%ebp)
.L19:
.loc 1 56 0 discriminator 1
movl -4(%ebp), %edx
movl 8(%ebp), %eax
addl %edx, %eax
movzbl (%eax), %eax
testb %al, %al
jne .L20
.loc 1 57 0 is_stmt 1
movl -4(%ebp), %eax
.loc 1 58 0
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE3:
.size strlen, .-strlen
.globl append
.type append, @function
append:
.LFB4:
.loc 1 60 0
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
subl $20, %esp
movl 12(%ebp), %eax
movb %al, -20(%ebp)
.loc 1 61 0
pushl 8(%ebp)
call strlen
addl $4, %esp
movl %eax, -4(%ebp)
.loc 1 62 0
movl -4(%ebp), %edx
movl 8(%ebp), %eax
addl %eax, %edx
movzbl -20(%ebp), %eax
movb %al, (%edx)
.loc 1 63 0
movl -4(%ebp), %eax
leal 1(%eax), %edx
movl 8(%ebp), %eax
addl %edx, %eax
movb $0, (%eax)
.loc 1 64 0
nop
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE4:
.size append, .-append
.globl backspace
.type backspace, @function
backspace:
.LFB5:
.loc 1 66 0
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
subl $16, %esp
.loc 1 67 0
pushl 8(%ebp)
call strlen
addl $4, %esp
movl %eax, -4(%ebp)
.loc 1 68 0
movl -4(%ebp), %eax
leal -1(%eax), %edx
movl 8(%ebp), %eax
addl %edx, %eax
movb $0, (%eax)
.loc 1 69 0
nop
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE5:
.size backspace, .-backspace
.globl strcmp
.type strcmp, @function
strcmp:
.LFB6:
.loc 1 73 0
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
subl $16, %esp
.loc 1 75 0
movl $0, -4(%ebp)
jmp .L25
.L28:
.loc 1 76 0
movl -4(%ebp), %edx
movl 8(%ebp), %eax
addl %edx, %eax
movzbl (%eax), %eax
testb %al, %al
jne .L26
.loc 1 76 0 is_stmt 0 discriminator 1
movl $0, %eax
jmp .L27
.L26:
.loc 1 75 0 is_stmt 1 discriminator 2
addl $1, -4(%ebp)
.L25:
.loc 1 75 0 is_stmt 0 discriminator 1
movl -4(%ebp), %edx
movl 8(%ebp), %eax
addl %edx, %eax
movzbl (%eax), %edx
movl -4(%ebp), %ecx
movl 12(%ebp), %eax
addl %ecx, %eax
movzbl (%eax), %eax
cmpb %al, %dl
je .L28
.loc 1 78 0 is_stmt 1
movl -4(%ebp), %edx
movl 8(%ebp), %eax
addl %edx, %eax
movzbl (%eax), %eax
movsbl %al, %edx
movl -4(%ebp), %ecx
movl 12(%ebp), %eax
addl %ecx, %eax
movzbl (%eax), %eax
movsbl %al, %eax
subl %eax, %edx
movl %edx, %eax
.L27:
.loc 1 79 0
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE6:
.size strcmp, .-strcmp
.Letext0:
.file 2 "./libc/../cpu/types.h"
.section .debug_info,"",@progbits
.Ldebug_info0:
.long 0x21f
.value 0x4
.long .Ldebug_abbrev0
.byte 0x4
.uleb128 0x1
.long .LASF13
.byte 0xc
.long .LASF14
.long .LASF15
.long .Ltext0
.long .Letext0-.Ltext0
.long .Ldebug_line0
.uleb128 0x2
.byte 0x4
.byte 0x7
.long .LASF0
.uleb128 0x3
.string "s32"
.byte 0x2
.byte 0x7
.long 0x37
.uleb128 0x4
.byte 0x4
.byte 0x5
.string "int"
.uleb128 0x2
.byte 0x2
.byte 0x7
.long .LASF1
.uleb128 0x2
.byte 0x2
.byte 0x5
.long .LASF2
.uleb128 0x2
.byte 0x1
.byte 0x8
.long .LASF3
.uleb128 0x2
.byte 0x1
.byte 0x6
.long .LASF4
.uleb128 0x5
.long .LASF6
.byte 0x1
.byte 0x6
.long .LFB0
.long .LFE0-.LFB0
.uleb128 0x1
.byte 0x9c
.long 0xa4
.uleb128 0x6
.string "n"
.byte 0x1
.byte 0x6
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 0
.uleb128 0x6
.string "str"
.byte 0x1
.byte 0x6
.long 0xa4
.uleb128 0x2
.byte 0x91
.sleb128 4
.uleb128 0x7
.string "i"
.byte 0x1
.byte 0x7
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -20
.uleb128 0x8
.long .LASF5
.byte 0x1
.byte 0x7
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -24
.byte 0
.uleb128 0x9
.byte 0x4
.long 0x53
.uleb128 0x5
.long .LASF7
.byte 0x1
.byte 0x14
.long .LFB1
.long .LFE1-.LFB1
.uleb128 0x1
.byte 0x9c
.long 0x102
.uleb128 0x6
.string "n"
.byte 0x1
.byte 0x14
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 0
.uleb128 0x6
.string "str"
.byte 0x1
.byte 0x14
.long 0xa4
.uleb128 0x2
.byte 0x91
.sleb128 4
.uleb128 0x8
.long .LASF8
.byte 0x1
.byte 0x18
.long 0x53
.uleb128 0x2
.byte 0x91
.sleb128 -17
.uleb128 0x7
.string "tmp"
.byte 0x1
.byte 0x1a
.long 0x2c
.uleb128 0x2
.byte 0x91
.sleb128 -28
.uleb128 0x7
.string "i"
.byte 0x1
.byte 0x1b
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -24
.byte 0
.uleb128 0x5
.long .LASF9
.byte 0x1
.byte 0x2c
.long .LFB2
.long .LFE2-.LFB2
.uleb128 0x1
.byte 0x9c
.long 0x148
.uleb128 0x6
.string "s"
.byte 0x1
.byte 0x2c
.long 0xa4
.uleb128 0x2
.byte 0x91
.sleb128 0
.uleb128 0x7
.string "c"
.byte 0x1
.byte 0x2d
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -28
.uleb128 0x7
.string "i"
.byte 0x1
.byte 0x2d
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -20
.uleb128 0x7
.string "j"
.byte 0x1
.byte 0x2d
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -24
.byte 0
.uleb128 0xa
.long .LASF16
.byte 0x1
.byte 0x36
.long 0x37
.long .LFB3
.long .LFE3-.LFB3
.uleb128 0x1
.byte 0x9c
.long 0x17a
.uleb128 0x6
.string "s"
.byte 0x1
.byte 0x36
.long 0xa4
.uleb128 0x2
.byte 0x91
.sleb128 0
.uleb128 0x7
.string "i"
.byte 0x1
.byte 0x37
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -12
.byte 0
.uleb128 0x5
.long .LASF10
.byte 0x1
.byte 0x3c
.long .LFB4
.long .LFE4-.LFB4
.uleb128 0x1
.byte 0x9c
.long 0x1b6
.uleb128 0x6
.string "s"
.byte 0x1
.byte 0x3c
.long 0xa4
.uleb128 0x2
.byte 0x91
.sleb128 0
.uleb128 0x6
.string "n"
.byte 0x1
.byte 0x3c
.long 0x53
.uleb128 0x2
.byte 0x91
.sleb128 -28
.uleb128 0x7
.string "len"
.byte 0x1
.byte 0x3d
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -12
.byte 0
.uleb128 0x5
.long .LASF11
.byte 0x1
.byte 0x42
.long .LFB5
.long .LFE5-.LFB5
.uleb128 0x1
.byte 0x9c
.long 0x1e6
.uleb128 0x6
.string "s"
.byte 0x1
.byte 0x42
.long 0xa4
.uleb128 0x2
.byte 0x91
.sleb128 0
.uleb128 0x7
.string "len"
.byte 0x1
.byte 0x43
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -12
.byte 0
.uleb128 0xb
.long .LASF12
.byte 0x1
.byte 0x49
.long 0x37
.long .LFB6
.long .LFE6-.LFB6
.uleb128 0x1
.byte 0x9c
.uleb128 0x6
.string "s1"
.byte 0x1
.byte 0x49
.long 0xa4
.uleb128 0x2
.byte 0x91
.sleb128 0
.uleb128 0x6
.string "s2"
.byte 0x1
.byte 0x49
.long 0xa4
.uleb128 0x2
.byte 0x91
.sleb128 4
.uleb128 0x7
.string "i"
.byte 0x1
.byte 0x4a
.long 0x37
.uleb128 0x2
.byte 0x91
.sleb128 -12
.byte 0
.byte 0
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x10
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0x2
.uleb128 0x24
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.byte 0
.byte 0
.uleb128 0x3
.uleb128 0x16
.byte 0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x4
.uleb128 0x24
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0x8
.byte 0
.byte 0
.uleb128 0x5
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0x19
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2116
.uleb128 0x19
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x6
.uleb128 0x5
.byte 0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x18
.byte 0
.byte 0
.uleb128 0x7
.uleb128 0x34
.byte 0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x18
.byte 0
.byte 0
.uleb128 0x8
.uleb128 0x34
.byte 0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x18
.byte 0
.byte 0
.uleb128 0x9
.uleb128 0xf
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xa
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0x19
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xb
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0x19
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.byte 0
.byte 0
.byte 0
.section .debug_aranges,"",@progbits
.long 0x1c
.value 0x2
.long .Ldebug_info0
.byte 0x4
.byte 0
.value 0
.value 0
.long .Ltext0
.long .Letext0-.Ltext0
.long 0
.long 0
.section .debug_line,"",@progbits
.Ldebug_line0:
.section .debug_str,"MS",@progbits,1
.LASF0:
.string "unsigned int"
.LASF8:
.string "zeros"
.LASF7:
.string "hex_to_ascii"
.LASF15:
.string "/home/os/OS_Project/Part4/10_scheduler"
.LASF5:
.string "sign"
.LASF6:
.string "int_to_ascii"
.LASF3:
.string "unsigned char"
.LASF4:
.string "char"
.LASF12:
.string "strcmp"
.LASF14:
.string "./libc/string.c"
.LASF9:
.string "reverse"
.LASF10:
.string "append"
.LASF13:
.string "GNU C11 5.4.0 20160609 -m32 -mtune=generic -march=i686 -g -fno-pie -ffreestanding -fno-builtin -fno-stack-protector"
.LASF16:
.string "strlen"
.LASF1:
.string "short unsigned int"
.LASF2:
.string "short int"
.LASF11:
.string "backspace"
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits