4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-27 19:17:18 +08:00

Seperate MSP430 cio syscalls into individual function sections.

START_FUNC: New macro.
    END_FUNC: New macro.
    exit, isatty, getpid, sc2: Use the new macros.
This commit is contained in:
Nick Clifton 2016-02-09 13:44:05 +00:00
parent c4dcfc1bda
commit 9676aeef0d

View File

@ -21,27 +21,59 @@
.macro sc,a .macro sc,a
sc2 \a,\a sc2 \a,\a
.endm .endm
.macro sc2,name,num .macro START_FUNC name1, name2=foo
.weak \name .pushsection .text.\name1,"ax",@progbits
.global \name .p2align 1
\name: .weak \name1
call_ #__errno .global \name1
movx_ #ENOSYS, @R12 \name1:
MOV.W #-1,R12 .ifnc \name2,foo
ret_ .weak \name2
.global \name2
\name2:
.endif
.endm .endm
.weak exit .macro END_FUNC name1, name2=foo
.weak _exit .type \name1 , @function
.global exit .size \name1 , . - \name1
.global _exit .ifnc \name2,foo
exit: .type \name2 , @function
_exit: .size \name2 , . - \name2
.endif
.popsection
.endm
START_FUNC exit, _exit
/* For some reason, the board fails to stop at a breakpoint /* For some reason, the board fails to stop at a breakpoint
placed on top of a software breakpoint instruction. */ placed on top of a software breakpoint instruction. */
/* MOV.B #0,R3 ; this is a software breakpoint instruction */ /* MOV.B #0,R3 ; this is a software breakpoint instruction */
1: br_ #1b 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
START_FUNC \name
call_ #__errno
movx_ #ENOSYS, @R12
MOV.W #-1,R12
ret_
END_FUNC \name
.endm
#define SC(n) sc2 n,SYS_##n #define SC(n) sc2 n,SYS_##n
@ -52,18 +84,3 @@ _exit:
SC (fstat) SC (fstat)
SC (lseek) SC (lseek)
SC (kill) 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_