OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [machine/] [spu/] [mk_syscalls] - Blame information for rev 455

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
#!/usr/bin/perl -w
2
#
3
#  (C) Copyright 2007 TOSHIBA CORPORATION
4
#  All Rights Reserved
5
#
6
#  Redistribution and use in source and binary forms, with or without
7
#  modification, are permitted provided that the following conditions are met:
8
#
9
#    * Redistributions of source code must retain the above copyright notice,
10
#  this list of conditions and the following disclaimer.
11
#    * Redistributions in binary form must reproduce the above copyright
12
#  notice, this list of conditions and the following disclaimer in the
13
#  documentation and/or other materials provided with the distribution.
14
#    * Neither the names of Toshiba nor the names of its
15
#  contributors may be used to endorse or promote products derived from this
16
#  software without specific prior written permission.
17
#
18
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22
#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
#  POSSIBILITY OF SUCH DAMAGE.
29
 
30
open(DEFS, "syscall.def");
31
 
32
while ($line = ) {
33
        next if ($line =~ /^#.*/);
34
 
35
        ($opcode, $name, $fp, $parms) = split(" ", $line);
36
        $filename = ">" . $name . ".S";
37
        open(SOURCE, $filename);
38
 
39
        print SOURCE "\/\*\n";
40
        print SOURCE "  Copyright (c) 2007, Toshiba Corporation\n\n";
41
 
42
        print SOURCE "  All rights reserved.\n\n";
43
 
44
        print SOURCE "  Redistribution and use in source and binary forms, with or without\n";
45
        print SOURCE "  modification, are permitted provided that the following conditions are met:\n\n";
46
 
47
        print SOURCE "    \* Redistributions of source code must retain the above copyright notice,\n";
48
        print SOURCE "  this list of conditions and the following disclaimer.\n";
49
        print SOURCE "    \* Redistributions in binary form must reproduce the above copyright\n";
50
        print SOURCE "  notice, this list of conditions and the following disclaimer in the\n";
51
        print SOURCE "  documentation and/or other materials provided with the distribution.\n";
52
        print SOURCE "    \* Neither the names of Toshiba nor the names of its\n";
53
        print SOURCE "  contributors may be used to endorse or promote products derived from this\n";
54
        print SOURCE "  software without specific prior written permission.\n\n";
55
 
56
        print SOURCE "  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n";
57
        print SOURCE "  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n";
58
        print SOURCE "  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n";
59
        print SOURCE "  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n";
60
        print SOURCE "  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n";
61
        print SOURCE "  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n";
62
        print SOURCE "  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n";
63
        print SOURCE "  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n";
64
        print SOURCE "  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n";
65
        print SOURCE "  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n";
66
        print SOURCE "  POSSIBILITY OF SUCH DAMAGE.\n";
67
        print SOURCE " \*\/\n\n";
68
        print SOURCE "#include \"c99ppe.h\"\n\n";
69
        print SOURCE "  .text\n";
70
        print SOURCE "  .align  4\n";
71
        print SOURCE "  GLOBL   ", $name, "\n";
72
        print SOURCE "  .type   ", $name, ", \@function\n";
73
        print SOURCE $name, ":\n";
74
 
75
        print SOURCE "  stqd    \$0, 16(\$sp)           \/\* save caller address \*\/\n";
76
        print SOURCE "  il      \$2, ", $parms, "                       \/\* number of fixed arguments \*\/\n";
77
        print SOURCE "  brsl    \$0, __stack_reg_va     \/\* save register to the stack frame \*\/\n\n";
78
 
79
        if ($fp > 0) {
80
                print SOURCE "  brsl    \$0, __check_init\n";
81
                print SOURCE "  lqd     \$3, 16\*2(\$sp)                \/\* \$3 <- saved FP on the stack frame \*\/\n";
82
                print SOURCE "  lqd     \$2, 0(\$3)             \/\* FP = fp->_fp \*\/\n";
83
                print SOURCE "  rotqby  \$2, \$2, \$3\n";
84
                print SOURCE "  stqd    \$2, 16\*2(\$sp)                \/\* replace FP on the stack frame \*\/\n\n";
85
        }
86
 
87
        print SOURCE "  il      \$3, SPE_C99_SIGNALCODE\n";
88
        print SOURCE "  il      \$4, ", $opcode, "\n";
89
        print SOURCE "  ai      \$5, \$sp, 16\*2                \/\* data (\$3 save address) \*\/\n";
90
        print SOURCE "  brsl    \$0, __send_to_ppe\n\n";
91
 
92
        print SOURCE "  il      \$2, 16\*(SPE_STACK_REGS+2+2)\n";
93
        print SOURCE "  a       \$sp, \$sp, \$2\n";
94
        print SOURCE "  lqd     \$0, 16(\$sp)           \/\* load caller address \*\/\n";
95
        print SOURCE "  bi      \$0                     \/\* return to caller \*\/\n";
96
 
97
        print SOURCE "  .size   ", $name, ", .-", $name, "\n";
98
 
99
        close(SOURCE);
100
}
101
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.