[rl78] avoid line separator characters
DJ Delorie
dj@redhat.com
Mon Oct 8 14:59:00 GMT 2012
GAS's line sep character is changing. This patch avoids using it
completely, to avoid release dependencies as much as possible.
Applied.
* libc/machine/rl78/setjmp.S: Convert from CPP macros to GAS
macros, to avoid dependence on the line separation character.
* rl78/crt0.S (_interrupt_vector_table): Convert from CPP macros
to GAS macros, to avoid dependence on the line separation
character.
Index: newlib/libc/machine/rl78/setjmp.S
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/rl78/setjmp.S,v
retrieving revision 1.1
diff -p -U5 -r1.1 newlib/libc/machine/rl78/setjmp.S
--- newlib/libc/machine/rl78/setjmp.S 29 Nov 2011 06:33:49 -0000 1.1
+++ newlib/libc/machine/rl78/setjmp.S 3 Oct 2012 20:21:42 -0000
@@ -55,12 +55,18 @@ r23 = 0xffeef
ES 1 byte
CS 1 byte
PC 4 bytes
*/
-#define SAVEB(ofs,reg) mov a,reg | mov [hl+ofs],a
-#define SAVE(ofs,reg) movw ax,reg | movw [hl+ofs],ax
+ .macro _saveb ofs,reg
+ mov a,\reg
+ mov [hl+\ofs],a
+ .endm
+ .macro _save ofs,reg
+ movw ax,\reg
+ movw [hl+\ofs],ax
+ .endm
.global _setjmp
.type _setjmp, @function
_setjmp:
;; R8 = setjmp (jmp_buf *[sp+4].w)
@@ -70,43 +76,52 @@ _setjmp:
push ax
movw ax, [sp+10]
movw hl, ax
pop ax
movw [hl], ax
- SAVE (2, bc)
- SAVE (4, de)
+ _save 2, bc
+ _save 4, de
pop ax
movw [hl+6], ax
- SAVE (8, r8)
- SAVE (10, r10)
- SAVE (12, r12)
- SAVE (14, r14)
- SAVE (16, r16)
- SAVE (18, r18)
- SAVE (20, r20)
- SAVE (22, r22)
+ _save 8, r8
+ _save 10, r10
+ _save 12, r12
+ _save 14, r14
+ _save 16, r16
+ _save 18, r18
+ _save 20, r20
+ _save 22, r22
;; The sp we have now includes one more pushed reg, plus $PC
movw ax, sp
addw ax, #6
movw [hl+24], ax
- SAVEB (26, es)
- SAVEB (27, cs)
- SAVE (28, [sp+2])
- SAVE (30, [sp+4])
+ _saveb 26, es
+ _saveb 27, cs
+ _save 28, [sp+2]
+ _save 30, [sp+4]
clrw ax
movw r8, ax
pop ax
ret
.size _setjmp, . - _setjmp
-#define LOADB(ofs,reg) mov a,[hl+ofs] | mov reg,a
-#define LOAD(ofs,reg) movw ax,[hl+ofs] | movw reg,ax
-#define PUSH(ofs) movw ax,[hl+ofs] | push ax
+ .macro _loadb ofs,reg
+ mov a,[hl+\ofs]
+ mov \reg,a
+ .endm
+ .macro _load ofs,reg
+ movw ax,[hl+\ofs]
+ movw \reg,ax
+ .endm
+ .macro _push ofs
+ movw ax,[hl+\ofs]
+ push ax
+ .endm
.global _longjmp
.type _longjmp, @function
_longjmp:
;; noreturn longjmp (jmp_buf *[sp+4].w, int [sp+6].w)
@@ -119,28 +134,28 @@ _longjmp:
movw ax, [sp+4]
movw hl, ax
movw ax, [hl+24]
movw sp, ax ; this is the *new* stack
- PUSH (30) ; high half of PC
- PUSH (28) ; low half of PC
- PUSH (6) ; HL
- PUSH (0) ; AX
-
- LOAD (2, bc)
- LOAD (4, de)
-
- LOAD (10, r10)
- LOAD (12, r12)
- LOAD (14, r14)
- LOAD (16, r16)
- LOAD (18, r18)
- LOAD (20, r20)
- LOAD (22, r22)
+ _push 30 ; high half of PC
+ _push 28 ; low half of PC
+ _push 6 ; HL
+ _push 0 ; AX
+
+ _load 2, bc
+ _load 4, de
+
+ _load 10, r10
+ _load 12, r12
+ _load 14, r14
+ _load 16, r16
+ _load 18, r18
+ _load 20, r20
+ _load 22, r22
- LOADB (26, es)
- LOADB (27, cs)
+ _loadb 26, es
+ _loadb 27, cs
pop ax
pop hl
Index: libgloss/rl78/crt0.S
===================================================================
RCS file: /cvs/src/src/libgloss/rl78/crt0.S,v
retrieving revision 1.1
diff -p -U5 -r1.1 libgloss/rl78/crt0.S
--- libgloss/rl78/crt0.S 29 Nov 2011 06:33:48 -0000 1.1
+++ libgloss/rl78/crt0.S 3 Oct 2012 20:21:42 -0000
@@ -32,11 +32,15 @@
.section ".vec","a"
.short _start
.section ".ivec","a"
-#define IV(x) .weak _##x##_handler | .short _##x##_handler
+ .macro _iv x
+ .weak \x
+ .short \x
+ .endm
+#define IV(x) _iv _##x##_handler
#define IVx() .short 0
/* To use a vector, simply define a global function named foo_handler()
for any IV(foo) listed below (i.e. tm05_handler) */
More information about the Newlib
mailing list