diff --git a/src/Makefile b/src/Makefile index 13059618fbf11f0a2a3d46def48288ec1ae40a6e..17a2cdac7c4fe41659fab6e1087bb23077d3cf9d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -17,7 +17,7 @@ ASFLAGS = -mcpu=arm920t -mapcs-32 ARFLAGS = rcs -LDFLAGS = -init main -Map first.map -N -T orex.ld -L/u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2 -L../lib +LDFLAGS = -init main -Map bwio.map -N -T orex.ld -L/u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2 -L../lib all: main.elf @@ -31,7 +31,5 @@ main.elf: main.o $(LD) $(LDFLAGS) -o $@ main.o -ltaskdescriptor -lscheduler -lbwio -lgcc clean: - -rm -f *.elf *.s *.o main.map *.a *~ ../../lib/*.a + -rm -f *.elf *.s *.o *.a *~ ../../lib/*.a - -: \ No newline at end of file diff --git a/src/first.map b/src/first.map new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/libsrc/Makefile b/src/libsrc/Makefile index 7f40a82812029275d0714696e9be456bb3ac924c..113142674b05ad3a95fbefee43ab88c0df9923c2 100644 --- a/src/libsrc/Makefile +++ b/src/libsrc/Makefile @@ -1,6 +1,6 @@ # Makefile for busy-wait IO tests # -XCC = /u/wbcowan/gnuarm-4.0.2/arm-elf/bin/gcc +XCC = /u/wbcowan/gnuarm-4.0.2/arm-elf/bin/gcc AS = /u/wbcowan/gnuarm-4.0.2/arm-elf/bin/as AR = /u/wbcowan/gnuarm-4.0.2/arm-elf/bin/ar CFLAGS = -c -fPIC -Wall -I. -I../../include -mcpu=arm920t -msoft-float @@ -17,7 +17,6 @@ ARFLAGS = rcs all: bwio.a - scheduler.s: scheduler.c $(XCC) -S $(CFLAGS) scheduler.c @@ -27,7 +26,6 @@ taskdescriptor.s: taskdescriptor.c bwio.s: bwio.c $(XCC) -S $(CFLAGS) bwio.c - scheduler.o: scheduler.s $(AS) $(ASFLAGS) -o scheduler.o scheduler.s @@ -37,7 +35,6 @@ taskdescriptor.o: taskdescriptor.s bwio.o: bwio.s $(AS) $(ASFLAGS) -o bwio.o bwio.s - scheduler.a: scheduler.o $(AR) $(ARFLAGS) $@ scheduler.o diff --git a/src/libsrc/bwio.a b/src/libsrc/bwio.a new file mode 100644 index 0000000000000000000000000000000000000000..c6d72c4a94e17c459261ef8d8d8bf159e9066a76 Binary files /dev/null and b/src/libsrc/bwio.a differ diff --git a/src/libsrc/bwio.o b/src/libsrc/bwio.o new file mode 100644 index 0000000000000000000000000000000000000000..1f01e290b85e1e1a3aedabe0cb298ef39089b2f4 Binary files /dev/null and b/src/libsrc/bwio.o differ diff --git a/src/libsrc/bwio.s b/src/libsrc/bwio.s new file mode 100644 index 0000000000000000000000000000000000000000..11317325ffb0ede5c4f5b9a8861dd4c4f912516e --- /dev/null +++ b/src/libsrc/bwio.s @@ -0,0 +1,982 @@ + .file "bwio.c" + .text + .align 2 + .global bwsetfifo + .type bwsetfifo, %function +bwsetfifo: + @ args = 0, pretend = 0, frame = 28 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #28 + str r0, [fp, #-24] + str r1, [fp, #-28] + ldr r3, [fp, #-24] + str r3, [fp, #-40] + ldr r3, [fp, #-40] + cmp r3, #0 + beq .L3 + ldr r3, [fp, #-40] + cmp r3, #1 + beq .L4 + b .L2 +.L3: + ldr r3, .L11 + str r3, [fp, #-20] + b .L5 +.L4: + ldr r3, .L11+4 + str r3, [fp, #-20] + b .L5 +.L2: + mvn r3, #0 + str r3, [fp, #-36] + b .L6 +.L5: + ldr r3, [fp, #-20] + ldr r3, [r3, #0] + str r3, [fp, #-16] + ldr r3, [fp, #-28] + cmp r3, #0 + beq .L7 + ldr r3, [fp, #-16] + orr r3, r3, #16 + str r3, [fp, #-32] + b .L9 +.L7: + ldr r3, [fp, #-16] + bic r3, r3, #16 + str r3, [fp, #-32] +.L9: + ldr r3, [fp, #-32] + str r3, [fp, #-16] + ldr r2, [fp, #-20] + ldr r3, [fp, #-16] + str r3, [r2, #0] + mov r3, #0 + str r3, [fp, #-36] +.L6: + ldr r3, [fp, #-36] + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} +.L12: + .align 2 +.L11: + .word -2138308600 + .word -2138243064 + .size bwsetfifo, .-bwsetfifo + .align 2 + .global bwsetspeed + .type bwsetspeed, %function +bwsetspeed: + @ args = 0, pretend = 0, frame = 28 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #28 + str r0, [fp, #-24] + str r1, [fp, #-28] + ldr r2, [fp, #-24] + str r2, [fp, #-36] + ldr r3, [fp, #-36] + cmp r3, #0 + beq .L15 + ldr r2, [fp, #-36] + cmp r2, #1 + beq .L16 + b .L14 +.L15: + ldr r3, .L23 + str r3, [fp, #-20] + ldr r3, .L23+4 + str r3, [fp, #-16] + b .L17 +.L16: + ldr r3, .L23+8 + str r3, [fp, #-20] + ldr r3, .L23+12 + str r3, [fp, #-16] + b .L17 +.L14: + mvn r3, #0 + str r3, [fp, #-32] + b .L18 +.L17: + ldr r2, [fp, #-28] + str r2, [fp, #-40] + ldr r3, [fp, #-40] + cmp r3, #2400 + beq .L20 + ldr r3, .L23+16 + ldr r2, [fp, #-40] + cmp r2, r3 + beq .L21 + b .L19 +.L21: + ldr r2, [fp, #-20] + mov r3, #0 + str r3, [r2, #0] + ldr r2, [fp, #-16] + mov r3, #3 + str r3, [r2, #0] + mov r3, #0 + str r3, [fp, #-32] + b .L18 +.L20: + ldr r2, [fp, #-20] + mov r3, #0 + str r3, [r2, #0] + ldr r2, [fp, #-16] + mov r3, #191 + str r3, [r2, #0] + mov r2, #0 + str r2, [fp, #-32] + b .L18 +.L19: + mvn r3, #0 + str r3, [fp, #-32] +.L18: + ldr r3, [fp, #-32] + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} +.L24: + .align 2 +.L23: + .word -2138308596 + .word -2138308592 + .word -2138243060 + .word -2138243056 + .word 115200 + .size bwsetspeed, .-bwsetspeed + .align 2 + .global bwputc + .type bwputc, %function +bwputc: + @ args = 0, pretend = 0, frame = 24 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #24 + str r0, [fp, #-24] + mov r3, r1 + strb r3, [fp, #-28] + ldr r3, [fp, #-24] + str r3, [fp, #-36] + ldr r3, [fp, #-36] + cmp r3, #0 + beq .L27 + ldr r3, [fp, #-36] + cmp r3, #1 + beq .L28 + b .L26 +.L27: + ldr r3, .L33 + str r3, [fp, #-20] + ldr r3, .L33+4 + str r3, [fp, #-16] + b .L29 +.L28: + ldr r3, .L33+8 + str r3, [fp, #-20] + ldr r3, .L33+12 + str r3, [fp, #-16] + b .L29 +.L26: + mvn r3, #0 + str r3, [fp, #-32] + b .L30 +.L29: + ldr r3, [fp, #-20] + ldr r3, [r3, #0] + mov r3, r3, lsr #5 + and r3, r3, #1 + and r3, r3, #255 + cmp r3, #0 + bne .L29 + ldrb r2, [fp, #-28] @ zero_extendqisi2 + ldr r3, [fp, #-16] + str r2, [r3, #0] + mov r3, #0 + str r3, [fp, #-32] +.L30: + ldr r3, [fp, #-32] + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} +.L34: + .align 2 +.L33: + .word -2138308584 + .word -2138308608 + .word -2138243048 + .word -2138243072 + .size bwputc, .-bwputc + .align 2 + .global c2x + .type c2x, %function +c2x: + @ args = 0, pretend = 0, frame = 8 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #8 + mov r3, r0 + strb r3, [fp, #-16] + ldrb r3, [fp, #-16] @ zero_extendqisi2 + cmp r3, #9 + bhi .L36 + ldrb r3, [fp, #-16] @ zero_extendqisi2 + add r3, r3, #48 + and r3, r3, #255 + and r3, r3, #255 + str r3, [fp, #-20] + b .L38 +.L36: + ldrb r3, [fp, #-16] @ zero_extendqisi2 + add r3, r3, #87 + and r3, r3, #255 + and r3, r3, #255 + str r3, [fp, #-20] +.L38: + ldr r3, [fp, #-20] + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size c2x, .-c2x + .align 2 + .global bwputx + .type bwputx, %function +bwputx: + @ args = 0, pretend = 0, frame = 12 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #12 + str r0, [fp, #-20] + mov r3, r1 + strb r3, [fp, #-24] + ldrb r3, [fp, #-24] @ zero_extendqisi2 + mov r3, r3, lsr #4 + and r3, r3, #255 + mov r0, r3 + bl c2x(PLT) + mov r3, r0 + strb r3, [fp, #-14] + ldrb r3, [fp, #-24] @ zero_extendqisi2 + and r3, r3, #15 + mov r0, r3 + bl c2x(PLT) + mov r3, r0 + strb r3, [fp, #-13] + ldrb r3, [fp, #-14] @ zero_extendqisi2 + ldr r0, [fp, #-20] + mov r1, r3 + bl bwputc(PLT) + ldrb r3, [fp, #-13] @ zero_extendqisi2 + ldr r0, [fp, #-20] + mov r1, r3 + bl bwputc(PLT) + mov r3, r0 + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwputx, .-bwputx + .align 2 + .global bwputr + .type bwputr, %function +bwputr: + @ args = 0, pretend = 0, frame = 16 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #16 + str r0, [fp, #-24] + str r1, [fp, #-28] + sub r3, fp, #28 + str r3, [fp, #-16] + mov r3, #3 + str r3, [fp, #-20] + b .L43 +.L44: + ldr r3, [fp, #-20] + mov r2, r3 + ldr r3, [fp, #-16] + add r3, r2, r3 + ldrb r3, [r3, #0] @ zero_extendqisi2 + ldr r0, [fp, #-24] + mov r1, r3 + bl bwputx(PLT) + ldr r3, [fp, #-20] + sub r3, r3, #1 + str r3, [fp, #-20] +.L43: + ldr r3, [fp, #-20] + cmp r3, #0 + bge .L44 + ldr r0, [fp, #-24] + mov r1, #32 + bl bwputc(PLT) + mov r3, r0 + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwputr, .-bwputr + .align 2 + .global bwputstr + .type bwputstr, %function +bwputstr: + @ args = 0, pretend = 0, frame = 12 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #12 + str r0, [fp, #-16] + str r1, [fp, #-20] + b .L48 +.L49: + ldr r3, [fp, #-20] + ldrb r3, [r3, #0] @ zero_extendqisi2 + ldr r0, [fp, #-16] + mov r1, r3 + bl bwputc(PLT) + mov r3, r0 + cmp r3, #0 + bge .L50 + mvn r3, #0 + str r3, [fp, #-24] + b .L52 +.L50: + ldr r3, [fp, #-20] + add r3, r3, #1 + str r3, [fp, #-20] +.L48: + ldr r3, [fp, #-20] + ldrb r3, [r3, #0] @ zero_extendqisi2 + cmp r3, #0 + bne .L49 + mov r3, #0 + str r3, [fp, #-24] +.L52: + ldr r3, [fp, #-24] + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwputstr, .-bwputstr + .align 2 + .global bwputw + .type bwputw, %function +bwputw: + @ args = 0, pretend = 0, frame = 24 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #24 + str r0, [fp, #-24] + str r1, [fp, #-28] + str r3, [fp, #-36] + mov r3, r2 + strb r3, [fp, #-32] + ldr r3, [fp, #-36] + str r3, [fp, #-16] + b .L56 +.L57: + ldr r3, [fp, #-28] + sub r3, r3, #1 + str r3, [fp, #-28] +.L56: + ldr r3, [fp, #-16] + ldrb r3, [r3, #0] @ zero_extendqisi2 + cmp r3, #0 + moveq r3, #0 + movne r3, #1 + and r2, r3, #255 + ldr r3, [fp, #-16] + add r3, r3, #1 + str r3, [fp, #-16] + eor r3, r2, #1 + and r3, r3, #255 + cmp r3, #0 + bne .L60 + ldr r3, [fp, #-28] + cmp r3, #0 + bgt .L57 + b .L60 +.L61: + ldrb r3, [fp, #-32] @ zero_extendqisi2 + ldr r0, [fp, #-24] + mov r1, r3 + bl bwputc(PLT) +.L60: + ldr r3, [fp, #-28] + cmp r3, #0 + movle r3, #0 + movgt r3, #1 + and r2, r3, #255 + ldr r3, [fp, #-28] + sub r3, r3, #1 + str r3, [fp, #-28] + cmp r2, #0 + bne .L61 + b .L63 +.L64: + ldrb r3, [fp, #-17] @ zero_extendqisi2 + ldr r0, [fp, #-24] + mov r1, r3 + bl bwputc(PLT) +.L63: + ldr r3, [fp, #-36] + ldrb r3, [r3, #0] + strb r3, [fp, #-17] + ldrb r3, [fp, #-17] @ zero_extendqisi2 + cmp r3, #0 + moveq r3, #0 + movne r3, #1 + and r2, r3, #255 + ldr r3, [fp, #-36] + add r3, r3, #1 + str r3, [fp, #-36] + cmp r2, #0 + bne .L64 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwputw, .-bwputw + .align 2 + .global bwgetc + .type bwgetc, %function +bwgetc: + @ args = 0, pretend = 0, frame = 24 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #24 + str r0, [fp, #-28] + ldr r3, [fp, #-28] + str r3, [fp, #-36] + ldr r3, [fp, #-36] + cmp r3, #0 + beq .L69 + ldr r3, [fp, #-36] + cmp r3, #1 + beq .L70 + b .L68 +.L69: + ldr r3, .L75 + str r3, [fp, #-24] + ldr r3, .L75+4 + str r3, [fp, #-20] + b .L71 +.L70: + ldr r3, .L75+8 + str r3, [fp, #-24] + ldr r3, .L75+12 + str r3, [fp, #-20] + b .L71 +.L68: + mvn r3, #0 + str r3, [fp, #-32] + b .L72 +.L71: + ldr r3, [fp, #-24] + ldr r3, [r3, #0] + mov r3, r3, lsr #6 + and r3, r3, #1 + cmp r3, #0 + beq .L71 + ldr r3, [fp, #-20] + ldr r3, [r3, #0] + strb r3, [fp, #-13] + ldrb r3, [fp, #-13] @ zero_extendqisi2 + str r3, [fp, #-32] +.L72: + ldr r3, [fp, #-32] + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} +.L76: + .align 2 +.L75: + .word -2138308584 + .word -2138308608 + .word -2138243048 + .word -2138243072 + .size bwgetc, .-bwgetc + .align 2 + .global bwa2d + .type bwa2d, %function +bwa2d: + @ args = 0, pretend = 0, frame = 8 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #8 + mov r3, r0 + strb r3, [fp, #-16] + ldrb r3, [fp, #-16] @ zero_extendqisi2 + cmp r3, #47 + bls .L78 + ldrb r3, [fp, #-16] @ zero_extendqisi2 + cmp r3, #57 + bhi .L78 + ldrb r3, [fp, #-16] @ zero_extendqisi2 + sub r3, r3, #48 + str r3, [fp, #-20] + b .L81 +.L78: + ldrb r3, [fp, #-16] @ zero_extendqisi2 + cmp r3, #96 + bls .L82 + ldrb r3, [fp, #-16] @ zero_extendqisi2 + cmp r3, #102 + bhi .L82 + ldrb r3, [fp, #-16] @ zero_extendqisi2 + sub r3, r3, #87 + str r3, [fp, #-20] + b .L81 +.L82: + ldrb r3, [fp, #-16] @ zero_extendqisi2 + cmp r3, #64 + bls .L85 + ldrb r3, [fp, #-16] @ zero_extendqisi2 + cmp r3, #70 + bhi .L85 + ldrb r3, [fp, #-16] @ zero_extendqisi2 + sub r3, r3, #55 + str r3, [fp, #-20] + b .L81 +.L85: + mvn r3, #0 + str r3, [fp, #-20] +.L81: + ldr r3, [fp, #-20] + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwa2d, .-bwa2d + .align 2 + .global bwa2i + .type bwa2i, %function +bwa2i: + @ args = 0, pretend = 0, frame = 28 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #28 + str r1, [fp, #-32] + str r2, [fp, #-36] + str r3, [fp, #-40] + mov r3, r0 + strb r3, [fp, #-28] + ldr r3, [fp, #-32] + ldr r3, [r3, #0] + str r3, [fp, #-16] + mov r3, #0 + str r3, [fp, #-24] + b .L90 +.L91: + ldr r2, [fp, #-20] + ldr r3, [fp, #-36] + cmp r2, r3 + bgt .L92 + ldr r2, [fp, #-24] + ldr r3, [fp, #-36] + mul r2, r3, r2 + ldr r3, [fp, #-20] + add r3, r2, r3 + str r3, [fp, #-24] + ldr r3, [fp, #-16] + ldrb r3, [r3, #0] + strb r3, [fp, #-28] + ldr r3, [fp, #-16] + add r3, r3, #1 + str r3, [fp, #-16] +.L90: + ldrb r3, [fp, #-28] @ zero_extendqisi2 + mov r0, r3 + bl bwa2d(PLT) + mov r3, r0 + str r3, [fp, #-20] + ldr r3, [fp, #-20] + cmp r3, #0 + bge .L91 +.L92: + ldr r2, [fp, #-32] + ldr r3, [fp, #-16] + str r3, [r2, #0] + ldr r2, [fp, #-40] + ldr r3, [fp, #-24] + str r3, [r2, #0] + ldrb r3, [fp, #-28] @ zero_extendqisi2 + mov r0, r3 + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwa2i, .-bwa2i + .global __udivsi3 + .global __umodsi3 + .align 2 + .global bwui2a + .type bwui2a, %function +bwui2a: + @ args = 0, pretend = 0, frame = 28 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #28 + str r0, [fp, #-28] + str r1, [fp, #-32] + str r2, [fp, #-36] + mov r3, #0 + str r3, [fp, #-24] + mov r3, #1 + str r3, [fp, #-16] + b .L96 +.L97: + ldr r3, [fp, #-16] + ldr r2, [fp, #-32] + mul r3, r2, r3 + str r3, [fp, #-16] +.L96: + ldr r0, [fp, #-28] + ldr r1, [fp, #-16] + bl __udivsi3(PLT) + mov r3, r0 + mov r2, r3 + ldr r3, [fp, #-32] + cmp r2, r3 + bcs .L97 + b .L109 +.L100: + ldr r0, [fp, #-28] + ldr r1, [fp, #-16] + bl __udivsi3(PLT) + mov r3, r0 + str r3, [fp, #-20] + ldr r3, [fp, #-28] + mov r0, r3 + ldr r1, [fp, #-16] + bl __umodsi3(PLT) + mov r3, r0 + str r3, [fp, #-28] + ldr r0, [fp, #-16] + ldr r1, [fp, #-32] + bl __udivsi3(PLT) + mov r3, r0 + str r3, [fp, #-16] + ldr r3, [fp, #-24] + cmp r3, #0 + bne .L101 + ldr r3, [fp, #-20] + cmp r3, #0 + bgt .L101 + ldr r3, [fp, #-16] + cmp r3, #0 + bne .L99 +.L101: + ldr r3, [fp, #-20] + cmp r3, #9 + bgt .L104 + mov r1, #48 + str r1, [fp, #-40] + b .L106 +.L104: + mov r3, #87 + str r3, [fp, #-40] +.L106: + ldr r3, [fp, #-20] + and r3, r3, #255 + ldr r1, [fp, #-40] + mov r2, r1 + add r3, r2, r3 + and r3, r3, #255 + and r3, r3, #255 + ldr r2, [fp, #-36] + strb r3, [r2, #0] + ldr r3, [fp, #-36] + add r3, r3, #1 + str r3, [fp, #-36] + ldr r3, [fp, #-24] + add r3, r3, #1 + str r3, [fp, #-24] +.L99: +.L109: + ldr r3, [fp, #-16] + cmp r3, #0 + bne .L100 + ldr r3, [fp, #-36] + mov r2, #0 + strb r2, [r3, #0] + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwui2a, .-bwui2a + .align 2 + .global bwi2a + .type bwi2a, %function +bwi2a: + @ args = 0, pretend = 0, frame = 8 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #8 + str r0, [fp, #-16] + str r1, [fp, #-20] + ldr r3, [fp, #-16] + cmp r3, #0 + bge .L111 + ldr r3, [fp, #-16] + rsb r3, r3, #0 + str r3, [fp, #-16] + ldr r2, [fp, #-20] + mov r3, #45 + strb r3, [r2, #0] + ldr r3, [fp, #-20] + add r3, r3, #1 + str r3, [fp, #-20] +.L111: + ldr r3, [fp, #-16] + mov r0, r3 + mov r1, #10 + ldr r2, [fp, #-20] + bl bwui2a(PLT) + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwi2a, .-bwi2a + .align 2 + .global bwformat + .type bwformat, %function +bwformat: + @ args = 0, pretend = 0, frame = 40 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + sub sp, sp, #40 + str r0, [fp, #-36] + str r1, [fp, #-40] + str r2, [fp, #-44] + b .L133 +.L116: + ldrb r3, [fp, #-14] @ zero_extendqisi2 + cmp r3, #37 + beq .L117 + ldrb r3, [fp, #-14] @ zero_extendqisi2 + ldr r0, [fp, #-36] + mov r1, r3 + bl bwputc(PLT) + b .L115 +.L117: + mov r3, #0 + strb r3, [fp, #-13] + mov r3, #0 + str r3, [fp, #-32] + ldr r2, [fp, #-40] + ldrb r3, [r2, #0] + strb r3, [fp, #-14] + add r3, r2, #1 + str r3, [fp, #-40] + ldrb r3, [fp, #-14] @ zero_extendqisi2 + str r3, [fp, #-52] + ldr r3, [fp, #-52] + cmp r3, #48 + beq .L120 + ldr r3, [fp, #-52] + cmp r3, #48 + blt .L119 + ldr r3, [fp, #-52] + cmp r3, #57 + bgt .L119 + b .L121 +.L120: + mov r3, #1 + strb r3, [fp, #-13] + ldr r2, [fp, #-40] + ldrb r3, [r2, #0] + strb r3, [fp, #-14] + add r3, r2, #1 + str r3, [fp, #-40] + b .L119 +.L121: + ldrb r3, [fp, #-14] @ zero_extendqisi2 + sub r2, fp, #40 + sub ip, fp, #32 + mov r0, r3 + mov r1, r2 + mov r2, #10 + mov r3, ip + bl bwa2i(PLT) + mov r3, r0 + strb r3, [fp, #-14] +.L119: + ldrb r3, [fp, #-14] @ zero_extendqisi2 + str r3, [fp, #-48] + ldr r3, [fp, #-48] + cmp r3, #115 + beq .L126 + ldr r3, [fp, #-48] + cmp r3, #115 + bgt .L129 + ldr r3, [fp, #-48] + cmp r3, #99 + beq .L124 + ldr r3, [fp, #-48] + cmp r3, #99 + bgt .L130 + ldr r3, [fp, #-48] + cmp r3, #0 + beq .L132 + ldr r3, [fp, #-48] + cmp r3, #37 + beq .L123 + b .L115 +.L130: + ldr r3, [fp, #-48] + cmp r3, #100 + beq .L125 + b .L115 +.L129: + ldr r3, [fp, #-48] + cmp r3, #117 + beq .L127 + ldr r3, [fp, #-48] + cmp r3, #120 + beq .L128 + b .L115 +.L124: + ldr r3, [fp, #-44] + add r3, r3, #4 + str r3, [fp, #-44] + ldr r3, [fp, #-44] + sub r3, r3, #4 + ldrb r3, [r3, #0] @ zero_extendqisi2 + ldr r0, [fp, #-36] + mov r1, r3 + bl bwputc(PLT) + b .L115 +.L126: + ldr r2, [fp, #-32] + ldr r3, [fp, #-44] + add r3, r3, #4 + str r3, [fp, #-44] + ldr r3, [fp, #-44] + sub r3, r3, #4 + ldr r3, [r3, #0] + ldr r0, [fp, #-36] + mov r1, r2 + mov r2, #0 + bl bwputw(PLT) + b .L115 +.L127: + ldr r3, [fp, #-44] + add r3, r3, #4 + str r3, [fp, #-44] + ldr r3, [fp, #-44] + sub r3, r3, #4 + ldr r3, [r3, #0] + sub r2, fp, #26 + mov r0, r3 + mov r1, #10 + bl bwui2a(PLT) + ldr r3, [fp, #-32] + ldrb r2, [fp, #-13] @ zero_extendqisi2 + sub ip, fp, #26 + ldr r0, [fp, #-36] + mov r1, r3 + mov r3, ip + bl bwputw(PLT) + b .L115 +.L125: + ldr r3, [fp, #-44] + add r3, r3, #4 + str r3, [fp, #-44] + ldr r3, [fp, #-44] + sub r3, r3, #4 + ldr r3, [r3, #0] + sub r2, fp, #26 + mov r0, r3 + mov r1, r2 + bl bwi2a(PLT) + ldr r3, [fp, #-32] + ldrb r2, [fp, #-13] @ zero_extendqisi2 + sub ip, fp, #26 + ldr r0, [fp, #-36] + mov r1, r3 + mov r3, ip + bl bwputw(PLT) + b .L115 +.L128: + ldr r3, [fp, #-44] + add r3, r3, #4 + str r3, [fp, #-44] + ldr r3, [fp, #-44] + sub r3, r3, #4 + ldr r3, [r3, #0] + sub r2, fp, #26 + mov r0, r3 + mov r1, #16 + bl bwui2a(PLT) + ldr r3, [fp, #-32] + ldrb r2, [fp, #-13] @ zero_extendqisi2 + sub ip, fp, #26 + ldr r0, [fp, #-36] + mov r1, r3 + mov r3, ip + bl bwputw(PLT) + b .L115 +.L123: + ldrb r3, [fp, #-14] @ zero_extendqisi2 + ldr r0, [fp, #-36] + mov r1, r3 + bl bwputc(PLT) +.L115: +.L133: + ldr r1, [fp, #-40] + ldrb r3, [r1, #0] + strb r3, [fp, #-14] + ldrb r3, [fp, #-14] @ zero_extendqisi2 + cmp r3, #0 + moveq r3, #0 + movne r3, #1 + and r2, r3, #255 + add r3, r1, #1 + str r3, [fp, #-40] + cmp r2, #0 + bne .L116 +.L132: + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwformat, .-bwformat + .align 2 + .global bwprintf + .type bwprintf, %function +bwprintf: + @ args = 4, pretend = 12, frame = 8 + @ frame_needed = 1, uses_anonymous_args = 1 + mov ip, sp + stmfd sp!, {r1, r2, r3} + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #16 + sub sp, sp, #8 + str r0, [fp, #-20] + add r3, fp, #8 + str r3, [fp, #-16] + ldr r0, [fp, #-20] + ldr r1, [fp, #4] + ldr r2, [fp, #-16] + bl bwformat(PLT) + sub sp, fp, #12 + ldmfd sp, {fp, sp, pc} + .size bwprintf, .-bwprintf + .ident "GCC: (GNU) 4.0.2" diff --git a/src/main.o b/src/main.o new file mode 100644 index 0000000000000000000000000000000000000000..a1e35354b3bb9a576f984e954fef13f5a77ef7ff Binary files /dev/null and b/src/main.o differ diff --git a/src/main.s b/src/main.s new file mode 100644 index 0000000000000000000000000000000000000000..6cff7294274d4091c2d21aa3ca5e8752719aa033 --- /dev/null +++ b/src/main.s @@ -0,0 +1,12 @@ + .file "main.c" + .section .rodata + .align 2 +.LC0: + .ascii "kerxit.c: Hello\012\015\000" + .align 2 +.LC1: + .ascii "kerxit.c: Activating\012\015\000" + .align 2 +.LC2: + .ascii "kerxit.c: Goodbye\012\015\000" + .ident "GCC: (GNU) 4.0.2"