Re: [libposix-development] [PATCH 2/2] x86_32: use 'int 0x80' for system calls to improve protabili
Status: Pre-Alpha
Brought to you by:
hdante
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... |