From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21593 invoked by alias); 9 Feb 2016 13:45:47 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 21517 invoked by uid 395); 9 Feb 2016 13:45:47 -0000 Date: Tue, 09 Feb 2016 13:45:00 -0000 Message-ID: <20160209134547.21514.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Nick Clifton To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Seperate MSP430 cio syscalls into individual function sections. X-Act-Checkin: newlib-cygwin X-Git-Author: Nick Clifton X-Git-Refname: refs/heads/master X-Git-Oldrev: c4dcfc1bda72883aa20eba627af840d1a4256c7b X-Git-Newrev: 9676aeef0d672fea93310df14d36c1c9904d0179 X-SW-Source: 2016-q1/txt/msg00034.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=9676aeef0d672fea93310df14d36c1c9904d0179 commit 9676aeef0d672fea93310df14d36c1c9904d0179 Author: Nick Clifton Date: Tue Feb 9 13:44:05 2016 +0000 Seperate MSP430 cio syscalls into individual function sections. START_FUNC: New macro. END_FUNC: New macro. exit, isatty, getpid, sc2: Use the new macros. Diff: --- libgloss/msp430/ciosyscalls.S | 75 ++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/libgloss/msp430/ciosyscalls.S b/libgloss/msp430/ciosyscalls.S index abb01b0..889deae 100644 --- a/libgloss/msp430/ciosyscalls.S +++ b/libgloss/msp430/ciosyscalls.S @@ -21,28 +21,60 @@ .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_