Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 503 → Rev 504

/uspace/trunk/init/init.c
27,8 → 27,10
*/
 
#include <unistd.h>
#include <stdio.h>
 
int main(int argc, char *argv[])
{
puts("Hello world\n");
return 0;
}
/uspace/trunk/libc/_link.ld.in
1,5 → 1,5
OUTPUT_FORMAT(binary)
STARTUP(../libc/arch/ARCH/entry.o)
STARTUP(../libc/arch/ARCH/src/entry.o)
ENTRY(__entry)
 
SECTIONS {
/uspace/trunk/libc/include/unistd.h
File deleted
/uspace/trunk/libc/include/libc.h
29,10 → 29,18
#ifndef __LIBC__LIBC_H__
#define __LIBC__LIBC_H__
 
#include <types.h>
 
 
typedef enum {
SYS_CTL = 0,
SYS_IO = 1
} syscall_t;
 
 
extern void __main(void);
extern void __exit(void);
extern void __syscall(const unsigned int id, const unsigned int p1, const unsigned int p2, const unsigned int p3);
extern unsigned int __syscall(const syscall_t id, const sysarg_t p1, const sysarg_t p2, const sysarg_t p3);
 
 
#endif
/uspace/trunk/libc/include/stdio.h
0,0 → 1,38
/*
* Copyright (C) 2005 Martin Decky
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __LIBC__STDIO_H__
#define __LIBC__STDIO_H__
 
#include <types.h>
 
#define EOF -1
 
extern int puts(const char * str);
 
#endif
/uspace/trunk/libc/Makefile.toolchain
27,7 → 27,7
#
 
DEFS = -DARCH=$(ARCH)
CFLAGS = -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include
CFLAGS = -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include -I$(LIBC_PREFIX)/arch/$(ARCH)/include
LFLAGS = -M
AFLAGS =
 
/uspace/trunk/libc/generic/io.c
0,0 → 1,47
/*
* Copyright (C) 2005 Martin Decky
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#include <libc.h>
#include <unistd.h>
#include <stdio.h>
 
int puts(const char * str)
{
size_t count;
for (count = 0; str[count] != 0; count++);
if (write(1, (void * ) str, count) == count)
return 0;
else
return EOF;
}
 
ssize_t write(int fd, const void * buf, size_t count)
{
return __syscall(SYS_IO, (sysarg_t) fd, (sysarg_t) buf, (sysarg_t) count);
}
/uspace/trunk/libc/Makefile
30,10 → 30,6
#
 
LIBC_PREFIX = .
DEFS = -DARCH=$(ARCH)
CFLAGS = -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include
LFLAGS = -M
AFLAGS =
 
## Setup toolchain
#
44,11 → 40,12
#
 
GENERIC_SOURCES = \
generic/libc.c
generic/libc.c \
generic/io.c
 
ARCH_SOURCES = \
arch/$(ARCH)/entry.s \
arch/$(ARCH)/syscall.c
arch/$(ARCH)/src/entry.s \
arch/$(ARCH)/src/syscall.c
 
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
/uspace/trunk/libc/arch/mips32/syscall.c
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:special
## -1 +0,0 ##
-*
\ No newline at end of property
Index: trunk/libc/arch/mips32/entry.s
===================================================================
--- trunk/libc/arch/mips32/entry.s (revision 503)
+++ trunk/libc/arch/mips32/entry.s (nonexistent)
@@ -1 +0,0 @@
-link ../mips32el/entry.s
\ No newline at end of file
/trunk/libc/arch/mips32/entry.s
Property changes:
Deleted: svn:special
## -1 +0,0 ##
-*
\ No newline at end of property
Index: trunk/libc/arch/mips32/include
===================================================================
--- trunk/libc/arch/mips32/include (nonexistent)
+++ trunk/libc/arch/mips32/include (revision 504)
@@ -0,0 +1 @@
+link ../mips32el/include
\ No newline at end of file
/trunk/libc/arch/mips32/include
Property changes:
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/libc/arch/mips32/src
===================================================================
--- trunk/libc/arch/mips32/src (nonexistent)
+++ trunk/libc/arch/mips32/src (revision 504)
@@ -0,0 +1 @@
+link ../mips32el/src
\ No newline at end of file
/trunk/libc/arch/mips32/src
Property changes:
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/libc/arch/ia32/syscall.c
===================================================================
--- trunk/libc/arch/ia32/syscall.c (revision 503)
+++ trunk/libc/arch/ia32/syscall.c (nonexistent)
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <libc.h>
-
-void __syscall(const unsigned int id, const unsigned int p1, const unsigned int p2, const unsigned int p3)
-{
-
-}
Index: trunk/libc/arch/ia32/entry.s
===================================================================
--- trunk/libc/arch/ia32/entry.s (revision 503)
+++ trunk/libc/arch/ia32/entry.s (nonexistent)
@@ -1,43 +0,0 @@
-#
-# Copyright (C) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-.text
-
-.org 0
-
-.globl __entry
-
-## User-space task entry point
-#
-#
-__entry:
-
- call main
- call __exit
-
-.end __entry
Index: trunk/libc/arch/ia32/include/types.h
===================================================================
--- trunk/libc/arch/ia32/include/types.h (nonexistent)
+++ trunk/libc/arch/ia32/include/types.h (revision 504)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __LIBC__TYPES_H__
+#define __LIBC__TYPES_H__
+
+typedef unsigned int sysarg_t;
+typedef unsigned int size_t;
+typedef signed int ssize_t;
+
+#endif
Index: trunk/libc/arch/ia32/src/entry.s
===================================================================
--- trunk/libc/arch/ia32/src/entry.s (nonexistent)
+++ trunk/libc/arch/ia32/src/entry.s (revision 504)
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2005 Martin Decky
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.text
+
+.org 0
+
+.globl __entry
+
+## User-space task entry point
+#
+#
+__entry:
+
+ call main
+ call __exit
+
+.end __entry
Index: trunk/libc/arch/ia32/src/syscall.c
===================================================================
--- trunk/libc/arch/ia32/src/syscall.c (nonexistent)
+++ trunk/libc/arch/ia32/src/syscall.c (revision 504)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <libc.h>
+
+unsigned int __syscall(const syscall_t id, const unsigned int p1, const unsigned int p2, const unsigned int p3)
+{
+ unsigned int ret;
+
+ asm volatile (
+ "int $0x80\n"
+ : "=a" (ret)
+ : "a" (id),
+ "b" (p1),
+ "c" (p2),
+ "d" (p3)
+ );
+
+ return ret;
+}
Index: trunk/libc/arch/mips32el/syscall.c
===================================================================
--- trunk/libc/arch/mips32el/syscall.c (revision 503)
+++ trunk/libc/arch/mips32el/syscall.c (nonexistent)
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <libc.h>
-
-void __syscall(const unsigned int id, const unsigned int p1, const unsigned int p2, const unsigned int p3)
-{
- register unsigned int __mips_reg_a0 asm("$4") = p1;
- register unsigned int __mips_reg_a1 asm("$5") = p2;
- register unsigned int __mips_reg_a2 asm("$6") = p3;
- register unsigned int __mips_reg_a3 asm("$7") = id;
-
- asm volatile (
- "syscall\n"
- :
- : "r" (__mips_reg_a0),
- "r" (__mips_reg_a1),
- "r" (__mips_reg_a2),
- "r" (__mips_reg_a3)
- : "v0"
- );
-}
Index: trunk/libc/arch/mips32el/entry.s
===================================================================
--- trunk/libc/arch/mips32el/entry.s (revision 503)
+++ trunk/libc/arch/mips32el/entry.s (nonexistent)
@@ -1,46 +0,0 @@
-#
-# Copyright (C) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-.text
-
-.org 0
-
-.globl __entry
-
-## User-space task entry point
-#
-#
-__entry:
-
- jal main
- nop
-
- jal __exit
- nop
-
-.end __entry
Index: trunk/libc/arch/mips32el/include/types.h
===================================================================
--- trunk/libc/arch/mips32el/include/types.h (nonexistent)
+++ trunk/libc/arch/mips32el/include/types.h (revision 504)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __LIBC__TYPES_H__
+#define __LIBC__TYPES_H__
+
+typedef unsigned int sysarg_t;
+typedef unsigned int size_t;
+typedef signed int ssize_t;
+
+#endif
Index: trunk/libc/arch/mips32el/src/entry.s
===================================================================
--- trunk/libc/arch/mips32el/src/entry.s (nonexistent)
+++ trunk/libc/arch/mips32el/src/entry.s (revision 504)
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2005 Martin Decky
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.text
+
+.org 0
+
+.globl __entry
+
+## User-space task entry point
+#
+#
+__entry:
+
+ jal main
+ nop
+
+ jal __exit
+ nop
+
+.end __entry
Index: trunk/libc/arch/mips32el/src/syscall.c
===================================================================
--- trunk/libc/arch/mips32el/src/syscall.c (nonexistent)
+++ trunk/libc/arch/mips32el/src/syscall.c (revision 504)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <libc.h>
+
+unsigned int __syscall(const syscall_t id, const unsigned int p1, const unsigned int p2, const unsigned int p3)
+{
+ register unsigned int __mips_reg_a0 asm("$4") = p1;
+ register unsigned int __mips_reg_a1 asm("$5") = p2;
+ register unsigned int __mips_reg_a2 asm("$6") = p3;
+ register unsigned int __mips_reg_a3 asm("$7") = id;
+ register unsigned int __mips_reg_v0 asm("$2");
+
+ asm volatile (
+ "syscall\n"
+ : "=r" (__mips_reg_v0)
+ : "r" (__mips_reg_a0),
+ "r" (__mips_reg_a1),
+ "r" (__mips_reg_a2),
+ "r" (__mips_reg_a3)
+ );
+
+ return __mips_reg_v0;
+}