summaryrefslogtreecommitdiffstats
path: root/newlib/libc/machine/h8300
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/machine/h8300')
-rw-r--r--newlib/libc/machine/h8300/defines.h52
-rw-r--r--newlib/libc/machine/h8300/memcpy.S8
-rw-r--r--newlib/libc/machine/h8300/reg_memcpy.S8
-rw-r--r--newlib/libc/machine/h8300/reg_memset.S5
-rw-r--r--newlib/libc/machine/h8300/strcmp.S4
5 files changed, 72 insertions, 5 deletions
diff --git a/newlib/libc/machine/h8300/defines.h b/newlib/libc/machine/h8300/defines.h
index c6ae3df10..84b2506d5 100644
--- a/newlib/libc/machine/h8300/defines.h
+++ b/newlib/libc/machine/h8300/defines.h
@@ -28,6 +28,7 @@
#define S2H r6h
#ifdef __H8300__
+
#define MOVP mov.w /* pointers are 16 bits */
#define ADDP add.w
#define CMPP cmp.w
@@ -41,9 +42,29 @@
#define S0P r4
#define S1P r5
#define S2P r6
-#endif
+
+#endif /* __H8300__ */
#ifdef __H8300H__
+
+#ifdef __NORMAL_MODE__
+
+#define MOVP mov.w /* pointers are 16 bits */
+#define ADDP add.w
+#define CMPP cmp.w
+#define PUSHP push
+#define POPP pop
+
+#define A0P r0
+#define A1P r1
+#define A2P r2
+#define A3P r3
+#define S0P r4
+#define S1P r5
+#define S2P r6
+
+#else /* !__NORMAL_MODE__ */
+
#define MOVP mov.l /* pointers are 32 bits */
#define ADDP add.l
#define CMPP cmp.l
@@ -58,13 +79,35 @@
#define S1P er5
#define S2P er6
+#endif /* !__NORMAL_MODE__ */
+
#define A0E e0
#define A1E e1
#define A2E e2
#define A3E e3
-#endif
+
+#endif /* __H8300H__ */
#ifdef __H8300S__
+
+#ifdef __NORMAL_MODE__
+
+#define MOVP mov.w /* pointers are 16 bits */
+#define ADDP add.w
+#define CMPP cmp.w
+#define PUSHP push
+#define POPP pop
+
+#define A0P r0
+#define A1P r1
+#define A2P r2
+#define A3P r3
+#define S0P r4
+#define S1P r5
+#define S2P r6
+
+#else /* !__NORMAL_MODE__ */
+
#define MOVP mov.l /* pointers are 32 bits */
#define ADDP add.l
#define CMPP cmp.l
@@ -79,8 +122,11 @@
#define S1P er5
#define S2P er6
+#endif /* !__NORMAL_MODE__ */
+
#define A0E e0
#define A1E e1
#define A2E e2
#define A3E e3
-#endif
+
+#endif /* __H8300S__ */
diff --git a/newlib/libc/machine/h8300/memcpy.S b/newlib/libc/machine/h8300/memcpy.S
index 21738e783..305e865df 100644
--- a/newlib/libc/machine/h8300/memcpy.S
+++ b/newlib/libc/machine/h8300/memcpy.S
@@ -23,7 +23,11 @@ _memcpy:
bne byteloop
wordloop:
+#ifdef __NORMAL_MODE__
+ sub #2,A1P
+#else
subs #2,A1P ; point to word
+#endif
mov.w @A1P,A2 ; get word
mov.w A2,@-A0P ; save word
CMPP A0P,A3P ; at the front again ?
@@ -31,7 +35,11 @@ wordloop:
rts
byteloop:
+#ifdef __NORMAL_MODE__
+ sub #1,A1P
+#else
subs #1,A1P ; point to byte
+#endif
mov.b @A1P,A2L ; get byte
mov.b A2L,@-A0P ; save byte
CMPP A0P,A3P ; at the front again ?
diff --git a/newlib/libc/machine/h8300/reg_memcpy.S b/newlib/libc/machine/h8300/reg_memcpy.S
index ea4aff0f6..5402fc46d 100644
--- a/newlib/libc/machine/h8300/reg_memcpy.S
+++ b/newlib/libc/machine/h8300/reg_memcpy.S
@@ -14,8 +14,12 @@ ___reg_memcpy:
CMPP A0P,A3P ; see if anything to do
beq quit
-
-loop: subs #1,A1P ; point to byte
+loop:
+#ifdef __NORMAL_MODE__
+ sub #1,A1P ; point to byte
+#else
+ subs #1,A1P ; point to byte
+#endif
mov.b @A1P,A2L ; get byte
mov.b A2L,@-A0P ; save byte
CMPP A0P,A3P ; at the front again ?
diff --git a/newlib/libc/machine/h8300/reg_memset.S b/newlib/libc/machine/h8300/reg_memset.S
index 79cccab38..ce4f5ca66 100644
--- a/newlib/libc/machine/h8300/reg_memset.S
+++ b/newlib/libc/machine/h8300/reg_memset.S
@@ -14,8 +14,13 @@ ___reg_memset:
memloop:
mov.b A1L,@A0P
+#ifdef __NORMAL_MODE__
+ add #1,A0P
+ sub #1,A2P
+#else
adds #1,A0P
subs #1,A2P
+#endif
MOVP A2P,A2P
bne memloop
diff --git a/newlib/libc/machine/h8300/strcmp.S b/newlib/libc/machine/h8300/strcmp.S
index 4433af523..2ee31f05c 100644
--- a/newlib/libc/machine/h8300/strcmp.S
+++ b/newlib/libc/machine/h8300/strcmp.S
@@ -14,7 +14,11 @@ _strcmp:
mov.b @A3P+,A0L
cmp.b A0L,A1L
beq .L5
+#ifdef __NORMAL_MODE__
+ sub #1,A3P
+#else
subs #1,A3P
+#endif
.L3:
mov.b @(-1,A2P),A0L
mov.b @A3P,A1L