Author: ps-guest
Date: 2006-01-18 10:26:44 +0000 (Wed, 18 Jan 2006)
New Revision: 1062

Added:
   trunk/glibc-2.3-head/sysdeps/kfreebsd/x86_64/getcontext.S
Removed:
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/setcontext.S
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/swapcontext.S
Modified:
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/getcontext.S
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/makecontext.S
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/ucontext_i.h
   trunk/glibc-2.3-head/sysdeps/kfreebsd/syscalls.list
Log:
updated ucontext calls



Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/getcontext.S
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/getcontext.S     2006-01-18 
00:29:18 UTC (rev 1061)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/getcontext.S     2006-01-18 
10:26:44 UTC (rev 1062)
@@ -1,7 +1,6 @@
 /* Save current context.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <[EMAIL PROTECTED]>, 2001.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -20,55 +19,16 @@
 
 #include <sysdep.h>
 
-#include "ucontext_i.h"
-
-
+.text
 ENTRY(__getcontext)
-       /* Load address of the context data structure.  */
-       movl    4(%esp), %eax
+        movl 0(%esp), %ecx     /* save the return PC value */
+ 
+        DO_CALL (getcontext, 1)
+        jb SYSCALL_ERROR_LABEL
 
-       /* Return value of getcontext.  EAX is the only register whose
-          value is not preserved.  */
-       movl    $0, oEAX(%eax)
+        addl $4, %esp          /* remove stale return address */
+        jmp  *%ecx
 
-       /* Save the 32-bit register values and the return address.  */
-       movl    %ecx, oECX(%eax)
-       movl    %edx, oEDX(%eax)
-       movl    %edi, oEDI(%eax)
-       movl    %esi, oESI(%eax)
-       movl    %ebp, oEBP(%eax)
-       movl    (%esp), %ecx
-       movl    %ecx, oEIP(%eax)
-       leal    4(%esp), %ecx           /* Exclude the return address.  */
-       movl    %ecx, oESP(%eax)
-       movl    %ebx, oEBX(%eax)
-
-       /* Save the FS segment register.  We don't touch the GS register
-          since it is used for threads.  */
-       xorl    %edx, %edx
-       movw    %fs, %dx
-       movl    %edx, oFS(%eax)
-
-       /* Save the floating-point registers.  */
-       leal    oFPREGSMEM(%eax), %ecx
-       /* Save the floating-point context.  */
-       fnstenv (%ecx)
-
-       /* Save the current signal mask.  */
-       pushl   %ebx
-       leal    oSIGMASK(%eax), %eax
-       pushl   %eax
-       pushl   $0
-       pushl   $SIG_BLOCK
-       pushl   $0                      /* Dummy return address.  */
-       movl    $SYS_sigprocmask, %eax
-       int     $0x80
-       addl    $16, %esp
-       popl    %ebx
-       jb      SYSCALL_ERROR_LABEL     /* Jump to error handler if error.  */
-
-       /* All done, return 0 for success.  */
-       xorl    %eax, %eax
 L(pseudo_end):
        ret
 

Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/makecontext.S
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/makecontext.S    2006-01-18 
00:29:18 UTC (rev 1061)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/makecontext.S    2006-01-18 
10:26:44 UTC (rev 1062)
@@ -1,113 +1 @@
-/* Create new context.
-   Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <[EMAIL PROTECTED]>, 2001.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#include "ucontext_i.h"
-
-
-ENTRY(__makecontext)
-       movl    4(%esp), %eax
-
-       /* Load the address of the function we are supposed to run.  */
-       movl    8(%esp), %ecx
-
-       /* Compute the address of the stack.  The information comes from
-          to us_stack element.  */
-       movl    oSS_SP(%eax), %edx
-       movl    %ecx, oEIP(%eax)
-       addl    oSS_SIZE(%eax), %edx
-
-       /* Put the next context on the new stack (from the uc_link
-          element).  */
-       movl    oLINK(%eax), %ecx
-       movl    %ecx, -4(%edx)
-
-       /* Remember the number of parameters for the exit handler since
-          it has to remove them.  We store the number in the EBX register
-          which the function we will call must preserve.  */
-       movl    12(%esp), %ecx
-       movl    %ecx, oEBX(%eax)
-
-       /* Make room on the new stack for the parameters.  */
-       negl    %ecx
-       leal    -8(%edx,%ecx,4), %edx
-       negl    %ecx
-       /* Store the future stack pointer.  */
-       movl    %edx, oESP(%eax)
-
-       /* Copy all the parameters.  */
-       jecxz   2f
-1:     movl    12(%esp,%ecx,4), %eax
-       movl    %eax, (%edx,%ecx,4)
-       decl    %ecx
-       jnz     1b
-2:
-
-       /* If the function we call returns we must continue with the
-          context which is given in the uc_link element.  To do this
-          set the return address for the function the user provides
-          to a little bit of helper code which does the magic (see
-          below).  */
-#ifdef PIC
-       call    1f
-1:     popl    %ecx
-       addl    $L(exitcode)-1b, %ecx
-       movl    %ecx, (%edx)
-#else
-       movl    $L(exitcode), (%edx)
-#endif
-       /* 'makecontext' returns no value.  */
-       ret
-
-       /* This is the helper code which gets called if a function which
-          is registered with 'makecontext' returns.  In this case we
-          have to install the context listed in the uc_link element of
-          the context 'makecontext' manipulated at the time of the
-          'makecontext' call.  If the pointer is NULL the process must
-          terminate.  */
-L(exitcode):
-       /* This removes the parameters passed to the function given to
-          'makecontext' from the stack.  EBX contains the number of
-          parameters (see above).  */
-       leal    (%esp,%ebx,4), %esp
-
-#ifdef PIC
-       call    1f
-1:     popl    %ebx
-       addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
-#endif
-       popl    %eax                    /* This is the next context.  */
-       testl   %eax, %eax
-       je      2f                      /* If it is zero exit.  */
-
-       pushl   %eax
-       call    JUMPTARGET(__setcontext)
-       /* If this returns (which can happen if the syscall fails) we'll
-          exit the program with the return error value (-1).  */
-
-2:     pushl   %eax
-       call    JUMPTARGET(exit)
-       /* The 'exit' call should never return.  In case it does cause
-          the process to terminate.  */
-       hlt
-END(__makecontext)
-
-weak_alias(__makecontext, makecontext)
+#include <sysdeps/unix/sysv/linux/i386/makecontext.S>

Deleted: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/setcontext.S
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/setcontext.S     2006-01-18 
00:29:18 UTC (rev 1061)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/setcontext.S     2006-01-18 
10:26:44 UTC (rev 1062)
@@ -1,97 +0,0 @@
-/* Install given context.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <[EMAIL PROTECTED]>, 2001.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#include "ucontext_i.h"
-
-
-ENTRY(__setcontext)
-       /* Load address of the context data structure.  */
-       movl    4(%esp), %eax
-
-       /* Get the current signal mask.  Note that we preserve EBX in case
-          the system call fails and we return from the function with an
-          error.  */
-       pushl   %ebx
-       leal    oSIGMASK(%eax), %eax
-       pushl   %eax
-       pushl   $0
-       pushl   $SIG_SETMASK
-       pushl   $0                      /* Dummy return address.  */
-       movl    $SYS_sigprocmask, %eax
-       int     $0x80
-       addl    $16, %esp
-       popl    %ebx
-       jb      SYSCALL_ERROR_LABEL     /* Jump to error handler if error.  */
-
-       /* EAX was modified, reload it.  */
-       movl    4(%esp), %eax
-
-       /* Restore the floating-point context.  Not the registers, only the
-          rest.  */
-       leal    oFPREGSMEM(%eax), %ecx
-       fldenv  (%ecx)
-
-       /* Restore the FS segment register.  We don't touch the GS register
-          since it is used for threads.  */
-       movl    oFS(%eax), %ecx
-       movw    %cx, %fs
-
-       /* Load the new stack pointer.  */
-       movl    oESP(%eax), %ecx
-       /* Make room for 8 registers and the return address.  We will load
-          the values from the stack.  */
-       subl    $36, %ecx
-
-       /* Move the values of all the 32-bit registers (except ESP) on
-          the stack.  This happens in the form the 'popa' instruction
-          expects it.  Before this block put the address of the code
-          to execute.  */
-       movl    oEDI(%eax), %ebx
-       movl    oESI(%eax), %edx
-       movl    oEBP(%eax), %esi
-       movl    oEBX(%eax), %edi
-       movl    %ebx, (%ecx)
-       movl    %edx, 4(%ecx)
-       movl    %esi, 8(%ecx)
-       movl    %edi, 16(%ecx)
-       movl    oEDX(%eax), %ebx
-       movl    oECX(%eax), %edx
-       movl    oEAX(%eax), %esi
-       movl    oEIP(%eax), %edi
-       movl    %ebx, 20(%ecx)
-       movl    %edx, 24(%ecx)
-       movl    %esi, 28(%ecx)
-       movl    %edi, 32(%ecx)
-
-       /* Set the new stack address.  The stack points now to the block
-          we put the register content in.  */
-       movl    %ecx, %esp
-       /* Restore the register content.  */
-       popa
-       /* The following 'ret' will pop the addres of the code and jump
-          to it.  */
-L(pseudo_end):
-       ret
-
-PSEUDO_END(__setcontext)
-
-weak_alias(__setcontext, setcontext)

Deleted: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/swapcontext.S
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/swapcontext.S    2006-01-18 
00:29:18 UTC (rev 1061)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/swapcontext.S    2006-01-18 
10:26:44 UTC (rev 1062)
@@ -1,124 +0,0 @@
-/* Save current context and install the given one.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <[EMAIL PROTECTED]>, 2001.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#include "ucontext_i.h"
-
-
-ENTRY(__swapcontext)
-       /* Load address of the context data structure we save in.  */
-       movl    4(%esp), %eax
-
-       /* Return value of swapcontext.  EAX is the only register whose
-          value is not preserved.  */
-       movl    $0, oEAX(%eax)
-
-       /* Save the 32-bit register values and the return address.  */
-       movl    %ecx, oECX(%eax)
-       movl    %edx, oEDX(%eax)
-       movl    %edi, oEDI(%eax)
-       movl    %esi, oESI(%eax)
-       movl    %ebp, oEBP(%eax)
-       movl    (%esp), %ecx
-       movl    %ecx, oEIP(%eax)
-       leal    4(%esp), %ecx
-       movl    %ecx, oESP(%eax)
-       movl    %ebx, oEBX(%eax)
-
-       /* Save the FS segment register.  */
-       xorl    %edx, %edx
-       movw    %fs, %dx
-       movl    %edx, oFS(%eax)
-
-       /* Save the floating-point registers.  */
-       leal    oFPREGSMEM(%eax), %ecx
-       /* Save the floating-point context.  */
-       fnstenv (%ecx)
-
-       /* Load address of the context data structure we have to load.  */
-       movl    8(%esp), %ecx
-
-       /* Save the current signal mask and install the new one.  */
-       pushl   %ebx
-       leal    oSIGMASK(%eax), %eax
-       leal    oSIGMASK(%ecx), %ecx
-       pushl   %eax
-       pushl   %ecx
-       pushl   $SIG_SETMASK
-       pushl   $0                      /* Dummy return address.  */
-       movl    $SYS_sigprocmask, %eax
-       int     $0x80
-       addl    $16, %esp
-       popl    %ebx
-       jb      SYSCALL_ERROR_LABEL     /* Jump to error handler if error.  */
-
-       /* EAX was modified, reload it.  */
-       movl    8(%esp), %eax
-
-       /* Restore the floating-point context.  Not the registers, only the
-          rest.  */
-       leal    oFPREGSMEM(%eax), %ecx
-       fldenv  (%ecx)
-
-       /* Restore the FS segment registers.  */
-       movl    oFS(%eax), %edx
-       movw    %dx, %fs
-
-       /* Load the new stack pointer.  */
-       movl    oESP(%eax), %ecx
-       /* Make room for 8 registers and the return address.  We will load
-          the values from the stack.  */
-       subl    $36, %ecx
-
-       /* Move the values of all the 32-bit registers (except ESP) on
-          the stack.  This happens in the form the 'popa' instruction
-          expects it.  Before this block put the address of the code
-          to execute.  */
-       movl    oEDI(%eax), %ebx
-       movl    oESI(%eax), %edx
-       movl    oEBP(%eax), %esi
-       movl    oEBX(%eax), %edi
-       movl    %ebx, (%ecx)
-       movl    %edx, 4(%ecx)
-       movl    %esi, 8(%ecx)
-       movl    %edi, 16(%ecx)
-       movl    oEDX(%eax), %ebx
-       movl    oECX(%eax), %edx
-       movl    oEAX(%eax), %esi
-       movl    oEIP(%eax), %edi
-       movl    %ebx, 20(%ecx)
-       movl    %edx, 24(%ecx)
-       movl    %esi, 28(%ecx)
-       movl    %edi, 32(%ecx)
-
-       /* Set the new stack address.  The stack points now to the block
-          we put the register content in.  */
-       movl    %ecx, %esp
-       /* Restore the register content.  */
-       popa
-       /* The following 'ret' will pop the addres of the code and jump
-          to it.  */
-L(pseudo_end):
-       ret
-
-PSEUDO_END(__swapcontext)
-
-weak_alias(__swapcontext, swapcontext)

Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/ucontext_i.h
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/ucontext_i.h     2006-01-18 
00:29:18 UTC (rev 1061)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/ucontext_i.h     2006-01-18 
10:26:44 UTC (rev 1062)
@@ -18,9 +18,6 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#define SIG_BLOCK      1
-#define SIG_SETMASK    3
-
 /* Offsets of the fields in the ucontext_t structure.  */
 #define oSIGMASK       0
 #define oGS            20
@@ -28,13 +25,14 @@
 #define oEDI           36
 #define oESI           40
 #define oEBP           44
-#define oESP           48
 #define oEBX           52
 #define oEDX           56
 #define oECX           60
 #define oEAX           64
+
 #define oEIP           76
-#define oFPREGSMEM     96      /* FIXME: not sure */
-#define oLINK          276
-#define oSS_SP         280
-#define oSS_SIZE       284
+#define oESP           88
+
+#define oLINK          656
+#define oSS_SP         660
+#define oSS_SIZE       664

Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/syscalls.list
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/syscalls.list 2006-01-18 00:29:18 UTC 
(rev 1061)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/syscalls.list 2006-01-18 10:26:44 UTC 
(rev 1062)
@@ -140,4 +140,7 @@
 sys_connect    -       connect                 i:ipi   __syscall_connect
 sys_bind        -       bind                    i:ipi   __syscall_bind
 sys_sendto      -       sendto                 i:ibnibn __syscall_sendto
+swapcontext    -       swapcontext             i:pp    __swapcontext   
swapcontext
+getcontext     -       getcontext              i:p     __getcontext    
getcontext
+setcontext     -       setcontext              i:p     __setcontext    
setcontext
 

Added: trunk/glibc-2.3-head/sysdeps/kfreebsd/x86_64/getcontext.S
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/x86_64/getcontext.S   2006-01-18 
00:29:18 UTC (rev 1061)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/x86_64/getcontext.S   2006-01-18 
10:26:44 UTC (rev 1062)
@@ -0,0 +1,37 @@
+/* Save current context.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+.text
+ENTRY(__getcontext)
+        movl 0(%rsp), %rcx     /* save the return PC value */
+ 
+        DO_CALL (getcontext, 1)
+        jb SYSCALL_ERROR_LABEL
+
+        addq $8, %rsp          /* remove stale return address */
+        jmp  *%rcx
+
+L(pseudo_end):
+       ret
+
+PSEUDO_END(__getcontext)
+
+weak_alias(__getcontext, getcontext)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to