source: trunk/libs/newlib/src/libgloss/msp430/ciosyscalls.S @ 642

Last change on this file since 642 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.9 KB
Line 
1/* Copyright (c) 2012, 2013 Red Hat, Inc. All rights reserved.
2
3   This copyrighted material is made available to anyone wishing to use, modify,
4   copy, or redistribute it subject to the terms and conditions of the BSD
5   License.   This program is distributed in the hope that it will be useful,
6   but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties
7   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  A copy of this license
8   is available at http://www.opensource.org/licenses. Any Red Hat trademarks that
9   are incorporated in the source code or documentation are not subject to the BSD
10   License and may only be used or replicated with the express permission of
11   Red Hat, Inc.
12*/
13
14/* Empty syscall definitions for when we run on real hardware.  */
15
16#include "../syscall.h"
17#include "memmodel.h"
18       
19#define ENOSYS 88
20
21.macro  sc,a
22        sc2 \a,\a
23.endm
24
25.macro START_FUNC name1, name2=foo
26        .pushsection .text.\name1,"ax",@progbits
27        .p2align 1
28        .weak   \name1
29        .global \name1
30\name1:
31  .ifnc \name2,foo
32        .weak   \name2
33        .global \name2
34\name2:
35  .endif
36.endm
37
38.macro END_FUNC name1, name2=foo
39        .type \name1 , @function
40        .size \name1 , . - \name1
41  .ifnc \name2,foo
42        .type \name2 , @function
43        .size \name2 , . - \name2
44  .endif
45        .popsection
46.endm
47
48
49START_FUNC exit, _exit
50        /* For some reason, the board fails to stop at a breakpoint
51           placed on top of a software breakpoint instruction.  */
52/*      MOV.B   #0,R3           ; this is a software breakpoint instruction */
531:      br_     #1b
54END_FUNC exit, _exit
55       
56
57START_FUNC isatty,_isatty
58        MOV     #1,R12
59        ret_
60END_FUNC isatty,_isatty
61
62
63START_FUNC getpid
64        MOV     #42,R12
65        ret_
66END_FUNC getpid
67
68
69.macro  sc2,name,num
70        START_FUNC \name
71        call_   #__errno                 
72        movx_   #ENOSYS, @R12               
73        MOV.W   #-1,R12
74        ret_
75        END_FUNC \name
76.endm
77
78#define SC(n) sc2 n,SYS_##n
79
80        SC (open)
81        SC (close)
82        SC (read)
83/*      SC (write)*/
84        SC (fstat)
85        SC (lseek)
86        SC (kill)
Note: See TracBrowser for help on using the repository browser.