Commit 4120bd78 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] s390: core s390

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

s390 core changes:
 - Fix system call trace / audit interface.
 - Fix find_first_bit / find_next_bit inlines assembly constraints.
parent 83ee50f5
...@@ -239,7 +239,7 @@ sysc_enter: ...@@ -239,7 +239,7 @@ sysc_enter:
sysc_do_restart: sysc_do_restart:
tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr. l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr.
bo BASED(sysc_tracesys) bnz BASED(sysc_tracesys)
basr %r14,%r8 # call sys_xxxx basr %r14,%r8 # call sys_xxxx
st %r2,SP_R2(%r15) # store return value (change R2 on stack) st %r2,SP_R2(%r15) # store return value (change R2 on stack)
# ATTENTION: check sys_execve_glue before # ATTENTION: check sys_execve_glue before
...@@ -328,7 +328,7 @@ sysc_tracego: ...@@ -328,7 +328,7 @@ sysc_tracego:
st %r2,SP_R2(%r15) # store return value st %r2,SP_R2(%r15) # store return value
sysc_tracenogo: sysc_tracenogo:
tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
bno BASED(sysc_return) bz BASED(sysc_return)
l %r1,BASED(.Ltrace) l %r1,BASED(.Ltrace)
la %r2,SP_PTREGS(%r15) # load pt_regs la %r2,SP_PTREGS(%r15) # load pt_regs
la %r3,1 la %r3,1
...@@ -512,7 +512,7 @@ pgm_svcper: ...@@ -512,7 +512,7 @@ pgm_svcper:
pgm_svcstd: pgm_svcstd:
tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr. l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr.
bo BASED(pgm_tracesys) bnz BASED(pgm_tracesys)
basr %r14,%r8 # call sys_xxxx basr %r14,%r8 # call sys_xxxx
st %r2,SP_R2(%r15) # store return value (change R2 on stack) st %r2,SP_R2(%r15) # store return value (change R2 on stack)
# ATTENTION: check sys_execve_glue before # ATTENTION: check sys_execve_glue before
...@@ -554,7 +554,7 @@ pgm_svc_go: ...@@ -554,7 +554,7 @@ pgm_svc_go:
st %r2,SP_R2(%r15) # store return value st %r2,SP_R2(%r15) # store return value
pgm_svc_nogo: pgm_svc_nogo:
tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
bno BASED(pgm_svcret) bz BASED(pgm_svcret)
l %r1,BASED(.Ltrace) l %r1,BASED(.Ltrace)
la %r2,SP_PTREGS(%r15) # load pt_regs la %r2,SP_PTREGS(%r15) # load pt_regs
la %r3,1 la %r3,1
......
...@@ -231,7 +231,7 @@ sysc_noemu: ...@@ -231,7 +231,7 @@ sysc_noemu:
#endif #endif
tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
lgf %r8,0(%r7,%r10) # load address of system call routine lgf %r8,0(%r7,%r10) # load address of system call routine
jo sysc_tracesys jnz sysc_tracesys
basr %r14,%r8 # call sys_xxxx basr %r14,%r8 # call sys_xxxx
stg %r2,SP_R2(%r15) # store return value (change R2 on stack) stg %r2,SP_R2(%r15) # store return value (change R2 on stack)
# ATTENTION: check sys_execve_glue before # ATTENTION: check sys_execve_glue before
...@@ -319,7 +319,7 @@ sysc_tracego: ...@@ -319,7 +319,7 @@ sysc_tracego:
stg %r2,SP_R2(%r15) # store return value stg %r2,SP_R2(%r15) # store return value
sysc_tracenogo: sysc_tracenogo:
tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
jno sysc_return jz sysc_return
la %r2,SP_PTREGS(%r15) # load pt_regs la %r2,SP_PTREGS(%r15) # load pt_regs
la %r3,1 la %r3,1
larl %r14,sysc_return # return point is sysc_return larl %r14,sysc_return # return point is sysc_return
...@@ -551,7 +551,7 @@ pgm_svcper_noemu: ...@@ -551,7 +551,7 @@ pgm_svcper_noemu:
#endif #endif
tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
lgf %r8,0(%r7,%r10) # load address of system call routine lgf %r8,0(%r7,%r10) # load address of system call routine
jo pgm_tracesys jnz pgm_tracesys
basr %r14,%r8 # call sys_xxxx basr %r14,%r8 # call sys_xxxx
stg %r2,SP_R2(%r15) # store return value (change R2 on stack) stg %r2,SP_R2(%r15) # store return value (change R2 on stack)
# ATTENTION: check sys_execve_glue before # ATTENTION: check sys_execve_glue before
...@@ -592,7 +592,7 @@ pgm_svc_go: ...@@ -592,7 +592,7 @@ pgm_svc_go:
stg %r2,SP_R2(%r15) # store return value stg %r2,SP_R2(%r15) # store return value
pgm_svc_nogo: pgm_svc_nogo:
tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
jno pgm_svcret jz pgm_svcret
la %r2,SP_PTREGS(%r15) # load pt_regs la %r2,SP_PTREGS(%r15) # load pt_regs
la %r3,1 la %r3,1
larl %r14,pgm_svcret # return point is sysc_return larl %r14,pgm_svcret # return point is sysc_return
......
...@@ -110,6 +110,7 @@ extern const char _sb_findmap[]; ...@@ -110,6 +110,7 @@ extern const char _sb_findmap[];
#endif /* __s390x__ */ #endif /* __s390x__ */
#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE)
#define __BITOPS_BARRIER() __asm__ __volatile__ ( "" : : : "memory" ) #define __BITOPS_BARRIER() __asm__ __volatile__ ( "" : : : "memory" )
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
...@@ -534,6 +535,7 @@ __constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { ...@@ -534,6 +535,7 @@ __constant_test_bit(unsigned long nr, const volatile unsigned long *addr) {
static inline int static inline int
find_first_zero_bit(const unsigned long * addr, unsigned int size) find_first_zero_bit(const unsigned long * addr, unsigned int size)
{ {
typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
unsigned long cmp, count; unsigned long cmp, count;
unsigned int res; unsigned int res;
...@@ -566,13 +568,15 @@ find_first_zero_bit(const unsigned long * addr, unsigned int size) ...@@ -566,13 +568,15 @@ find_first_zero_bit(const unsigned long * addr, unsigned int size)
" alr %0,%2\n" " alr %0,%2\n"
"4:" "4:"
: "=&a" (res), "=&d" (cmp), "=&a" (count) : "=&a" (res), "=&d" (cmp), "=&a" (count)
: "a" (size), "a" (addr), "a" (&_zb_findmap) : "cc" ); : "a" (size), "a" (addr), "a" (&_zb_findmap),
"m" (*(addrtype *) addr) : "cc" );
return (res < size) ? res : size; return (res < size) ? res : size;
} }
static inline int static inline int
find_first_bit(const unsigned long * addr, unsigned int size) find_first_bit(const unsigned long * addr, unsigned int size)
{ {
typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
unsigned long cmp, count; unsigned long cmp, count;
unsigned int res; unsigned int res;
...@@ -605,7 +609,8 @@ find_first_bit(const unsigned long * addr, unsigned int size) ...@@ -605,7 +609,8 @@ find_first_bit(const unsigned long * addr, unsigned int size)
" alr %0,%2\n" " alr %0,%2\n"
"4:" "4:"
: "=&a" (res), "=&d" (cmp), "=&a" (count) : "=&a" (res), "=&d" (cmp), "=&a" (count)
: "a" (size), "a" (addr), "a" (&_sb_findmap) : "cc" ); : "a" (size), "a" (addr), "a" (&_sb_findmap),
"m" (*(addrtype *) addr) : "cc" );
return (res < size) ? res : size; return (res < size) ? res : size;
} }
...@@ -695,6 +700,7 @@ find_next_bit (const unsigned long * addr, int size, int offset) ...@@ -695,6 +700,7 @@ find_next_bit (const unsigned long * addr, int size, int offset)
static inline unsigned long static inline unsigned long
find_first_zero_bit(const unsigned long * addr, unsigned long size) find_first_zero_bit(const unsigned long * addr, unsigned long size)
{ {
typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
unsigned long res, cmp, count; unsigned long res, cmp, count;
if (!size) if (!size)
...@@ -730,13 +736,15 @@ find_first_zero_bit(const unsigned long * addr, unsigned long size) ...@@ -730,13 +736,15 @@ find_first_zero_bit(const unsigned long * addr, unsigned long size)
" algr %0,%2\n" " algr %0,%2\n"
"5:" "5:"
: "=&a" (res), "=&d" (cmp), "=&a" (count) : "=&a" (res), "=&d" (cmp), "=&a" (count)
: "a" (size), "a" (addr), "a" (&_zb_findmap) : "cc" ); : "a" (size), "a" (addr), "a" (&_zb_findmap),
"m" (*(addrtype *) addr) : "cc" );
return (res < size) ? res : size; return (res < size) ? res : size;
} }
static inline unsigned long static inline unsigned long
find_first_bit(const unsigned long * addr, unsigned long size) find_first_bit(const unsigned long * addr, unsigned long size)
{ {
typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
unsigned long res, cmp, count; unsigned long res, cmp, count;
if (!size) if (!size)
...@@ -772,7 +780,8 @@ find_first_bit(const unsigned long * addr, unsigned long size) ...@@ -772,7 +780,8 @@ find_first_bit(const unsigned long * addr, unsigned long size)
" algr %0,%2\n" " algr %0,%2\n"
"5:" "5:"
: "=&a" (res), "=&d" (cmp), "=&a" (count) : "=&a" (res), "=&d" (cmp), "=&a" (count)
: "a" (size), "a" (addr), "a" (&_sb_findmap) : "cc" ); : "a" (size), "a" (addr), "a" (&_sb_findmap),
"m" (*(addrtype *) addr) : "cc" );
return (res < size) ? res : size; return (res < size) ? res : size;
} }
...@@ -983,6 +992,7 @@ static inline int sched_find_first_bit(unsigned long *b) ...@@ -983,6 +992,7 @@ static inline int sched_find_first_bit(unsigned long *b)
static inline int static inline int
ext2_find_first_zero_bit(void *vaddr, unsigned int size) ext2_find_first_zero_bit(void *vaddr, unsigned int size)
{ {
typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
unsigned long cmp, count; unsigned long cmp, count;
unsigned int res; unsigned int res;
...@@ -1016,7 +1026,8 @@ ext2_find_first_zero_bit(void *vaddr, unsigned int size) ...@@ -1016,7 +1026,8 @@ ext2_find_first_zero_bit(void *vaddr, unsigned int size)
" alr %0,%2\n" " alr %0,%2\n"
"4:" "4:"
: "=&a" (res), "=&d" (cmp), "=&a" (count) : "=&a" (res), "=&d" (cmp), "=&a" (count)
: "a" (size), "a" (vaddr), "a" (&_zb_findmap) : "cc" ); : "a" (size), "a" (vaddr), "a" (&_zb_findmap),
"m" (*(addrtype *) vaddr) : "cc" );
return (res < size) ? res : size; return (res < size) ? res : size;
} }
...@@ -1068,6 +1079,7 @@ ext2_find_next_zero_bit(void *vaddr, unsigned int size, unsigned offset) ...@@ -1068,6 +1079,7 @@ ext2_find_next_zero_bit(void *vaddr, unsigned int size, unsigned offset)
static inline unsigned long static inline unsigned long
ext2_find_first_zero_bit(void *vaddr, unsigned long size) ext2_find_first_zero_bit(void *vaddr, unsigned long size)
{ {
typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
unsigned long res, cmp, count; unsigned long res, cmp, count;
if (!size) if (!size)
...@@ -1103,7 +1115,8 @@ ext2_find_first_zero_bit(void *vaddr, unsigned long size) ...@@ -1103,7 +1115,8 @@ ext2_find_first_zero_bit(void *vaddr, unsigned long size)
" algr %0,%2\n" " algr %0,%2\n"
"5:" "5:"
: "=&a" (res), "=&d" (cmp), "=&a" (count) : "=&a" (res), "=&d" (cmp), "=&a" (count)
: "a" (size), "a" (vaddr), "a" (&_zb_findmap) : "cc" ); : "a" (size), "a" (vaddr), "a" (&_zb_findmap),
"m" (*(addrtype *) vaddr) : "cc" );
return (res < size) ? res : size; return (res < size) ? res : size;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment