Package: dietlibc
Version: 0.29-8
Severity: important

dietlibc have broken mmap and missing mmap64 implementation for s390.
The attached patch fixes this.

Bastian

-- 
Klingon phaser attack from front!!!!!
100% Damage to life support!!!!
--- dietlibc-0.29/debian/changelog
+++ dietlibc-0.29/debian/changelog
@@ -1,3 +1,9 @@
+dietlibc (0.29-8.0.1) UNRELEASED; urgency=low
+
+  * Fix s390.
+
+ -- Bastian Blank <[EMAIL PROTECTED]>  Sun, 12 Mar 2006 19:04:13 +0100
+
 dietlibc (0.29-8) unstable; urgency=low
 
   * debian/rules: binary-arch: set MYARCH on make install also (fixes build
--- dietlibc-0.29.orig/s390/mmap.S
+++ dietlibc-0.29/s390/mmap.S
@@ -38,10 +38,10 @@
        j       __unified_syscall
 
         /* check gpr 2 for error */
-//        lhi     %r0,-4096
-//        clr     %r2,%r0
-//        jnl     SYSCALL_ERROR_LABEL
+        lhi     %r0,-4096
+        clr     %r2,%r0
+        jnl     1b
 
         /* Successful; return the syscall's value.  */
-//        br      %r14
+        br      %r14
 
--- dietlibc-0.29.orig/s390/mmap64.S
+++ dietlibc-0.29/s390/mmap64.S
@@ -0,0 +1,52 @@
+#include <errno.h>
+#include "syscalls.h"
+
+#define EINVAL  22
+
+       .text
+       .align 4
+       .global mmap64
+       .type   mmap64,@function
+mmap64:
+        /* Save registers and setup stack frame.  */
+        stm     %r6,%r15,24(%r15)
+        lr      %r1,%r15
+        ahi     %r15,-120               /* buy stack space */
+        st      %r1,0(%r15)             /* store back chain */
+
+        /* Store parameters on stack, because old_mmap/mmap2
+         * take only one parameter: a pointer to the parameter area
+         */
+        st      %r6,0x70(%r15)          /* Store 'fd'.      */
+        st      %r5,0x6C(%r15)          /* Store 'flags'.   */
+        st      %r4,0x68(%r15)          /* Store 'prot'.    */
+        st      %r3,0x64(%r15)          /* Store 'length'.  */
+        st      %r2,0x60(%r15)          /* Store 'start'.   */
+
+        lm      %r0,%r1,216(%r15)           /* Load offset.     */
+        tml     %r1,0x0fff              /* Offset page aligned ?  */
+        jnz     1f                      /* No -> EINVAL.  */
+        srdl    %r0,12                  /* mmap2 takes the offset in pages.  */
+       ltr     %r0,%r0
+       jnz     1f
+        st      %r1,0x74(%r15)          /* Store page offset.  */
+
+        la      %r2,0x60(%r15)          /* Load address of parameter list.  */
+        svc     __NR_mmap2              /* Do the system call trap.  */
+
+        l       %r15,0(%r15)            /* Load back chain.  */
+        lm      %r6,%r15,24(%r15)       /* Load registers.  */
+
+        /* check gpr 2 for error */
+        lhi     %r0,-4096
+        clr     %r2,%r0
+        jnl     __unified_syscall
+
+        /* Successful; return the syscall's value.  */
+        br      %r14
+
+1:     lhi     %r2,-EINVAL
+        l       %r15,0(%r15)            /* Load back chain.  */
+        lm      %r6,%r15,24(%r15)       /* Load registers.  */
+       j       __unified_syscall
+

Attachment: signature.asc
Description: Digital signature

Reply via email to