libposix-development Mailing List for libposix (Page 5)
Status: Pre-Alpha
Brought to you by:
hdante
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(16) |
Jun
(122) |
Jul
(49) |
Aug
(19) |
Sep
(6) |
Oct
(4) |
Nov
(1) |
Dec
|
---|
From: Henrique A. <hd...@gm...> - 2009-06-28 15:44:41
|
I'm approaching a complete printf implementation, and I've just updated a printf parser to the repository, which is already in an advanced state. It's able to parse non trivial strings, like "e %-2ld f %0#'133.45Lg g %+.hhX i\n". The actual output functions (output_unsigned, output_double, etc.) are still missing, so it doesn't print anything yet, but I'll start writing those soon. Also missing are dealing with "numbered arguments" (things like "%2$d %1$s %3$g", they allow out of order argument passing), which are harder and require a working malloc implementation. Please run the tests "printf_parser" and "printf_scanner" and check that they don't crash or give weird results. printf_scanner should return zero and printf_parser should have the following result at the moment: abcd e f g i I expect to finish this until the middle of the week, so that we have a nearly complete printf. -- Henrique Dante de Almeida hd...@gm... |
From: Henrique A. <hd...@gm...> - 2009-06-27 20:59:46
|
It didn't work again, but this time because I have changed CMakeLists.txt, so I just rewrote the patch and applied locally. I'll update it with my latest changes when my repository is in a sane state. Bye, 2009/6/27 Kirill A. Shutemov <ki...@sh...>: > Signed-off-by: Kirill A. Shutemov <ki...@sh...> > --- > ------------------------------------------------------------------------------ > _______________________________________________ > Libposix-development mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libposix-development > -- Henrique Dante de Almeida hd...@gm... |
From: Kirill A. S. <ki...@sh...> - 2009-06-27 17:11:12
|
Signed-off-by: Kirill A. Shutemov <ki...@sh...> --- CMakeLists.txt | 11 +- Makefile | 2 +- runtime/freebsd/i386/_start.S | 47 -- runtime/freebsd/x86_32/_start.S | 47 ++ runtime/linux/i686/_start.S | 47 -- runtime/linux/i686/architecture_init.c | 54 --- runtime/linux/x86_32/_start.S | 47 ++ runtime/linux/x86_32/architecture_init.c | 54 +++ system/freebsd/i386/system_calls.S | 39 -- system/freebsd/x86_32/system_calls.S | 39 ++ system/linux/i686/system_call_numbers.h | 732 ----------------------------- system/linux/i686/system_calls.S | 79 --- system/linux/x86_32/system_call_numbers.h | 732 +++++++++++++++++++++++++++++ system/linux/x86_32/system_calls.S | 79 +++ 14 files changed, 1007 insertions(+), 1002 deletions(-) delete mode 100644 runtime/freebsd/i386/_start.S create mode 100644 runtime/freebsd/x86_32/_start.S delete mode 100644 runtime/linux/i686/_start.S delete mode 100644 runtime/linux/i686/architecture_init.c create mode 100644 runtime/linux/x86_32/_start.S create mode 100644 runtime/linux/x86_32/architecture_init.c delete mode 100644 system/freebsd/i386/system_calls.S create mode 100644 system/freebsd/x86_32/system_calls.S delete mode 100644 system/linux/i686/system_call_numbers.h delete mode 100644 system/linux/i686/system_calls.S create mode 100644 system/linux/x86_32/system_call_numbers.h create mode 100644 system/linux/x86_32/system_calls.S diff --git a/CMakeLists.txt b/CMakeLists.txt index dfa65ec..179a579 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,16 +32,21 @@ set(LIBPOSIX_INCLUDE_DIRECTORY include CACHE STRING set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -nostdlib") set(BUILD_SHARED_LIBS true) string(TOLOWER ${CMAKE_SYSTEM_NAME} system_name) -string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} system_processor) + +if(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86") + set(arch "x86_32") +else(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86") + string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} arch) +endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86") set(libposix_root ${PROJECT_SOURCE_DIR}) set(mandatory_path ${libposix_root}/mandatory) set(optional_path ${libposix_root}/optional) set(os_path ${libposix_root}/system/${system_name}) -set(architecture_path ${os_path}/${system_processor}) +set(architecture_path ${os_path}/${arch}) set(runtime_path ${libposix_root}/runtime) set(runtime_os_path ${runtime_path}/${system_name}) -set(runtime_architecture_path ${runtime_os_path}/${system_processor}) +set(runtime_architecture_path ${runtime_os_path}/${arch}) set(mandatory_include_path ${mandatory_path}/include) set(runtime_file_name runtime${CMAKE_C_OUTPUT_EXTENSION}) # Wait for those to be populated to avoid error in installation diff --git a/Makefile b/Makefile index 3c0fb77..3f18e2b 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ RANLIB=ranlib AS=as OSNAME:=$(shell uname -s | tr A-Z a-z) -ARCH:=$(shell uname -m | sed 's/i[456]86/i686/') +ARCH:=$(shell uname -m | sed 's/i[0-9]86/x86_32/') OUTPUTDIR:=output-$(OSNAME)-$(ARCH) CFLAGS+=-Isystem/$(OSNAME) -Isystem/$(OSNAME)/$(ARCH) diff --git a/runtime/freebsd/i386/_start.S b/runtime/freebsd/i386/_start.S deleted file mode 100644 index 682f37c..0000000 --- a/runtime/freebsd/i386/_start.S +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (c) 2009, Henrique Dante de Almeida - 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 -.global _start -.type _start,@function - -_start: - /* This code generates a call to init(argc, argv, envp, auxv); */ - movl %esp, %ebp - subl $16, %esp - movl (%ebp), %eax - movl %eax, (%esp) - leal 4(%ebp), %ecx - movl %ecx, 4(%esp) - leal 8(%ebp,%eax,4), %ecx - movl %ecx, 8(%esp) -search_auxv: - movl (%ecx), %eax - addl $4, %ecx - testl %eax, %eax - jnz search_auxv - movl %ecx, 12(%esp) - call init@PLT - diff --git a/runtime/freebsd/x86_32/_start.S b/runtime/freebsd/x86_32/_start.S new file mode 100644 index 0000000..682f37c --- /dev/null +++ b/runtime/freebsd/x86_32/_start.S @@ -0,0 +1,47 @@ +/* + Copyright (c) 2009, Henrique Dante de Almeida + 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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 +.global _start +.type _start,@function + +_start: + /* This code generates a call to init(argc, argv, envp, auxv); */ + movl %esp, %ebp + subl $16, %esp + movl (%ebp), %eax + movl %eax, (%esp) + leal 4(%ebp), %ecx + movl %ecx, 4(%esp) + leal 8(%ebp,%eax,4), %ecx + movl %ecx, 8(%esp) +search_auxv: + movl (%ecx), %eax + addl $4, %ecx + testl %eax, %eax + jnz search_auxv + movl %ecx, 12(%esp) + call init@PLT + diff --git a/runtime/linux/i686/_start.S b/runtime/linux/i686/_start.S deleted file mode 100644 index 682f37c..0000000 --- a/runtime/linux/i686/_start.S +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (c) 2009, Henrique Dante de Almeida - 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 -.global _start -.type _start,@function - -_start: - /* This code generates a call to init(argc, argv, envp, auxv); */ - movl %esp, %ebp - subl $16, %esp - movl (%ebp), %eax - movl %eax, (%esp) - leal 4(%ebp), %ecx - movl %ecx, 4(%esp) - leal 8(%ebp,%eax,4), %ecx - movl %ecx, 8(%esp) -search_auxv: - movl (%ecx), %eax - addl $4, %ecx - testl %eax, %eax - jnz search_auxv - movl %ecx, 12(%esp) - call init@PLT - diff --git a/runtime/linux/i686/architecture_init.c b/runtime/linux/i686/architecture_init.c deleted file mode 100644 index f080dc4..0000000 --- a/runtime/linux/i686/architecture_init.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright (c) 2009, Henrique Dante de Almeida -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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 <stddef.h> -#include "runtime.h" - -void (*kernel_vsyscall)(); - -/* AT_SYSINFO entry has the vsyscall address */ -#define AT_SYSINFO 32 - -void set_kernel_vsyscall(const auxv_t *auxv) -{ - if (auxv != NULL) { - const auxv_t *auxv_walk; - for (auxv_walk = auxv; auxv_walk->a_type != 0; auxv_walk++) { - if (auxv_walk->a_type == AT_SYSINFO) { - kernel_vsyscall = auxv_walk->a_un.a_fcn; - return; - - } - } - // ERROR: AT_SYSINFO entry not found - } -} - -void architecture_init(int argc, const char **argv, const char **envp, - const auxv_t *auxv) -{ - set_kernel_vsyscall(auxv); -} diff --git a/runtime/linux/x86_32/_start.S b/runtime/linux/x86_32/_start.S new file mode 100644 index 0000000..682f37c --- /dev/null +++ b/runtime/linux/x86_32/_start.S @@ -0,0 +1,47 @@ +/* + Copyright (c) 2009, Henrique Dante de Almeida + 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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 +.global _start +.type _start,@function + +_start: + /* This code generates a call to init(argc, argv, envp, auxv); */ + movl %esp, %ebp + subl $16, %esp + movl (%ebp), %eax + movl %eax, (%esp) + leal 4(%ebp), %ecx + movl %ecx, 4(%esp) + leal 8(%ebp,%eax,4), %ecx + movl %ecx, 8(%esp) +search_auxv: + movl (%ecx), %eax + addl $4, %ecx + testl %eax, %eax + jnz search_auxv + movl %ecx, 12(%esp) + call init@PLT + diff --git a/runtime/linux/x86_32/architecture_init.c b/runtime/linux/x86_32/architecture_init.c new file mode 100644 index 0000000..f080dc4 --- /dev/null +++ b/runtime/linux/x86_32/architecture_init.c @@ -0,0 +1,54 @@ +/* +Copyright (c) 2009, Henrique Dante de Almeida +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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 <stddef.h> +#include "runtime.h" + +void (*kernel_vsyscall)(); + +/* AT_SYSINFO entry has the vsyscall address */ +#define AT_SYSINFO 32 + +void set_kernel_vsyscall(const auxv_t *auxv) +{ + if (auxv != NULL) { + const auxv_t *auxv_walk; + for (auxv_walk = auxv; auxv_walk->a_type != 0; auxv_walk++) { + if (auxv_walk->a_type == AT_SYSINFO) { + kernel_vsyscall = auxv_walk->a_un.a_fcn; + return; + + } + } + // ERROR: AT_SYSINFO entry not found + } +} + +void architecture_init(int argc, const char **argv, const char **envp, + const auxv_t *auxv) +{ + set_kernel_vsyscall(auxv); +} diff --git a/system/freebsd/i386/system_calls.S b/system/freebsd/i386/system_calls.S deleted file mode 100644 index e08f257..0000000 --- a/system/freebsd/i386/system_calls.S +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 2009, Henrique Dante de Almeida - 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''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 <copyright holder> 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. -*/ - -.global syscall -.type syscall,@function - -/* System calls in x86 are described in - http://www.int80h.org/bsdasm/#first-program -*/ - - -syscall: - addl $4, %esp - mov (%esp), %eax - int $0x80 - subl $4, %esp - ret - diff --git a/system/freebsd/x86_32/system_calls.S b/system/freebsd/x86_32/system_calls.S new file mode 100644 index 0000000..e08f257 --- /dev/null +++ b/system/freebsd/x86_32/system_calls.S @@ -0,0 +1,39 @@ +/* + Copyright (c) 2009, Henrique Dante de Almeida + 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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''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 <copyright holder> 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. +*/ + +.global syscall +.type syscall,@function + +/* System calls in x86 are described in + http://www.int80h.org/bsdasm/#first-program +*/ + + +syscall: + addl $4, %esp + mov (%esp), %eax + int $0x80 + subl $4, %esp + ret + diff --git a/system/linux/i686/system_call_numbers.h b/system/linux/i686/system_call_numbers.h deleted file mode 100644 index 04c78a5..0000000 --- a/system/linux/i686/system_call_numbers.h +++ /dev/null @@ -1,732 +0,0 @@ -/* - Copyright (c) 2009, Henrique Dante de Almeida - Copyright (c) 2009, njoly (NetBSD) - 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. - -*/ -/* $NetBSD: linux_syscall.h,v 1.83 2009/01/17 22:34:02 c Exp $ */ - -/* - * System call numbers. - * - * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.99 2009/01/17 22:28:52 njoly Exp - */ - -#ifndef _LINUX_SYS_SYSCALL_H_ -#define _LINUX_SYS_SYSCALL_H_ - -#define LINUX_SYS_MAXSYSARGS 8 - -/* syscall: "syscall" ret: "int" args: */ -#define LINUX_SYS_syscall 0 - -/* syscall: "exit" ret: "int" args: "int" */ -#define LINUX_SYS_exit 1 - -/* syscall: "fork" ret: "int" args: */ -#define LINUX_SYS_fork 2 - -/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */ -#define LINUX_SYS_read 3 - -/* syscall: "write" ret: "int" args: "int" "char *" "u_int" */ -#define LINUX_SYS_write 4 - -/* syscall: "open" ret: "int" args: "const char *" "int" "int" */ -#define LINUX_SYS_open 5 - -/* syscall: "close" ret: "int" args: "int" */ -#define LINUX_SYS_close 6 - -/* syscall: "waitpid" ret: "int" args: "int" "int *" "int" */ -#define LINUX_SYS_waitpid 7 - -/* syscall: "creat" ret: "int" args: "const char *" "int" */ -#define LINUX_SYS_creat 8 - -/* syscall: "link" ret: "int" args: "const char *" "const char *" */ -#define LINUX_SYS_link 9 - -/* syscall: "unlink" ret: "int" args: "const char *" */ -#define LINUX_SYS_unlink 10 - -/* syscall: "execve" ret: "int" args: "const char *" "char **" "char **" */ -#define LINUX_SYS_execve 11 - -/* syscall: "chdir" ret: "int" args: "const char *" */ -#define LINUX_SYS_chdir 12 - -/* syscall: "time" ret: "int" args: "linux_time_t *" */ -#define LINUX_SYS_time 13 - -/* syscall: "mknod" ret: "int" args: "const char *" "int" "int" */ -#define LINUX_SYS_mknod 14 - -/* syscall: "chmod" ret: "int" args: "const char *" "int" */ -#define LINUX_SYS_chmod 15 - -/* syscall: "lchown16" ret: "int" args: "const char *" "linux_uid16_t" "linux_gid16_t" */ -#define LINUX_SYS_lchown16 16 - -/* syscall: "break" ret: "int" args: "char *" */ -#define LINUX_SYS_break 17 - - /* 18 is obsolete ostat */ -/* syscall: "lseek" ret: "long" args: "int" "long" "int" */ -#define LINUX_SYS_lseek 19 - -#ifdef LINUX_NPTL -/* syscall: "getpid" ret: "pid_t" args: */ -#define LINUX_SYS_getpid 20 - -#else -/* syscall: "getpid" ret: "pid_t" args: */ -#define LINUX_SYS_getpid 20 - -#endif -/* syscall: "linux_setuid16" ret: "int" args: "uid_t" */ -#define LINUX_SYS_linux_setuid16 23 - -/* syscall: "linux_getuid16" ret: "uid_t" args: */ -#define LINUX_SYS_linux_getuid16 24 - -/* syscall: "stime" ret: "int" args: "linux_time_t *" */ -#define LINUX_SYS_stime 25 - -/* syscall: "ptrace" ret: "int" args: "int" "int" "int" "int" */ -#define LINUX_SYS_ptrace 26 - -/* syscall: "alarm" ret: "int" args: "unsigned int" */ -#define LINUX_SYS_alarm 27 - - /* 28 is obsolete ofstat */ -/* syscall: "pause" ret: "int" args: */ -#define LINUX_SYS_pause 29 - -/* syscall: "utime" ret: "int" args: "const char *" "struct linux_utimbuf *" */ -#define LINUX_SYS_utime 30 - - /* 31 is obsolete stty */ - /* 32 is obsolete gtty */ -/* syscall: "access" ret: "int" args: "const char *" "int" */ -#define LINUX_SYS_access 33 - -/* syscall: "nice" ret: "int" args: "int" */ -#define LINUX_SYS_nice 34 - - /* 35 is obsolete ftime */ -/* syscall: "sync" ret: "int" args: */ -#define LINUX_SYS_sync 36 - -/* syscall: "kill" ret: "int" args: "int" "int" */ -#define LINUX_SYS_kill 37 - -/* syscall: "__posix_rename" ret: "int" args: "const char *" "const char *" */ -#define LINUX_SYS___posix_rename 38 - -/* syscall: "mkdir" ret: "int" args: "const char *" "int" */ -#define LINUX_SYS_mkdir 39 - -/* syscall: "rmdir" ret: "int" args: "const char *" */ -#define LINUX_SYS_rmdir 40 - -/* syscall: "dup" ret: "int" args: "u_int" */ -#define LINUX_SYS_dup 41 - -/* syscall: "pipe" ret: "int" args: "int *" */ -#define LINUX_SYS_pipe 42 - -/* syscall: "times" ret: "int" args: "struct times *" */ -#define LINUX_SYS_times 43 - - /* 44 is obsolete prof */ -/* syscall: "brk" ret: "int" args: "char *" */ -#define LINUX_SYS_brk 45 - -/* syscall: "linux_setgid16" ret: "int" args: "gid_t" */ -#define LINUX_SYS_linux_setgid16 46 - -/* syscall: "linux_getgid16" ret: "gid_t" args: */ -#define LINUX_SYS_linux_getgid16 47 - -/* syscall: "signal" ret: "int" args: "int" "linux_handler_t" */ -#define LINUX_SYS_signal 48 - -/* syscall: "linux_geteuid16" ret: "uid_t" args: */ -#define LINUX_SYS_linux_geteuid16 49 - -/* syscall: "linux_getegid16" ret: "gid_t" args: */ -#define LINUX_SYS_linux_getegid16 50 - -/* syscall: "acct" ret: "int" args: "char *" */ -#define LINUX_SYS_acct 51 - - /* 52 is obsolete phys */ - /* 53 is obsolete lock */ -/* syscall: "ioctl" ret: "int" args: "int" "u_long" "void *" */ -#define LINUX_SYS_ioctl 54 - -/* syscall: "fcntl" ret: "int" args: "int" "int" "void *" */ -#define LINUX_SYS_fcntl 55 - - /* 56 is obsolete mpx */ -/* syscall: "setpgid" ret: "int" args: "int" "int" */ -#define LINUX_SYS_setpgid 57 - - /* 58 is obsolete ulimit */ -/* syscall: "oldolduname" ret: "int" args: "struct linux_oldold_utsname *" */ -#define LINUX_SYS_oldolduname 59 - -/* syscall: "umask" ret: "int" args: "int" */ -#define LINUX_SYS_umask 60 - -/* syscall: "chroot" ret: "int" args: "char *" */ -#define LINUX_SYS_chroot 61 - -/* syscall: "dup2" ret: "int" args: "u_int" "u_int" */ -#define LINUX_SYS_dup2 63 - -#ifdef LINUX_NPTL -/* syscall: "getppid" ret: "pid_t" args: */ -#define LINUX_SYS_getppid 64 - -#else -/* syscall: "getppid" ret: "pid_t" args: */ -#define LINUX_SYS_getppid 64 - -#endif -/* syscall: "getpgrp" ret: "int" args: */ -#define LINUX_SYS_getpgrp 65 - -/* syscall: "setsid" ret: "int" args: */ -#define LINUX_SYS_setsid 66 - -/* syscall: "sigaction" ret: "int" args: "int" "const struct linux_old_sigaction *" "struct linux_old_sigaction *" */ -#define LINUX_SYS_sigaction 67 - -/* syscall: "siggetmask" ret: "int" args: */ -#define LINUX_SYS_siggetmask 68 - -/* syscall: "sigsetmask" ret: "int" args: "linux_old_sigset_t" */ -#define LINUX_SYS_sigsetmask 69 - -/* syscall: "setreuid16" ret: "int" args: "linux_uid16_t" "linux_uid16_t" */ -#define LINUX_SYS_setreuid16 70 - -/* syscall: "setregid16" ret: "int" args: "linux_gid16_t" "linux_gid16_t" */ -#define LINUX_SYS_setregid16 71 - -/* syscall: "sigsuspend" ret: "int" args: "void *" "int" "int" */ -#define LINUX_SYS_sigsuspend 72 - -/* syscall: "sigpending" ret: "int" args: "linux_old_sigset_t *" */ -#define LINUX_SYS_sigpending 73 - -/* syscall: "sethostname" ret: "int" args: "char *" "u_int" */ -#define LINUX_SYS_sethostname 74 - -/* syscall: "setrlimit" ret: "int" args: "u_int" "struct orlimit *" */ -#define LINUX_SYS_setrlimit 75 - -/* syscall: "getrlimit" ret: "int" args: "u_int" "struct orlimit *" */ -#define LINUX_SYS_getrlimit 76 - -/* syscall: "getrusage" ret: "int" args: "int" "struct rusage50 *" */ -#define LINUX_SYS_getrusage 77 - -/* syscall: "gettimeofday" ret: "int" args: "struct timeval50 *" "struct timezone *" */ -#define LINUX_SYS_gettimeofday 78 - -/* syscall: "settimeofday" ret: "int" args: "struct timeval50 *" "struct timezone *" */ -#define LINUX_SYS_settimeofday 79 - -/* syscall: "getgroups16" ret: "int" args: "int" "linux_gid16_t *" */ -#define LINUX_SYS_getgroups16 80 - -/* syscall: "setgroups16" ret: "int" args: "int" "linux_gid16_t *" */ -#define LINUX_SYS_setgroups16 81 - -/* syscall: "oldselect" ret: "int" args: "struct linux_oldselect *" */ -#define LINUX_SYS_oldselect 82 - -/* syscall: "symlink" ret: "int" args: "const char *" "const char *" */ -#define LINUX_SYS_symlink 83 - -/* syscall: "oolstat" ret: "int" args: "const char *" "struct stat43 *" */ -#define LINUX_SYS_oolstat 84 - -/* syscall: "readlink" ret: "int" args: "const char *" "char *" "int" */ -#define LINUX_SYS_readlink 85 - -#ifdef EXEC_AOUT -/* syscall: "uselib" ret: "int" args: "const char *" */ -#define LINUX_SYS_uselib 86 - -#else -#endif -/* syscall: "swapon" ret: "int" args: "char *" */ -#define LINUX_SYS_swapon 87 - -/* syscall: "reboot" ret: "int" args: "int" "int" "int" "void *" */ -#define LINUX_SYS_reboot 88 - -/* syscall: "readdir" ret: "int" args: "int" "void *" "unsigned int" */ -#define LINUX_SYS_readdir 89 - -/* syscall: "old_mmap" ret: "int" args: "struct linux_oldmmap *" */ -#define LINUX_SYS_old_mmap 90 - -/* syscall: "munmap" ret: "int" args: "void *" "int" */ -#define LINUX_SYS_munmap 91 - -/* syscall: "truncate" ret: "int" args: "const char *" "long" */ -#define LINUX_SYS_truncate 92 - -/* syscall: "ftruncate" ret: "int" args: "int" "long" */ -#define LINUX_SYS_ftruncate 93 - -/* syscall: "fchmod" ret: "int" args: "int" "int" */ -#define LINUX_SYS_fchmod 94 - -/* syscall: "fchown16" ret: "int" args: "int" "linux_uid16_t" "linux_gid16_t" */ -#define LINUX_SYS_fchown16 95 - -/* syscall: "getpriority" ret: "int" args: "int" "int" */ -#define LINUX_SYS_getpriority 96 - -/* syscall: "setpriority" ret: "int" args: "int" "int" "int" */ -#define LINUX_SYS_setpriority 97 - -/* syscall: "profil" ret: "int" args: "void *" "u_int" "u_int" "u_int" */ -#define LINUX_SYS_profil 98 - -/* syscall: "statfs" ret: "int" args: "const char *" "struct linux_statfs *" */ -#define LINUX_SYS_statfs 99 - -/* syscall: "fstatfs" ret: "int" args: "int" "struct linux_statfs *" */ -#define LINUX_SYS_fstatfs 100 - -/* syscall: "ioperm" ret: "int" args: "unsigned int" "unsigned int" "int" */ -#define LINUX_SYS_ioperm 101 - -/* syscall: "socketcall" ret: "int" args: "int" "void *" */ -#define LINUX_SYS_socketcall 102 - -/* syscall: "setitimer" ret: "int" args: "u_int" "struct itimerval50 *" "struct itimerval50 *" */ -#define LINUX_SYS_setitimer 104 - -/* syscall: "getitimer" ret: "int" args: "u_int" "struct itimerval50 *" */ -#define LINUX_SYS_getitimer 105 - -/* syscall: "stat" ret: "int" args: "const char *" "struct linux_stat *" */ -#define LINUX_SYS_stat 106 - -/* syscall: "lstat" ret: "int" args: "const char *" "struct linux_stat *" */ -#define LINUX_SYS_lstat 107 - -/* syscall: "fstat" ret: "int" args: "int" "struct linux_stat *" */ -#define LINUX_SYS_fstat 108 - -/* syscall: "olduname" ret: "int" args: "struct linux_old_utsname *" */ -#define LINUX_SYS_olduname 109 - -/* syscall: "iopl" ret: "int" args: "int" */ -#define LINUX_SYS_iopl 110 - -/* syscall: "wait4" ret: "int" args: "int" "int *" "int" "struct rusage50 *" */ -#define LINUX_SYS_wait4 114 - -/* syscall: "swapoff" ret: "int" args: "const char *" */ -#define LINUX_SYS_swapoff 115 - -/* syscall: "sysinfo" ret: "int" args: "struct linux_sysinfo *" */ -#define LINUX_SYS_sysinfo 116 - -/* syscall: "ipc" ret: "int" args: "int" "int" "int" "int" "void *" */ -#define LINUX_SYS_ipc 117 - -/* syscall: "fsync" ret: "int" args: "int" */ -#define LINUX_SYS_fsync 118 - -/* syscall: "sigreturn" ret: "int" args: "struct linux_sigcontext *" */ -#define LINUX_SYS_sigreturn 119 - -/* syscall: "clone" ret: "int" args: "int" "void *" "void *" "void *" */ -#define LINUX_SYS_clone 120 - -/* syscall: "setdomainname" ret: "int" args: "char *" "int" */ -#define LINUX_SYS_setdomainname 121 - -/* syscall: "uname" ret: "int" args: "struct linux_utsname *" */ -#define LINUX_SYS_uname 122 - -/* syscall: "modify_ldt" ret: "int" args: "int" "void *" "size_t" */ -#define LINUX_SYS_modify_ldt 123 - -/* syscall: "mprotect" ret: "int" args: "const void *" "unsigned long" "int" */ -#define LINUX_SYS_mprotect 125 - -/* syscall: "sigprocmask" ret: "int" args: "int" "const linux_old_sigset_t *" "linux_old_sigset_t *" */ -#define LINUX_SYS_sigprocmask 126 - -/* syscall: "getpgid" ret: "pid_t" args: "pid_t" */ -#define LINUX_SYS_getpgid 132 - -/* syscall: "fchdir" ret: "int" args: "int" */ -#define LINUX_SYS_fchdir 133 - -/* syscall: "personality" ret: "int" args: "int" */ -#define LINUX_SYS_personality 136 - -/* syscall: "linux_setfsuid16" ret: "int" args: "uid_t" */ -#define LINUX_SYS_linux_setfsuid16 138 - -/* syscall: "linux_setfsgid16" ret: "int" args: "gid_t" */ -#define LINUX_SYS_linux_setfsgid16 139 - -/* syscall: "llseek" ret: "int" args: "int" "u_int32_t" "u_int32_t" "void *" "int" */ -#define LINUX_SYS_llseek 140 - -/* syscall: "getdents" ret: "int" args: "int" "struct linux_dirent *" "unsigned int" */ -#define LINUX_SYS_getdents 141 - -/* syscall: "select" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "struct timeval50 *" */ -#define LINUX_SYS_select 142 - -/* syscall: "flock" ret: "int" args: "int" "int" */ -#define LINUX_SYS_flock 143 - -/* syscall: "__msync13" ret: "int" args: "void *" "size_t" "int" */ -#define LINUX_SYS___msync13 144 - -/* syscall: "readv" ret: "int" args: "int" "struct iovec *" "u_int" */ -#define LINUX_SYS_readv 145 - -/* syscall: "writev" ret: "int" args: "int" "struct iovec *" "u_int" */ -#define LINUX_SYS_writev 146 - -/* syscall: "getsid" ret: "pid_t" args: "pid_t" */ -#define LINUX_SYS_getsid 147 - -/* syscall: "fdatasync" ret: "int" args: "int" */ -#define LINUX_SYS_fdatasync 148 - -/* syscall: "__sysctl" ret: "int" args: "struct linux___sysctl *" */ -#define LINUX_SYS___sysctl 149 - -/* syscall: "mlock" ret: "int" args: "void *" "size_t" */ -#define LINUX_SYS_mlock 150 - -/* syscall: "munlock" ret: "int" args: "void *" "size_t" */ -#define LINUX_SYS_munlock 151 - -/* syscall: "mlockall" ret: "int" args: "int" */ -#define LINUX_SYS_mlockall 152 - -/* syscall: "munlockall" ret: "int" args: */ -#define LINUX_SYS_munlockall 153 - -/* syscall: "sched_setparam" ret: "int" args: "pid_t" "const struct linux_sched_param *" */ -#define LINUX_SYS_sched_setparam 154 - -/* syscall: "sched_getparam" ret: "int" args: "pid_t" "struct linux_sched_param *" */ -#define LINUX_SYS_sched_getparam 155 - -/* syscall: "sched_setscheduler" ret: "int" args: "pid_t" "int" "const struct linux_sched_param *" */ -#define LINUX_SYS_sched_setscheduler 156 - -/* syscall: "sched_getscheduler" ret: "int" args: "pid_t" */ -#define LINUX_SYS_sched_getscheduler 157 - -/* syscall: "sched_yield" ret: "int" args: */ -#define LINUX_SYS_sched_yield 158 - -/* syscall: "sched_get_priority_max" ret: "int" args: "int" */ -#define LINUX_SYS_sched_get_priority_max 159 - -/* syscall: "sched_get_priority_min" ret: "int" args: "int" */ -#define LINUX_SYS_sched_get_priority_min 160 - -/* syscall: "nanosleep" ret: "int" args: "const struct linux_timespec *" "struct linux_timespec *" */ -#define LINUX_SYS_nanosleep 162 - -/* syscall: "mremap" ret: "void *" args: "void *" "size_t" "size_t" "u_long" */ -#define LINUX_SYS_mremap 163 - -/* syscall: "setresuid16" ret: "int" args: "linux_uid16_t" "linux_uid16_t" "linux_uid16_t" */ -#define LINUX_SYS_setresuid16 164 - -/* syscall: "getresuid16" ret: "int" args: "linux_uid16_t *" "linux_uid16_t *" "linux_uid16_t *" */ -#define LINUX_SYS_getresuid16 165 - -/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_int" "int" */ -#define LINUX_SYS_poll 168 - -/* syscall: "setresgid16" ret: "int" args: "linux_gid16_t" "linux_gid16_t" "linux_gid16_t" */ -#define LINUX_SYS_setresgid16 170 - -/* syscall: "getresgid16" ret: "int" args: "linux_gid16_t *" "linux_gid16_t *" "linux_gid16_t *" */ -#define LINUX_SYS_getresgid16 171 - -/* syscall: "rt_sigreturn" ret: "int" args: "struct linux_ucontext *" */ -#define LINUX_SYS_rt_sigreturn 173 - -/* syscall: "rt_sigaction" ret: "int" args: "int" "const struct linux_sigaction *" "struct linux_sigaction *" "size_t" */ -#define LINUX_SYS_rt_sigaction 174 - -/* syscall: "rt_sigprocmask" ret: "int" args: "int" "const linux_sigset_t *" "linux_sigset_t *" "size_t" */ -#define LINUX_SYS_rt_sigprocmask 175 - -/* syscall: "rt_sigpending" ret: "int" args: "linux_sigset_t *" "size_t" */ -#define LINUX_SYS_rt_sigpending 176 - -/* syscall: "rt_queueinfo" ret: "int" args: "int" "int" "void *" */ -#define LINUX_SYS_rt_queueinfo 178 - -/* syscall: "rt_sigsuspend" ret: "int" args: "linux_sigset_t *" "size_t" */ -#define LINUX_SYS_rt_sigsuspend 179 - -/* syscall: "pread" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */ -#define LINUX_SYS_pread 180 - -/* syscall: "pwrite" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */ -#define LINUX_SYS_pwrite 181 - -/* syscall: "chown16" ret: "int" args: "const char *" "linux_uid16_t" "linux_gid16_t" */ -#define LINUX_SYS_chown16 182 - -/* syscall: "__getcwd" ret: "int" args: "char *" "size_t" */ -#define LINUX_SYS___getcwd 183 - -/* syscall: "sigaltstack" ret: "int" args: "const struct linux_sigaltstack *" "struct linux_sigaltstack *" */ -#define LINUX_SYS_sigaltstack 186 - -/* syscall: "__vfork14" ret: "int" args: */ -#define LINUX_SYS___vfork14 190 - -/* syscall: "ugetrlimit" ret: "int" args: "int" "struct orlimit *" */ -#define LINUX_SYS_ugetrlimit 191 - -#define linux_sys_mmap2_args linux_sys_mmap_args -/* syscall: "mmap2" ret: "linux_off_t" args: "unsigned long" "size_t" "int" "int" "int" "linux_off_t" */ -#define LINUX_SYS_mmap2 192 - -/* syscall: "truncate64" ret: "int" args: "const char *" "off_t" */ -#define LINUX_SYS_truncate64 193 - -/* syscall: "ftruncate64" ret: "int" args: "unsigned int" "off_t" */ -#define LINUX_SYS_ftruncate64 194 - -/* syscall: "stat64" ret: "int" args: "const char *" "struct linux_stat64 *" */ -#define LINUX_SYS_stat64 195 - -/* syscall: "lstat64" ret: "int" args: "const char *" "struct linux_stat64 *" */ -#define LINUX_SYS_lstat64 196 - -/* syscall: "fstat64" ret: "int" args: "int" "struct linux_stat64 *" */ -#define LINUX_SYS_fstat64 197 - -/* syscall: "__posix_lchown" ret: "int" args: "const char *" "uid_t" "gid_t" */ -#define LINUX_SYS___posix_lchown 198 - -/* syscall: "getuid" ret: "uid_t" args: */ -#define LINUX_SYS_getuid 199 - -/* syscall: "getgid" ret: "gid_t" args: */ -#define LINUX_SYS_getgid 200 - -/* syscall: "geteuid" ret: "uid_t" args: */ -#define LINUX_SYS_geteuid 201 - -/* syscall: "getegid" ret: "gid_t" args: */ -#define LINUX_SYS_getegid 202 - -/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */ -#define LINUX_SYS_setreuid 203 - -/* syscall: "setregid" ret: "int" args: "gid_t" "gid_t" */ -#define LINUX_SYS_setregid 204 - -/* syscall: "getgroups" ret: "int" args: "u_int" "gid_t *" */ -#define LINUX_SYS_getgroups 205 - -/* syscall: "setgroups" ret: "int" args: "u_int" "gid_t *" */ -#define LINUX_SYS_setgroups 206 - -/* syscall: "__posix_fchown" ret: "int" args: "int" "uid_t" "gid_t" */ -#define LINUX_SYS___posix_fchown 207 - -/* syscall: "setresuid" ret: "int" args: "uid_t" "uid_t" "uid_t" */ -#define LINUX_SYS_setresuid 208 - -/* syscall: "getresuid" ret: "int" args: "uid_t *" "uid_t *" "uid_t *" */ -#define LINUX_SYS_getresuid 209 - -/* syscall: "setresgid" ret: "int" args: "gid_t" "gid_t" "gid_t" */ -#define LINUX_SYS_setresgid 210 - -/* syscall: "getresgid" ret: "int" args: "gid_t *" "gid_t *" "gid_t *" */ -#define LINUX_SYS_getresgid 211 - -/* syscall: "__posix_chown" ret: "int" args: "const char *" "uid_t" "gid_t" */ -#define LINUX_SYS___posix_chown 212 - -/* syscall: "setuid" ret: "int" args: "uid_t" */ -#define LINUX_SYS_setuid 213 - -/* syscall: "setgid" ret: "int" args: "gid_t" */ -#define LINUX_SYS_setgid 214 - -/* syscall: "setfsuid" ret: "int" args: "uid_t" */ -#define LINUX_SYS_setfsuid 215 - -/* syscall: "setfsgid" ret: "int" args: "gid_t" */ -#define LINUX_SYS_setfsgid 216 - -/* syscall: "mincore" ret: "int" args: "void *" "size_t" "char *" */ -#define LINUX_SYS_mincore 218 - -/* syscall: "madvise" ret: "int" args: "void *" "size_t" "int" */ -#define LINUX_SYS_madvise 219 - -/* syscall: "getdents64" ret: "int" args: "int" "struct linux_dirent64 *" "unsigned int" */ -#define LINUX_SYS_getdents64 220 - -/* syscall: "fcntl64" ret: "int" args: "int" "int" "void *" */ -#define LINUX_SYS_fcntl64 221 - -#ifdef LINUX_NPTL -/* syscall: "gettid" ret: "pid_t" args: */ -#define LINUX_SYS_gettid 224 - -#else -#endif -/* syscall: "setxattr" ret: "int" args: "char *" "char *" "void *" "size_t" "int" */ -#define LINUX_SYS_setxattr 226 - -/* syscall: "lsetxattr" ret: "int" args: "char *" "char *" "void *" "size_t" "int" */ -#define LINUX_SYS_lsetxattr 227 - -/* syscall: "fsetxattr" ret: "int" args: "int" "char *" "void *" "size_t" "int" */ -#define LINUX_SYS_fsetxattr 228 - -/* syscall: "getxattr" ret: "ssize_t" args: "char *" "char *" "void *" "size_t" */ -#define LINUX_SYS_getxattr 229 - -/* syscall: "lgetxattr" ret: "ssize_t" args: "char *" "char *" "void *" "size_t" */ -#define LINUX_SYS_lgetxattr 230 - -/* syscall: "fgetxattr" ret: "ssize_t" args: "int" "char *" "void *" "size_t" */ -#define LINUX_SYS_fgetxattr 231 - -/* syscall: "listxattr" ret: "ssize_t" args: "char *" "char *" "size_t" */ -#define LINUX_SYS_listxattr 232 - -/* syscall: "llistxattr" ret: "ssize_t" args: "char *" "char *" "size_t" */ -#define LINUX_SYS_llistxattr 233 - -/* syscall: "flistxattr" ret: "ssize_t" args: "int" "char *" "size_t" */ -#define LINUX_SYS_flistxattr 234 - -/* syscall: "removexattr" ret: "int" args: "char *" "char *" */ -#define LINUX_SYS_removexattr 235 - -/* syscall: "lremovexattr" ret: "int" args: "char *" "char *" */ -#define LINUX_SYS_lremovexattr 236 - -/* syscall: "fremovexattr" ret: "int" args: "int" "char *" */ -#define LINUX_SYS_fremovexattr 237 - -#ifdef LINUX_NPTL -/* syscall: "tkill" ret: "int" args: "int" "int" */ -#define LINUX_SYS_tkill 238 - -#else -#endif -/* syscall: "futex" ret: "int" args: "int *" "int" "int" "const struct linux_timespec *" "int *" "int" */ -#define LINUX_SYS_futex 240 - -#ifdef LINUX_NPTL -/* syscall: "sched_setaffinity" ret: "int" args: "pid_t" "unsigned int" "unsigned long *" */ -#define LINUX_SYS_sched_setaffinity 241 - -/* syscall: "sched_getaffinity" ret: "int" args: "pid_t" "unsigned int" "unsigned long *" */ -#define LINUX_SYS_sched_getaffinity 242 - -#else -#endif -#ifdef LINUX_NPTL -/* syscall: "set_thread_area" ret: "int" args: "struct linux_user_desc *" */ -#define LINUX_SYS_set_thread_area 243 - -/* syscall: "get_thread_area" ret: "int" args: "struct linux_user_desc *" */ -#define LINUX_SYS_get_thread_area 244 - -#else -#endif -/* syscall: "exit_group" ret: "int" args: "int" */ -#define LINUX_SYS_exit_group 252 - -#ifdef LINUX_NPTL -/* syscall: "set_tid_address" ret: "int" args: "int *" */ -#define LINUX_SYS_set_tid_address 258 - -#else -#endif -/* syscall: "clock_settime" ret: "int" args: "clockid_t" "struct linux_timespec *" */ -#define LINUX_SYS_clock_settime 264 - -/* syscall: "clock_gettime" ret: "int" args: "clockid_t" "struct linux_timespec *" */ -#define LINUX_SYS_clock_gettime 265 - -/* syscall: "clock_getres" ret: "int" args: "clockid_t" "struct linux_timespec *" */ -#define LINUX_SYS_clock_getres 266 - -/* syscall: "clock_nanosleep" ret: "int" args: "clockid_t" "int" "struct linux_timespec *" "struct linux_timespec *" */ -#define LINUX_SYS_clock_nanosleep 267 - -/* syscall: "statfs64" ret: "int" args: "const char *" "size_t" "struct linux_statfs64 *" */ -#define LINUX_SYS_statfs64 268 - -/* syscall: "fstatfs64" ret: "int" args: "int" "size_t" "struct linux_statfs64 *" */ -#define LINUX_SYS_fstatfs64 269 - -#ifdef LINUX_NPTL -/* syscall: "tgkill" ret: "int" args: "int" "int" "int" */ -#define LINUX_SYS_tgkill 270 - -#else -#endif - /* 285 is obsolete / * XXXJDM really? * / */ -/* syscall: "set_robust_list" ret: "int" args: "struct linux_robust_list_head *" "size_t" */ -#define LINUX_SYS_set_robust_list 311 - -/* syscall: "get_robust_list" ret: "int" args: "int" "struct linux_robust_list_head **" "size_t *" */ -#define LINUX_SYS_get_robust_list 312 - -#define LINUX_SYS_MAXSYSCALL 317 -#define LINUX_SYS_NSYSENT 512 -#endif /* _LINUX_SYS_SYSCALL_H_ */ - diff --git a/system/linux/i686/system_calls.S b/system/linux/i686/system_calls.S deleted file mode 100644 index 8e1d6f9..0000000 --- a/system/linux/i686/system_calls.S +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (c) 2009, Henrique Dante de Almeida - 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. -*/ - -.global syscall1 -.type syscall1,@function -.global syscall3 -.type syscall3,@function - -/* System calls in x86 are informally described in blogs and mailing lists. - See, for example: - http://hdante.blogspot.com/2007/02/getting-vsyscall-address-from-elf.html - Calling conventions are described on the System V x86 ABI supplement. - Paramenter sequence is: %ebx, %ecx, %edx, %esi, %edi and %ebp - See, for example: - http://www.linuxjournal.com/article/4048 - - TODO: remove calculation for kernel_vsyscall (use a fixed address) -*/ - - -syscall1: - pushl %ebp - movl %esp, %ebp - pushl %ebx - call get_abs_address - addl $_GLOBAL_OFFSET_TABLE_, %ebx - movl kernel_vsyscall@GOT(%ebx), %ecx - movl 8(%ebp), %eax - movl 12(%ebp), %ebx - call *(%ecx) - popl %ebx - popl %ebp - ret - -syscall3: - pushl %ebp - movl %esp, %ebp - pushl %edi - pushl %ebx - call get_abs_address - addl $_GLOBAL_OFFSET_TABLE_, %ebx - movl kernel_vsyscall@GOT(%ebx), %edi - movl 8(%ebp), %eax - movl 12(%ebp), %ebx - movl 16(%ebp), %ecx - movl 20(%ebp), %edx - call *(%edi) - popl %ebx - popl %edi - popl %ebp - ret - -get_abs_address: - mov (%esp), %ebx - ret - diff --git a/system/linux/x86_32/system_call_numbers.h b/system/linux/x86_32/system_call_numbers.h new file mode 100644 index 0000000..04c78a5 --- /dev/null +++ b/system/linux/x86_32/system_call_numbers.h @@ -0,0 +1,732 @@ +/* + Copyright (c) 2009, Henrique Dante de Almeida + Copyright (c) 2009, njoly (NetBSD) + 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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. + +*/ +/* $NetBSD: linux_syscall.h,v 1.83 2009/01/17 22:34:02 c Exp $ */ + +/* + * System call numbers. + * + * DO NOT EDIT-- this file is automatically generated. + * created from NetBSD: syscalls.master,v 1.99 2009/01/17 22:28:52 njoly Exp + */ + +#ifndef _LINUX_SYS_SYSCALL_H_ +#define _LINUX_SYS_SYSCALL_H_ + +#define LINUX_SYS_MAXSYSARGS 8 + +/* syscall: "syscall" ret: "int" args: */ +#define LINUX_SYS_syscall 0 + +/* syscall: "exit" ret: "int" args: "int" */ +#define LINUX_SYS_exit 1 + +/* syscall: "fork" ret: "int" args: */ +#define LINUX_SYS_fork 2 + +/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */ +#define LINUX_SYS_read 3 + +/* syscall: "write" ret: "int" args: "int" "char *" "u_int" */ +#define LINUX_SYS_write 4 + +/* syscall: "open" ret: "int" args: "const char *" "int" "int" */ +#define LINUX_SYS_open 5 + +/* syscall: "close" ret: "int" args: "int" */ +#define LINUX_SYS_close 6 + +/* syscall: "waitpid" ret: "int" args: "int" "int *" "int" */ +#define LINUX_SYS_waitpid 7 + +/* syscall: "creat" ret: "int" args: "const char *" "int" */ +#define LINUX_SYS_creat 8 + +/* syscall: "link" ret: "int" args: "const char *" "const char *" */ +#define LINUX_SYS_link 9 + +/* syscall: "unlink" ret: "int" args: "const char *" */ +#define LINUX_SYS_unlink 10 + +/* syscall: "execve" ret: "int" args: "const char *" "char **" "char **" */ +#define LINUX_SYS_execve 11 + +/* syscall: "chdir" ret: "int" args: "const char *" */ +#define LINUX_SYS_chdir 12 + +/* syscall: "time" ret: "int" args: "linux_time_t *" */ +#define LINUX_SYS_time 13 + +/* syscall: "mknod" ret: "int" args: "const char *" "int" "int" */ +#define LINUX_SYS_mknod 14 + +/* syscall: "chmod" ret: "int" args: "const char *" "int" */ +#define LINUX_SYS_chmod 15 + +/* syscall: "lchown16" ret: "int" args: "const char *" "linux_uid16_t" "linux_gid16_t" */ +#define LINUX_SYS_lchown16 16 + +/* syscall: "break" ret: "int" args: "char *" */ +#define LINUX_SYS_break 17 + + /* 18 is obsolete ostat */ +/* syscall: "lseek" ret: "long" args: "int" "long" "int" */ +#define LINUX_SYS_lseek 19 + +#ifdef LINUX_NPTL +/* syscall: "getpid" ret: "pid_t" args: */ +#define LINUX_SYS_getpid 20 + +#else +/* syscall: "getpid" ret: "pid_t" args: */ +#define LINUX_SYS_getpid 20 + +#endif +/* syscall: "linux_setuid16" ret: "int" args: "uid_t" */ +#define LINUX_SYS_linux_setuid16 23 + +/* syscall: "linux_getuid16" ret: "uid_t" args: */ +#define LINUX_SYS_linux_getuid16 24 + +/* syscall: "stime" ret: "int" args: "linux_time_t *" */ +#define LINUX_SYS_stime 25 + +/* syscall: "ptrace" ret: "int" args: "int" "int" "int" "int" */ +#define LINUX_SYS_ptrace 26 + +/* syscall: "alarm" ret: "int" args: "unsigned int" */ +#define LINUX_SYS_alarm 27 + + /* 28 is obsolete ofstat */ +/* syscall: "pause" ret: "int" args: */ +#define LINUX_SYS_pause 29 + +/* syscall: "utime" ret: "int" args: "const char *" "struct linux_utimbuf *" */ +#define LINUX_SYS_utime 30 + + /* 31 is obsolete stty */ + /* 32 is obsolete gtty */ +/* syscall: "access" ret: "int" args: "const char *" "int" */ +#define LINUX_SYS_access 33 + +/* syscall: "nice" ret: "int" args: "int" */ +#define LINUX_SYS_nice 34 + + /* 35 is obsolete ftime */ +/* syscall: "sync" ret: "int" args: */ +#define LINUX_SYS_sync 36 + +/* syscall: "kill" ret: "int" args: "int" "int" */ +#define LINUX_SYS_kill 37 + +/* syscall: "__posix_rename" ret: "int" args: "const char *" "const char *" */ +#define LINUX_SYS___posix_rename 38 + +/* syscall: "mkdir" ret: "int" args: "const char *" "int" */ +#define LINUX_SYS_mkdir 39 + +/* syscall: "rmdir" ret: "int" args: "const char *" */ +#define LINUX_SYS_rmdir 40 + +/* syscall: "dup" ret: "int" args: "u_int" */ +#define LINUX_SYS_dup 41 + +/* syscall: "pipe" ret: "int" args: "int *" */ +#define LINUX_SYS_pipe 42 + +/* syscall: "times" ret: "int" args: "struct times *" */ +#define LINUX_SYS_times 43 + + /* 44 is obsolete prof */ +/* syscall: "brk" ret: "int" args: "char *" */ +#define LINUX_SYS_brk 45 + +/* syscall: "linux_setgid16" ret: "int" args: "gid_t" */ +#define LINUX_SYS_linux_setgid16 46 + +/* syscall: "linux_getgid16" ret: "gid_t" args: */ +#define LINUX_SYS_linux_getgid16 47 + +/* syscall: "signal" ret: "int" args: "int" "linux_handler_t" */ +#define LINUX_SYS_signal 48 + +/* syscall: "linux_geteuid16" ret: "uid_t" args: */ +#define LINUX_SYS_linux_geteuid16 49 + +/* syscall: "linux_getegid16" ret: "gid_t" args: */ +#define LINUX_SYS_linux_getegid16 50 + +/* syscall: "acct" ret: "int" args: "char *" */ +#define LINUX_SYS_acct 51 + + /* 52 is obsolete phys */ + /* 53 is obsolete lock */ +/* syscall: "ioctl" ret: "int" args: "int" "u_long" "void *" */ +#define LINUX_SYS_ioctl 54 + +/* syscall: "fcntl" ret: "int" args: "int" "int" "void *" */ +#define LINUX_SYS_fcntl 55 + + /* 56 is obsolete mpx */ +/* syscall: "setpgid" ret: "int" args: "int" "int" */ +#define LINUX_SYS_setpgid 57 + + /* 58 is obsolete ulimit */ +/* syscall: "oldolduname" ret: "int" args: "struct linux_oldold_utsname *" */ +#define LINUX_SYS_oldolduname 59 + +/* syscall: "umask" ret: "int" args: "int" */ +#define LINUX_SYS_umask 60 + +/* syscall: "chroot" ret: "int" args: "char *" */ +#define LINUX_SYS_chroot 61 + +/* syscall: "dup2" ret: "int" args: "u_int" "u_int" */ +#define LINUX_SYS_dup2 63 + +#ifdef LINUX_NPTL +/* syscall: "getppid" ret: "pid_t" args: */ +#define LINUX_SYS_getppid 64 + +#else +/* syscall: "getppid" ret: "pid_t" args: */ +#define LINUX_SYS_getppid 64 + +#endif +/* syscall: "getpgrp" ret: "int" args: */ +#define LINUX_SYS_getpgrp 65 + +/* syscall: "setsid" ret: "int" args: */ +#define LINUX_SYS_setsid 66 + +/* syscall: "sigaction" ret: "int" args: "int" "const struct linux_old_sigaction *" "struct linux_old_sigaction *" */ +#define LINUX_SYS_sigaction 67 + +/* syscall: "siggetmask" ret: "int" args: */ +#define LINUX_SYS_siggetmask 68 + +/* syscall: "sigsetmask" ret: "int" args: "linux_old_sigset_t" */ +#define LINUX_SYS_sigsetmask 69 + +/* syscall: "setreuid16" ret: "int" args: "linux_uid16_t" "linux_uid16_t" */ +#define LINUX_SYS_setreuid16 70 + +/* syscall: "setregid16" ret: "int" args: "linux_gid16_t" "linux_gid16_t" */ +#define LINUX_SYS_setregid16 71 + +/* syscall: "sigsuspend" ret: "int" args: "void *" "int" "int" */ +#define LINUX_SYS_sigsuspend 72 + +/* syscall: "sigpending" ret: "int" args: "linux_old_sigset_t *" */ +#define LINUX_SYS_sigpending 73 + +/* syscall: "sethostname" ret: "int" args: "char *" "u_int" */ +#define LINUX_SYS_sethostname 74 + +/* syscall: "setrlimit" ret: "int" args: "u_int" "struct orlimit *" */ +#define LINUX_SYS_setrlimit 75 + +/* syscall: "getrlimit" ret: "int" args: "u_int" "struct orlimit *" */ +#define LINUX_SYS_getrlimit 76 + +/* syscall: "getrusage" ret: "int" args: "int" "struct rusage50 *" */ +#define LINUX_SYS_getrusage 77 + +/* syscall: "gettimeofday" ret: "int" args: "struct timeval50 *" "struct timezone *" */ +#define LINUX_SYS_gettimeofday 78 + +/* syscall: "settimeofday" ret: "int" args: "struct timeval50 *" "struct timezone *" */ +#define LINUX_SYS_settimeofday 79 + +/* syscall: "getgroups16" ret: "int" args: "int" "linux_gid16_t *" */ +#define LINUX_SYS_getgroups16 80 + +/* syscall: "setgroups16" ret: "int" args: "int" "linux_gid16_t *" */ +#define LINUX_SYS_setgroups16 81 + +/* syscall: "oldselect" ret: "int" args: "struct linux_oldselect *" */ +#define LINUX_SYS_oldselect 82 + +/* syscall: "symlink" ret: "int" args: "const char *" "const char *" */ +#define LINUX_SYS_symlink 83 + +/* syscall: "oolstat" ret: "int" args: "const char *" "struct stat43 *" */ +#define LINUX_SYS_oolstat 84 + +/* syscall: "readlink" ret: "int" args: "const char *" "char *" "int" */ +#define LINUX_SYS_readlink 85 + +#ifdef EXEC_AOUT +/* syscall: "uselib" ret: "int" args: "const char *" */ +#define LINUX_SYS_uselib 86 + +#else +#endif +/* syscall: "swapon" ret: "int" args: "char *" */ +#define LINUX_SYS_swapon 87 + +/* syscall: "reboot" ret: "int" args: "int" "int" "int" "void *" */ +#define LINUX_SYS_reboot 88 + +/* syscall: "readdir" ret: "int" args: "int" "void *" "unsigned int" */ +#define LINUX_SYS_readdir 89 + +/* syscall: "old_mmap" ret: "int" args: "struct linux_oldmmap *" */ +#define LINUX_SYS_old_mmap 90 + +/* syscall: "munmap" ret: "int" args: "void *" "int" */ +#define LINUX_SYS_munmap 91 + +/* syscall: "truncate" ret: "int" args: "const char *" "long" */ +#define LINUX_SYS_truncate 92 + +/* syscall: "ftruncate" ret: "int" args: "int" "long" */ +#define LINUX_SYS_ftruncate 93 + +/* syscall: "fchmod" ret: "int" args: "int" "int" */ +#define LINUX_SYS_fchmod 94 + +/* syscall: "fchown16" ret: "int" args: "int" "linux_uid16_t" "linux_gid16_t" */ +#define LINUX_SYS_fchown16 95 + +/* syscall: "getpriority" ret: "int" args: "int" "int" */ +#define LINUX_SYS_getpriority 96 + +/* syscall: "setpriority" ret: "int" args: "int" "int" "int" */ +#define LINUX_SYS_setpriority 97 + +/* syscall: "profil" ret: "int" args: "void *" "u_int" "u_int" "u_int" */ +#define LINUX_SYS_profil 98 + +/* syscall: "statfs" ret: "int" args: "const char *" "struct linux_statfs *" */ +#define LINUX_SYS_statfs 99 + +/* syscall: "fstatfs" ret: "int" args: "int" "struct linux_statfs *" */ +#define LINUX_SYS_fstatfs 100 + +/* syscall: "ioperm" ret: "int" args: "unsigned int" "unsigned int" "int" */ +#define LINUX_SYS_ioperm 101 + +/* syscall: "socketcall" ret: "int" args: "int" "void *" */ +#define LINUX_SYS_socketcall 102 + +/* syscall: "setitimer" ret: "int" args: "u_int" "struct itimerval50 *" "struct itimerval50 *" */ +#define LINUX_SYS_setitimer 104 + +/* syscall: "getitimer" ret: "int" args: "u_int" "struct itimerval50 *" */ +#define LINUX_SYS_getitimer 105 + +/* syscall: "stat" ret: "int" args: "const char *" "struct linux_stat *" */ +#define LINUX_SYS_stat 106 + +/* syscall: "lstat" ret: "int" args: "const char *" "struct linux_stat *" */ +#define LINUX_SYS_lstat 107 + +/* syscall: "fstat" ret: "int" args: "int" "struct linux_stat *" */ +#define LINUX_SYS_fstat 108 + +/* syscall: "olduname" ret: "int" args: "struct linux_old_utsname *" */ +#define LINUX_SYS_olduname 109 + +/* syscall: "iopl" ret: "int" args: "int" */ +#define LINUX_SYS_iopl 110 + +/* syscall: "wait4" ret: "int" args: "int" "int *" "int" "struct rusage50 *" */ +#define LINUX_SYS_wait4 114 + +/* syscall: "swapoff" ret: "int" args: "const char *" */ +#define LINUX_SYS_swapoff 115 + +/* syscall: "sysinfo" ret: "int" args: "struct linux_sysinfo *" */ +#define LINUX_SYS_sysinfo 116 + +/* syscall: "ipc" ret: "int" args: "int" "int" "int" "int" "void *" */ +#define LINUX_SYS_ipc 117 + +/* syscall: "fsync" ret: "int" args: "int" */ +#define LINUX_SYS_fsync 118 + +/* syscall: "sigreturn" ret: "int" args: "struct linux_sigcontext *" */ +#define LINUX_SYS_sigreturn 119 + +/* syscall: "clone" ret: "int" args: "int" "void *" "void *" "void *" */ +#define LINUX_SYS_clone 120 + +/* syscall: "setdomainname" ret: "int" args: "char *" "int" */ +#define LINUX_SYS_setdomainname 121 + +/* syscall: "uname" ret: "int" args: "struct linux_utsname *" */ +#define LINUX_SYS_uname 122 + +/* syscall: "modify_ldt" ret: "int" args: "int" "void *" "size_t" */ +#define LINUX_SYS_modify_ldt 123 + +/* syscall: "mprotect" ret: "int" args: "const void *" "unsigned long" "int" */ +#define LINUX_SYS_mprotect 125 + +/* syscall: "sigprocmask" ret: "int" args: "int" "const linux_old_sigset_t *" "linux_old_sigset_t *" */ +#define LINUX_SYS_sigprocmask 126 + +/* syscall: "getpgid" ret: "pid_t" args: "pid_t" */ +#define LINUX_SYS_getpgid 132 + +/* syscall: "fchdir" ret: "int" args: "int" */ +#define LINUX_SYS_fchdir 133 + +/* syscall: "personality" ret: "int" args: "int" */ +#define LINUX_SYS_personality 136 + +/* syscall: "linux_setfsuid16" ret: "int" args: "uid_t" */ +#define LINUX_SYS_linux_setfsuid16 138 + +/* syscall: "linux_setfsgid16" ret: "int" args: "gid_t" */ +#define LINUX_SYS_linux_setfsgid16 139 + +/* syscall: "llseek" ret: "int" args: "int" "u_int32_t" "u_int32_t" "void *" "int" */ +#define LINUX_SYS_llseek 140 + +/* syscall: "getdents" ret: "int" args: "int" "struct linux_dirent *" "unsigned int" */ +#define LINUX_SYS_getdents 141 + +/* syscall: "select" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "struct timeval50 *" */ +#define LINUX_SYS_select ... [truncated message content] |
From: Henrique A. <hd...@gm...> - 2009-06-26 20:56:44
|
2009/6/26 Kirill A. Shutemov <ki...@sh...>: > On Fri, Jun 26, 2009 at 8:36 PM, Henrique Almeida<hd...@gm...> wrote: >> Can you check /proc/sys/vm/vdso_enabled ? > > I can't reproduce the problem on my home machine. I'll try it on Monday at work. > It looks like local misconfiguration. Ok. Can you send patch 1/2 again ? > > ------------------------------------------------------------------------------ > _______________________________________________ > Libposix-development mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libposix-development > -- Henrique Dante de Almeida hd...@gm... |
From: Kirill A. S. <ki...@sh...> - 2009-06-26 19:53:34
|
On Fri, Jun 26, 2009 at 8:36 PM, Henrique Almeida<hd...@gm...> wrote: > Can you check /proc/sys/vm/vdso_enabled ? I can't reproduce the problem on my home machine. I'll try it on Monday at work. It looks like local misconfiguration. |
From: Kirill A. S. <ki...@sh...> - 2009-06-26 17:37:54
|
On Fri, Jun 26, 2009 at 8:32 PM, Henrique Almeida<hd...@gm...> wrote: > Ok, is the config default from your distro ? Or can you turn the vdso on ? It seems only for compatibility with old glibc: config COMPAT_VDSO def_bool y prompt "Compat VDSO support" depends on X86_32 || IA32_EMULATION ---help--- Map the 32-bit VDSO to the predictable old-style address too. ---help--- Say N here if you are running a sufficiently recent glibc version (2.3.3 or later), to remove the high-mapped VDSO mapping and to exclusively use the randomized VDSO. If unsure, say Y. I don't this that it's right way. |
From: Henrique A. <hd...@gm...> - 2009-06-26 17:37:05
|
Can you check /proc/sys/vm/vdso_enabled ? 2009/6/26 Henrique Almeida <hd...@gm...>: > Wait, my CONFIG_COMPAT_VDSO is not set either. > > 2009/6/26 Henrique Almeida <hd...@gm...>: >> Ok, is the config default from your distro ? Or can you turn the vdso on ? >> >> 2009/6/26 Kirill A. Shutemov <ki...@sh...>: >>> On Fri, Jun 26, 2009 at 8:20 PM, Henrique Almeida<hd...@gm...> wrote: >>>> Thanks for the patch. However, do you need those for linux 2.4 ? >>> >>> No, I use 2.6.30. Config here: >>> >>> http://git.altlinux.org/people/lakostis/packages/?p=kernel-image-2.6.30.git;a=blob;f=config-i586;h=9635402ce20ee00645daeb3ffd1f236fde01e5cd;hb=fc05c2cdc66d7d64a62c5f07df43e25437a5902e >>> >>> I guess it because CONFIG_COMPAT_VDSO=n. >>> >>> ------------------------------------------------------------------------------ >>> _______________________________________________ >>> Libposix-development mailing list >>> Lib...@li... >>> https://lists.sourceforge.net/lists/listinfo/libposix-development >>> >> >> >> >> -- >> Henrique Dante de Almeida >> hd...@gm... >> > > > > -- > Henrique Dante de Almeida > hd...@gm... > -- Henrique Dante de Almeida hd...@gm... |
From: Henrique A. <hd...@gm...> - 2009-06-26 17:35:50
|
Wait, my CONFIG_COMPAT_VDSO is not set either. 2009/6/26 Henrique Almeida <hd...@gm...>: > Ok, is the config default from your distro ? Or can you turn the vdso on ? > > 2009/6/26 Kirill A. Shutemov <ki...@sh...>: >> On Fri, Jun 26, 2009 at 8:20 PM, Henrique Almeida<hd...@gm...> wrote: >>> Thanks for the patch. However, do you need those for linux 2.4 ? >> >> No, I use 2.6.30. Config here: >> >> http://git.altlinux.org/people/lakostis/packages/?p=kernel-image-2.6.30.git;a=blob;f=config-i586;h=9635402ce20ee00645daeb3ffd1f236fde01e5cd;hb=fc05c2cdc66d7d64a62c5f07df43e25437a5902e >> >> I guess it because CONFIG_COMPAT_VDSO=n. >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Libposix-development mailing list >> Lib...@li... >> https://lists.sourceforge.net/lists/listinfo/libposix-development >> > > > > -- > Henrique Dante de Almeida > hd...@gm... > -- Henrique Dante de Almeida hd...@gm... |
From: Henrique A. <hd...@gm...> - 2009-06-26 17:33:37
|
Ok, is the config default from your distro ? Or can you turn the vdso on ? 2009/6/26 Kirill A. Shutemov <ki...@sh...>: > On Fri, Jun 26, 2009 at 8:20 PM, Henrique Almeida<hd...@gm...> wrote: >> Thanks for the patch. However, do you need those for linux 2.4 ? > > No, I use 2.6.30. Config here: > > http://git.altlinux.org/people/lakostis/packages/?p=kernel-image-2.6.30.git;a=blob;f=config-i586;h=9635402ce20ee00645daeb3ffd1f236fde01e5cd;hb=fc05c2cdc66d7d64a62c5f07df43e25437a5902e > > I guess it because CONFIG_COMPAT_VDSO=n. > > ------------------------------------------------------------------------------ > _______________________________________________ > Libposix-development mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libposix-development > -- Henrique Dante de Almeida hd...@gm... |
From: Kirill A. S. <ki...@sh...> - 2009-06-26 17:30:07
|
On Fri, Jun 26, 2009 at 8:20 PM, Henrique Almeida<hd...@gm...> wrote: > Thanks for the patch. However, do you need those for linux 2.4 ? No, I use 2.6.30. Config here: http://git.altlinux.org/people/lakostis/packages/?p=kernel-image-2.6.30.git;a=blob;f=config-i586;h=9635402ce20ee00645daeb3ffd1f236fde01e5cd;hb=fc05c2cdc66d7d64a62c5f07df43e25437a5902e I guess it because CONFIG_COMPAT_VDSO=n. |
From: Henrique A. <hd...@gm...> - 2009-06-26 17:21:19
|
Thanks for the patch. However, do you need those for linux 2.4 ? If you do, that would be a variant from the default implementation. I'll explain variants when I define platform sets, but the point is that the amount of variants should be kept to a minimum possible. For linux 2.6, vsyscall can always be set and is considered to be the default way to do system calls (because it's faster in modern processors), so a second implementation would be redundant. Also, I wasn't considering supporting linux 2.4 in x86. If someone is willing to switch to libposix to use a newer standard, then probably the person is also willing to update to linux 2.6 ;-) So, if you DEFINITELY need x86 linux 2.4 support in libposix, please resend the patch as a variant: create a subdirectory called "linux24" in system/linux/x86_32 and runtime/linux/x86_32 and create a separate cmake file to support the variant by redefining the necessary support files. 2009/6/26 Kirill A. Shutemov <ki...@sh...>: > Not every kernel provide __kernel_vsyscall. It's possible to add > configuration option later. > > Signed-off-by: Kirill A. Shutemov <ki...@sh...> > --- > runtime/linux/x86_32/architecture_init.c | 22 +--------------------- > system/linux/x86_32/system_calls.S | 17 ++--------------- > 2 files changed, 3 insertions(+), 36 deletions(-) > > diff --git a/runtime/linux/x86_32/architecture_init.c > b/runtime/linux/x86_32/architecture_init.c > index f080dc4..f3fb6e6 100644 > --- a/runtime/linux/x86_32/architecture_init.c > +++ b/runtime/linux/x86_32/architecture_init.c > @@ -27,28 +27,8 @@ POSSIBILITY OF SUCH DAMAGE. > #include <stddef.h> > #include "runtime.h" > > -void (*kernel_vsyscall)(); > - > -/* AT_SYSINFO entry has the vsyscall address */ > -#define AT_SYSINFO 32 > - > -void set_kernel_vsyscall(const auxv_t *auxv) > -{ > - if (auxv != NULL) { > - const auxv_t *auxv_walk; > - for (auxv_walk = auxv; auxv_walk->a_type != 0; auxv_walk++) { > - if (auxv_walk->a_type == AT_SYSINFO) { > - kernel_vsyscall = auxv_walk->a_un.a_fcn; > - return; > - > - } > - } > - // ERROR: AT_SYSINFO entry not found > - } > -} > - > void architecture_init(int argc, const char **argv, const char **envp, > const auxv_t *auxv) > { > - set_kernel_vsyscall(auxv); > + /* Do nothing */ > } > diff --git a/system/linux/x86_32/system_calls.S > b/system/linux/x86_32/system_calls.S > index 8e1d6f9..f11f8ca 100644 > --- a/system/linux/x86_32/system_calls.S > +++ b/system/linux/x86_32/system_calls.S > @@ -36,8 +36,6 @@ POSSIBILITY OF SUCH DAMAGE. > Paramenter sequence is: %ebx, %ecx, %edx, %esi, %edi and %ebp > See, for example: > http://www.linuxjournal.com/article/4048 > - > - TODO: remove calculation for kernel_vsyscall (use a fixed address) > */ > > > @@ -45,12 +43,9 @@ syscall1: > pushl %ebp > movl %esp, %ebp > pushl %ebx > - call get_abs_address > - addl $_GLOBAL_OFFSET_TABLE_, %ebx > - movl kernel_vsyscall@GOT(%ebx), %ecx > movl 8(%ebp), %eax > movl 12(%ebp), %ebx > - call *(%ecx) > + int $0x80 > popl %ebx > popl %ebp > ret > @@ -60,20 +55,12 @@ syscall3: > movl %esp, %ebp > pushl %edi > pushl %ebx > - call get_abs_address > - addl $_GLOBAL_OFFSET_TABLE_, %ebx > - movl kernel_vsyscall@GOT(%ebx), %edi > movl 8(%ebp), %eax > movl 12(%ebp), %ebx > movl 16(%ebp), %ecx > movl 20(%ebp), %edx > - call *(%edi) > + int $0x80 > popl %ebx > popl %edi > popl %ebp > ret > - > -get_abs_address: > - mov (%esp), %ebx > - ret > - > -- > 1.6.3.3 > > ------------------------------------------------------------------------------ > _______________________________________________ > Libposix-development mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libposix-development > -- Henrique Dante de Almeida hd...@gm... |
From: Henrique A. <hd...@gm...> - 2009-06-26 16:54:27
|
Thanks for the patch. I'm trying to apply it, but it gives an error, I think there's a problem near the "lchown16" system call in the message you sent. Maybe an attachment will work ? Also, note that later I'll describe "platform sets" which will standardize the way we deal with specific target configurations (those will go into the "build" directory). 2009/6/26 Kirill A. Shutemov <ki...@sh...>: > Signed-off-by: Kirill A. Shutemov <ki...@sh...> > --- > CMakeLists.txt | 11 +- > Makefile | 2 +- > runtime/linux/i686/_start.S | 47 -- > runtime/linux/i686/architecture_init.c | 54 --- > runtime/linux/x86_32/_start.S | 47 ++ > runtime/linux/x86_32/architecture_init.c | 54 +++ > system/linux/i686/system_call_numbers.h | 732 ----------------------------- > system/linux/i686/system_calls.S | 79 --- > system/linux/x86_32/system_call_numbers.h | 732 +++++++++++++++++++++++++++++ > system/linux/x86_32/system_calls.S | 79 +++ > 10 files changed, 921 insertions(+), 916 deletions(-) > delete mode 100644 runtime/linux/i686/_start.S > delete mode 100644 runtime/linux/i686/architecture_init.c > create mode 100644 runtime/linux/x86_32/_start.S > create mode 100644 runtime/linux/x86_32/architecture_init.c > delete mode 100644 system/linux/i686/system_call_numbers.h > delete mode 100644 system/linux/i686/system_calls.S > create mode 100644 system/linux/x86_32/system_call_numbers.h > create mode 100644 system/linux/x86_32/system_calls.S > > diff --git a/CMakeLists.txt b/CMakeLists.txt > index dfa65ec..b5e1dca 100644 > --- a/CMakeLists.txt > +++ b/CMakeLists.txt > @@ -32,16 +32,21 @@ set(LIBPOSIX_INCLUDE_DIRECTORY include CACHE STRING > set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -nostdlib") > set(BUILD_SHARED_LIBS true) > string(TOLOWER ${CMAKE_SYSTEM_NAME} system_name) > -string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} system_processor) > + > +if(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86") > + set(arch "x86_32") > +else(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86") > + string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} arch) > +endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86") > > set(libposix_root ${PROJECT_SOURCE_DIR}) > set(mandatory_path ${libposix_root}/mandatory) > set(optional_path ${libposix_root}/optional) > set(os_path ${libposix_root}/system/${system_name}) > -set(architecture_path ${os_path}/${system_processor}) > +set(architecture_path ${os_path}/${arch}) > set(runtime_path ${libposix_root}/runtime) > set(runtime_os_path ${runtime_path}/${system_name}) > -set(runtime_architecture_path ${runtime_os_path}/${system_processor}) > +set(runtime_architecture_path ${runtime_os_path}/${arch}) > set(mandatory_include_path ${mandatory_path}/include) > set(runtime_file_name runtime${CMAKE_C_OUTPUT_EXTENSION}) > # Wait for those to be populated to avoid error in installation > diff --git a/Makefile b/Makefile > index 3c0fb77..3f18e2b 100644 > --- a/Makefile > +++ b/Makefile > @@ -6,7 +6,7 @@ RANLIB=ranlib > AS=as > > OSNAME:=$(shell uname -s | tr A-Z a-z) > -ARCH:=$(shell uname -m | sed 's/i[456]86/i686/') > +ARCH:=$(shell uname -m | sed 's/i[0-9]86/x86_32/') > OUTPUTDIR:=output-$(OSNAME)-$(ARCH) > > CFLAGS+=-Isystem/$(OSNAME) -Isystem/$(OSNAME)/$(ARCH) > diff --git a/runtime/linux/i686/_start.S b/runtime/linux/i686/_start.S > deleted file mode 100644 > index 682f37c..0000000 > --- a/runtime/linux/i686/_start.S > +++ /dev/null > @@ -1,47 +0,0 @@ > -/* > - Copyright (c) 2009, Henrique Dante de Almeida > - 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. > - > -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 > -.global _start > -.type _start,@function > - > -_start: > - /* This code generates a call to init(argc, argv, envp, auxv); */ > - movl %esp, %ebp > - subl $16, %esp > - movl (%ebp), %eax > - movl %eax, (%esp) > - leal 4(%ebp), %ecx > - movl %ecx, 4(%esp) > - leal 8(%ebp,%eax,4), %ecx > - movl %ecx, 8(%esp) > -search_auxv: > - movl (%ecx), %eax > - addl $4, %ecx > - testl %eax, %eax > - jnz search_auxv > - movl %ecx, 12(%esp) > - call init@PLT > - > diff --git a/runtime/linux/i686/architecture_init.c > b/runtime/linux/i686/architecture_init.c > deleted file mode 100644 > index f080dc4..0000000 > --- a/runtime/linux/i686/architecture_init.c > +++ /dev/null > @@ -1,54 +0,0 @@ > -/* > -Copyright (c) 2009, Henrique Dante de Almeida > -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. > - > -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 <stddef.h> > -#include "runtime.h" > - > -void (*kernel_vsyscall)(); > - > -/* AT_SYSINFO entry has the vsyscall address */ > -#define AT_SYSINFO 32 > - > -void set_kernel_vsyscall(const auxv_t *auxv) > -{ > - if (auxv != NULL) { > - const auxv_t *auxv_walk; > - for (auxv_walk = auxv; auxv_walk->a_type != 0; auxv_walk++) { > - if (auxv_walk->a_type == AT_SYSINFO) { > - kernel_vsyscall = auxv_walk->a_un.a_fcn; > - return; > - > - } > - } > - // ERROR: AT_SYSINFO entry not found > - } > -} > - > -void architecture_init(int argc, const char **argv, const char **envp, > - const auxv_t *auxv) > -{ > - set_kernel_vsyscall(auxv); > -} > diff --git a/runtime/linux/x86_32/_start.S b/runtime/linux/x86_32/_start.S > new file mode 100644 > index 0000000..682f37c > --- /dev/null > +++ b/runtime/linux/x86_32/_start.S > @@ -0,0 +1,47 @@ > +/* > + Copyright (c) 2009, Henrique Dante de Almeida > + 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. > + > +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 > +.global _start > +.type _start,@function > + > +_start: > + /* This code generates a call to init(argc, argv, envp, auxv); */ > + movl %esp, %ebp > + subl $16, %esp > + movl (%ebp), %eax > + movl %eax, (%esp) > + leal 4(%ebp), %ecx > + movl %ecx, 4(%esp) > + leal 8(%ebp,%eax,4), %ecx > + movl %ecx, 8(%esp) > +search_auxv: > + movl (%ecx), %eax > + addl $4, %ecx > + testl %eax, %eax > + jnz search_auxv > + movl %ecx, 12(%esp) > + call init@PLT > + > diff --git a/runtime/linux/x86_32/architecture_init.c > b/runtime/linux/x86_32/architecture_init.c > new file mode 100644 > index 0000000..f080dc4 > --- /dev/null > +++ b/runtime/linux/x86_32/architecture_init.c > @@ -0,0 +1,54 @@ > +/* > +Copyright (c) 2009, Henrique Dante de Almeida > +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. > + > +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 <stddef.h> > +#include "runtime.h" > + > +void (*kernel_vsyscall)(); > + > +/* AT_SYSINFO entry has the vsyscall address */ > +#define AT_SYSINFO 32 > + > +void set_kernel_vsyscall(const auxv_t *auxv) > +{ > + if (auxv != NULL) { > + const auxv_t *auxv_walk; > + for (auxv_walk = auxv; auxv_walk->a_type != 0; auxv_walk++) { > + if (auxv_walk->a_type == AT_SYSINFO) { > + kernel_vsyscall = auxv_walk->a_un.a_fcn; > + return; > + > + } > + } > + // ERROR: AT_SYSINFO entry not found > + } > +} > + > +void architecture_init(int argc, const char **argv, const char **envp, > + const auxv_t *auxv) > +{ > + set_kernel_vsyscall(auxv); > +} > diff --git a/system/linux/i686/system_call_numbers.h > b/system/linux/i686/system_call_numbers.h > deleted file mode 100644 > index 04c78a5..0000000 > --- a/system/linux/i686/system_call_numbers.h > +++ /dev/null > @@ -1,732 +0,0 @@ > -/* > - Copyright (c) 2009, Henrique Dante de Almeida > - Copyright (c) 2009, njoly (NetBSD) > - 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. > - > -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. > - > -*/ > -/* $NetBSD: linux_syscall.h,v 1.83 2009/01/17 22:34:02 c Exp $ */ > - > -/* > - * System call numbers. > - * > - * DO NOT EDIT-- this file is automatically generated. > - * created from NetBSD: syscalls.master,v 1.99 2009/01/17 22:28:52 njoly Exp > - */ > - > -#ifndef _LINUX_SYS_SYSCALL_H_ > -#define _LINUX_SYS_SYSCALL_H_ > - > -#define LINUX_SYS_MAXSYSARGS 8 > - > -/* syscall: "syscall" ret: "int" args: */ > -#define LINUX_SYS_syscall 0 > - > -/* syscall: "exit" ret: "int" args: "int" */ > -#define LINUX_SYS_exit 1 > - > -/* syscall: "fork" ret: "int" args: */ > -#define LINUX_SYS_fork 2 > - > -/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */ > -#define LINUX_SYS_read 3 > - > -/* syscall: "write" ret: "int" args: "int" "char *" "u_int" */ > -#define LINUX_SYS_write 4 > - > -/* syscall: "open" ret: "int" args: "const char *" "int" "int" */ > -#define LINUX_SYS_open 5 > - > -/* syscall: "close" ret: "int" args: "int" */ > -#define LINUX_SYS_close 6 > - > -/* syscall: "waitpid" ret: "int" args: "int" "int *" "int" */ > -#define LINUX_SYS_waitpid 7 > - > -/* syscall: "creat" ret: "int" args: "const char *" "int" */ > -#define LINUX_SYS_creat 8 > - > -/* syscall: "link" ret: "int" args: "const char *" "const char *" */ > -#define LINUX_SYS_link 9 > - > -/* syscall: "unlink" ret: "int" args: "const char *" */ > -#define LINUX_SYS_unlink 10 > - > -/* syscall: "execve" ret: "int" args: "const char *" "char **" "char **" */ > -#define LINUX_SYS_execve 11 > - > -/* syscall: "chdir" ret: "int" args: "const char *" */ > -#define LINUX_SYS_chdir 12 > - > -/* syscall: "time" ret: "int" args: "linux_time_t *" */ > -#define LINUX_SYS_time 13 > - > -/* syscall: "mknod" ret: "int" args: "const char *" "int" "int" */ > -#define LINUX_SYS_mknod 14 > - > -/* syscall: "chmod" ret: "int" args: "const char *" "int" */ > -#define LINUX_SYS_chmod 15 > - > -/* syscall: "lchown16" ret: "int" args: "const char *" > "linux_uid16_t" "linux_gid16_t" */ > -#define LINUX_SYS_lchown16 16 > - > -/* syscall: "break" ret: "int" args: "char *" */ > -#define LINUX_SYS_break 17 > - > - /* 18 is obsolete ostat */ > -/* syscall: "lseek" ret: "long" args: "int" "long" "int" */ > -#define LINUX_SYS_lseek 19 > - > -#ifdef LINUX_NPTL > -/* syscall: "getpid" ret: "pid_t" args: */ > -#define LINUX_SYS_getpid 20 > - > -#else > -/* syscall: "getpid" ret: "pid_t" args: */ > -#define LINUX_SYS_getpid 20 > - > -#endif > -/* syscall: "linux_setuid16" ret: "int" args: "uid_t" */ > -#define LINUX_SYS_linux_setuid16 23 > - > -/* syscall: "linux_getuid16" ret: "uid_t" args: */ > -#define LINUX_SYS_linux_getuid16 24 > - > -/* syscall: "stime" ret: "int" args: "linux_time_t *" */ > -#define LINUX_SYS_stime 25 > - > -/* syscall: "ptrace" ret: "int" args: "int" "int" "int" "int" */ > -#define LINUX_SYS_ptrace 26 > - > -/* syscall: "alarm" ret: "int" args: "unsigned int" */ > -#define LINUX_SYS_alarm 27 > - > - /* 28 is obsolete ofstat */ > -/* syscall: "pause" ret: "int" args: */ > -#define LINUX_SYS_pause 29 > - > -/* syscall: "utime" ret: "int" args: "const char *" "struct linux_utimbuf *" */ > -#define LINUX_SYS_utime 30 > - > - /* 31 is obsolete stty */ > - /* 32 is obsolete gtty */ > -/* syscall: "access" ret: "int" args: "const char *" "int" */ > -#define LINUX_SYS_access 33 > - > -/* syscall: "nice" ret: "int" args: "int" */ > -#define LINUX_SYS_nice 34 > - > - /* 35 is obsolete ftime */ > -/* syscall: "sync" ret: "int" args: */ > -#define LINUX_SYS_sync 36 > - > -/* syscall: "kill" ret: "int" args: "int" "int" */ > -#define LINUX_SYS_kill 37 > - > -/* syscall: "__posix_rename" ret: "int" args: "const char *" "const char *" */ > -#define LINUX_SYS___posix_rename 38 > - > -/* syscall: "mkdir" ret: "int" args: "const char *" "int" */ > -#define LINUX_SYS_mkdir 39 > - > -/* syscall: "rmdir" ret: "int" args: "const char *" */ > -#define LINUX_SYS_rmdir 40 > - > -/* syscall: "dup" ret: "int" args: "u_int" */ > -#define LINUX_SYS_dup 41 > - > -/* syscall: "pipe" ret: "int" args: "int *" */ > -#define LINUX_SYS_pipe 42 > - > -/* syscall: "times" ret: "int" args: "struct times *" */ > -#define LINUX_SYS_times 43 > - > - /* 44 is obsolete prof */ > -/* syscall: "brk" ret: "int" args: "char *" */ > -#define LINUX_SYS_brk 45 > - > -/* syscall: "linux_setgid16" ret: "int" args: "gid_t" */ > -#define LINUX_SYS_linux_setgid16 46 > - > -/* syscall: "linux_getgid16" ret: "gid_t" args: */ > -#define LINUX_SYS_linux_getgid16 47 > - > -/* syscall: "signal" ret: "int" args: "int" "linux_handler_t" */ > -#define LINUX_SYS_signal 48 > - > -/* syscall: "linux_geteuid16" ret: "uid_t" args: */ > -#define LINUX_SYS_linux_geteuid16 49 > - > -/* syscall: "linux_getegid16" ret: "gid_t" args: */ > -#define LINUX_SYS_linux_getegid16 50 > - > -/* syscall: "acct" ret: "int" args: "char *" */ > -#define LINUX_SYS_acct 51 > - > - /* 52 is obsolete phys */ > - /* 53 is obsolete lock */ > -/* syscall: "ioctl" ret: "int" args: "int" "u_long" "void *" */ > -#define LINUX_SYS_ioctl 54 > - > -/* syscall: "fcntl" ret: "int" args: "int" "int" "void *" */ > -#define LINUX_SYS_fcntl 55 > - > - /* 56 is obsolete mpx */ > -/* syscall: "setpgid" ret: "int" args: "int" "int" */ > -#define LINUX_SYS_setpgid 57 > - > - /* 58 is obsolete ulimit */ > -/* syscall: "oldolduname" ret: "int" args: "struct linux_oldold_utsname *" */ > -#define LINUX_SYS_oldolduname 59 > - > -/* syscall: "umask" ret: "int" args: "int" */ > -#define LINUX_SYS_umask 60 > - > -/* syscall: "chroot" ret: "int" args: "char *" */ > -#define LINUX_SYS_chroot 61 > - > -/* syscall: "dup2" ret: "int" args: "u_int" "u_int" */ > -#define LINUX_SYS_dup2 63 > - > -#ifdef LINUX_NPTL > -/* syscall: "getppid" ret: "pid_t" args: */ > -#define LINUX_SYS_getppid 64 > - > -#else > -/* syscall: "getppid" ret: "pid_t" args: */ > -#define LINUX_SYS_getppid 64 > - > -#endif > -/* syscall: "getpgrp" ret: "int" args: */ > -#define LINUX_SYS_getpgrp 65 > - > -/* syscall: "setsid" ret: "int" args: */ > -#define LINUX_SYS_setsid 66 > - > -/* syscall: "sigaction" ret: "int" args: "int" "const struct > linux_old_sigaction *" "struct linux_old_sigaction *" */ > -#define LINUX_SYS_sigaction 67 > - > -/* syscall: "siggetmask" ret: "int" args: */ > -#define LINUX_SYS_siggetmask 68 > - > -/* syscall: "sigsetmask" ret: "int" args: "linux_old_sigset_t" */ > -#define LINUX_SYS_sigsetmask 69 > - > -/* syscall: "setreuid16" ret: "int" args: "linux_uid16_t" "linux_uid16_t" */ > -#define LINUX_SYS_setreuid16 70 > - > -/* syscall: "setregid16" ret: "int" args: "linux_gid16_t" "linux_gid16_t" */ > -#define LINUX_SYS_setregid16 71 > - > -/* syscall: "sigsuspend" ret: "int" args: "void *" "int" "int" */ > -#define LINUX_SYS_sigsuspend 72 > - > -/* syscall: "sigpending" ret: "int" args: "linux_old_sigset_t *" */ > -#define LINUX_SYS_sigpending 73 > - > -/* syscall: "sethostname" ret: "int" args: "char *" "u_int" */ > -#define LINUX_SYS_sethostname 74 > - > -/* syscall: "setrlimit" ret: "int" args: "u_int" "struct orlimit *" */ > -#define LINUX_SYS_setrlimit 75 > - > -/* syscall: "getrlimit" ret: "int" args: "u_int" "struct orlimit *" */ > -#define LINUX_SYS_getrlimit 76 > - > -/* syscall: "getrusage" ret: "int" args: "int" "struct rusage50 *" */ > -#define LINUX_SYS_getrusage 77 > - > -/* syscall: "gettimeofday" ret: "int" args: "struct timeval50 *" > "struct timezone *" */ > -#define LINUX_SYS_gettimeofday 78 > - > -/* syscall: "settimeofday" ret: "int" args: "struct timeval50 *" > "struct timezone *" */ > -#define LINUX_SYS_settimeofday 79 > - > -/* syscall: "getgroups16" ret: "int" args: "int" "linux_gid16_t *" */ > -#define LINUX_SYS_getgroups16 80 > - > -/* syscall: "setgroups16" ret: "int" args: "int" "linux_gid16_t *" */ > -#define LINUX_SYS_setgroups16 81 > - > -/* syscall: "oldselect" ret: "int" args: "struct linux_oldselect *" */ > -#define LINUX_SYS_oldselect 82 > - > -/* syscall: "symlink" ret: "int" args: "const char *" "const char *" */ > -#define LINUX_SYS_symlink 83 > - > -/* syscall: "oolstat" ret: "int" args: "const char *" "struct stat43 *" */ > -#define LINUX_SYS_oolstat 84 > - > -/* syscall: "readlink" ret: "int" args: "const char *" "char *" "int" */ > -#define LINUX_SYS_readlink 85 > - > -#ifdef EXEC_AOUT > -/* syscall: "uselib" ret: "int" args: "const char *" */ > -#define LINUX_SYS_uselib 86 > - > -#else > -#endif > -/* syscall: "swapon" ret: "int" args: "char *" */ > -#define LINUX_SYS_swapon 87 > - > -/* syscall: "reboot" ret: "int" args: "int" "int" "int" "void *" */ > -#define LINUX_SYS_reboot 88 > - > -/* syscall: "readdir" ret: "int" args: "int" "void *" "unsigned int" */ > -#define LINUX_SYS_readdir 89 > - > -/* syscall: "old_mmap" ret: "int" args: "struct linux_oldmmap *" */ > -#define LINUX_SYS_old_mmap 90 > - > -/* syscall: "munmap" ret: "int" args: "void *" "int" */ > -#define LINUX_SYS_munmap 91 > - > -/* syscall: "truncate" ret: "int" args: "const char *" "long" */ > -#define LINUX_SYS_truncate 92 > - > -/* syscall: "ftruncate" ret: "int" args: "int" "long" */ > -#define LINUX_SYS_ftruncate 93 > - > -/* syscall: "fchmod" ret: "int" args: "int" "int" */ > -#define LINUX_SYS_fchmod 94 > - > -/* syscall: "fchown16" ret: "int" args: "int" "linux_uid16_t" > "linux_gid16_t" */ > -#define LINUX_SYS_fchown16 95 > - > -/* syscall: "getpriority" ret: "int" args: "int" "int" */ > -#define LINUX_SYS_getpriority 96 > - > -/* syscall: "setpriority" ret: "int" args: "int" "int" "int" */ > -#define LINUX_SYS_setpriority 97 > - > -/* syscall: "profil" ret: "int" args: "void *" "u_int" "u_int" "u_int" */ > -#define LINUX_SYS_profil 98 > - > -/* syscall: "statfs" ret: "int" args: "const char *" "struct linux_statfs *" */ > -#define LINUX_SYS_statfs 99 > - > -/* syscall: "fstatfs" ret: "int" args: "int" "struct linux_statfs *" */ > -#define LINUX_SYS_fstatfs 100 > - > -/* syscall: "ioperm" ret: "int" args: "unsigned int" "unsigned int" "int" */ > -#define LINUX_SYS_ioperm 101 > - > -/* syscall: "socketcall" ret: "int" args: "int" "void *" */ > -#define LINUX_SYS_socketcall 102 > - > -/* syscall: "setitimer" ret: "int" args: "u_int" "struct itimerval50 > *" "struct itimerval50 *" */ > -#define LINUX_SYS_setitimer 104 > - > -/* syscall: "getitimer" ret: "int" args: "u_int" "struct itimerval50 *" */ > -#define LINUX_SYS_getitimer 105 > - > -/* syscall: "stat" ret: "int" args: "const char *" "struct linux_stat *" */ > -#define LINUX_SYS_stat 106 > - > -/* syscall: "lstat" ret: "int" args: "const char *" "struct linux_stat *" */ > -#define LINUX_SYS_lstat 107 > - > -/* syscall: "fstat" ret: "int" args: "int" "struct linux_stat *" */ > -#define LINUX_SYS_fstat 108 > - > -/* syscall: "olduname" ret: "int" args: "struct linux_old_utsname *" */ > -#define LINUX_SYS_olduname 109 > - > -/* syscall: "iopl" ret: "int" args: "int" */ > -#define LINUX_SYS_iopl 110 > - > -/* syscall: "wait4" ret: "int" args: "int" "int *" "int" "struct rusage50 *" */ > -#define LINUX_SYS_wait4 114 > - > -/* syscall: "swapoff" ret: "int" args: "const char *" */ > -#define LINUX_SYS_swapoff 115 > - > -/* syscall: "sysinfo" ret: "int" args: "struct linux_sysinfo *" */ > -#define LINUX_SYS_sysinfo 116 > - > -/* syscall: "ipc" ret: "int" args: "int" "int" "int" "int" "void *" */ > -#define LINUX_SYS_ipc 117 > - > -/* syscall: "fsync" ret: "int" args: "int" */ > -#define LINUX_SYS_fsync 118 > - > -/* syscall: "sigreturn" ret: "int" args: "struct linux_sigcontext *" */ > -#define LINUX_SYS_sigreturn 119 > - > -/* syscall: "clone" ret: "int" args: "int" "void *" "void *" "void *" */ > -#define LINUX_SYS_clone 120 > - > -/* syscall: "setdomainname" ret: "int" args: "char *" "int" */ > -#define LINUX_SYS_setdomainname 121 > - > -/* syscall: "uname" ret: "int" args: "struct linux_utsname *" */ > -#define LINUX_SYS_uname 122 > - > -/* syscall: "modify_ldt" ret: "int" args: "int" "void *" "size_t" */ > -#define LINUX_SYS_modify_ldt 123 > - > -/* syscall: "mprotect" ret: "int" args: "const void *" "unsigned long" "int" */ > -#define LINUX_SYS_mprotect 125 > - > -/* syscall: "sigprocmask" ret: "int" args: "int" "const > linux_old_sigset_t *" "linux_old_sigset_t *" */ > -#define LINUX_SYS_sigprocmask 126 > - > -/* syscall: "getpgid" ret: "pid_t" args: "pid_t" */ > -#define LINUX_SYS_getpgid 132 > - > -/* syscall: "fchdir" ret: "int" args: "int" */ > -#define LINUX_SYS_fchdir 133 > - > -/* syscall: "personality" ret: "int" args: "int" */ > -#define LINUX_SYS_personality 136 > - > -/* syscall: "linux_setfsuid16" ret: "int" args: "uid_t" */ > -#define LINUX_SYS_linux_setfsuid16 138 > - > -/* syscall: "linux_setfsgid16" ret: "int" args: "gid_t" */ > -#define LINUX_SYS_linux_setfsgid16 139 > - > -/* syscall: "llseek" ret: "int" args: "int" "u_int32_t" "u_int32_t" > "void *" "int" */ > -#define LINUX_SYS_llseek 140 > - > -/* syscall: "getdents" ret: "int" args: "int" "struct linux_dirent *" > "unsigned int" */ > -#define LINUX_SYS_getdents 141 > - > -/* syscall: "select" ret: "int" args: "int" "fd_set *" "fd_set *" > "fd_set *" "struct timeval50 *" */ > -#define LINUX_SYS_select 142 > - > -/* syscall: "flock" ret: "int" args: "int" "int" */ > -#define LINUX_SYS_flock 143 > - > -/* syscall: "__msync13" ret: "int" args: "void *" "size_t" "int" */ > -#define LINUX_SYS___msync13 144 > - > -/* syscall: "readv" ret: "int" args: "int" "struct iovec *" "u_int" */ > -#define LINUX_SYS_readv 145 > - > -/* syscall: "writev" ret: "int" args: "int" "struct iovec *" "u_int" */ > -#define LINUX_SYS_writev 146 > - > -/* syscall: "getsid" ret: "pid_t" args: "pid_t" */ > -#define LINUX_SYS_getsid 147 > - > -/* syscall: "fdatasync" ret: "int" args: "int" */ > -#define LINUX_SYS_fdatasync 148 > - > -/* syscall: "__sysctl" ret: "int" args: "struct linux___sysctl *" */ > -#define LINUX_SYS___sysctl 149 > - > -/* syscall: "mlock" ret: "int" args: "void *" "size_t" */ > -#define LINUX_SYS_mlock 150 > - > -/* syscall: "munlock" ret: "int" args: "void *" "size_t" */ > -#define LINUX_SYS_munlock 151 > - > -/* syscall: "mlockall" ret: "int" args: "int" */ > -#define LINUX_SYS_mlockall 152 > - > -/* syscall: "munlockall" ret: "int" args: */ > -#define LINUX_SYS_munlockall 153 > - > -/* syscall: "sched_setparam" ret: "int" args: "pid_t" "const struct > linux_sched_param *" */ > -#define LINUX_SYS_sched_setparam 154 > - > -/* syscall: "sched_getparam" ret: "int" args: "pid_t" "struct > linux_sched_param *" */ > -#define LINUX_SYS_sched_getparam 155 > - > -/* syscall: "sched_setscheduler" ret: "int" args: "pid_t" "int" > "const struct linux_sched_param *" */ > -#define LINUX_SYS_sched_setscheduler 156 > - > -/* syscall: "sched_getscheduler" ret: "int" args: "pid_t" */ > -#define LINUX_SYS_sched_getscheduler 157 > - > -/* syscall: "sched_yield" ret: "int" args: */ > -#define LINUX_SYS_sched_yield 158 > - > -/* syscall: "sched_get_priority_max" ret: "int" args: "int" */ > -#define LINUX_SYS_sched_get_priority_max 159 > - > -/* syscall: "sched_get_priority_min" ret: "int" args: "int" */ > -#define LINUX_SYS_sched_get_priority_min 160 > - > -/* syscall: "nanosleep" ret: "int" args: "const struct linux_timespec > *" "struct linux_timespec *" */ > -#define LINUX_SYS_nanosleep 162 > - > -/* syscall: "mremap" ret: "void *" args: "void *" "size_t" "size_t" "u_long" */ > -#define LINUX_SYS_mremap 163 > - > -/* syscall: "setresuid16" ret: "int" args: "linux_uid16_t" > "linux_uid16_t" "linux_uid16_t" */ > -#define LINUX_SYS_setresuid16 164 > - > -/* syscall: "getresuid16" ret: "int" args: "linux_uid16_t *" > "linux_uid16_t *" "linux_uid16_t *" */ > -#define LINUX_SYS_getresuid16 165 > - > -/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_int" "int" */ > -#define LINUX_SYS_poll 168 > - > -/* syscall: "setresgid16" ret: "int" args: "linux_gid16_t" > "linux_gid16_t" "linux_gid16_t" */ > -#define LINUX_SYS_setresgid16 170 > - > -/* syscall: "getresgid16" ret: "int" args: "linux_gid16_t *" > "linux_gid16_t *" "linux_gid16_t *" */ > -#define LINUX_SYS_getresgid16 171 > - > -/* syscall: "rt_sigreturn" ret: "int" args: "struct linux_ucontext *" */ > -#define LINUX_SYS_rt_sigreturn 173 > - > -/* syscall: "rt_sigaction" ret: "int" args: "int" "const struct > linux_sigaction *" "struct linux_sigaction *" "size_t" */ > -#define LINUX_SYS_rt_sigaction 174 > - > -/* syscall: "rt_sigprocmask" ret: "int" args: "int" "const > linux_sigset_t *" "linux_sigset_t *" "size_t" */ > -#define LINUX_SYS_rt_sigprocmask 175 > - > -/* syscall: "rt_sigpending" ret: "int" args: "linux_sigset_t *" "size_t" */ > -#define LINUX_SYS_rt_sigpending 176 > - > -/* syscall: "rt_queueinfo" ret: "int" args: "int" "int" "void *" */ > -#define LINUX_SYS_rt_queueinfo 178 > - > -/* syscall: "rt_sigsuspend" ret: "int" args: "linux_sigset_t *" "size_t" */ > -#define LINUX_SYS_rt_sigsuspend 179 > - > -/* syscall: "pread" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */ > -#define LINUX_SYS_pread 180 > - > -/* syscall: "pwrite" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */ > -#define LINUX_SYS_pwrite 181 > - > -/* syscall: "chown16" ret: "int" args: "const char *" "linux_uid16_t" > "linux_gid16_t" */ > -#define LINUX_SYS_chown16 182 > - > -/* syscall: "__getcwd" ret: "int" args: "char *" "size_t" */ > -#define LINUX_SYS___getcwd 183 > - > -/* syscall: "sigaltstack" ret: "int" args: "const struct > linux_sigaltstack *" "struct linux_sigaltstack *" */ > -#define LINUX_SYS_sigaltstack 186 > - > -/* syscall: "__vfork14" ret: "int" args: */ > -#define LINUX_SYS___vfork14 190 > - > -/* syscall: "ugetrlimit" ret: "int" args: "int" "struct orlimit *" */ > -#define LINUX_SYS_ugetrlimit 191 > - > -#define linux_sys_mmap2_args linux_sys_mmap_args > -/* syscall: "mmap2" ret: "linux_off_t" args: "unsigned long" "size_t" > "int" "int" "int" "linux_off_t" */ > -#define LINUX_SYS_mmap2 192 > - > -/* syscall: "truncate64" ret: "int" args: "const char *" "off_t" */ > -#define LINUX_SYS_truncate64 193 > - > -/* syscall: "ftruncate64" ret: "int" args: "unsigned int" "off_t" */ > -#define LINUX_SYS_ftruncate64 194 > - > -/* syscall: "stat64" ret: "int" args: "const char *" "struct linux_stat64 *" */ > -#define LINUX_SYS_stat64 195 > - > -/* syscall: "lstat64" ret: "int" args: "const char *" "struct > linux_stat64 *" */ > -#define LINUX_SYS_lstat64 196 > - > -/* syscall: "fstat64" ret: "int" args: "int" "struct linux_stat64 *" */ > -#define LINUX_SYS_fstat64 197 > - > -/* syscall: "__posix_lchown" ret: "int" args: "const char *" "uid_t" "gid_t" */ > -#define LINUX_SYS___posix_lchown 198 > - > -/* syscall: "getuid" ret: "uid_t" args: */ > -#define LINUX_SYS_getuid 199 > - > -/* syscall: "getgid" ret: "gid_t" args: */ > -#define LINUX_SYS_getgid 200 > - > -/* syscall: "geteuid" ret: "uid_t" args: */ > -#define LINUX_SYS_geteuid 201 > - > -/* syscall: "getegid" ret: "gid_t" args: */ > -#define LINUX_SYS_getegid 202 > - > -/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */ > -#define LINUX_SYS_setreuid 203 > - > -/* syscall: "setregid" ret: "int" args: "gid_t" "gid_t" */ > -#define LINUX_SYS_setregid 204 > - > -/* syscall: "getgroups" ret: "int" args: "u_int" "gid_t *" */ > -#define LINUX_SYS_getgroups 205 > - > -/* syscall: "setgroups" ret: "int" args: "u_int" "gid_t *" */ > -#define LINUX_SYS_setgroups 206 > - > -/* syscall: "__posix_fchown" ret: "int" args: "int" "uid_t" "gid_t" */ > -#define LINUX_SYS___posix_fchown 207 > - > -/* syscall: "setresuid" ret: "int" args: "uid_t" "uid_t" "uid_t" */ > -#define LINUX_SYS_setresuid 208 > - > -/* syscall: "getresuid" ret: "int" args: "uid_t *" "uid_t *" "uid_t *" */ > -#define LINUX_SYS_getresuid 209 > - > -/* syscall: "setresgid" ret: "int" args: "gid_t" "gid_t" "gid_t" */ > -#define LINUX_SYS_setresgid 210 > - > -/* syscall: "getresgid" ret: "int" args: "gid_t *" "gid_t *" "gid_t *" */ > -#define LINUX_SYS_getresgid 211 > - > -/* syscall: "__posix_chown" ret: "int" args: "const char *" "uid_t" "gid_t" */ > -#define LINUX_SYS___posix_chown 212 > - > -/* syscall: "setuid" ret: "int" args: "uid_t" */ > -#define LINUX_SYS_setuid 213 > - > -/* syscall: "setgid" ret: "int" args: "gid_t" */ > -#define LINUX_SYS_setgid 214 > - > -/* syscall: "setfsuid" ret: "int" args: "uid_t" */ > -#define LINUX_SYS_setfsuid 215 > - > -/* syscall: "setfsgid" ret: "int" args: "gid_t" */ > -#define LINUX_SYS_setfsgid 216 > - > -/* syscall: "mincore" ret: "int" args: "void *" "size_t" "char *" */ > -#define LINUX_SYS_mincore 218 > - > -/* syscall: "madvise" ret: "int" args: "void *" "size_t" "int" */ > -#define LINUX_SYS_madvise 219 > - > -/* syscall: "getdents64" ret: "int" args: "int" "struct > linux_dirent64 *" "unsigned int" */ > -#define LINUX_SYS_getdents64 220 > - > -/* syscall: "fcntl64" ret: "int" args: "int" "int" "void *" */ > -#define LINUX_SYS_fcntl64 221 > - > -#ifdef LINUX_NPTL > -/* syscall: "gettid" ret: "pid_t" args: */ > -#define LINUX_SYS_gettid 224 > - > -#else > -#endif > -/* syscall: "setxattr" ret: "int" args: "char *" "char *" "void *" > "size_t" "int" */ > -#define LINUX_SYS_setxattr 226 > - > -/* syscall: "lsetxattr" ret: "int" args: "char *" "char *" "void *" > "size_t" "int" */ > -#define LINUX_SYS_lsetxattr 227 > - > -/* syscall: "fsetxattr" ret: "int" args: "int" "char *" "void *" > "size_t" "int" */ > -#define LINUX_SYS_fsetxattr 228 > - > -/* syscall: "getxattr" ret: "ssize_t" args: "char *" "char *" "void > *" "size_t" */ > -#define LINUX_SYS_getxattr 229 > - > -/* syscall: "lgetxattr" ret: "ssize_t" args: "char *" "char *" "void > *" "size_t" */ > -#define LINUX_SYS_lgetxattr 230 > - > -/* syscall: "fgetxattr" ret: "ssize_t" args: "int" "char *" "void *" > "size_t" */ > -#define LINUX_SYS_fgetxattr 231 > - > -/* syscall: "listxattr" ret: "ssize_t" args: "char *" "char *" "size_t" */ > -#define LINUX_SYS_listxattr 232 > - > -/* syscall: "llistxattr" ret: "ssize_t" args: "char *" "char *" "size_t" */ > -#define LINUX_SYS_llistxattr 233 > - > -/* syscall: "flistxattr" ret: "ssize_t" args: "int" "char *" "size_t" */ > -#define LINUX_SYS_flistxattr 234 > - > -/* syscall: "removexattr" ret: "int" args: "char *" "char *" */ > -#define LINUX_SYS_removexattr 235 > - > -/* syscall: "lremovexattr" ret: "int" args: "char *" "char *" */ > -#define LINUX_SYS_lremovexattr 236 > - > -/* syscall: "fremovexattr" ret: "int" args: "int" "char *" */ > -#define LINUX_SYS_fremovexattr 237 > - > -#ifdef LINUX_NPTL > -/* syscall: "tkill" ret: "int" args: "int" "int" */ > -#define LINUX_SYS_tkill 238 > - > -#else > -#endif > -/* syscall: "futex" ret: "int" args: "int *" "int" "int" "const > struct linux_timespec *" "int *" "int" */ > -#define LINUX_SYS_futex 240 > - > -#ifdef LINUX_NPTL > -/* syscall: "sched_setaffinity" ret: "int" args: "pid_t" "unsigned > int" "unsigned long *" */ > -#define LINUX_SYS_sched_setaffinity 241 > - > -/* syscall: "sched_getaffinity" ret: "int" args: "pid_t" "unsigned > int" "unsigned long *" */ > -#define LINUX_SYS_sched_getaffinity 242 > - > -#else > -#endif > -#ifdef LINUX_NPTL > -/* syscall: "set_thread_area" ret: "int" args: "struct linux_user_desc *" */ > -#define LINUX_SYS_set_thread_area 243 > - > -/* syscall: "get_thread_area" ret: "int" args: "struct linux_user_desc *" */ > -#define LINUX_SYS_get_thread_area 244 > - > -#else > -#endif > -/* syscall: "exit_group" ret: "int" args: "int" */ > -#define LINUX_SYS_exit_group 252 > - > -#ifdef LINUX_NPTL > -/* syscall: "set_tid_address" ret: "int" args: "int *" */ > -#define LINUX_SYS_set_tid_address 258 > - > -#else > -#endif > -/* syscall: "clock_settime" ret: "int" args: "clockid_t" "struct > linux_timespec *" */ > -#define LINUX_SYS_clock_settime 264 > - > -/* syscall: "clock_gettime" ret: "int" args: "clockid_t" "struct > linux_timespec *" */ > -#define LINUX_SYS_clock_gettime 265 > - > -/* syscall: "clock_getres" ret: "int" args: "clockid_t" "struct > linux_timespec *" */ > -#define LINUX_SYS_clock_getres 266 > - > -/* syscall: "clock_nanosleep" ret: "int" args: "clockid_t" "int" > "struct linux_timespec *" "struct linux_timespec *" */ > -#define LINUX_SYS_clock_nanosleep 267 > - > -/* syscall: "statfs64" ret: "int" args: "const char *" "size_t" > "struct linux_statfs64 *" */ > -#define LINUX_SYS_statfs64 268 > - > -/* syscall: "fstatfs64" ret: "int" args: "int" "size_t" "struct > linux_statfs64 *" */ > -#define LINUX_SYS_fstatfs64 269 > - > -#ifdef LINUX_NPTL > -/* syscall: "tgkill" ret: "int" args: "int" "int" "int" */ > -#define LINUX_SYS_tgkill 270 > - > -#else > -#endif > - /* 285 is obsolete / * XXXJDM really? * / */ > -/* syscall: "set_robust_list" ret: "int" args: "struct > linux_robust_list_head *" "size_t" */ > -#define LINUX_SYS_set_robust_list 311 > - > -/* syscall: "get_robust_list" ret: "int" args: "int" "struct > linux_robust_list_head **" "size_t *" */ > -#define LINUX_SYS_get_robust_list 312 > - > -#define LINUX_SYS_MAXSYSCALL 317 > -#define LINUX_SYS_NSYSENT 512 > -#endif /* _LINUX_SYS_SYSCALL_H_ */ > - > diff --git a/system/linux/i686/system_calls.S b/system/linux/i686/system_calls.S > deleted file mode 100644 > index 8e1d6f9..0000000 > --- a/system/linux/i686/system_calls.S > +++ /dev/null > @@ -1,79 +0,0 @@ > -/* > - Copyright (c) 2009, Henrique Dante de Almeida > - 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. > - > -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. > -*/ > - > -.global syscall1 > -.type syscall1,@function > -.global syscall3 > -.type syscall3,@function > - > -/* System calls in x86 are informally described in blogs and mailing lists. > - See, for example: > - http://hdante.blogspot.com/2007/02/getting-vsyscall-address-from-elf.html > - Calling conventions are described on the System V x86 ABI supplement. > - Paramenter sequence is: %ebx, %ecx, %edx, %esi, %edi and %ebp > - See, for example: > - http://www.linuxjournal.com/article/4048 > - > - TODO: remove calculation for kernel_vsyscall (use a fixed address) > -*/ > - > - > -syscall1: > - pushl %ebp > - movl %esp, %ebp > - pushl %ebx > - call get_abs_address > - addl $_GLOBAL_OFFSET_TABLE_, %ebx > - movl kernel_vsyscall@GOT(%ebx), %ecx > - movl 8(%ebp), %eax > - movl 12(%ebp), %ebx > - call *(%ecx) > - popl %ebx > - popl %ebp > - ret > - > -syscall3: > - pushl %ebp > - movl %esp, %ebp > - pushl %edi > - pushl %ebx > - call get_abs_address > - addl $_GLOBAL_OFFSET_TABLE_, %ebx > - movl kernel_vsyscall@GOT(%ebx), %edi > - movl 8(%ebp), %eax > - movl 12(%ebp), %ebx > - movl 16(%ebp), %ecx > - movl 20(%ebp), %edx > - call *(%edi) > - popl %ebx > - popl %edi > - popl %ebp > - ret > - > -get_abs_address: > - mov (%esp), %ebx > - ret > - > diff --git a/system/linux/x86_32/system_call_numbers.h > b/system/linux/x86_32/system_call_numbers.h > new file mode 100644 > index 0000000..04c78a5 > --- /dev/null > +++ b/system/linux/x86_32/system_call_numbers.h > @@ -0,0 +1,732 @@ > +/* > + Copyright (c) 2009, Henrique Dante de Almeida > + Copyright (c) 2009, njoly (NetBSD) > + 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. > + > +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. > + > +*/ > +/* $NetBSD: linux_syscall.h,v 1.83 2009/01/17 22:34:02 c Exp $ */ > + > +/* > + * System call numbers. > + * > + * DO NOT EDIT-- this file is automatically generated. > + * created from NetBSD: syscalls.master,v 1.99 2009/01/17 22:28:52 njoly Exp > + */ > + > +#ifndef _LINUX_SYS_SYSCALL_H_ > +#define _LINUX_SYS_SYSCALL_H_ > + > +#define LINUX_SYS_MAXSYSARGS 8 > + > +/* syscall: "syscall" ret: "int" args: */ > +#define LINUX_SYS_syscall 0 > + > +/* syscall: "exit" ret: "int" args: "int" */ > +#define LINUX_SYS_exit 1 > + > +/* syscall: "fork" ret: "int" args: */ > +#define LINUX_SYS_fork 2 > + > +/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */ > +#define LINUX_SYS_read 3 > + > +/* syscall: "write" ret: "int" args: "int" "char *" "u_int" */ > +#define LINUX_SYS_write 4 > + > +/* syscall: "open" ret: "int" args: "const char *" "int" "int" */ > +#define LINUX_SYS_open 5 > + > +/* syscall: "close" ret: "int" args: "int" */ > +#define LINUX_SYS_close 6 > + > +/* syscall: "waitpid" ret: "int" args: "int" "int *" "int" */ > +#define LINUX_SYS_waitpid 7 > + > +/* syscall: "creat" ret: "int" args: "const char *" "int" */ > +#define LINUX_SYS_creat 8 > + > +/* syscall: "link" ret: "int" args: "const char *" "const char *" */ > +#define LINUX_SYS_link 9 > + > +/* syscall: "unlink" ret: "int" args: "const char *" */ > +#define LINUX_SYS_unlink 10 > + > +/* syscall: "execve" ret: "int" args: "const char *" "char **" "char **" */ > +#define LINUX_SYS_execve 11 > + > +/* syscall: "chdir" ret: "int" args: "const char *" */ > +#define LINUX_SYS_chdir 12 > + > +/* syscall: "time" ret: "int" args: "linux_time_t *" */ > +#define LINUX_SYS_time 13 > + > +/* syscall: "mknod" ret: "int" args: "const char *" "int" "int" */ > +#define LINUX_SYS_mknod 14 > + > +/* syscall: "chmod" ret: "int" args: "const char *" "int" */ > +#define LINUX_SYS_chmod 15 > + > +/* syscall: "lchown16" ret: "int" args: "const char *" > "linux_uid16_t" "linux_gid16_t" */ > +#define LINUX_SYS_lchown16 16 > + > +/* syscall: "break" ret: "int" args: "char *" */ > +#define LINUX_SYS_break 17 > + > + /* 18 is obsolete ostat */ > +/* syscall: "lseek" ret: "long" args: "int" "long" "int" */ > +#define LINUX_SYS_lseek 19 > + > +#ifdef LINUX_NPTL > +/* syscall: "getpid" ret: "pid_t" args: */ > +#define LINUX_SYS_getpid 20 > + > +#else > +/* syscall: "getpid" ret: "pid_t" args: */ > +#define LINUX_SYS_getpid 20 > + > +#endif > +/* syscall: "linux_setuid16" ret: "int" args: "uid_t" */ > +#define LINUX_SYS_linux_setuid16 23 > + > +/* syscall: "linux_getuid16" ret: "uid_t" args: */ > +#define LINUX_SYS_linux_getuid16 24 > + > +/* syscall: "stime" ret: "int" args: "linux_time_t *" */ > +#define LINUX_SYS_stime 25 > + > +/* syscall: "ptrace" ret: "int" args: "int" "int" "int" "int" */ > +#define LINUX_SYS_ptrace 26 > + > +/* syscall: "alarm" ret: "int" args: "unsigned int" */ > +#define LINUX_SYS_alarm 27 > + > + /* 28 is obsolete ofstat */ > +/* syscall: "pause" ret: "int" args: */ > +#define LINUX_SYS_pause 29 > + > +/* syscall: "utime" ret: "int" args: "const char *" "struct linux_utimbuf *" */ > +#define LINUX_SYS_utime 30 > + > + /* 31 is obsolete stty */ > + /* 32 is obsolete gtty */ > +/* syscall: "access" ret: "int" args: "const char *" "int" */ > +#define LINUX_SYS_access 33 > + > +/* syscall: "nice" ret: "int" args: "int" */ > +#define LINUX_SYS_nice 34 > + > + /* 35 is obsolete ftime */ > +/* syscall: "sync" ret: "int" args: */ > +#define LINUX_SYS_sync 36 > + > +/* syscall: "kill" ret: "int" args: "int" "int" */ > +#define LINUX_SYS_kill 37 > + > +/* syscall: "__posix_rename" ret: "int" args: "const char *" "const char *" */ > +#define LINUX_SYS___posix_rename 38 > + > +/* syscall: "mkdir" ret: "int" args: "const char *" "int" */ > +#define LINUX_SYS_mkdir 39 > + > +/* syscall: "rmdir" ret: "int" args: "const char *" */ > +#define LINUX_SYS_rmdir 40 > + > +/* syscall: "dup" ret: "int" args: "u_int" */ > +#define LINUX_SYS_dup 41 > + > +/* syscall: "pipe" ret: "int" args: "int *" */ > +#define LINUX_SYS_pipe 42 > + > +/* syscall: "times" ret: "int" args: "struct times *" */ > +#define LINUX_SYS_times 43 > + > + /* 44 is obsolete prof */ > +/* syscall: "brk" ret: "int" args: "char *" */ > +#define LINUX_SYS_brk 45 > + > +/* syscall: "linux_setgid16" ret: "int" args: "gid_t" */ > +#define LINUX_SYS_linux_setgid16 46 > + > +/* syscall: "linux_getgid16" ret: "gid_t" args: */ > +#define LINUX_SYS_linux_getgid16 47 > + > +/* syscall: "signal" ret: "int" args: "int" "linux_handler_t" */ > +#define LINUX_SYS_signal 48 > + > +/* syscall: "linux_geteuid16" ret: "uid_t" args: */ > +#define LINUX_SYS_linux_geteuid16 49 > + > +/* syscall: "linux_getegid16" ret: "gid_t" args: */ > +#define LINUX_SYS_linux_getegid16 50 > + > +/* syscall: "acct" ret: "int" args: "char *" */ > +#define LINUX_SYS_acct 51 > + > + /* 52 is obsolete phys */ > + /* 53 is obsolete lock */ > +/* syscall: "ioctl" ret: "int" args: "int" "u_long" "void *" */ > +#define LINUX_SYS_ioctl 54 > + > +/* syscall: "fcntl" ret: "int" args: "int" "int" "void *" */ > +#define LINUX_SYS_fcntl 55 > + > + /* 56 is obsolete mpx */ > +/* syscall: "setpgid" ret: "int" args: "int" "int" */ > +#define LINUX_SYS_setpgid 57 > + > + /* 58 is obsolete ulimit */ > +/* syscall: "oldolduname" ret: "int" args: "struct linux_oldold_utsname *" */ > +#define LINUX_SYS_oldolduname 59 > + > +/* syscall: "umask" ret: "int" args: "int" */ > +#define LINUX_SYS_umask 60 > + > +/* syscall: "chroot" ret: "int" args: "char *" */ > +#define LINUX_SYS_chroot 61 > + > +/* syscall: "dup2" ret: "int" args: "u_int" "u_int" */ > +#define LINUX_SYS_dup2 63 > + > +#ifdef LINUX_NPTL > +/* syscall: "getppid" ret: "pid_t" args: */ > +#define LINUX_SYS_getppid 64 > + > +#else > +/* syscall: "getppid" ret: "pid_t" args: */ > +#define LINUX_SYS_getppid 64 > + > +#endif > +/* syscall: "getpgrp" ret: "int" args: */ > +#define LINUX_SYS_getpgrp 65 > + > +/* syscall: "setsid" ret: "int" args: */ > +#define LINUX_SYS_setsid 66 > + > +/* syscall: "sigaction" ret: "int" args: "int" "const struct > linux_old_sigaction *" "struct linux_old_sigaction *" */ > +#define LINUX_SYS_sigaction 67 > + > +/* syscall: "siggetmask" ret: "int" args: */ > +#define LINUX_SYS_siggetmask 68 > + > +/* syscall: "sigsetmask" ret: "int" args: "linux_old_sigset_t" */ > +#define LINUX_SYS_sigsetmask 69 > + > +/* syscall: "setreuid16" ret: "int" args: "linux_uid16_t" "linux_uid16_t" */ > +#define LINUX_SYS_setreuid16 70 > + > +/* syscall: "setregid16" ret: "int" args: "linux_gid16_t" "linux_gid16_t" */ > +#define LINUX_SYS_setregid16 71 > + > +/* syscall: "sigsuspend" ret: "int" args: "void *" "int" "int" */ > +#define LINUX_SYS_sigsuspend 72 > + > +/* syscall: "sigpending" ret: "int" args: "linux_old_sigset_t *" */ > +#define LINUX_SYS_sigpending 73 > + > +/* syscall: "sethostname" ret: "int" args: "char *" "u_int" */ > +#define LINUX_SYS_sethostname 74 > + > +/* syscall: "setrlimit" ret: "int" args: "u_int" "struct orlimit *" */ > +#define LINUX_SYS_setrlimit 75 > + > +/* syscall: "getrlimit" ret: "int" args: "u_int" "struct orlimit *" */ > +#define LINUX_SYS_getrlimit 76 > + > +/* syscall: "getrusage" ret: "int" args: "int" "struct rusage50 *" */ > +#define LINUX_SYS_getrusage 77 > + > +/* syscall: "gettimeofday" ret: "int" args: "struct timeval50 *" > "struct timezone *" */ > +#define LINUX_SYS_gettimeofday 78 > + > +/* syscall: "settimeofday" ret: "int" args: "struct timeval50 *" > "struct timezone *" */ > +#define LINUX_SYS_settimeofday 79 > + > +/* syscall: "getgroups16" ret: "int" args: "int" "linux_gid16_t *" */ > +#define LINUX_SYS_getgroups16 80 > + > +/* syscall: "setgroups16" ret: "int" args: "int" "linux_gid16_t *" */ > +#define LINUX_SYS_setgroups16 81 > + > +/* syscall: "oldselect" ret: "int" args: "struct linux_oldselect *" */ > +#define LINUX_SYS_oldselect 82 > + > +/* syscall: "symlink" ret: "int" args: "const char *" "const char *" */ > +#define LINUX_SYS_symlink 83 > + > +/* syscall: "oolstat" ret: "int" args: "const char *" "struct stat43 *" */ > +#define LINUX_SYS_oolstat 84 > + > +/* syscall: "readlink" ret: "int" args: "const char *" "char *" "int" */ > +#define LINUX_SYS_readlink 85 > + > +#ifdef EXEC_AOUT > +/* syscall: "uselib" ret: "int" args: "const char *" */ > +#define LINUX_SYS_uselib 86 > + > +#else > +#endif > +/* syscall: "swapon" ret: "int" args: "char *" */ > +#define LINUX_SYS_swapon 87 > + > +/* syscall: "reboot" ret: "int" args: "int" "int" "int" "void *" */ > +#define LINUX_SYS_reboot 88 > + > +/* syscall: "readdir" ret: "int" args: "int" "void *" "unsigned int" */ > +#define LINUX_SYS_readdir 89 > + > +/* syscall: "old_mmap" ret: "int" args: "struct linux_oldmmap *" */ > +#define LINUX_SYS_old_mmap 90 > + > +/* syscall: "munmap" ret: "int" args: "void *" "int" */ > +#define LINUX_SYS_munmap 91 > + > +/* syscall: "truncate" ret: "int" args: "const char *" "long" */ > +#define LINUX_SYS_truncate 92 > + > +/* syscall: "ftruncate" ret: "int" args: "int" "long" */ > +#define LINUX_SYS_ftruncate 93 > + > +/* syscall: "fchmod" ret: "int" args: "int" "int" */ > +#define LINUX_SYS_fchmod 94 > + > +/* syscall: "fchown16" ret: "int" args: "int" "linux_uid16_t" > "linux_gid16_t" */ > +#define LINUX_SYS_fchown16 95 > + > +/* syscall: "getpriority" ret: "int" args: "int" "int" */ > +#define LINUX_SYS_getpriority 96 > + > +/* syscall: "setpriority" ret: "int" args: "int" "int" "int" */ > +#define LINUX_SYS_setpriority 97 > + > +/* syscall: "profil" ret: "int" args: "void *" "u_int" "u_int" "u_int" */ > +#define LINUX_SYS_profil 98 > + > +/* syscall: "statfs" ret: "int" args: "const char *" "struct linux_statfs *" */ > +#define LINUX_SYS_statfs 99 > + > +/* syscall: "fstatfs" ret: "int" args: "int" "struct linux_statfs *" */ > +#define LINUX_SYS_fstatfs 100 > + > +/* syscall: "ioperm" ret: "int" args: "unsigned int" "unsigned int" "int" */ > +#define LINUX_SYS_ioperm 101 > + > +/* syscall: "socketcall" ret: "int" args: "int" "void *" */ > +#define LINUX_SYS_socketcall 102 > + > +/* syscall: "setitimer" ret: "int" args: "u_int" "struct itimerval50 > *" "struct itimerval50 *" */ > +#define LINUX_SYS_setitimer 104 > + > +/* syscall: "getitimer" ret: "int" args: "u_int" "struct itimerval50 *" */ > +#define LINUX_SYS_getitimer 105 > + > +/* syscall: "stat" ret: "int" args: "const char *" "struct linux_stat *" */ > +#define LINUX_SYS_stat 106 > + > +/* syscall: "lstat" ret: "int" args: "const char *" "struct linux_stat *" */ > +#define LINUX_SYS_lstat 107 > + > +/* syscall: "fstat" ret: "int" args: "int" "struct linux_stat *" */ > +#define LINUX_SYS_fstat 108 > + > +/* syscall: "olduname" ret: "int" args: "struct linux_old_utsname *" */ > +#define LINUX_SYS_olduname 109 > + > +/* syscall: "iopl" ret: "int" args: "int" */ > +#define LINUX_SYS_iopl 110 > + > +/* syscall: "wait4" ret: "int" args: "int" "int *" "int" "struct rusage50 *" */ > +#define LINUX_SYS_wait4 114 > + > +/* syscall: "swapoff" ret: "int" args: "const char *" */ > +#define LINUX_SYS_swapoff 115 > + > +/* syscall: "sysinfo" ret: "int" args: "struct linux_sysinfo *" */ > +#define LINUX_SYS_sysinfo 116 > + > +/* syscall: "ipc" ret: "int" args: "int" "int" "int" "int" "void *" */ > +#define LINUX_SYS_ipc 117 > + > +/* syscall: "fsync" ret: "int" args: "int" */ > +#define LINUX_SYS_fsync 118 > + > +/* syscall: "sigreturn" ret: "int" args: "struct linux_sigcontext *" */ > +#define LINUX_SYS_sigreturn 119 > + > +/* syscall: "clone" ret: "int" args: "int" "void *" "void *" "void *" */ > +#define LINUX_SYS_clone 120 > + > +/* syscall: "setdomainname" ret: "int" args: "char *" "int" */ > +#define LINUX_SYS_setdomainname 121 > + > +/* syscall: "uname" ret: "int" args: "struct linux_utsname *" */ > +#define LINUX_SYS_uname 122 > + > +/* syscall: "modify_ldt" ret: "int" args: "int" "void *" "size_t" */ > +#define LINUX_SYS_modify_ldt 123 > + > +/* syscall: "mprotect" ret: "int" args: "const void *" "unsigned long" "int" */ > +#define LINUX_SYS_mprotect 125 > + > +/* syscall: "sigprocmask" ret: "int" args: "int" "const > linux_old_sigset_t *" "linux_old_sigset_t *" */ > +#define LINUX_SYS_sigprocmask 126 > + > +/* syscall: "getpgid" ret: "pid_t" args: "pid_t" */ > +#define LINUX_SYS_getpgid 132 > + > +/* syscall: "fchdir" ret: "int" args: "int" */ > +#define LINUX_SYS_fchdir 133 > + > +/* syscall: "personality" ret: "int" args: "int" */ > +#define LINUX_SYS_personality 136 > + > +/* syscall: "linux_setfsuid16" ret: "int" args: "uid_t" */ > +#define LINUX_SYS_linux_setfsuid16 138 > + > +/* syscall: "linux_set... [truncated message content] |
From: Kirill A. S. <ki...@sh...> - 2009-06-26 15:11:29
|
Signed-off-by: Kirill A. Shutemov <ki...@sh...> --- CMakeLists.txt | 11 +- Makefile | 2 +- runtime/linux/i686/_start.S | 47 -- runtime/linux/i686/architecture_init.c | 54 --- runtime/linux/x86_32/_start.S | 47 ++ runtime/linux/x86_32/architecture_init.c | 54 +++ system/linux/i686/system_call_numbers.h | 732 ----------------------------- system/linux/i686/system_calls.S | 79 --- system/linux/x86_32/system_call_numbers.h | 732 +++++++++++++++++++++++++++++ system/linux/x86_32/system_calls.S | 79 +++ 10 files changed, 921 insertions(+), 916 deletions(-) delete mode 100644 runtime/linux/i686/_start.S delete mode 100644 runtime/linux/i686/architecture_init.c create mode 100644 runtime/linux/x86_32/_start.S create mode 100644 runtime/linux/x86_32/architecture_init.c delete mode 100644 system/linux/i686/system_call_numbers.h delete mode 100644 system/linux/i686/system_calls.S create mode 100644 system/linux/x86_32/system_call_numbers.h create mode 100644 system/linux/x86_32/system_calls.S diff --git a/CMakeLists.txt b/CMakeLists.txt index dfa65ec..b5e1dca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,16 +32,21 @@ set(LIBPOSIX_INCLUDE_DIRECTORY include CACHE STRING set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -nostdlib") set(BUILD_SHARED_LIBS true) string(TOLOWER ${CMAKE_SYSTEM_NAME} system_name) -string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} system_processor) + +if(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86") + set(arch "x86_32") +else(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86") + string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} arch) +endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i[0-9]86") set(libposix_root ${PROJECT_SOURCE_DIR}) set(mandatory_path ${libposix_root}/mandatory) set(optional_path ${libposix_root}/optional) set(os_path ${libposix_root}/system/${system_name}) -set(architecture_path ${os_path}/${system_processor}) +set(architecture_path ${os_path}/${arch}) set(runtime_path ${libposix_root}/runtime) set(runtime_os_path ${runtime_path}/${system_name}) -set(runtime_architecture_path ${runtime_os_path}/${system_processor}) +set(runtime_architecture_path ${runtime_os_path}/${arch}) set(mandatory_include_path ${mandatory_path}/include) set(runtime_file_name runtime${CMAKE_C_OUTPUT_EXTENSION}) # Wait for those to be populated to avoid error in installation diff --git a/Makefile b/Makefile index 3c0fb77..3f18e2b 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ RANLIB=ranlib AS=as OSNAME:=$(shell uname -s | tr A-Z a-z) -ARCH:=$(shell uname -m | sed 's/i[456]86/i686/') +ARCH:=$(shell uname -m | sed 's/i[0-9]86/x86_32/') OUTPUTDIR:=output-$(OSNAME)-$(ARCH) CFLAGS+=-Isystem/$(OSNAME) -Isystem/$(OSNAME)/$(ARCH) diff --git a/runtime/linux/i686/_start.S b/runtime/linux/i686/_start.S deleted file mode 100644 index 682f37c..0000000 --- a/runtime/linux/i686/_start.S +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (c) 2009, Henrique Dante de Almeida - 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 -.global _start -.type _start,@function - -_start: - /* This code generates a call to init(argc, argv, envp, auxv); */ - movl %esp, %ebp - subl $16, %esp - movl (%ebp), %eax - movl %eax, (%esp) - leal 4(%ebp), %ecx - movl %ecx, 4(%esp) - leal 8(%ebp,%eax,4), %ecx - movl %ecx, 8(%esp) -search_auxv: - movl (%ecx), %eax - addl $4, %ecx - testl %eax, %eax - jnz search_auxv - movl %ecx, 12(%esp) - call init@PLT - diff --git a/runtime/linux/i686/architecture_init.c b/runtime/linux/i686/architecture_init.c deleted file mode 100644 index f080dc4..0000000 --- a/runtime/linux/i686/architecture_init.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright (c) 2009, Henrique Dante de Almeida -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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 <stddef.h> -#include "runtime.h" - -void (*kernel_vsyscall)(); - -/* AT_SYSINFO entry has the vsyscall address */ -#define AT_SYSINFO 32 - -void set_kernel_vsyscall(const auxv_t *auxv) -{ - if (auxv != NULL) { - const auxv_t *auxv_walk; - for (auxv_walk = auxv; auxv_walk->a_type != 0; auxv_walk++) { - if (auxv_walk->a_type == AT_SYSINFO) { - kernel_vsyscall = auxv_walk->a_un.a_fcn; - return; - - } - } - // ERROR: AT_SYSINFO entry not found - } -} - -void architecture_init(int argc, const char **argv, const char **envp, - const auxv_t *auxv) -{ - set_kernel_vsyscall(auxv); -} diff --git a/runtime/linux/x86_32/_start.S b/runtime/linux/x86_32/_start.S new file mode 100644 index 0000000..682f37c --- /dev/null +++ b/runtime/linux/x86_32/_start.S @@ -0,0 +1,47 @@ +/* + Copyright (c) 2009, Henrique Dante de Almeida + 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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 +.global _start +.type _start,@function + +_start: + /* This code generates a call to init(argc, argv, envp, auxv); */ + movl %esp, %ebp + subl $16, %esp + movl (%ebp), %eax + movl %eax, (%esp) + leal 4(%ebp), %ecx + movl %ecx, 4(%esp) + leal 8(%ebp,%eax,4), %ecx + movl %ecx, 8(%esp) +search_auxv: + movl (%ecx), %eax + addl $4, %ecx + testl %eax, %eax + jnz search_auxv + movl %ecx, 12(%esp) + call init@PLT + diff --git a/runtime/linux/x86_32/architecture_init.c b/runtime/linux/x86_32/architecture_init.c new file mode 100644 index 0000000..f080dc4 --- /dev/null +++ b/runtime/linux/x86_32/architecture_init.c @@ -0,0 +1,54 @@ +/* +Copyright (c) 2009, Henrique Dante de Almeida +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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 <stddef.h> +#include "runtime.h" + +void (*kernel_vsyscall)(); + +/* AT_SYSINFO entry has the vsyscall address */ +#define AT_SYSINFO 32 + +void set_kernel_vsyscall(const auxv_t *auxv) +{ + if (auxv != NULL) { + const auxv_t *auxv_walk; + for (auxv_walk = auxv; auxv_walk->a_type != 0; auxv_walk++) { + if (auxv_walk->a_type == AT_SYSINFO) { + kernel_vsyscall = auxv_walk->a_un.a_fcn; + return; + + } + } + // ERROR: AT_SYSINFO entry not found + } +} + +void architecture_init(int argc, const char **argv, const char **envp, + const auxv_t *auxv) +{ + set_kernel_vsyscall(auxv); +} diff --git a/system/linux/i686/system_call_numbers.h b/system/linux/i686/system_call_numbers.h deleted file mode 100644 index 04c78a5..0000000 --- a/system/linux/i686/system_call_numbers.h +++ /dev/null @@ -1,732 +0,0 @@ -/* - Copyright (c) 2009, Henrique Dante de Almeida - Copyright (c) 2009, njoly (NetBSD) - 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. - -*/ -/* $NetBSD: linux_syscall.h,v 1.83 2009/01/17 22:34:02 c Exp $ */ - -/* - * System call numbers. - * - * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.99 2009/01/17 22:28:52 njoly Exp - */ - -#ifndef _LINUX_SYS_SYSCALL_H_ -#define _LINUX_SYS_SYSCALL_H_ - -#define LINUX_SYS_MAXSYSARGS 8 - -/* syscall: "syscall" ret: "int" args: */ -#define LINUX_SYS_syscall 0 - -/* syscall: "exit" ret: "int" args: "int" */ -#define LINUX_SYS_exit 1 - -/* syscall: "fork" ret: "int" args: */ -#define LINUX_SYS_fork 2 - -/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */ -#define LINUX_SYS_read 3 - -/* syscall: "write" ret: "int" args: "int" "char *" "u_int" */ -#define LINUX_SYS_write 4 - -/* syscall: "open" ret: "int" args: "const char *" "int" "int" */ -#define LINUX_SYS_open 5 - -/* syscall: "close" ret: "int" args: "int" */ -#define LINUX_SYS_close 6 - -/* syscall: "waitpid" ret: "int" args: "int" "int *" "int" */ -#define LINUX_SYS_waitpid 7 - -/* syscall: "creat" ret: "int" args: "const char *" "int" */ -#define LINUX_SYS_creat 8 - -/* syscall: "link" ret: "int" args: "const char *" "const char *" */ -#define LINUX_SYS_link 9 - -/* syscall: "unlink" ret: "int" args: "const char *" */ -#define LINUX_SYS_unlink 10 - -/* syscall: "execve" ret: "int" args: "const char *" "char **" "char **" */ -#define LINUX_SYS_execve 11 - -/* syscall: "chdir" ret: "int" args: "const char *" */ -#define LINUX_SYS_chdir 12 - -/* syscall: "time" ret: "int" args: "linux_time_t *" */ -#define LINUX_SYS_time 13 - -/* syscall: "mknod" ret: "int" args: "const char *" "int" "int" */ -#define LINUX_SYS_mknod 14 - -/* syscall: "chmod" ret: "int" args: "const char *" "int" */ -#define LINUX_SYS_chmod 15 - -/* syscall: "lchown16" ret: "int" args: "const char *" "linux_uid16_t" "linux_gid16_t" */ -#define LINUX_SYS_lchown16 16 - -/* syscall: "break" ret: "int" args: "char *" */ -#define LINUX_SYS_break 17 - - /* 18 is obsolete ostat */ -/* syscall: "lseek" ret: "long" args: "int" "long" "int" */ -#define LINUX_SYS_lseek 19 - -#ifdef LINUX_NPTL -/* syscall: "getpid" ret: "pid_t" args: */ -#define LINUX_SYS_getpid 20 - -#else -/* syscall: "getpid" ret: "pid_t" args: */ -#define LINUX_SYS_getpid 20 - -#endif -/* syscall: "linux_setuid16" ret: "int" args: "uid_t" */ -#define LINUX_SYS_linux_setuid16 23 - -/* syscall: "linux_getuid16" ret: "uid_t" args: */ -#define LINUX_SYS_linux_getuid16 24 - -/* syscall: "stime" ret: "int" args: "linux_time_t *" */ -#define LINUX_SYS_stime 25 - -/* syscall: "ptrace" ret: "int" args: "int" "int" "int" "int" */ -#define LINUX_SYS_ptrace 26 - -/* syscall: "alarm" ret: "int" args: "unsigned int" */ -#define LINUX_SYS_alarm 27 - - /* 28 is obsolete ofstat */ -/* syscall: "pause" ret: "int" args: */ -#define LINUX_SYS_pause 29 - -/* syscall: "utime" ret: "int" args: "const char *" "struct linux_utimbuf *" */ -#define LINUX_SYS_utime 30 - - /* 31 is obsolete stty */ - /* 32 is obsolete gtty */ -/* syscall: "access" ret: "int" args: "const char *" "int" */ -#define LINUX_SYS_access 33 - -/* syscall: "nice" ret: "int" args: "int" */ -#define LINUX_SYS_nice 34 - - /* 35 is obsolete ftime */ -/* syscall: "sync" ret: "int" args: */ -#define LINUX_SYS_sync 36 - -/* syscall: "kill" ret: "int" args: "int" "int" */ -#define LINUX_SYS_kill 37 - -/* syscall: "__posix_rename" ret: "int" args: "const char *" "const char *" */ -#define LINUX_SYS___posix_rename 38 - -/* syscall: "mkdir" ret: "int" args: "const char *" "int" */ -#define LINUX_SYS_mkdir 39 - -/* syscall: "rmdir" ret: "int" args: "const char *" */ -#define LINUX_SYS_rmdir 40 - -/* syscall: "dup" ret: "int" args: "u_int" */ -#define LINUX_SYS_dup 41 - -/* syscall: "pipe" ret: "int" args: "int *" */ -#define LINUX_SYS_pipe 42 - -/* syscall: "times" ret: "int" args: "struct times *" */ -#define LINUX_SYS_times 43 - - /* 44 is obsolete prof */ -/* syscall: "brk" ret: "int" args: "char *" */ -#define LINUX_SYS_brk 45 - -/* syscall: "linux_setgid16" ret: "int" args: "gid_t" */ -#define LINUX_SYS_linux_setgid16 46 - -/* syscall: "linux_getgid16" ret: "gid_t" args: */ -#define LINUX_SYS_linux_getgid16 47 - -/* syscall: "signal" ret: "int" args: "int" "linux_handler_t" */ -#define LINUX_SYS_signal 48 - -/* syscall: "linux_geteuid16" ret: "uid_t" args: */ -#define LINUX_SYS_linux_geteuid16 49 - -/* syscall: "linux_getegid16" ret: "gid_t" args: */ -#define LINUX_SYS_linux_getegid16 50 - -/* syscall: "acct" ret: "int" args: "char *" */ -#define LINUX_SYS_acct 51 - - /* 52 is obsolete phys */ - /* 53 is obsolete lock */ -/* syscall: "ioctl" ret: "int" args: "int" "u_long" "void *" */ -#define LINUX_SYS_ioctl 54 - -/* syscall: "fcntl" ret: "int" args: "int" "int" "void *" */ -#define LINUX_SYS_fcntl 55 - - /* 56 is obsolete mpx */ -/* syscall: "setpgid" ret: "int" args: "int" "int" */ -#define LINUX_SYS_setpgid 57 - - /* 58 is obsolete ulimit */ -/* syscall: "oldolduname" ret: "int" args: "struct linux_oldold_utsname *" */ -#define LINUX_SYS_oldolduname 59 - -/* syscall: "umask" ret: "int" args: "int" */ -#define LINUX_SYS_umask 60 - -/* syscall: "chroot" ret: "int" args: "char *" */ -#define LINUX_SYS_chroot 61 - -/* syscall: "dup2" ret: "int" args: "u_int" "u_int" */ -#define LINUX_SYS_dup2 63 - -#ifdef LINUX_NPTL -/* syscall: "getppid" ret: "pid_t" args: */ -#define LINUX_SYS_getppid 64 - -#else -/* syscall: "getppid" ret: "pid_t" args: */ -#define LINUX_SYS_getppid 64 - -#endif -/* syscall: "getpgrp" ret: "int" args: */ -#define LINUX_SYS_getpgrp 65 - -/* syscall: "setsid" ret: "int" args: */ -#define LINUX_SYS_setsid 66 - -/* syscall: "sigaction" ret: "int" args: "int" "const struct linux_old_sigaction *" "struct linux_old_sigaction *" */ -#define LINUX_SYS_sigaction 67 - -/* syscall: "siggetmask" ret: "int" args: */ -#define LINUX_SYS_siggetmask 68 - -/* syscall: "sigsetmask" ret: "int" args: "linux_old_sigset_t" */ -#define LINUX_SYS_sigsetmask 69 - -/* syscall: "setreuid16" ret: "int" args: "linux_uid16_t" "linux_uid16_t" */ -#define LINUX_SYS_setreuid16 70 - -/* syscall: "setregid16" ret: "int" args: "linux_gid16_t" "linux_gid16_t" */ -#define LINUX_SYS_setregid16 71 - -/* syscall: "sigsuspend" ret: "int" args: "void *" "int" "int" */ -#define LINUX_SYS_sigsuspend 72 - -/* syscall: "sigpending" ret: "int" args: "linux_old_sigset_t *" */ -#define LINUX_SYS_sigpending 73 - -/* syscall: "sethostname" ret: "int" args: "char *" "u_int" */ -#define LINUX_SYS_sethostname 74 - -/* syscall: "setrlimit" ret: "int" args: "u_int" "struct orlimit *" */ -#define LINUX_SYS_setrlimit 75 - -/* syscall: "getrlimit" ret: "int" args: "u_int" "struct orlimit *" */ -#define LINUX_SYS_getrlimit 76 - -/* syscall: "getrusage" ret: "int" args: "int" "struct rusage50 *" */ -#define LINUX_SYS_getrusage 77 - -/* syscall: "gettimeofday" ret: "int" args: "struct timeval50 *" "struct timezone *" */ -#define LINUX_SYS_gettimeofday 78 - -/* syscall: "settimeofday" ret: "int" args: "struct timeval50 *" "struct timezone *" */ -#define LINUX_SYS_settimeofday 79 - -/* syscall: "getgroups16" ret: "int" args: "int" "linux_gid16_t *" */ -#define LINUX_SYS_getgroups16 80 - -/* syscall: "setgroups16" ret: "int" args: "int" "linux_gid16_t *" */ -#define LINUX_SYS_setgroups16 81 - -/* syscall: "oldselect" ret: "int" args: "struct linux_oldselect *" */ -#define LINUX_SYS_oldselect 82 - -/* syscall: "symlink" ret: "int" args: "const char *" "const char *" */ -#define LINUX_SYS_symlink 83 - -/* syscall: "oolstat" ret: "int" args: "const char *" "struct stat43 *" */ -#define LINUX_SYS_oolstat 84 - -/* syscall: "readlink" ret: "int" args: "const char *" "char *" "int" */ -#define LINUX_SYS_readlink 85 - -#ifdef EXEC_AOUT -/* syscall: "uselib" ret: "int" args: "const char *" */ -#define LINUX_SYS_uselib 86 - -#else -#endif -/* syscall: "swapon" ret: "int" args: "char *" */ -#define LINUX_SYS_swapon 87 - -/* syscall: "reboot" ret: "int" args: "int" "int" "int" "void *" */ -#define LINUX_SYS_reboot 88 - -/* syscall: "readdir" ret: "int" args: "int" "void *" "unsigned int" */ -#define LINUX_SYS_readdir 89 - -/* syscall: "old_mmap" ret: "int" args: "struct linux_oldmmap *" */ -#define LINUX_SYS_old_mmap 90 - -/* syscall: "munmap" ret: "int" args: "void *" "int" */ -#define LINUX_SYS_munmap 91 - -/* syscall: "truncate" ret: "int" args: "const char *" "long" */ -#define LINUX_SYS_truncate 92 - -/* syscall: "ftruncate" ret: "int" args: "int" "long" */ -#define LINUX_SYS_ftruncate 93 - -/* syscall: "fchmod" ret: "int" args: "int" "int" */ -#define LINUX_SYS_fchmod 94 - -/* syscall: "fchown16" ret: "int" args: "int" "linux_uid16_t" "linux_gid16_t" */ -#define LINUX_SYS_fchown16 95 - -/* syscall: "getpriority" ret: "int" args: "int" "int" */ -#define LINUX_SYS_getpriority 96 - -/* syscall: "setpriority" ret: "int" args: "int" "int" "int" */ -#define LINUX_SYS_setpriority 97 - -/* syscall: "profil" ret: "int" args: "void *" "u_int" "u_int" "u_int" */ -#define LINUX_SYS_profil 98 - -/* syscall: "statfs" ret: "int" args: "const char *" "struct linux_statfs *" */ -#define LINUX_SYS_statfs 99 - -/* syscall: "fstatfs" ret: "int" args: "int" "struct linux_statfs *" */ -#define LINUX_SYS_fstatfs 100 - -/* syscall: "ioperm" ret: "int" args: "unsigned int" "unsigned int" "int" */ -#define LINUX_SYS_ioperm 101 - -/* syscall: "socketcall" ret: "int" args: "int" "void *" */ -#define LINUX_SYS_socketcall 102 - -/* syscall: "setitimer" ret: "int" args: "u_int" "struct itimerval50 *" "struct itimerval50 *" */ -#define LINUX_SYS_setitimer 104 - -/* syscall: "getitimer" ret: "int" args: "u_int" "struct itimerval50 *" */ -#define LINUX_SYS_getitimer 105 - -/* syscall: "stat" ret: "int" args: "const char *" "struct linux_stat *" */ -#define LINUX_SYS_stat 106 - -/* syscall: "lstat" ret: "int" args: "const char *" "struct linux_stat *" */ -#define LINUX_SYS_lstat 107 - -/* syscall: "fstat" ret: "int" args: "int" "struct linux_stat *" */ -#define LINUX_SYS_fstat 108 - -/* syscall: "olduname" ret: "int" args: "struct linux_old_utsname *" */ -#define LINUX_SYS_olduname 109 - -/* syscall: "iopl" ret: "int" args: "int" */ -#define LINUX_SYS_iopl 110 - -/* syscall: "wait4" ret: "int" args: "int" "int *" "int" "struct rusage50 *" */ -#define LINUX_SYS_wait4 114 - -/* syscall: "swapoff" ret: "int" args: "const char *" */ -#define LINUX_SYS_swapoff 115 - -/* syscall: "sysinfo" ret: "int" args: "struct linux_sysinfo *" */ -#define LINUX_SYS_sysinfo 116 - -/* syscall: "ipc" ret: "int" args: "int" "int" "int" "int" "void *" */ -#define LINUX_SYS_ipc 117 - -/* syscall: "fsync" ret: "int" args: "int" */ -#define LINUX_SYS_fsync 118 - -/* syscall: "sigreturn" ret: "int" args: "struct linux_sigcontext *" */ -#define LINUX_SYS_sigreturn 119 - -/* syscall: "clone" ret: "int" args: "int" "void *" "void *" "void *" */ -#define LINUX_SYS_clone 120 - -/* syscall: "setdomainname" ret: "int" args: "char *" "int" */ -#define LINUX_SYS_setdomainname 121 - -/* syscall: "uname" ret: "int" args: "struct linux_utsname *" */ -#define LINUX_SYS_uname 122 - -/* syscall: "modify_ldt" ret: "int" args: "int" "void *" "size_t" */ -#define LINUX_SYS_modify_ldt 123 - -/* syscall: "mprotect" ret: "int" args: "const void *" "unsigned long" "int" */ -#define LINUX_SYS_mprotect 125 - -/* syscall: "sigprocmask" ret: "int" args: "int" "const linux_old_sigset_t *" "linux_old_sigset_t *" */ -#define LINUX_SYS_sigprocmask 126 - -/* syscall: "getpgid" ret: "pid_t" args: "pid_t" */ -#define LINUX_SYS_getpgid 132 - -/* syscall: "fchdir" ret: "int" args: "int" */ -#define LINUX_SYS_fchdir 133 - -/* syscall: "personality" ret: "int" args: "int" */ -#define LINUX_SYS_personality 136 - -/* syscall: "linux_setfsuid16" ret: "int" args: "uid_t" */ -#define LINUX_SYS_linux_setfsuid16 138 - -/* syscall: "linux_setfsgid16" ret: "int" args: "gid_t" */ -#define LINUX_SYS_linux_setfsgid16 139 - -/* syscall: "llseek" ret: "int" args: "int" "u_int32_t" "u_int32_t" "void *" "int" */ -#define LINUX_SYS_llseek 140 - -/* syscall: "getdents" ret: "int" args: "int" "struct linux_dirent *" "unsigned int" */ -#define LINUX_SYS_getdents 141 - -/* syscall: "select" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "struct timeval50 *" */ -#define LINUX_SYS_select 142 - -/* syscall: "flock" ret: "int" args: "int" "int" */ -#define LINUX_SYS_flock 143 - -/* syscall: "__msync13" ret: "int" args: "void *" "size_t" "int" */ -#define LINUX_SYS___msync13 144 - -/* syscall: "readv" ret: "int" args: "int" "struct iovec *" "u_int" */ -#define LINUX_SYS_readv 145 - -/* syscall: "writev" ret: "int" args: "int" "struct iovec *" "u_int" */ -#define LINUX_SYS_writev 146 - -/* syscall: "getsid" ret: "pid_t" args: "pid_t" */ -#define LINUX_SYS_getsid 147 - -/* syscall: "fdatasync" ret: "int" args: "int" */ -#define LINUX_SYS_fdatasync 148 - -/* syscall: "__sysctl" ret: "int" args: "struct linux___sysctl *" */ -#define LINUX_SYS___sysctl 149 - -/* syscall: "mlock" ret: "int" args: "void *" "size_t" */ -#define LINUX_SYS_mlock 150 - -/* syscall: "munlock" ret: "int" args: "void *" "size_t" */ -#define LINUX_SYS_munlock 151 - -/* syscall: "mlockall" ret: "int" args: "int" */ -#define LINUX_SYS_mlockall 152 - -/* syscall: "munlockall" ret: "int" args: */ -#define LINUX_SYS_munlockall 153 - -/* syscall: "sched_setparam" ret: "int" args: "pid_t" "const struct linux_sched_param *" */ -#define LINUX_SYS_sched_setparam 154 - -/* syscall: "sched_getparam" ret: "int" args: "pid_t" "struct linux_sched_param *" */ -#define LINUX_SYS_sched_getparam 155 - -/* syscall: "sched_setscheduler" ret: "int" args: "pid_t" "int" "const struct linux_sched_param *" */ -#define LINUX_SYS_sched_setscheduler 156 - -/* syscall: "sched_getscheduler" ret: "int" args: "pid_t" */ -#define LINUX_SYS_sched_getscheduler 157 - -/* syscall: "sched_yield" ret: "int" args: */ -#define LINUX_SYS_sched_yield 158 - -/* syscall: "sched_get_priority_max" ret: "int" args: "int" */ -#define LINUX_SYS_sched_get_priority_max 159 - -/* syscall: "sched_get_priority_min" ret: "int" args: "int" */ -#define LINUX_SYS_sched_get_priority_min 160 - -/* syscall: "nanosleep" ret: "int" args: "const struct linux_timespec *" "struct linux_timespec *" */ -#define LINUX_SYS_nanosleep 162 - -/* syscall: "mremap" ret: "void *" args: "void *" "size_t" "size_t" "u_long" */ -#define LINUX_SYS_mremap 163 - -/* syscall: "setresuid16" ret: "int" args: "linux_uid16_t" "linux_uid16_t" "linux_uid16_t" */ -#define LINUX_SYS_setresuid16 164 - -/* syscall: "getresuid16" ret: "int" args: "linux_uid16_t *" "linux_uid16_t *" "linux_uid16_t *" */ -#define LINUX_SYS_getresuid16 165 - -/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_int" "int" */ -#define LINUX_SYS_poll 168 - -/* syscall: "setresgid16" ret: "int" args: "linux_gid16_t" "linux_gid16_t" "linux_gid16_t" */ -#define LINUX_SYS_setresgid16 170 - -/* syscall: "getresgid16" ret: "int" args: "linux_gid16_t *" "linux_gid16_t *" "linux_gid16_t *" */ -#define LINUX_SYS_getresgid16 171 - -/* syscall: "rt_sigreturn" ret: "int" args: "struct linux_ucontext *" */ -#define LINUX_SYS_rt_sigreturn 173 - -/* syscall: "rt_sigaction" ret: "int" args: "int" "const struct linux_sigaction *" "struct linux_sigaction *" "size_t" */ -#define LINUX_SYS_rt_sigaction 174 - -/* syscall: "rt_sigprocmask" ret: "int" args: "int" "const linux_sigset_t *" "linux_sigset_t *" "size_t" */ -#define LINUX_SYS_rt_sigprocmask 175 - -/* syscall: "rt_sigpending" ret: "int" args: "linux_sigset_t *" "size_t" */ -#define LINUX_SYS_rt_sigpending 176 - -/* syscall: "rt_queueinfo" ret: "int" args: "int" "int" "void *" */ -#define LINUX_SYS_rt_queueinfo 178 - -/* syscall: "rt_sigsuspend" ret: "int" args: "linux_sigset_t *" "size_t" */ -#define LINUX_SYS_rt_sigsuspend 179 - -/* syscall: "pread" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */ -#define LINUX_SYS_pread 180 - -/* syscall: "pwrite" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */ -#define LINUX_SYS_pwrite 181 - -/* syscall: "chown16" ret: "int" args: "const char *" "linux_uid16_t" "linux_gid16_t" */ -#define LINUX_SYS_chown16 182 - -/* syscall: "__getcwd" ret: "int" args: "char *" "size_t" */ -#define LINUX_SYS___getcwd 183 - -/* syscall: "sigaltstack" ret: "int" args: "const struct linux_sigaltstack *" "struct linux_sigaltstack *" */ -#define LINUX_SYS_sigaltstack 186 - -/* syscall: "__vfork14" ret: "int" args: */ -#define LINUX_SYS___vfork14 190 - -/* syscall: "ugetrlimit" ret: "int" args: "int" "struct orlimit *" */ -#define LINUX_SYS_ugetrlimit 191 - -#define linux_sys_mmap2_args linux_sys_mmap_args -/* syscall: "mmap2" ret: "linux_off_t" args: "unsigned long" "size_t" "int" "int" "int" "linux_off_t" */ -#define LINUX_SYS_mmap2 192 - -/* syscall: "truncate64" ret: "int" args: "const char *" "off_t" */ -#define LINUX_SYS_truncate64 193 - -/* syscall: "ftruncate64" ret: "int" args: "unsigned int" "off_t" */ -#define LINUX_SYS_ftruncate64 194 - -/* syscall: "stat64" ret: "int" args: "const char *" "struct linux_stat64 *" */ -#define LINUX_SYS_stat64 195 - -/* syscall: "lstat64" ret: "int" args: "const char *" "struct linux_stat64 *" */ -#define LINUX_SYS_lstat64 196 - -/* syscall: "fstat64" ret: "int" args: "int" "struct linux_stat64 *" */ -#define LINUX_SYS_fstat64 197 - -/* syscall: "__posix_lchown" ret: "int" args: "const char *" "uid_t" "gid_t" */ -#define LINUX_SYS___posix_lchown 198 - -/* syscall: "getuid" ret: "uid_t" args: */ -#define LINUX_SYS_getuid 199 - -/* syscall: "getgid" ret: "gid_t" args: */ -#define LINUX_SYS_getgid 200 - -/* syscall: "geteuid" ret: "uid_t" args: */ -#define LINUX_SYS_geteuid 201 - -/* syscall: "getegid" ret: "gid_t" args: */ -#define LINUX_SYS_getegid 202 - -/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */ -#define LINUX_SYS_setreuid 203 - -/* syscall: "setregid" ret: "int" args: "gid_t" "gid_t" */ -#define LINUX_SYS_setregid 204 - -/* syscall: "getgroups" ret: "int" args: "u_int" "gid_t *" */ -#define LINUX_SYS_getgroups 205 - -/* syscall: "setgroups" ret: "int" args: "u_int" "gid_t *" */ -#define LINUX_SYS_setgroups 206 - -/* syscall: "__posix_fchown" ret: "int" args: "int" "uid_t" "gid_t" */ -#define LINUX_SYS___posix_fchown 207 - -/* syscall: "setresuid" ret: "int" args: "uid_t" "uid_t" "uid_t" */ -#define LINUX_SYS_setresuid 208 - -/* syscall: "getresuid" ret: "int" args: "uid_t *" "uid_t *" "uid_t *" */ -#define LINUX_SYS_getresuid 209 - -/* syscall: "setresgid" ret: "int" args: "gid_t" "gid_t" "gid_t" */ -#define LINUX_SYS_setresgid 210 - -/* syscall: "getresgid" ret: "int" args: "gid_t *" "gid_t *" "gid_t *" */ -#define LINUX_SYS_getresgid 211 - -/* syscall: "__posix_chown" ret: "int" args: "const char *" "uid_t" "gid_t" */ -#define LINUX_SYS___posix_chown 212 - -/* syscall: "setuid" ret: "int" args: "uid_t" */ -#define LINUX_SYS_setuid 213 - -/* syscall: "setgid" ret: "int" args: "gid_t" */ -#define LINUX_SYS_setgid 214 - -/* syscall: "setfsuid" ret: "int" args: "uid_t" */ -#define LINUX_SYS_setfsuid 215 - -/* syscall: "setfsgid" ret: "int" args: "gid_t" */ -#define LINUX_SYS_setfsgid 216 - -/* syscall: "mincore" ret: "int" args: "void *" "size_t" "char *" */ -#define LINUX_SYS_mincore 218 - -/* syscall: "madvise" ret: "int" args: "void *" "size_t" "int" */ -#define LINUX_SYS_madvise 219 - -/* syscall: "getdents64" ret: "int" args: "int" "struct linux_dirent64 *" "unsigned int" */ -#define LINUX_SYS_getdents64 220 - -/* syscall: "fcntl64" ret: "int" args: "int" "int" "void *" */ -#define LINUX_SYS_fcntl64 221 - -#ifdef LINUX_NPTL -/* syscall: "gettid" ret: "pid_t" args: */ -#define LINUX_SYS_gettid 224 - -#else -#endif -/* syscall: "setxattr" ret: "int" args: "char *" "char *" "void *" "size_t" "int" */ -#define LINUX_SYS_setxattr 226 - -/* syscall: "lsetxattr" ret: "int" args: "char *" "char *" "void *" "size_t" "int" */ -#define LINUX_SYS_lsetxattr 227 - -/* syscall: "fsetxattr" ret: "int" args: "int" "char *" "void *" "size_t" "int" */ -#define LINUX_SYS_fsetxattr 228 - -/* syscall: "getxattr" ret: "ssize_t" args: "char *" "char *" "void *" "size_t" */ -#define LINUX_SYS_getxattr 229 - -/* syscall: "lgetxattr" ret: "ssize_t" args: "char *" "char *" "void *" "size_t" */ -#define LINUX_SYS_lgetxattr 230 - -/* syscall: "fgetxattr" ret: "ssize_t" args: "int" "char *" "void *" "size_t" */ -#define LINUX_SYS_fgetxattr 231 - -/* syscall: "listxattr" ret: "ssize_t" args: "char *" "char *" "size_t" */ -#define LINUX_SYS_listxattr 232 - -/* syscall: "llistxattr" ret: "ssize_t" args: "char *" "char *" "size_t" */ -#define LINUX_SYS_llistxattr 233 - -/* syscall: "flistxattr" ret: "ssize_t" args: "int" "char *" "size_t" */ -#define LINUX_SYS_flistxattr 234 - -/* syscall: "removexattr" ret: "int" args: "char *" "char *" */ -#define LINUX_SYS_removexattr 235 - -/* syscall: "lremovexattr" ret: "int" args: "char *" "char *" */ -#define LINUX_SYS_lremovexattr 236 - -/* syscall: "fremovexattr" ret: "int" args: "int" "char *" */ -#define LINUX_SYS_fremovexattr 237 - -#ifdef LINUX_NPTL -/* syscall: "tkill" ret: "int" args: "int" "int" */ -#define LINUX_SYS_tkill 238 - -#else -#endif -/* syscall: "futex" ret: "int" args: "int *" "int" "int" "const struct linux_timespec *" "int *" "int" */ -#define LINUX_SYS_futex 240 - -#ifdef LINUX_NPTL -/* syscall: "sched_setaffinity" ret: "int" args: "pid_t" "unsigned int" "unsigned long *" */ -#define LINUX_SYS_sched_setaffinity 241 - -/* syscall: "sched_getaffinity" ret: "int" args: "pid_t" "unsigned int" "unsigned long *" */ -#define LINUX_SYS_sched_getaffinity 242 - -#else -#endif -#ifdef LINUX_NPTL -/* syscall: "set_thread_area" ret: "int" args: "struct linux_user_desc *" */ -#define LINUX_SYS_set_thread_area 243 - -/* syscall: "get_thread_area" ret: "int" args: "struct linux_user_desc *" */ -#define LINUX_SYS_get_thread_area 244 - -#else -#endif -/* syscall: "exit_group" ret: "int" args: "int" */ -#define LINUX_SYS_exit_group 252 - -#ifdef LINUX_NPTL -/* syscall: "set_tid_address" ret: "int" args: "int *" */ -#define LINUX_SYS_set_tid_address 258 - -#else -#endif -/* syscall: "clock_settime" ret: "int" args: "clockid_t" "struct linux_timespec *" */ -#define LINUX_SYS_clock_settime 264 - -/* syscall: "clock_gettime" ret: "int" args: "clockid_t" "struct linux_timespec *" */ -#define LINUX_SYS_clock_gettime 265 - -/* syscall: "clock_getres" ret: "int" args: "clockid_t" "struct linux_timespec *" */ -#define LINUX_SYS_clock_getres 266 - -/* syscall: "clock_nanosleep" ret: "int" args: "clockid_t" "int" "struct linux_timespec *" "struct linux_timespec *" */ -#define LINUX_SYS_clock_nanosleep 267 - -/* syscall: "statfs64" ret: "int" args: "const char *" "size_t" "struct linux_statfs64 *" */ -#define LINUX_SYS_statfs64 268 - -/* syscall: "fstatfs64" ret: "int" args: "int" "size_t" "struct linux_statfs64 *" */ -#define LINUX_SYS_fstatfs64 269 - -#ifdef LINUX_NPTL -/* syscall: "tgkill" ret: "int" args: "int" "int" "int" */ -#define LINUX_SYS_tgkill 270 - -#else -#endif - /* 285 is obsolete / * XXXJDM really? * / */ -/* syscall: "set_robust_list" ret: "int" args: "struct linux_robust_list_head *" "size_t" */ -#define LINUX_SYS_set_robust_list 311 - -/* syscall: "get_robust_list" ret: "int" args: "int" "struct linux_robust_list_head **" "size_t *" */ -#define LINUX_SYS_get_robust_list 312 - -#define LINUX_SYS_MAXSYSCALL 317 -#define LINUX_SYS_NSYSENT 512 -#endif /* _LINUX_SYS_SYSCALL_H_ */ - diff --git a/system/linux/i686/system_calls.S b/system/linux/i686/system_calls.S deleted file mode 100644 index 8e1d6f9..0000000 --- a/system/linux/i686/system_calls.S +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (c) 2009, Henrique Dante de Almeida - 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. -*/ - -.global syscall1 -.type syscall1,@function -.global syscall3 -.type syscall3,@function - -/* System calls in x86 are informally described in blogs and mailing lists. - See, for example: - http://hdante.blogspot.com/2007/02/getting-vsyscall-address-from-elf.html - Calling conventions are described on the System V x86 ABI supplement. - Paramenter sequence is: %ebx, %ecx, %edx, %esi, %edi and %ebp - See, for example: - http://www.linuxjournal.com/article/4048 - - TODO: remove calculation for kernel_vsyscall (use a fixed address) -*/ - - -syscall1: - pushl %ebp - movl %esp, %ebp - pushl %ebx - call get_abs_address - addl $_GLOBAL_OFFSET_TABLE_, %ebx - movl kernel_vsyscall@GOT(%ebx), %ecx - movl 8(%ebp), %eax - movl 12(%ebp), %ebx - call *(%ecx) - popl %ebx - popl %ebp - ret - -syscall3: - pushl %ebp - movl %esp, %ebp - pushl %edi - pushl %ebx - call get_abs_address - addl $_GLOBAL_OFFSET_TABLE_, %ebx - movl kernel_vsyscall@GOT(%ebx), %edi - movl 8(%ebp), %eax - movl 12(%ebp), %ebx - movl 16(%ebp), %ecx - movl 20(%ebp), %edx - call *(%edi) - popl %ebx - popl %edi - popl %ebp - ret - -get_abs_address: - mov (%esp), %ebx - ret - diff --git a/system/linux/x86_32/system_call_numbers.h b/system/linux/x86_32/system_call_numbers.h new file mode 100644 index 0000000..04c78a5 --- /dev/null +++ b/system/linux/x86_32/system_call_numbers.h @@ -0,0 +1,732 @@ +/* + Copyright (c) 2009, Henrique Dante de Almeida + Copyright (c) 2009, njoly (NetBSD) + 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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. + +*/ +/* $NetBSD: linux_syscall.h,v 1.83 2009/01/17 22:34:02 c Exp $ */ + +/* + * System call numbers. + * + * DO NOT EDIT-- this file is automatically generated. + * created from NetBSD: syscalls.master,v 1.99 2009/01/17 22:28:52 njoly Exp + */ + +#ifndef _LINUX_SYS_SYSCALL_H_ +#define _LINUX_SYS_SYSCALL_H_ + +#define LINUX_SYS_MAXSYSARGS 8 + +/* syscall: "syscall" ret: "int" args: */ +#define LINUX_SYS_syscall 0 + +/* syscall: "exit" ret: "int" args: "int" */ +#define LINUX_SYS_exit 1 + +/* syscall: "fork" ret: "int" args: */ +#define LINUX_SYS_fork 2 + +/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */ +#define LINUX_SYS_read 3 + +/* syscall: "write" ret: "int" args: "int" "char *" "u_int" */ +#define LINUX_SYS_write 4 + +/* syscall: "open" ret: "int" args: "const char *" "int" "int" */ +#define LINUX_SYS_open 5 + +/* syscall: "close" ret: "int" args: "int" */ +#define LINUX_SYS_close 6 + +/* syscall: "waitpid" ret: "int" args: "int" "int *" "int" */ +#define LINUX_SYS_waitpid 7 + +/* syscall: "creat" ret: "int" args: "const char *" "int" */ +#define LINUX_SYS_creat 8 + +/* syscall: "link" ret: "int" args: "const char *" "const char *" */ +#define LINUX_SYS_link 9 + +/* syscall: "unlink" ret: "int" args: "const char *" */ +#define LINUX_SYS_unlink 10 + +/* syscall: "execve" ret: "int" args: "const char *" "char **" "char **" */ +#define LINUX_SYS_execve 11 + +/* syscall: "chdir" ret: "int" args: "const char *" */ +#define LINUX_SYS_chdir 12 + +/* syscall: "time" ret: "int" args: "linux_time_t *" */ +#define LINUX_SYS_time 13 + +/* syscall: "mknod" ret: "int" args: "const char *" "int" "int" */ +#define LINUX_SYS_mknod 14 + +/* syscall: "chmod" ret: "int" args: "const char *" "int" */ +#define LINUX_SYS_chmod 15 + +/* syscall: "lchown16" ret: "int" args: "const char *" "linux_uid16_t" "linux_gid16_t" */ +#define LINUX_SYS_lchown16 16 + +/* syscall: "break" ret: "int" args: "char *" */ +#define LINUX_SYS_break 17 + + /* 18 is obsolete ostat */ +/* syscall: "lseek" ret: "long" args: "int" "long" "int" */ +#define LINUX_SYS_lseek 19 + +#ifdef LINUX_NPTL +/* syscall: "getpid" ret: "pid_t" args: */ +#define LINUX_SYS_getpid 20 + +#else +/* syscall: "getpid" ret: "pid_t" args: */ +#define LINUX_SYS_getpid 20 + +#endif +/* syscall: "linux_setuid16" ret: "int" args: "uid_t" */ +#define LINUX_SYS_linux_setuid16 23 + +/* syscall: "linux_getuid16" ret: "uid_t" args: */ +#define LINUX_SYS_linux_getuid16 24 + +/* syscall: "stime" ret: "int" args: "linux_time_t *" */ +#define LINUX_SYS_stime 25 + +/* syscall: "ptrace" ret: "int" args: "int" "int" "int" "int" */ +#define LINUX_SYS_ptrace 26 + +/* syscall: "alarm" ret: "int" args: "unsigned int" */ +#define LINUX_SYS_alarm 27 + + /* 28 is obsolete ofstat */ +/* syscall: "pause" ret: "int" args: */ +#define LINUX_SYS_pause 29 + +/* syscall: "utime" ret: "int" args: "const char *" "struct linux_utimbuf *" */ +#define LINUX_SYS_utime 30 + + /* 31 is obsolete stty */ + /* 32 is obsolete gtty */ +/* syscall: "access" ret: "int" args: "const char *" "int" */ +#define LINUX_SYS_access 33 + +/* syscall: "nice" ret: "int" args: "int" */ +#define LINUX_SYS_nice 34 + + /* 35 is obsolete ftime */ +/* syscall: "sync" ret: "int" args: */ +#define LINUX_SYS_sync 36 + +/* syscall: "kill" ret: "int" args: "int" "int" */ +#define LINUX_SYS_kill 37 + +/* syscall: "__posix_rename" ret: "int" args: "const char *" "const char *" */ +#define LINUX_SYS___posix_rename 38 + +/* syscall: "mkdir" ret: "int" args: "const char *" "int" */ +#define LINUX_SYS_mkdir 39 + +/* syscall: "rmdir" ret: "int" args: "const char *" */ +#define LINUX_SYS_rmdir 40 + +/* syscall: "dup" ret: "int" args: "u_int" */ +#define LINUX_SYS_dup 41 + +/* syscall: "pipe" ret: "int" args: "int *" */ +#define LINUX_SYS_pipe 42 + +/* syscall: "times" ret: "int" args: "struct times *" */ +#define LINUX_SYS_times 43 + + /* 44 is obsolete prof */ +/* syscall: "brk" ret: "int" args: "char *" */ +#define LINUX_SYS_brk 45 + +/* syscall: "linux_setgid16" ret: "int" args: "gid_t" */ +#define LINUX_SYS_linux_setgid16 46 + +/* syscall: "linux_getgid16" ret: "gid_t" args: */ +#define LINUX_SYS_linux_getgid16 47 + +/* syscall: "signal" ret: "int" args: "int" "linux_handler_t" */ +#define LINUX_SYS_signal 48 + +/* syscall: "linux_geteuid16" ret: "uid_t" args: */ +#define LINUX_SYS_linux_geteuid16 49 + +/* syscall: "linux_getegid16" ret: "gid_t" args: */ +#define LINUX_SYS_linux_getegid16 50 + +/* syscall: "acct" ret: "int" args: "char *" */ +#define LINUX_SYS_acct 51 + + /* 52 is obsolete phys */ + /* 53 is obsolete lock */ +/* syscall: "ioctl" ret: "int" args: "int" "u_long" "void *" */ +#define LINUX_SYS_ioctl 54 + +/* syscall: "fcntl" ret: "int" args: "int" "int" "void *" */ +#define LINUX_SYS_fcntl 55 + + /* 56 is obsolete mpx */ +/* syscall: "setpgid" ret: "int" args: "int" "int" */ +#define LINUX_SYS_setpgid 57 + + /* 58 is obsolete ulimit */ +/* syscall: "oldolduname" ret: "int" args: "struct linux_oldold_utsname *" */ +#define LINUX_SYS_oldolduname 59 + +/* syscall: "umask" ret: "int" args: "int" */ +#define LINUX_SYS_umask 60 + +/* syscall: "chroot" ret: "int" args: "char *" */ +#define LINUX_SYS_chroot 61 + +/* syscall: "dup2" ret: "int" args: "u_int" "u_int" */ +#define LINUX_SYS_dup2 63 + +#ifdef LINUX_NPTL +/* syscall: "getppid" ret: "pid_t" args: */ +#define LINUX_SYS_getppid 64 + +#else +/* syscall: "getppid" ret: "pid_t" args: */ +#define LINUX_SYS_getppid 64 + +#endif +/* syscall: "getpgrp" ret: "int" args: */ +#define LINUX_SYS_getpgrp 65 + +/* syscall: "setsid" ret: "int" args: */ +#define LINUX_SYS_setsid 66 + +/* syscall: "sigaction" ret: "int" args: "int" "const struct linux_old_sigaction *" "struct linux_old_sigaction *" */ +#define LINUX_SYS_sigaction 67 + +/* syscall: "siggetmask" ret: "int" args: */ +#define LINUX_SYS_siggetmask 68 + +/* syscall: "sigsetmask" ret: "int" args: "linux_old_sigset_t" */ +#define LINUX_SYS_sigsetmask 69 + +/* syscall: "setreuid16" ret: "int" args: "linux_uid16_t" "linux_uid16_t" */ +#define LINUX_SYS_setreuid16 70 + +/* syscall: "setregid16" ret: "int" args: "linux_gid16_t" "linux_gid16_t" */ +#define LINUX_SYS_setregid16 71 + +/* syscall: "sigsuspend" ret: "int" args: "void *" "int" "int" */ +#define LINUX_SYS_sigsuspend 72 + +/* syscall: "sigpending" ret: "int" args: "linux_old_sigset_t *" */ +#define LINUX_SYS_sigpending 73 + +/* syscall: "sethostname" ret: "int" args: "char *" "u_int" */ +#define LINUX_SYS_sethostname 74 + +/* syscall: "setrlimit" ret: "int" args: "u_int" "struct orlimit *" */ +#define LINUX_SYS_setrlimit 75 + +/* syscall: "getrlimit" ret: "int" args: "u_int" "struct orlimit *" */ +#define LINUX_SYS_getrlimit 76 + +/* syscall: "getrusage" ret: "int" args: "int" "struct rusage50 *" */ +#define LINUX_SYS_getrusage 77 + +/* syscall: "gettimeofday" ret: "int" args: "struct timeval50 *" "struct timezone *" */ +#define LINUX_SYS_gettimeofday 78 + +/* syscall: "settimeofday" ret: "int" args: "struct timeval50 *" "struct timezone *" */ +#define LINUX_SYS_settimeofday 79 + +/* syscall: "getgroups16" ret: "int" args: "int" "linux_gid16_t *" */ +#define LINUX_SYS_getgroups16 80 + +/* syscall: "setgroups16" ret: "int" args: "int" "linux_gid16_t *" */ +#define LINUX_SYS_setgroups16 81 + +/* syscall: "oldselect" ret: "int" args: "struct linux_oldselect *" */ +#define LINUX_SYS_oldselect 82 + +/* syscall: "symlink" ret: "int" args: "const char *" "const char *" */ +#define LINUX_SYS_symlink 83 + +/* syscall: "oolstat" ret: "int" args: "const char *" "struct stat43 *" */ +#define LINUX_SYS_oolstat 84 + +/* syscall: "readlink" ret: "int" args: "const char *" "char *" "int" */ +#define LINUX_SYS_readlink 85 + +#ifdef EXEC_AOUT +/* syscall: "uselib" ret: "int" args: "const char *" */ +#define LINUX_SYS_uselib 86 + +#else +#endif +/* syscall: "swapon" ret: "int" args: "char *" */ +#define LINUX_SYS_swapon 87 + +/* syscall: "reboot" ret: "int" args: "int" "int" "int" "void *" */ +#define LINUX_SYS_reboot 88 + +/* syscall: "readdir" ret: "int" args: "int" "void *" "unsigned int" */ +#define LINUX_SYS_readdir 89 + +/* syscall: "old_mmap" ret: "int" args: "struct linux_oldmmap *" */ +#define LINUX_SYS_old_mmap 90 + +/* syscall: "munmap" ret: "int" args: "void *" "int" */ +#define LINUX_SYS_munmap 91 + +/* syscall: "truncate" ret: "int" args: "const char *" "long" */ +#define LINUX_SYS_truncate 92 + +/* syscall: "ftruncate" ret: "int" args: "int" "long" */ +#define LINUX_SYS_ftruncate 93 + +/* syscall: "fchmod" ret: "int" args: "int" "int" */ +#define LINUX_SYS_fchmod 94 + +/* syscall: "fchown16" ret: "int" args: "int" "linux_uid16_t" "linux_gid16_t" */ +#define LINUX_SYS_fchown16 95 + +/* syscall: "getpriority" ret: "int" args: "int" "int" */ +#define LINUX_SYS_getpriority 96 + +/* syscall: "setpriority" ret: "int" args: "int" "int" "int" */ +#define LINUX_SYS_setpriority 97 + +/* syscall: "profil" ret: "int" args: "void *" "u_int" "u_int" "u_int" */ +#define LINUX_SYS_profil 98 + +/* syscall: "statfs" ret: "int" args: "const char *" "struct linux_statfs *" */ +#define LINUX_SYS_statfs 99 + +/* syscall: "fstatfs" ret: "int" args: "int" "struct linux_statfs *" */ +#define LINUX_SYS_fstatfs 100 + +/* syscall: "ioperm" ret: "int" args: "unsigned int" "unsigned int" "int" */ +#define LINUX_SYS_ioperm 101 + +/* syscall: "socketcall" ret: "int" args: "int" "void *" */ +#define LINUX_SYS_socketcall 102 + +/* syscall: "setitimer" ret: "int" args: "u_int" "struct itimerval50 *" "struct itimerval50 *" */ +#define LINUX_SYS_setitimer 104 + +/* syscall: "getitimer" ret: "int" args: "u_int" "struct itimerval50 *" */ +#define LINUX_SYS_getitimer 105 + +/* syscall: "stat" ret: "int" args: "const char *" "struct linux_stat *" */ +#define LINUX_SYS_stat 106 + +/* syscall: "lstat" ret: "int" args: "const char *" "struct linux_stat *" */ +#define LINUX_SYS_lstat 107 + +/* syscall: "fstat" ret: "int" args: "int" "struct linux_stat *" */ +#define LINUX_SYS_fstat 108 + +/* syscall: "olduname" ret: "int" args: "struct linux_old_utsname *" */ +#define LINUX_SYS_olduname 109 + +/* syscall: "iopl" ret: "int" args: "int" */ +#define LINUX_SYS_iopl 110 + +/* syscall: "wait4" ret: "int" args: "int" "int *" "int" "struct rusage50 *" */ +#define LINUX_SYS_wait4 114 + +/* syscall: "swapoff" ret: "int" args: "const char *" */ +#define LINUX_SYS_swapoff 115 + +/* syscall: "sysinfo" ret: "int" args: "struct linux_sysinfo *" */ +#define LINUX_SYS_sysinfo 116 + +/* syscall: "ipc" ret: "int" args: "int" "int" "int" "int" "void *" */ +#define LINUX_SYS_ipc 117 + +/* syscall: "fsync" ret: "int" args: "int" */ +#define LINUX_SYS_fsync 118 + +/* syscall: "sigreturn" ret: "int" args: "struct linux_sigcontext *" */ +#define LINUX_SYS_sigreturn 119 + +/* syscall: "clone" ret: "int" args: "int" "void *" "void *" "void *" */ +#define LINUX_SYS_clone 120 + +/* syscall: "setdomainname" ret: "int" args: "char *" "int" */ +#define LINUX_SYS_setdomainname 121 + +/* syscall: "uname" ret: "int" args: "struct linux_utsname *" */ +#define LINUX_SYS_uname 122 + +/* syscall: "modify_ldt" ret: "int" args: "int" "void *" "size_t" */ +#define LINUX_SYS_modify_ldt 123 + +/* syscall: "mprotect" ret: "int" args: "const void *" "unsigned long" "int" */ +#define LINUX_SYS_mprotect 125 + +/* syscall: "sigprocmask" ret: "int" args: "int" "const linux_old_sigset_t *" "linux_old_sigset_t *" */ +#define LINUX_SYS_sigprocmask 126 + +/* syscall: "getpgid" ret: "pid_t" args: "pid_t" */ +#define LINUX_SYS_getpgid 132 + +/* syscall: "fchdir" ret: "int" args: "int" */ +#define LINUX_SYS_fchdir 133 + +/* syscall: "personality" ret: "int" args: "int" */ +#define LINUX_SYS_personality 136 + +/* syscall: "linux_setfsuid16" ret: "int" args: "uid_t" */ +#define LINUX_SYS_linux_setfsuid16 138 + +/* syscall: "linux_setfsgid16" ret: "int" args: "gid_t" */ +#define LINUX_SYS_linux_setfsgid16 139 + +/* syscall: "llseek" ret: "int" args: "int" "u_int32_t" "u_int32_t" "void *" "int" */ +#define LINUX_SYS_llseek 140 + +/* syscall: "getdents" ret: "int" args: "int" "struct linux_dirent *" "unsigned int" */ +#define LINUX_SYS_getdents 141 + +/* syscall: "select" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "struct timeval50 *" */ +#define LINUX_SYS_select 142 + +/* syscall: "flock" ret: "int" args: "int" "int" */ +#define LINUX_SYS_flock 143 + +/* syscall: "__msync13" ret: "int" args: "void *" "size_t" "int" */ +#define LINUX_SYS___msync13 144 + +/* syscall: "readv" ret: "int" args: "int" "struct iovec *" "u_int" */ +#define LINUX_SYS_readv 145 + +/* syscall: "writev" ret: "int" args: "int" "struct iovec *" "u_int" */ +#define LINUX_SYS_writev 146 + +/* syscall: "getsid" ret: "pid_t" args: "pid_t" */ +#define LINUX_SYS_getsid 147 + +/* syscall: "fdatasync" ret: "int" args: "int" */ +#define LINUX_SYS_fdatasync 148 + +/* syscall: "__sysctl" ret: "int" args: "struct linux___sysctl *" */ +#define LINUX_SYS___sysctl 149 + +/* syscall: "mlock" ret: "int" args: "void *" "size_t" */ +#define LINUX_SYS_mlock 150 + +/* syscall: "munlock" ret: "int" args: "void *" "size_t" */ +#define LINUX_SYS_munlock 151 + +/* syscall: "mlockall" ret: "int" args: "int" */ +#define LINUX_SYS_mlockall 152 + +/* syscall: "munlockall" ret: "int" args: */ +#define LINUX_SYS_munlockall 153 + +/* syscall: "sched_setparam" ret: "int" args: "pid_t" "const struct linux_sched_param *" */ +#define LINUX_SYS_sched_setparam 154 + +/* syscall: "sched_getparam" ret: "int" args: "pid_t" "struct linux_sched_param *" */ +#define LINUX_SYS_sched_getparam 155 + +/* syscall: "sched_setscheduler" ret: "int" args: "pid_t" "int" "const struct linux_sched_param *" */ +#define LINUX_SYS_sched_setscheduler 156 + +/* syscall: "sched_getscheduler" ret: "int" args: "pid_t" */ +#define LINUX_SYS_sched_getscheduler 157 + +/* syscall: "sched_yield" ret: "int" args: */ +#define LINUX_SYS_sched_yield 158 + +/* syscall: "sched_get_priority_max" ret: "int" args: "int" */ +#define LINUX_SYS_sched_get_priority_max 159 + +/* syscall: "sched_get_priority_min" ret: "int" args: "int" */ +#define LINUX_SYS_sched_get_priority_min 160 + +/* syscall: "nanosleep" ret: "int" args: "const struct linux_timespec *" "struct linux_timespec *" */ +#define LINUX_SYS_nanosleep 162 + +/* syscall: "mremap" ret: "void *" args: "void *" "size_t" "size_t" "u_long" */ +#define LINUX_SYS_mremap 163 + +/* syscall: "setresuid16" ret: "int" args: "linux_uid16_t" "linux_uid16_t" "linux_uid16_t" */ +#define LINUX_SYS_setresuid16 164 + +/* syscall: "getresuid16" ret: "int" args: "linux_uid16_t *" "linux_uid16_t *" "linux_uid16_t *" */ +#define LINUX_SYS_getresuid16 165 + +/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_int" "int" */ +#define LINUX_SYS_poll 168 + +/* syscall: "setresgid16" ret: "int" args: "linux_gid16_t" "linux_gid16_t" "linux_gid16_t" */ +#define LINUX_SYS_setresgid16 170 + +/* syscall: "getresgid16" ret: "int" args: "linux_gid16_t *" "linux_gid16_t *" "linux_gid16_t *" */ +#define LINUX_SYS_getresgid16 171 + +/* syscall: "rt_sigreturn" ret: "int" args: "struct linux_ucontext *" */ +#define LINUX_SYS_rt_sigreturn 173 + +/* syscall: "rt_sigaction" ret: "int" args: "int" "const struct linux_sigaction *" "struct linux_sigaction *" "size_t" */ +#define LINUX_SYS_rt_sigaction 174 + +/* syscall: "rt_sigprocmask" ret: "int" args: "int" "const linux_sigset_t *" "linux_sigset_t *" "size_t" */ +#define LINUX_SYS_rt_sigprocmask 175 + +/* syscall: "rt_sigpending" ret: "int" args: "linux_sigset_t *" "size_t" */ +#define LINUX_SYS_rt_sigpending 176 + +/* syscall: "rt_queueinfo" ret: "int" args: "int" "int" "void *" */ +#define LINUX_SYS_rt_queueinfo 178 + +/* syscall: "rt_sigsuspend" ret: "int" args: "linux_sigset_t *" "size_t" */ +#define LINUX_SYS_rt_sigsuspend 179 + +/* syscall: "pread" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */ +#define LINUX_SYS_pread 180 + +/* syscall: "pwrite" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */ +#define LINUX_SYS_pwrite 181 + +/* syscall: "chown16" ret: "int" args: "const char *" "linux_uid16_t" "linux_gid16_t" */ +#define LINUX_SYS_chown16 182 + +/* syscall: "__getcwd" ret: "int" args: "char *" "size_t" */ +#define LINUX_SYS___getcwd 183 + +/* syscall: "sigaltstack" ret: "int" args: "const struct linux_sigaltstack *" "struct linux_sigaltstack *" */ +#define LINUX_SYS_sigaltstack 186 + +/* syscall: "__vfork14" ret: "int" args: */ +#define LINUX_SYS___vfork14 190 + +/* syscall: "ugetrlimit" ret: "int" args: "int" "struct orlimit *" */ +#define LINUX_SYS_ugetrlimit 191 + +#define linux_sys_mmap2_args linux_sys_mmap_args +/* syscall: "mmap2" ret: "linux_off_t" args: "unsigned long" "size_t" "int" "int" "int" "linux_off_t" */ +#define LINUX_SYS_mmap2 192 + +/* syscall: "truncate64" ret: "int" args: "const char *" "off_t" */ +#define LINUX_SYS_truncate64 193 + +/* syscall: "ftruncate64" ret: "int" args: "unsigned int" "off_t" */ +#define LINUX_SYS_ftruncate64 194 + +/* syscall: "stat64" ret: "int" args: "const char *" "struct linux_stat64 *" */ +#define LINUX_SYS_stat64 195 + +/* syscall: "lstat64" ret: "int" args: "const char *" "struct linux_stat64 *" */ +#define LINUX_SYS_lstat64 196 + +/* syscall: "fstat64" ret: "int" args: "int" "struct linux_stat64 *" */ +#define LINUX_SYS_fstat64 197 + +/* syscall: "__posix_lchown" ret: "int" args: "const char *" "uid_t" "gid_t" */ +#define LINUX_SYS___posix_lchown 198 + +/* syscall: "getuid" ret: "uid_t" args: */ +#define LINUX_SYS_getuid 199 + +/* syscall: "getgid" ret: "gid_t" args: */ +#define LINUX_SYS_getgid 200 + +/* syscall: "geteuid" ret: "uid_t" args: */ +#define LINUX_SYS_geteuid 201 + +/* syscall: "getegid" ret: "gid_t" args: */ +#define LINUX_SYS_getegid 202 + +/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */ +#define LINUX_SYS_setreuid 203 + +/* syscall: "setregid" ret: "int" args: "gid_t" "gid_t" */ +#define LINUX_SYS_setregid 204 + +/* syscall: "getgroups" ret: "int" args: "u_int" "gid_t *" */ +#define LINUX_SYS_getgroups 205 + +/* syscall: "setgroups" ret: "int" args: "u_int" "gid_t *" */ +#define LINUX_SYS_setgroups 206 + +/* syscall: "__posix_fchown" ret: "int" args: "int" "uid_t" "gid_t" */ +#define LINUX_SYS___posix_fchown 207 + +/* syscall: "setresuid" ret: "int" args: "uid_t" "uid_t" "uid_t" */ +#define LINUX_SYS_setresuid 208 + +/* syscall: "getresuid" ret: "int" args: "uid_t *" "uid_t *" "uid_t *" */ +#define LINUX_SYS_getresuid 209 + +/* syscall: "setresgid" ret: "int" args: "gid_t" "gid_t" "gid_t" */ +#define LINUX_SYS_setresgid 210 + +/* syscall: "getresgid" ret: "int" args: "gid_t *" "gid_t *" "gid_t *" */ +#define LINUX_SYS_getresgid 211 + +/* syscall: "__posix_chown" ret: "int" args: "const char *" "uid_t" "gid_t" */ +#define LINUX_SYS___posix_chown 212 + +/* syscall: "setuid" ret: "int" args: "uid_t" */ +#define LINUX_SYS_setuid 213 + +/* syscall: "setgid" ret: "int" args: "gid_t" */ +#define LINUX_SYS_setgid 214 + +/* syscall: "setfsuid" ret: "int" args: "uid_t" */ +#define LINUX_SYS_setfsuid 215 + +/* syscall: "setfsgid" ret: "int" args: "gid_t" */ +#define LINUX_SYS_setfsgid 216 + +/* syscall: "mincore" ret: "int" args: "void *" "size_t" "char *" */ +#define LINUX_SYS_mincore 218 + +/* syscall: "madvise" ret: "int" args: "void *" "size_t" "int" */ +#define LINUX_SYS_madvise 219 + +/* syscall: "getdents64" ret: "int" args: "int" "struct linux_dirent64 *" "unsigned int" */ +#define LINUX_SYS_getdents64 220 + +/* syscall: "fcntl64" ret: "int" args: "int" "int" "void *" */ +#define LINUX_SYS_fcntl64 221 + +#ifdef LINUX_NPTL +/* syscall: "gettid" ret: "pid_t" args: */ +#define LINUX_SYS_gettid 224 + +#else +#endif +/* syscall: "setxattr" ret: "int" args: "char *" "char *" "void *" "size_t" "int" */ +#define LINUX_SYS_setxattr 226 + +/* syscall: "lsetxattr" ret: "int" args: "char *" "char *" "void *" "size_t" "int" */ +#define LINUX_SYS_lsetxattr 227 + +/* syscall: "fsetxattr" ret: "int" args: "int" "char *" "void *" "size_t" "int" */ +#define LINUX_SYS_fsetxattr 228 + +/* syscall: "getxattr" ret: "ssize_t" args: "char *" "char *" "void *" "size_t" */ +#define LINUX_SYS_getxattr 229 + +/* syscall: "lgetxattr" ret: "ssize_t" args: "char *" "char *" "void *" "size_t" */ +#define LINUX_SYS_lgetxattr 2... [truncated message content] |
From: Kirill A. S. <ki...@sh...> - 2009-06-26 14:44:20
|
Not every kernel provide __kernel_vsyscall. It's possible to add configuration option later. Signed-off-by: Kirill A. Shutemov <ki...@sh...> --- runtime/linux/x86_32/architecture_init.c | 22 +--------------------- system/linux/x86_32/system_calls.S | 17 ++--------------- 2 files changed, 3 insertions(+), 36 deletions(-) diff --git a/runtime/linux/x86_32/architecture_init.c b/runtime/linux/x86_32/architecture_init.c index f080dc4..f3fb6e6 100644 --- a/runtime/linux/x86_32/architecture_init.c +++ b/runtime/linux/x86_32/architecture_init.c @@ -27,28 +27,8 @@ POSSIBILITY OF SUCH DAMAGE. #include <stddef.h> #include "runtime.h" -void (*kernel_vsyscall)(); - -/* AT_SYSINFO entry has the vsyscall address */ -#define AT_SYSINFO 32 - -void set_kernel_vsyscall(const auxv_t *auxv) -{ - if (auxv != NULL) { - const auxv_t *auxv_walk; - for (auxv_walk = auxv; auxv_walk->a_type != 0; auxv_walk++) { - if (auxv_walk->a_type == AT_SYSINFO) { - kernel_vsyscall = auxv_walk->a_un.a_fcn; - return; - - } - } - // ERROR: AT_SYSINFO entry not found - } -} - void architecture_init(int argc, const char **argv, const char **envp, const auxv_t *auxv) { - set_kernel_vsyscall(auxv); + /* Do nothing */ } diff --git a/system/linux/x86_32/system_calls.S b/system/linux/x86_32/system_calls.S index 8e1d6f9..f11f8ca 100644 --- a/system/linux/x86_32/system_calls.S +++ b/system/linux/x86_32/system_calls.S @@ -36,8 +36,6 @@ POSSIBILITY OF SUCH DAMAGE. Paramenter sequence is: %ebx, %ecx, %edx, %esi, %edi and %ebp See, for example: http://www.linuxjournal.com/article/4048 - - TODO: remove calculation for kernel_vsyscall (use a fixed address) */ @@ -45,12 +43,9 @@ syscall1: pushl %ebp movl %esp, %ebp pushl %ebx - call get_abs_address - addl $_GLOBAL_OFFSET_TABLE_, %ebx - movl kernel_vsyscall@GOT(%ebx), %ecx movl 8(%ebp), %eax movl 12(%ebp), %ebx - call *(%ecx) + int $0x80 popl %ebx popl %ebp ret @@ -60,20 +55,12 @@ syscall3: movl %esp, %ebp pushl %edi pushl %ebx - call get_abs_address - addl $_GLOBAL_OFFSET_TABLE_, %ebx - movl kernel_vsyscall@GOT(%ebx), %edi movl 8(%ebp), %eax movl 12(%ebp), %ebx movl 16(%ebp), %ecx movl 20(%ebp), %edx - call *(%edi) + int $0x80 popl %ebx popl %edi popl %ebp ret - -get_abs_address: - mov (%esp), %ebx - ret - -- 1.6.3.3 |
From: Henrique A. <hd...@gm...> - 2009-06-24 17:01:46
|
The project doesn't aim to target most restricted environments. As a general rule, the target platform must fully suport POSIX requirements (at least all the mandatory parts) and such environments are usually powerful enough to support compilers, like gcc (thus c++) and others. I know that CMake isn't portable to some platforms, but: - it should be easily ported to all platforms we are targeting (ie, full featured Unix systems) - even when there are no native C++ compilers for some target, a C++ application can be built with a cross compiler (the actual deployment on the target board may be easy or hard depending on the vendor tools) Do you have some specific embedded target in mind ? In general, libposix doesn't support embedded targets for the above reason. This is regarded as a good thing, because any user of libposix can trust on which features are available on the system (at least the mandatory ones). Also, there are many other libc implementations that target embedded system that can do a better job than libposix for that purpose: they are the uclibc, newlibc, and (soon) eglibc (and we don't try to compete with projects that already do it right, we only complement them). See the libc comparison page, for a better explanation when each libc implementation is better suited: http://sourceforge.net/apps/mediawiki/libposix/index.php?title=Compare Do you have an specific embedded environment in mind ? If you need a good "insanely" stripped down libc implementation, a starting point is Android libc. It's a stripped down FreeBSD libc ported to linux, which aims to do only what Android tools need and nothing else. ;-) A note about CMake: I'm in the middle of the process of porting our GNU Makefile to CMake. The main reason for that is code maintainability. GNU make is too powerful and, traditionally, makefiles become unreadable and unmantainable with time. CMake is automatically dealing with specific platform tools, so we don't need to deal with them most of the time. Said that, I must confess that I'm not overly confident with the CMake port. It's not that CMake can't do the most usual cases perfectly (which are compiling or cross compiling for a single target). I'm afraid CMake doesn't have support to do the most advanced tasks (eg: single command cross compilation to multiple targets, deploying libraries in emulators, testing them, etc.) without custom commands. If CMake becomes more a burden than a useful tool, then we'll need to choose something else (eg, GNU Make). For short: CMake was chosen because it's accordance with the project's goals. 2009/6/24 Kirill A. Shutemov <ki...@sh...>: > Why does the project use CMake? CMake has written in C++. C++ is not > available on every platform(e.g. embedded). I think better way is use > GNU Make instead of CMake to improve portability. > > ------------------------------------------------------------------------------ > _______________________________________________ > Libposix-development mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libposix-development > -- Henrique Dante de Almeida hd...@gm... |
From: Kirill A. S. <ki...@sh...> - 2009-06-24 11:17:16
|
Why does the project use CMake? CMake has written in C++. C++ is not available on every platform(e.g. embedded). I think better way is use GNU Make instead of CMake to improve portability. |
From: Henrique A. <hd...@gm...> - 2009-06-24 02:05:41
|
2009/6/23 Aníbal Monsalve Salazar <an...@de...>: > > Thank you. No problem. > > > That fixed my build problem. > > When do you plan to provide proper versioned symbols? It's a project goal to provide exactly one version of each function at any moment. In principle symbol versions wouldn't be necessary. Is this an unconditional requirement of Debian packages ? > > I would like to upload my package to Debian (Ubuntu will pick it up > eventually) but I found some issues with the shared library. They are > listed below. Note that currently libposix can only run one program (hello world). It's in pre pre pre pre alpha state. :-) Is it safe to submit it to Debian ? For the test below, it shows three problems: - The stack is flagged as executable - The library file name doesn't have a version - The library doesn't have dependency information The third problem is not a problem. The library doesn't depend on any other library (it's statically linked). For the other two problems: I'm somewhat busy right now implementing printf, so I won't be able to work on those soon. Can you deal with them ? If that's not possible, please file bugs to the tracker, so that we can track their progress. http://sourceforge.net/tracker/?group_id=261625 > > lintian -i /tmp/libposix/libposix_0-1_i386.changes > W: libposix-dev: shlib-with-executable-stack usr/lib/libposix.so > N: > N: The listed shared libraries declares the stack as executable. > N: > N: Executable stack is usually an error as it is only needed if the code > N: contains GCC trampolines or similar constructs which uses code on the > N: stack. One possible source for false positives are object files built > N: from assembler files which don't define a proper .note.GNU-stack > N: section. > N: > N: To see the permissions on the stack, run readelf -l on the shared > N: library and look for the program header of type GNU_STACK. In the flag > N: column, there should not be an E flag set. > N: > W: libposix-dev: shlib-without-versioned-soname usr/lib/libposix.so libposix.so > N: > N: The listed shared library in a public library directory has an SONAME > N: that does not contain any versioning information, either after the .so > N: or before it and set off by a hyphen. It cannot therefore be represented > N: in the shlibs system, and if linked by binaries its interface cannot > N: safely change. There is no backward-compatible way to migrate programs > N: linked against it to a new ABI. > N: > N: Normally, this means the shared library is a private library for a > N: particular application and is not meant for general use. Policy > N: recommends that such libraries be installed in a subdirectory of > N: /usr/lib rather than in a public shared library directory. > N: > N: To view the SONAME of a shared library, run readelf -d on the shared > N: library and look for the tag of type SONAME. > N: > N: There are some special stub libraries or special-purpose shared objects > N: for which an ABI version is not meaningful. If this is one of those > N: cases, please add an override. > N: > N: Refer to Debian Policy Manual section 10.2 (Libraries) and Debian Policy > N: Manual section 8.6 (Dependencies between the library and other packages > N: - the shlibs system) for details. > N: > W: libposix-dev: shared-lib-without-dependency-information ./usr/lib/libposix.so > N: > N: The listed shared library doesn't include information about which other > N: libraries the library was linked against. (When running "ldd foo.so" ldd > N: should report about these other libraries. In your case, ldd just > N: reports "statically linked".) > N: > N: To fix this, you should explicitly specify the libraries which are used > N: (e.g., "-lc") when building the shared library with "ld". > N: > N: Severity: normal, Certainty: certain > > ------------------------------------------------------------------------------ > _______________________________________________ > Libposix-development mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libposix-development > -- Henrique Dante de Almeida hd...@gm... |
From: Aníbal M. S. <an...@de...> - 2009-06-24 01:16:58
|
On Tue, Jun 23, 2009 at 11:27:50AM -0300, Henrique Almeida wrote: >Because there's a syntax error in CMakeList.txt ;-) Thanks for pointing >out. It's fixed in the repository. Thank you. >Can you try again? That fixed my build problem. When do you plan to provide proper versioned symbols? I would like to upload my package to Debian (Ubuntu will pick it up eventually) but I found some issues with the shared library. They are listed below. lintian -i /tmp/libposix/libposix_0-1_i386.changes W: libposix-dev: shlib-with-executable-stack usr/lib/libposix.so N: N: The listed shared libraries declares the stack as executable. N: N: Executable stack is usually an error as it is only needed if the code N: contains GCC trampolines or similar constructs which uses code on the N: stack. One possible source for false positives are object files built N: from assembler files which don't define a proper .note.GNU-stack N: section. N: N: To see the permissions on the stack, run readelf -l on the shared N: library and look for the program header of type GNU_STACK. In the flag N: column, there should not be an E flag set. N: W: libposix-dev: shlib-without-versioned-soname usr/lib/libposix.so libposix.so N: N: The listed shared library in a public library directory has an SONAME N: that does not contain any versioning information, either after the .so N: or before it and set off by a hyphen. It cannot therefore be represented N: in the shlibs system, and if linked by binaries its interface cannot N: safely change. There is no backward-compatible way to migrate programs N: linked against it to a new ABI. N: N: Normally, this means the shared library is a private library for a N: particular application and is not meant for general use. Policy N: recommends that such libraries be installed in a subdirectory of N: /usr/lib rather than in a public shared library directory. N: N: To view the SONAME of a shared library, run readelf -d on the shared N: library and look for the tag of type SONAME. N: N: There are some special stub libraries or special-purpose shared objects N: for which an ABI version is not meaningful. If this is one of those N: cases, please add an override. N: N: Refer to Debian Policy Manual section 10.2 (Libraries) and Debian Policy N: Manual section 8.6 (Dependencies between the library and other packages N: - the shlibs system) for details. N: W: libposix-dev: shared-lib-without-dependency-information ./usr/lib/libposix.so N: N: The listed shared library doesn't include information about which other N: libraries the library was linked against. (When running "ldd foo.so" ldd N: should report about these other libraries. In your case, ldd just N: reports "statically linked".) N: N: To fix this, you should explicitly specify the libraries which are used N: (e.g., "-lc") when building the shared library with "ld". N: N: Severity: normal, Certainty: certain |
From: Henrique A. <hd...@gm...> - 2009-06-23 14:28:11
|
Because there's a syntax error in CMakeList.txt ;-) Thanks for pointing out. It's fixed in the repository. Can you try again ? 2009/6/23 Aníbal Monsalve Salazar <an...@de...> > I'm trying to create a Debian package and need help. > > Why there is a ";" just before "-std=c99" in the last compile command in > the attached log file? > > And how can I fix it? > > > ------------------------------------------------------------------------------ > Are you an open source citizen? Join us for the Open Source Bridge > conference! > Portland, OR, June 17-19. Two days of sessions, one day of unconference: > $250. > Need another reason to go? 24-hour hacker lounge. Register today! > > http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org > _______________________________________________ > Libposix-development mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libposix-development > > -- Henrique Dante de Almeida hd...@gm... |
From: Aníbal M. S. <an...@de...> - 2009-06-23 11:59:55
|
I'm trying to create a Debian package and need help. Why there is a ";" just before "-std=c99" in the last compile command in the attached log file? And how can I fix it? |
From: Henrique A. <hd...@gm...> - 2009-06-23 03:10:20
|
Hello, people, I'm in the middle of work for the printf parser, it's rather hard. Maybe I can finish it until weekend. What about the functions ? Remember to pick some functions to implement. 2009/6/20 Henrique Almeida <hd...@gm...>: > I think bzip2 is a good one to start. It has aroung 6.000 lines of > code, doesn't use a configure script, and doesn't use extensions (some > extended operations are automatically included by GNU libc and won't > interfere with our implementation). The function list in the bzip2 > binary (when compiled with glibc, this is an approximate list for us) > follows. Please choose some functions to implement. Don't worry about > fully implementing the functions, only the features needed by bzip2 > need to be present. Later, I'll write unit tests so that we can > gradually complete the implementation. Use the standard to derive the > implementation. Assume that linux system calls (such as "open" or > "write") conform to POSIX 2008. > > I'm planning to add a printf parser to the repository soon. :-) > > Relocation section '.rel.plt' at offset 0x858 contains 40 entries: > Offset Info Type Sym.Value Sym. Name > 0805d000 00000107 R_386_JUMP_SLOT 00000000 fileno > 0805d004 00000207 R_386_JUMP_SLOT 00000000 __errno_location > 0805d008 00000307 R_386_JUMP_SLOT 00000000 strerror > 0805d00c 00000407 R_386_JUMP_SLOT 00000000 open64 > 0805d010 00000507 R_386_JUMP_SLOT 00000000 __fprintf_chk > 0805d014 00000607 R_386_JUMP_SLOT 00000000 signal > 0805d018 00000707 R_386_JUMP_SLOT 00000000 __gmon_start__ > 0805d01c 00000807 R_386_JUMP_SLOT 00000000 rewind > 0805d020 00000907 R_386_JUMP_SLOT 00000000 __xstat64 > 0805d024 00000a07 R_386_JUMP_SLOT 00000000 getenv > 0805d028 00000b07 R_386_JUMP_SLOT 00000000 strncpy > 0805d02c 00000c07 R_386_JUMP_SLOT 00000000 fchown > 0805d030 00000d07 R_386_JUMP_SLOT 00000000 fopen64 > 0805d034 00000e07 R_386_JUMP_SLOT 00000000 __libc_start_main > 0805d038 00000f07 R_386_JUMP_SLOT 00000000 perror > 0805d03c 00001007 R_386_JUMP_SLOT 00000000 __strcat_chk > 0805d040 00001107 R_386_JUMP_SLOT 00000000 ungetc > 0805d044 00001207 R_386_JUMP_SLOT 00000000 fdopen > 0805d048 00001307 R_386_JUMP_SLOT 00000000 free > 0805d04c 00001407 R_386_JUMP_SLOT 00000000 __lxstat64 > 0805d050 00001507 R_386_JUMP_SLOT 00000000 fflush > 0805d054 00001607 R_386_JUMP_SLOT 00000000 __ctype_b_loc > 0805d058 00001707 R_386_JUMP_SLOT 00000000 isatty > 0805d05c 00001807 R_386_JUMP_SLOT 00000000 fclose > 0805d060 00001907 R_386_JUMP_SLOT 00000000 utime > 0805d064 00001a07 R_386_JUMP_SLOT 00000000 strlen > 0805d068 00001b07 R_386_JUMP_SLOT 00000000 fgetc > 0805d06c 00001c07 R_386_JUMP_SLOT 00000000 strcpy > 0805d070 00001d07 R_386_JUMP_SLOT 00000000 close > 0805d074 00001e07 R_386_JUMP_SLOT 00000000 fwrite > 0805d078 00001f07 R_386_JUMP_SLOT 00000000 strstr > 0805d07c 00002007 R_386_JUMP_SLOT 00000000 remove > 0805d080 00002107 R_386_JUMP_SLOT 00000000 malloc > 0805d084 00002207 R_386_JUMP_SLOT 00000000 __stack_chk_fail > 0805d088 00002307 R_386_JUMP_SLOT 00000000 fputc > 0805d08c 00002407 R_386_JUMP_SLOT 00000000 fread > 0805d090 00002507 R_386_JUMP_SLOT 00000000 ferror > 0805d094 00002607 R_386_JUMP_SLOT 00000000 strcmp > 0805d098 00002707 R_386_JUMP_SLOT 00000000 exit > 0805d09c 00002807 R_386_JUMP_SLOT 00000000 fchmod > > 2009/6/18 Henrique Almeida <hd...@gm...>: >> I've made a list of all the packages that install files in /bin and >> /sbin in my system. Some of them are simple. Maybe bzip2 is a possible >> choice, however it uses extensions, at least in x86 (it uses the >> open64 family of functions). Maybe we can compile it without >> extensions. Also, we can get the list of all the functions imported by >> the binaries with realdelf. With the function list we're building, we >> could attribute a difficulty grade for supporting each program, and >> follow the order, starting from the easiest. :-) >> >> alsa-base >> alsa-utils >> apparmor >> bash >> binutils-static >> brltty >> bzip2 >> console-setup >> coreutils >> cpio >> csh >> dash >> dbus >> debianutils >> dhcp3-client >> dmsetup >> dosfstools >> dpkg >> e2fsprogs >> ed >> fuse-utils >> grep >> grub >> gzip >> hal >> hdparm >> hostname >> ifupdown >> initscripts >> iproute >> iptables >> iputils-ping >> kbd >> klogd >> libc6 >> libpam-modules >> linux-restricted-modules-common >> login >> makedev >> mktemp >> module-init-tools >> mount >> nano >> netcat-traditional >> net-tools >> ntfs-3g >> parted >> passwd >> pcmciautils >> powermgmt-base >> procps >> psmisc >> readahead >> reiserfsprogs >> sed >> sysklogd >> sysvinit-utils >> tar >> udev >> upstart >> upstart-compat-sysv >> upstart-logd >> usplash >> util-linux >> wireless-crda >> wireless-tools >> wpasupplicant >> xfsprogs >> >> 2009/6/18 Chris Forbes <ch...@fa...>: >>> I think that would be a good idea. >>> That pile of m4 code is ... large :) >>> >>> -----Original Message----- >>> From: Henrique Almeida [mailto:hd...@gm...] >>> Sent: Friday, 19 June 2009 4:18 a.m. >>> To: lib...@li... >>> Subject: Re: [libposix-development] Selective compilation >>> >>> Maybe we should choose another application ? >>> >>> 2009/6/18 Jim Meyering <ji...@me...>: >>>> Henrique Almeida wrote: >>>>> I'm building a new libc implementation, called libposix, with a few >>>>> volunteers. We'll begin to use a test driven development approach and >>>>> we're considering GNU coreutils for our initial test case. I'd like to >>>>> know if it's possible to build only small parts of coreutils, instead >>>>> of the full package, during this initial evolution of libposix code. >>>>> Ideally, it would be good if we were able to build only a single tool >>>>> and its dependecies. Also, if that's not possible, maybe you could >>>>> point other applications that would be useful to us. I'm also afraid >>>>> that the configure script would not work with libposix in this stage. >>>>> Is it possible to point out what are the requirements for the >>>>> configure script ? >>>> >>>> The programs in coreutils depend heavily on gnulib. >>>> The parts of gnulib used in coreutils are distributed throughout the >>>> m4/*.m4 files (which are integrated into configure), lib/* files, and >>>> Makefile snippets. The sources and gnulib support are intertwined >>>> enough that separating the src/*.c code from configure-time tests >>>> is likely to be a challenging and subtly error-prone task. >>>> >>> >>> >>> >>> -- >>> Henrique Dante de Almeida >>> hd...@gm... >>> >>> ------------------------------------------------------------------------------ >>> Crystal Reports - New Free Runtime and 30 Day Trial >>> Check out the new simplified licensing option that enables unlimited >>> royalty-free distribution of the report engine for externally facing >>> server and web deployment. >>> http://p.sf.net/sfu/businessobjects >>> _______________________________________________ >>> Libposix-development mailing list >>> Lib...@li... >>> https://lists.sourceforge.net/lists/listinfo/libposix-development >>> ------------------------------------------------------------------------------ >>> Crystal Reports - New Free Runtime and 30 Day Trial >>> Check out the new simplified licensing option that enables unlimited >>> royalty-free distribution of the report engine for externally facing >>> server and web deployment. >>> http://p.sf.net/sfu/businessobjects >>> _______________________________________________ >>> Libposix-development mailing list >>> Lib...@li... >>> https://lists.sourceforge.net/lists/listinfo/libposix-development >>> >> >> >> >> -- >> Henrique Dante de Almeida >> hd...@gm... >> > > > > -- > Henrique Dante de Almeida > hd...@gm... > -- Henrique Dante de Almeida hd...@gm... |
From: Henrique A. <hd...@gm...> - 2009-06-20 21:32:58
|
I think bzip2 is a good one to start. It has aroung 6.000 lines of code, doesn't use a configure script, and doesn't use extensions (some extended operations are automatically included by GNU libc and won't interfere with our implementation). The function list in the bzip2 binary (when compiled with glibc, this is an approximate list for us) follows. Please choose some functions to implement. Don't worry about fully implementing the functions, only the features needed by bzip2 need to be present. Later, I'll write unit tests so that we can gradually complete the implementation. Use the standard to derive the implementation. Assume that linux system calls (such as "open" or "write") conform to POSIX 2008. I'm planning to add a printf parser to the repository soon. :-) Relocation section '.rel.plt' at offset 0x858 contains 40 entries: Offset Info Type Sym.Value Sym. Name 0805d000 00000107 R_386_JUMP_SLOT 00000000 fileno 0805d004 00000207 R_386_JUMP_SLOT 00000000 __errno_location 0805d008 00000307 R_386_JUMP_SLOT 00000000 strerror 0805d00c 00000407 R_386_JUMP_SLOT 00000000 open64 0805d010 00000507 R_386_JUMP_SLOT 00000000 __fprintf_chk 0805d014 00000607 R_386_JUMP_SLOT 00000000 signal 0805d018 00000707 R_386_JUMP_SLOT 00000000 __gmon_start__ 0805d01c 00000807 R_386_JUMP_SLOT 00000000 rewind 0805d020 00000907 R_386_JUMP_SLOT 00000000 __xstat64 0805d024 00000a07 R_386_JUMP_SLOT 00000000 getenv 0805d028 00000b07 R_386_JUMP_SLOT 00000000 strncpy 0805d02c 00000c07 R_386_JUMP_SLOT 00000000 fchown 0805d030 00000d07 R_386_JUMP_SLOT 00000000 fopen64 0805d034 00000e07 R_386_JUMP_SLOT 00000000 __libc_start_main 0805d038 00000f07 R_386_JUMP_SLOT 00000000 perror 0805d03c 00001007 R_386_JUMP_SLOT 00000000 __strcat_chk 0805d040 00001107 R_386_JUMP_SLOT 00000000 ungetc 0805d044 00001207 R_386_JUMP_SLOT 00000000 fdopen 0805d048 00001307 R_386_JUMP_SLOT 00000000 free 0805d04c 00001407 R_386_JUMP_SLOT 00000000 __lxstat64 0805d050 00001507 R_386_JUMP_SLOT 00000000 fflush 0805d054 00001607 R_386_JUMP_SLOT 00000000 __ctype_b_loc 0805d058 00001707 R_386_JUMP_SLOT 00000000 isatty 0805d05c 00001807 R_386_JUMP_SLOT 00000000 fclose 0805d060 00001907 R_386_JUMP_SLOT 00000000 utime 0805d064 00001a07 R_386_JUMP_SLOT 00000000 strlen 0805d068 00001b07 R_386_JUMP_SLOT 00000000 fgetc 0805d06c 00001c07 R_386_JUMP_SLOT 00000000 strcpy 0805d070 00001d07 R_386_JUMP_SLOT 00000000 close 0805d074 00001e07 R_386_JUMP_SLOT 00000000 fwrite 0805d078 00001f07 R_386_JUMP_SLOT 00000000 strstr 0805d07c 00002007 R_386_JUMP_SLOT 00000000 remove 0805d080 00002107 R_386_JUMP_SLOT 00000000 malloc 0805d084 00002207 R_386_JUMP_SLOT 00000000 __stack_chk_fail 0805d088 00002307 R_386_JUMP_SLOT 00000000 fputc 0805d08c 00002407 R_386_JUMP_SLOT 00000000 fread 0805d090 00002507 R_386_JUMP_SLOT 00000000 ferror 0805d094 00002607 R_386_JUMP_SLOT 00000000 strcmp 0805d098 00002707 R_386_JUMP_SLOT 00000000 exit 0805d09c 00002807 R_386_JUMP_SLOT 00000000 fchmod 2009/6/18 Henrique Almeida <hd...@gm...>: > I've made a list of all the packages that install files in /bin and > /sbin in my system. Some of them are simple. Maybe bzip2 is a possible > choice, however it uses extensions, at least in x86 (it uses the > open64 family of functions). Maybe we can compile it without > extensions. Also, we can get the list of all the functions imported by > the binaries with realdelf. With the function list we're building, we > could attribute a difficulty grade for supporting each program, and > follow the order, starting from the easiest. :-) > > alsa-base > alsa-utils > apparmor > bash > binutils-static > brltty > bzip2 > console-setup > coreutils > cpio > csh > dash > dbus > debianutils > dhcp3-client > dmsetup > dosfstools > dpkg > e2fsprogs > ed > fuse-utils > grep > grub > gzip > hal > hdparm > hostname > ifupdown > initscripts > iproute > iptables > iputils-ping > kbd > klogd > libc6 > libpam-modules > linux-restricted-modules-common > login > makedev > mktemp > module-init-tools > mount > nano > netcat-traditional > net-tools > ntfs-3g > parted > passwd > pcmciautils > powermgmt-base > procps > psmisc > readahead > reiserfsprogs > sed > sysklogd > sysvinit-utils > tar > udev > upstart > upstart-compat-sysv > upstart-logd > usplash > util-linux > wireless-crda > wireless-tools > wpasupplicant > xfsprogs > > 2009/6/18 Chris Forbes <ch...@fa...>: >> I think that would be a good idea. >> That pile of m4 code is ... large :) >> >> -----Original Message----- >> From: Henrique Almeida [mailto:hd...@gm...] >> Sent: Friday, 19 June 2009 4:18 a.m. >> To: lib...@li... >> Subject: Re: [libposix-development] Selective compilation >> >> Maybe we should choose another application ? >> >> 2009/6/18 Jim Meyering <ji...@me...>: >>> Henrique Almeida wrote: >>>> I'm building a new libc implementation, called libposix, with a few >>>> volunteers. We'll begin to use a test driven development approach and >>>> we're considering GNU coreutils for our initial test case. I'd like to >>>> know if it's possible to build only small parts of coreutils, instead >>>> of the full package, during this initial evolution of libposix code. >>>> Ideally, it would be good if we were able to build only a single tool >>>> and its dependecies. Also, if that's not possible, maybe you could >>>> point other applications that would be useful to us. I'm also afraid >>>> that the configure script would not work with libposix in this stage. >>>> Is it possible to point out what are the requirements for the >>>> configure script ? >>> >>> The programs in coreutils depend heavily on gnulib. >>> The parts of gnulib used in coreutils are distributed throughout the >>> m4/*.m4 files (which are integrated into configure), lib/* files, and >>> Makefile snippets. The sources and gnulib support are intertwined >>> enough that separating the src/*.c code from configure-time tests >>> is likely to be a challenging and subtly error-prone task. >>> >> >> >> >> -- >> Henrique Dante de Almeida >> hd...@gm... >> >> ------------------------------------------------------------------------------ >> Crystal Reports - New Free Runtime and 30 Day Trial >> Check out the new simplified licensing option that enables unlimited >> royalty-free distribution of the report engine for externally facing >> server and web deployment. >> http://p.sf.net/sfu/businessobjects >> _______________________________________________ >> Libposix-development mailing list >> Lib...@li... >> https://lists.sourceforge.net/lists/listinfo/libposix-development >> ------------------------------------------------------------------------------ >> Crystal Reports - New Free Runtime and 30 Day Trial >> Check out the new simplified licensing option that enables unlimited >> royalty-free distribution of the report engine for externally facing >> server and web deployment. >> http://p.sf.net/sfu/businessobjects >> _______________________________________________ >> Libposix-development mailing list >> Lib...@li... >> https://lists.sourceforge.net/lists/listinfo/libposix-development >> > > > > -- > Henrique Dante de Almeida > hd...@gm... > -- Henrique Dante de Almeida hd...@gm... |
From: Henrique A. <hd...@gm...> - 2009-06-19 02:18:05
|
I've made a list of all the packages that install files in /bin and /sbin in my system. Some of them are simple. Maybe bzip2 is a possible choice, however it uses extensions, at least in x86 (it uses the open64 family of functions). Maybe we can compile it without extensions. Also, we can get the list of all the functions imported by the binaries with realdelf. With the function list we're building, we could attribute a difficulty grade for supporting each program, and follow the order, starting from the easiest. :-) alsa-base alsa-utils apparmor bash binutils-static brltty bzip2 console-setup coreutils cpio csh dash dbus debianutils dhcp3-client dmsetup dosfstools dpkg e2fsprogs ed fuse-utils grep grub gzip hal hdparm hostname ifupdown initscripts iproute iptables iputils-ping kbd klogd libc6 libpam-modules linux-restricted-modules-common login makedev mktemp module-init-tools mount nano netcat-traditional net-tools ntfs-3g parted passwd pcmciautils powermgmt-base procps psmisc readahead reiserfsprogs sed sysklogd sysvinit-utils tar udev upstart upstart-compat-sysv upstart-logd usplash util-linux wireless-crda wireless-tools wpasupplicant xfsprogs 2009/6/18 Chris Forbes <ch...@fa...>: > I think that would be a good idea. > That pile of m4 code is ... large :) > > -----Original Message----- > From: Henrique Almeida [mailto:hd...@gm...] > Sent: Friday, 19 June 2009 4:18 a.m. > To: lib...@li... > Subject: Re: [libposix-development] Selective compilation > > Maybe we should choose another application ? > > 2009/6/18 Jim Meyering <ji...@me...>: >> Henrique Almeida wrote: >>> I'm building a new libc implementation, called libposix, with a few >>> volunteers. We'll begin to use a test driven development approach and >>> we're considering GNU coreutils for our initial test case. I'd like to >>> know if it's possible to build only small parts of coreutils, instead >>> of the full package, during this initial evolution of libposix code. >>> Ideally, it would be good if we were able to build only a single tool >>> and its dependecies. Also, if that's not possible, maybe you could >>> point other applications that would be useful to us. I'm also afraid >>> that the configure script would not work with libposix in this stage. >>> Is it possible to point out what are the requirements for the >>> configure script ? >> >> The programs in coreutils depend heavily on gnulib. >> The parts of gnulib used in coreutils are distributed throughout the >> m4/*.m4 files (which are integrated into configure), lib/* files, and >> Makefile snippets. The sources and gnulib support are intertwined >> enough that separating the src/*.c code from configure-time tests >> is likely to be a challenging and subtly error-prone task. >> > > > > -- > Henrique Dante de Almeida > hd...@gm... > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Libposix-development mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libposix-development > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Libposix-development mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libposix-development > -- Henrique Dante de Almeida hd...@gm... |
From: Henrique A. <hd...@gm...> - 2009-06-19 02:18:00
|
2009/6/16 Henrique Almeida <hd...@gm...>: > I've updated a initial version of a CMakeLists.txt for the project > and it can be compiled with cmake. Instructions follow: > > - install cmake ("sudo apt-get install cmake" in Ubuntu) > - from "libposix" directory, cd .. && mkdir libposix.build && cd libposix.build > - cmake ../libposix > - make > > Please test. It should work on all targets. Immediate TODO list follows: > > - add a target for runtime (runtime.o) Runtime is now installed with the library. > - remove hardcoded path (RPATH) for libposix in "hello" CMake automatically changes rpaths on installation, so it's not necessary to remove it (actually, it's better like that, because we don't need to set up LD_LIBRARY_PATH while running hello) > - improve system/architecture detection to map to "platform sets" > (I'll describe those later) Since this is more important for cross compiling, I'll leave that for some other time. > > -- > Henrique Dante de Almeida > hd...@gm... > -- Henrique Dante de Almeida hd...@gm... |
From: Chris F. <ch...@fa...> - 2009-06-18 21:11:50
|
I think that would be a good idea. That pile of m4 code is ... large :) -----Original Message----- From: Henrique Almeida [mailto:hd...@gm...] Sent: Friday, 19 June 2009 4:18 a.m. To: lib...@li... Subject: Re: [libposix-development] Selective compilation Maybe we should choose another application ? 2009/6/18 Jim Meyering <ji...@me...>: > Henrique Almeida wrote: >> I'm building a new libc implementation, called libposix, with a few >> volunteers. We'll begin to use a test driven development approach and >> we're considering GNU coreutils for our initial test case. I'd like to >> know if it's possible to build only small parts of coreutils, instead >> of the full package, during this initial evolution of libposix code. >> Ideally, it would be good if we were able to build only a single tool >> and its dependecies. Also, if that's not possible, maybe you could >> point other applications that would be useful to us. I'm also afraid >> that the configure script would not work with libposix in this stage. >> Is it possible to point out what are the requirements for the >> configure script ? > > The programs in coreutils depend heavily on gnulib. > The parts of gnulib used in coreutils are distributed throughout the > m4/*.m4 files (which are integrated into configure), lib/* files, and > Makefile snippets. The sources and gnulib support are intertwined > enough that separating the src/*.c code from configure-time tests > is likely to be a challenging and subtly error-prone task. > -- Henrique Dante de Almeida hd...@gm... ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Libposix-development mailing list Lib...@li... https://lists.sourceforge.net/lists/listinfo/libposix-development |