]> sourceware.org Git - newlib-cygwin.git/commitdiff
Seperate MSP430 cio syscalls into individual function sections.
authorNick Clifton <nickc@redhat.com>
Tue, 9 Feb 2016 13:44:05 +0000 (13:44 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 9 Feb 2016 13:44:05 +0000 (13:44 +0000)
    START_FUNC: New macro.
    END_FUNC: New macro.
    exit, isatty, getpid, sc2: Use the new macros.

libgloss/msp430/ciosyscalls.S

index abb01b03e1c842d3b6be051801e12e3b3140b161..889deae9ee4a4ae80dae3d65f57b0a4bcec57a70 100644 (file)
 .macro sc,a
        sc2 \a,\a
 .endm
+
+.macro START_FUNC name1, name2=foo
+       .pushsection .text.\name1,"ax",@progbits
+       .p2align 1
+       .weak   \name1
+       .global \name1
+\name1:
+  .ifnc \name2,foo
+       .weak   \name2
+       .global \name2
+\name2:
+  .endif
+.endm
+
+.macro END_FUNC name1, name2=foo
+       .type \name1 , @function
+       .size \name1 , . - \name1
+  .ifnc \name2,foo
+       .type \name2 , @function
+       .size \name2 , . - \name2
+  .endif
+       .popsection
+.endm
+
+
+START_FUNC exit, _exit
+       /* For some reason, the board fails to stop at a breakpoint
+          placed on top of a software breakpoint instruction.  */
+/*     MOV.B   #0,R3           ; this is a software breakpoint instruction */
+1:     br_     #1b
+END_FUNC exit, _exit
        
+
+START_FUNC isatty,_isatty
+       MOV     #1,R12
+       ret_
+END_FUNC isatty,_isatty
+
+
+START_FUNC getpid
+       MOV     #42,R12
+       ret_
+END_FUNC getpid
+
+
 .macro sc2,name,num
-       .weak   \name
-       .global \name
-\name:
+       START_FUNC \name
         call_   #__errno                 
         movx_   #ENOSYS, @R12                
        MOV.W   #-1,R12
        ret_
+       END_FUNC \name
 .endm
 
-       .weak   exit
-       .weak   _exit
-       .global exit
-       .global _exit
-exit:
-_exit:
-       /* For some reason, the board fails to stop at a breakpoint
-          placed on top of a software breakpoint instruction.  */
-/*     MOV.B   #0,R3           ; this is a software breakpoint instruction */
-1:     br_     #1b
-
 #define SC(n) sc2 n,SYS_##n
 
        SC (open)
@@ -52,18 +84,3 @@ _exit:
        SC (fstat)
        SC (lseek)
        SC (kill)
-
-       .weak   isatty
-       .global isatty
-isatty:
-       .weak   _isatty
-       .global _isatty
-_isatty:
-       MOV     #1,R12
-       ret_
-       
-       .weak   getpid
-       .global getpid
-getpid:
-       MOV     #42,R12
-       ret_
This page took 0.03214 seconds and 5 git commands to generate.