74 lines
1.2 KiB
ArmAsm
74 lines
1.2 KiB
ArmAsm
.file "task02_free_list.c"
|
|
.option nopic
|
|
.attribute arch, "rv32i2p1_zicsr2p0_zifencei2p0"
|
|
.attribute unaligned_access, 0
|
|
.attribute stack_align, 16
|
|
.text
|
|
.align 2
|
|
.globl main
|
|
.type main, @function
|
|
main:
|
|
addi sp,sp,-32
|
|
addi a5,sp,16
|
|
sw a5,24(sp)
|
|
li a5,32
|
|
sw a5,28(sp)
|
|
addi a5,sp,8
|
|
sw a5,16(sp)
|
|
li a5,80
|
|
sw a5,20(sp)
|
|
sw zero,8(sp)
|
|
li a5,24
|
|
sw a5,12(sp)
|
|
li a4,0
|
|
add a5,sp,a5
|
|
.L2:
|
|
lw a3,4(a5)
|
|
add a4,a4,a3
|
|
lw a5,0(a5)
|
|
bne a5,zero,.L2
|
|
sw a4,g_free_total,a5
|
|
li a3,0
|
|
addi a5,sp,24
|
|
j .L4
|
|
.L3:
|
|
lw a5,0(a5)
|
|
beq a5,zero,.L10
|
|
.L4:
|
|
lw a4,4(a5)
|
|
bgeu a3,a4,.L3
|
|
mv a3,a4
|
|
j .L3
|
|
.L10:
|
|
sw a3,g_largest_free,a5
|
|
addi a5,sp,24
|
|
li a4,0
|
|
.L5:
|
|
addi a4,a4,1
|
|
lw a5,0(a5)
|
|
bne a5,zero,.L5
|
|
sw a4,g_node_count,a5
|
|
li a0,0
|
|
addi sp,sp,32
|
|
jr ra
|
|
.size main, .-main
|
|
.globl g_node_count
|
|
.globl g_largest_free
|
|
.globl g_free_total
|
|
.section .sbss,"aw",@nobits
|
|
.align 2
|
|
.type g_node_count, @object
|
|
.size g_node_count, 4
|
|
g_node_count:
|
|
.zero 4
|
|
.type g_largest_free, @object
|
|
.size g_largest_free, 4
|
|
g_largest_free:
|
|
.zero 4
|
|
.type g_free_total, @object
|
|
.size g_free_total, 4
|
|
g_free_total:
|
|
.zero 4
|
|
.ident "GCC: (15.2.0-23) 15.2.0"
|
|
.section .note.GNU-stack,"",@progbits
|