.section core_ram_0 .align 4 .global _hwloop .global hwloop_exit .type _hwloop, %function _hwloop: // function entry str fp, [sp],#-8; mov fp,sp; strd r4, [fp,#1]; strd r6, [fp,#2]; strd r8, [fp,#3]; gid; mov r1, %low(loop_start); movt r1, %high(loop_start); movts ls, r1; mov r1, %low(loop_end); movt r1, %high(loop_end); movts le, r1; mov r1, #0x10; movts lc, r1; mov r0, #1; mov r1, #0; mov r2, #0; mov r3, #0; mov r4, #0; mov r5, #0; mov r6, #0; mov r7, #0; // This loop should increment r1-r8 by 1. The loop should execute // 0x10 times, so when it exits, r1-8 should each equal 0x10 .balignw 8,0x01a2; nop; nop; mov r8, #0; .balignw 8,0x01a2; loop_start: add.l r1, r1, r0; add.l r2, r2, r0; add.l r3, r3, r0; add.l r4, r4, r0; add.l r5, r5, r0; add.l r6, r6, r0; .balignw 8,0x01a2; add.l r7, r7, r0; loop_end: add.l r8, r8, r0; mov r0, #0x10; gie; // compare each register to 0x10 sub r1, r1, r0; sub r2, r2, r0; sub r3, r3, r0; sub r4, r4, r0; sub r5, r5, r0; sub r6, r6, r0; sub r7, r7, r0; sub r8, r8, r0; // OR them all together so we can tell if they were all 0 or not. orr r0, r1, r2; orr r0, r0, r3; orr r0, r0, r4; orr r0, r0, r5; orr r0, r0, r6; orr r0, r0, r7; orr r0, r0, r8; hwloop_exit: // restore regs ldrd r4, [fp,#1]; // restore r4 & r5 ldrd r6, [fp,#2]; // restore r6 & r7 ldrd r8, [fp,#3]; // restore r8 & r9 // return mov sp,fp; ldr fp,[sp,#8]; add sp,sp,#32; rts; .size _hwloop, .-_hwloop