diff options
Diffstat (limited to 'newlib/libc/machine/m68k')
-rw-r--r-- | newlib/libc/machine/m68k/m68kasm.h | 40 | ||||
-rw-r--r-- | newlib/libc/machine/m68k/memcpy.S | 64 | ||||
-rw-r--r-- | newlib/libc/machine/m68k/memset.S | 72 | ||||
-rw-r--r-- | newlib/libc/machine/m68k/setjmp.S | 41 |
4 files changed, 106 insertions, 111 deletions
diff --git a/newlib/libc/machine/m68k/m68kasm.h b/newlib/libc/machine/m68k/m68kasm.h deleted file mode 100644 index a5c610af9..000000000 --- a/newlib/libc/machine/m68k/m68kasm.h +++ /dev/null @@ -1,40 +0,0 @@ -/* These are predefined by new versions of GNU cpp. */ - -#ifndef __USER_LABEL_PREFIX__ -#define __USER_LABEL_PREFIX__ _ -#endif - -#ifndef __REGISTER_PREFIX__ -#define __REGISTER_PREFIX__ -#endif - -/* ANSI concatenation macros. */ - -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ - -#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) - -/* Use the right prefix for registers. */ - -#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) - -#define d0 REG (d0) -#define d1 REG (d1) -#define d2 REG (d2) -#define d3 REG (d3) -#define d4 REG (d4) -#define d5 REG (d5) -#define d6 REG (d6) -#define d7 REG (d7) -#define a0 REG (a0) -#define a1 REG (a1) -#define a2 REG (a2) -#define a3 REG (a3) -#define a4 REG (a4) -#define a5 REG (a5) -#define a6 REG (a6) -#define fp REG (fp) -#define sp REG (sp) diff --git a/newlib/libc/machine/m68k/memcpy.S b/newlib/libc/machine/m68k/memcpy.S index 3badd58bf..ed9e7b2a1 100644 --- a/newlib/libc/machine/m68k/memcpy.S +++ b/newlib/libc/machine/m68k/memcpy.S @@ -13,13 +13,11 @@ * they apply. */ -#include "m68kasm.h" - .text .align 4 - .globl SYM(memcpy) - .type SYM(memcpy), @function + .globl memcpy + .type memcpy, @function /* memcpy, optimised * @@ -33,64 +31,64 @@ * to further improve speed. */ -SYM(memcpy): - move.l 4(sp),a0 | dest ptr - move.l 8(sp),a1 | src ptr - move.l 12(sp),d1 | len - cmp.l #8,d1 | if fewer than 8 bytes to transfer, +memcpy: + move.l 4(%sp),%a0 | dest ptr + move.l 8(%sp),%a1 | src ptr + move.l 12(%sp),%d1 | len + cmp.l #8,%d1 | if fewer than 8 bytes to transfer, blo .Lresidue | do not optimise /* align dest */ - move.l a0,d0 | copy of dest - neg.l d0 - and.l #3,d0 | look for the lower two only + move.l %a0,%d0 | copy of dest + neg.l %d0 + and.l #3,%d0 | look for the lower two only beq 2f | is aligned? - sub.l d0,d1 - lsr.l #1,d0 | word align needed? + sub.l %d0,%d1 + lsr.l #1,%d0 | word align needed? bcc 1f - move.b (a1)+,(a0)+ + move.b (%a1)+,(%a0)+ 1: - lsr.l #1,d0 | long align needed? + lsr.l #1,%d0 | long align needed? bcc 2f - move.w (a1)+,(a0)+ + move.w (%a1)+,(%a0)+ 2: /* long word transfers */ - move.l d1,d0 - and.l #3,d1 | byte residue - lsr.l #3,d0 + move.l %d1,%d0 + and.l #3,%d1 | byte residue + lsr.l #3,%d0 bcc 1f | carry set for 4-byte residue - move.l (a1)+,(a0)+ + move.l (%a1)+,(%a0)+ 1: - lsr.l #1,d0 | number of 16-byte transfers + lsr.l #1,%d0 | number of 16-byte transfers bcc .Lcopy | carry set for 8-byte residue bra .Lcopy8 1: - move.l (a1)+,(a0)+ - move.l (a1)+,(a0)+ + move.l (%a1)+,(%a0)+ + move.l (%a1)+,(%a0)+ .Lcopy8: - move.l (a1)+,(a0)+ - move.l (a1)+,(a0)+ + move.l (%a1)+,(%a0)+ + move.l (%a1)+,(%a0)+ .Lcopy: #if !defined (__mcoldfire__) - dbra d0,1b - sub.l #0x10000,d0 + dbra %d0,1b + sub.l #0x10000,%d0 #else - subq.l #1,d0 + subq.l #1,%d0 #endif bpl 1b bra .Lresidue 1: - move.b (a1)+,(a0)+ | move residue bytes + move.b (%a1)+,(%a0)+ | move residue bytes .Lresidue: #if !defined (__mcoldfire__) - dbra d1,1b | loop until done + dbra %d1,1b | loop until done #else - subq.l #1,d1 + subq.l #1,%d1 bpl 1b #endif - move.l 4(sp),d0 | return value + move.l 4(%sp),%d0 | return value rts diff --git a/newlib/libc/machine/m68k/memset.S b/newlib/libc/machine/m68k/memset.S index 622cf014d..545bf7e7d 100644 --- a/newlib/libc/machine/m68k/memset.S +++ b/newlib/libc/machine/m68k/memset.S @@ -13,13 +13,11 @@ * they apply. */ -#include "m68kasm.h" - .text .align 4 - .globl SYM(memset) - .type SYM(memset), @function + .globl memset + .type memset, @function | memset, optimised | @@ -40,61 +38,61 @@ | | VG, April 2007 | -SYM(memset): - move.l 4(sp),a0 | dest ptr - move.l 8(sp),d0 | value - move.l 12(sp),d1 | len - cmp.l #16,d1 +memset: + move.l 4(%sp),%a0 | dest ptr + move.l 8(%sp),%d0 | value + move.l 12(%sp),%d1 | len + cmp.l #16,%d1 blo .Lbset | below, byte fills | - move.l d2,-(sp) | need a register - move.b d0,d2 | distribute low byte to all byte in word - lsl.l #8,d0 - move.b d2,d0 - move.w d0,d2 - swap d0 | rotate 16 - move.w d2,d0 + move.l %d2,-(%sp) | need a register + move.b %d0,%d2 | distribute low byte to all byte in word + lsl.l #8,%d0 + move.b %d2,%d0 + move.w %d0,%d2 + swap %d0 | rotate 16 + move.w %d2,%d0 | - move.l a0,d2 | copy of src - neg.l d2 | 1 2 3 ==> 3 2 1 - and.l #3,d2 + move.l %a0,%d2 | copy of src + neg.l %d2 | 1 2 3 ==> 3 2 1 + and.l #3,%d2 beq 2f | is aligned | - sub.l d2,d1 | fix length - lsr.l #1,d2 | word align needed? + sub.l %d2,%d1 | fix length + lsr.l #1,%d2 | word align needed? bcc 1f - move.b d0,(a0)+ | fill byte + move.b %d0,(%a0)+ | fill byte 1: - lsr.l #1,d2 | long align needed? + lsr.l #1,%d2 | long align needed? bcc 2f - move.w d0,(a0)+ | fill word + move.w %d0,(%a0)+ | fill word 2: - move.l d1,d2 | number of long transfers (at least 3) - lsr.l #2,d2 - subq.l #1,d2 + move.l %d1,%d2 | number of long transfers (at least 3) + lsr.l #2,%d2 + subq.l #1,%d2 1: - move.l d0,(a0)+ | fill long words + move.l %d0,(%a0)+ | fill long words .Llset: #if !defined (__mcoldfire__) - dbra d2,1b | loop until done - sub.l #0x10000,d2 + dbra %d2,1b | loop until done + sub.l #0x10000,%d2 #else - subq.l #1,d2 + subq.l #1,%d2 #endif bpl 1b - and.l #3,d1 | residue byte transfers, fixed - move.l (sp)+,d2 | restore d2 + and.l #3,%d1 | residue byte transfers, fixed + move.l (%sp)+,%d2 | restore d2 bra .Lbset 1: - move.b d0,(a0)+ | fill residue bytes + move.b %d0,(%a0)+ | fill residue bytes .Lbset: #if !defined (__mcoldfire__) - dbra d1,1b | loop until done + dbra %d1,1b | loop until done #else - subq.l #1,d1 + subq.l #1,%d1 bpl 1b #endif - move.l 4(sp),d0 | return value + move.l 4(%sp),%d0 | return value rts diff --git a/newlib/libc/machine/m68k/setjmp.S b/newlib/libc/machine/m68k/setjmp.S index 4b260efcc..02a02c4e1 100644 --- a/newlib/libc/machine/m68k/setjmp.S +++ b/newlib/libc/machine/m68k/setjmp.S @@ -1,4 +1,43 @@ -#include "m68kasm.h" +/* These are predefined by new versions of GNU cpp. */ + +#ifndef __USER_LABEL_PREFIX__ +#define __USER_LABEL_PREFIX__ _ +#endif + +#ifndef __REGISTER_PREFIX__ +#define __REGISTER_PREFIX__ +#endif + +/* ANSI concatenation macros. */ + +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ + +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) + +/* Use the right prefix for registers. */ + +#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) + +#define d0 REG (d0) +#define d1 REG (d1) +#define d2 REG (d2) +#define d3 REG (d3) +#define d4 REG (d4) +#define d5 REG (d5) +#define d6 REG (d6) +#define d7 REG (d7) +#define a0 REG (a0) +#define a1 REG (a1) +#define a2 REG (a2) +#define a3 REG (a3) +#define a4 REG (a4) +#define a5 REG (a5) +#define a6 REG (a6) +#define fp REG (fp) +#define sp REG (sp) .global SYM (setjmp) .global SYM (longjmp) |