diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-12-09 00:44:02 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-12-09 00:44:02 +0400 |
commit | 28af078283512952004b1e4d5b38c03a0f57ad11 (patch) | |
tree | 314db5393bdd933201ddd26030affbc80004701e /sysdeps/unix | |
parent | 69843cf2425d133cf81b75de200da59d08914395 (diff) | |
download | glibc-28af078283512952004b1e4d5b38c03a0f57ad11.tar.gz |
Update kopensolaris-gnu/i386 to new syscall mechanics
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/make-syscalls.sh | 20 | ||||
-rw-r--r-- | sysdeps/unix/syscall-template.S | 40 | ||||
-rw-r--r-- | sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.h | 12 |
3 files changed, 58 insertions, 14 deletions
diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh index 89ed17b064..6eb0c546fd 100644 --- a/sysdeps/unix/make-syscalls.sh +++ b/sysdeps/unix/make-syscalls.sh @@ -238,23 +238,19 @@ while read file srcfile caller syscall args strong weak; do (echo '/* Dummy module requested by syscalls.list */'; \\" ;; x*) - if [ $noerrno = 0 ]; then - noerrno_s='' - else - noerrno_s='_NOERRNO' - fi - case x"$subcallnum" in - x) pseudo_line="PSEUDO$noerrno_s ($strong, $syscall, $nargs)";; - *) pseudo_line="PSEUDO_SUBCALL$noerrno_s ($strong, $syscall, $subcall, `expr $nargs + 1`)";; - esac echo "\ \$(make-target-directory) (echo '#define SYSCALL_NAME $syscall'; \\ - echo '#define SYSCALL_NARGS $nargs'; \\ echo '#define SYSCALL_SYMBOL $strong'; \\" - [ x"$subcallnum" = x ] || echo "\ - echo '#define SYSCALL_SUBCALL_NUM $subcallnum'; \\" + if [ x"$subcallnum" != x ]; then + echo "\ + echo '#define SYSCALL_SUBCALL_NAME $subcall'; \\ + echo '#define SYSCALL_NARGS `expr $nargs + 1`'; \\" + else + echo "\ + echo '#define SYSCALL_NARGS $nargs'; \\" + fi [ $restart = 0 ] || echo "\ echo '#define SYSCALL_RESTARTABLE 1'; \\" [ $cancellable = 0 ] || echo "\ diff --git a/sysdeps/unix/syscall-template.S b/sysdeps/unix/syscall-template.S index d4f67c4b13..3a9a10b7cf 100644 --- a/sysdeps/unix/syscall-template.S +++ b/sysdeps/unix/syscall-template.S @@ -39,7 +39,22 @@ functions in libc are plain stubs and which have nontrivial C wrappers. Some versions of the "plain" stub generation macros are more than a few instructions long and the untrained eye might not distinguish them from - some compiled code that inexplicably lacks source line information. */ + some compiled code that inexplicably lacks source line information. + + + illumos/solaris specific: + + SYSCALL_SUBCALL_NAME, if defined, specifies a "subcall" name - symbolic + name of the first argument to the real system call. E. g. zone_list(a, b) + is not a real syscall, but the syscall zone(4, a, b); zone_setattr(...) is + zone(9, ...). Iff this macro is defined, we use PSEUDO_SUBCALL() instead + of plain PSEUDO(). Also note that SYSCALL_NARGS is a number of arguments + for a real syscall (see sysdeps/unix/make-syscalls.sh). + + SYSCALL_NAME is the name of the real syscall if SYSCALL_SUBCALL_NAME + is defined. For example, SYSCALL_NAME=zone for SYSCALL_SYMBOL=zone_list. + +*/ #if SYSCALL_CANCELLABLE # include <sysdep-cancel.h> @@ -52,14 +67,27 @@ #define T_PSEUDO_ERRVAL(SYMBOL, NAME, N) PSEUDO_ERRVAL (SYMBOL, NAME, N) #define T_PSEUDO_END(SYMBOL) PSEUDO_END (SYMBOL) #define T_PSEUDO_END_NOERRNO(SYMBOL) PSEUDO_END_NOERRNO (SYMBOL) -#define T_PSEUDO_END_ERRVAL(SYMBOL) PSEUDO_END_ERRVAL (SYMBOL) +#define T_PSEUDO_END_ERRVAL(SYMBOL) PSEUDO_END_ERRVAL (SYMBOL) + +#define T_PSEUDO_SUBCALL(SYMBOL, NAME, SUB, N) \ + PSEUDO_SUBCALL (SYMBOL, NAME, SUB, N) + +#define T_PSEUDO_SUBCALL_NOERRNO(SYMBOL, NAME, SUB, N) \ + PSEUDO_SUBCALL_NOERRNO (SYMBOL, NAME, SUB, N) + +#define T_PSEUDO_SUBCALL_ERRVAL(SYMBOL, NAME, SUB, N) \ + PSEUDO_SUBCALL_ERRVAL (SYMBOL, NAME, SUB, N) #if SYSCALL_NOERRNO /* This kind of system call stub never returns an error. We return the return value register to the caller unexamined. */ +#ifdef SYSCALL_SUBCALL_NAME +T_PSEUDO_SUBCALL_NOERRNO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_SUBCALL_NAME, SYSCALL_NARGS) +#else T_PSEUDO_NOERRNO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS) +#endif ret_NOERRNO T_PSEUDO_END_NOERRNO (SYSCALL_SYMBOL) @@ -69,7 +97,11 @@ T_PSEUDO_END_NOERRNO (SYSCALL_SYMBOL) value, or zero for success. We may massage the kernel's return value to meet that ABI, but we never set errno here. */ +#ifdef SYSCALL_SUBCALL_NAME +T_PSEUDO_SUBCALL_ERRVAL (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_SUBCALL_NAME, SYSCALL_NARGS) +#else T_PSEUDO_ERRVAL (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS) +#endif ret_ERRVAL T_PSEUDO_END_ERRVAL (SYSCALL_SYMBOL) @@ -78,7 +110,11 @@ T_PSEUDO_END_ERRVAL (SYSCALL_SYMBOL) /* This is a "normal" system call stub: if there is an error, it returns -1 and sets errno. */ +#ifdef SYSCALL_SUBCALL_NAME +T_PSEUDO_SUBCALL (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_SUBCALL_NAME, SYSCALL_NARGS) +#else T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS) +#endif ret T_PSEUDO_END (SYSCALL_SYMBOL) diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.h index f93fdba57e..3e84717aab 100644 --- a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.h +++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.h @@ -97,6 +97,13 @@ # define SYSCALL_ERROR_LABEL syscall_error #endif +/* + * Arguments for syscalls of OpenSolaris kernel on i386 + * are passed in the stack, so when libc's syscall stub + * is called, arguments are already at proper places. + * At least if we use int $0x91. + */ + #undef PSEUDO #define PSEUDO(name, syscall_name, args) \ .text; \ @@ -109,6 +116,11 @@ 2: \ L(pseudo_end): +/* + * In case of a "subcall" we have to put subcall number + * before actual arguments, and thus we need to save + * return address before syscall, and restore after. + */ #define PSEUDO_SUBCALL(name, syscall_name, subcall_name, args) \ .text; \ ENTRY (name) \ |