[PATCH] powerpc: Make the vDSO functions set error code (#2)
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 16 Nov 2005 02:54:32 +0000 (13:54 +1100)
committerPaul Mackerras <paulus@samba.org>
Wed, 16 Nov 2005 03:05:11 +0000 (14:05 +1100)
The vDSO functions should have the same calling convention as a syscall.
Unfortunately, they currently don't set the cr0.so bit which is used to
indicate an error. This patch makes them clear this bit unconditionally
since all functions currently succeed. The syscall fallback done by some
of them will eventually override this if the syscall fails.

This also changes the symbol version of all vdso exports to make sure
glibc can differenciate between old and fixed calls for existing ones
like __kernel_gettimeofday.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/vdso32/cacheflush.S
arch/powerpc/kernel/vdso32/datapage.S
arch/powerpc/kernel/vdso32/gettimeofday.S
arch/powerpc/kernel/vdso64/cacheflush.S
arch/powerpc/kernel/vdso64/datapage.S
arch/powerpc/kernel/vdso64/gettimeofday.S
include/asm-powerpc/vdso.h

index c8db993574ee84a0c6dd455f081a5788c9d51b22..09629aea3e4738d812280343756920edd55b0b74 100644 (file)
@@ -35,6 +35,7 @@ V_FUNCTION_BEGIN(__kernel_sync_dicache)
        subf    r8,r6,r4                /* compute length */
        add     r8,r8,r5                /* ensure we get enough */
        srwi.   r8,r8,7                 /* compute line count */
+       crclr   cr0*4+so
        beqlr                           /* nothing to do? */
        mtctr   r8
        mr      r3,r6
@@ -58,6 +59,7 @@ V_FUNCTION_END(__kernel_sync_dicache)
  */
 V_FUNCTION_BEGIN(__kernel_sync_dicache_p5)
   .cfi_startproc
+       crclr   cr0*4+so
        sync
        isync
        li      r3,0
index f6b38472318d64fb4c4c0ac3591c2d017670aca5..4709f1d9542cde4aca0bfbc1e1bffc2ceefcb3ab 100644 (file)
@@ -54,7 +54,6 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map)
   .cfi_startproc
        mflr    r12
   .cfi_register lr,r12
-
        mr      r4,r3
        bl      __get_datapage@local
        mtlr    r12
@@ -63,6 +62,7 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map)
        beqlr
        li      r0,__NR_syscalls
        stw     r0,0(r4)
+       crclr   cr0*4+so
        blr
   .cfi_endproc
 V_FUNCTION_END(__kernel_get_syscall_map)
@@ -80,6 +80,7 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq)
        lwz     r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
        lwz     r3,CFG_TB_TICKS_PER_SEC(r3)
        mtlr    r12
+       crclr   cr0*4+so
        blr
   .cfi_endproc
 V_FUNCTION_END(__kernel_get_tbfreq)
index 0a32a41d50b0bcfba3158514c68b0822a7b626c8..7eebff03a0415c97d831c117d1269be34988e7a3 100644 (file)
@@ -59,6 +59,7 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday)
        stw     r5,TZONE_TZ_DSTTIME(r11)
 
 1:     mtlr    r12
+       crclr   cr0*4+so
        li      r3,0
        blr
 
@@ -117,6 +118,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
        mulli   r5,r5,1000
        stw     r5,TSPC32_TV_NSEC(r11)
        mtlr    r12
+       crclr   cr0*4+so
        li      r3,0
        blr
 
@@ -185,6 +187,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
        stw     r4,TSPC32_TV_NSEC(r11)
 
        mtlr    r12
+       crclr   cr0*4+so
        li      r3,0
        blr
 
@@ -219,6 +222,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
 
        li      r3,0
        cmpli   cr0,r4,0
+       crclr   cr0*4+so
        beqlr
        lis     r5,CLOCK_REALTIME_RES@h
        ori     r5,r5,CLOCK_REALTIME_RES@l
index d4a0ad28d534ead85150a30f5607cfbc48969ad7..cb4ae0a5edd098491fdc2a0145a15b35f7896c22 100644 (file)
@@ -35,6 +35,7 @@ V_FUNCTION_BEGIN(__kernel_sync_dicache)
        subf    r8,r6,r4                /* compute length */
        add     r8,r8,r5                /* ensure we get enough */
        srwi.   r8,r8,7                 /* compute line count */
+       crclr   cr0*4+so
        beqlr                           /* nothing to do? */
        mtctr   r8
        mr      r3,r6
@@ -58,6 +59,7 @@ V_FUNCTION_END(__kernel_sync_dicache)
  */
 V_FUNCTION_BEGIN(__kernel_sync_dicache_p5)
   .cfi_startproc
+       crclr   cr0*4+so
        sync
        isync
        li      r3,0
index 6393e4137bc7e3dfb0a1b82f0cb6e0c8bd72d95c..3b2dd7d0c1ebf88453cc80b8b7ae658216a20d2e 100644 (file)
@@ -54,12 +54,12 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map)
   .cfi_startproc
        mflr    r12
   .cfi_register lr,r12
-
        mr      r4,r3
        bl      V_LOCAL_FUNC(__get_datapage)
        mtlr    r12
        addi    r3,r3,CFG_SYSCALL_MAP64
        cmpli   cr0,r4,0
+       crclr   cr0*4+so
        beqlr
        li      r0,__NR_syscalls
        stw     r0,0(r4)
@@ -80,6 +80,7 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq)
        bl      V_LOCAL_FUNC(__get_datapage)
        ld      r3,CFG_TB_TICKS_PER_SEC(r3)
        mtlr    r12
+       crclr   cr0*4+so
        blr
   .cfi_endproc
 V_FUNCTION_END(__kernel_get_tbfreq)
index 1a89094715cca61a5221079334c9f1ada796b5da..ccaeda5136d17e63a71c6d1d64209e2d8d515694 100644 (file)
@@ -52,6 +52,7 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday)
        stw     r4,TZONE_TZ_MINWEST(r10)
        stw     r5,TZONE_TZ_DSTTIME(r10)
 1:     mtlr    r12
+       crclr   cr0*4+so
        li      r3,0                    /* always success */
        blr
   .cfi_endproc
@@ -99,6 +100,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
        std     r0,TSPC64_TV_NSEC(r11)  /* store nsec in tp */
 
        mtlr    r12
+       crclr   cr0*4+so
        li      r3,0
        blr
 
@@ -159,6 +161,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
        std     r7,TSPC64_TV_NSEC(r11)
 
        mtlr    r12
+       crclr   cr0*4+so
        li      r3,0
        blr
 
@@ -193,6 +196,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
 
        li      r3,0
        cmpli   cr0,r4,0
+       crclr   cr0*4+so
        beqlr
        lis     r5,CLOCK_REALTIME_RES@h
        ori     r5,r5,CLOCK_REALTIME_RES@l
index 85d8a7be25c482a359bee0baf3b96f028f577983..b9f9118b1607e667ebbc6df2f1145c18494180fe 100644 (file)
@@ -11,7 +11,7 @@
 #define VDSO32_MBASE   VDSO32_LBASE
 #define VDSO64_MBASE   VDSO64_LBASE
 
-#define VDSO_VERSION_STRING    LINUX_2.6.12
+#define VDSO_VERSION_STRING    LINUX_2.6.15
 
 /* Define if 64 bits VDSO has procedure descriptors */
 #undef VDS64_HAS_DESCRIPTORS