How does copy_to_user work on s390?

286 views Asked by At

On the s390 architecture virtual kernel and user address spaces are never present at the same time, so how does copy_to_user work?

1

There are 1 answers

3
osgx On BEST ANSWER

copy_to_user for s390 is implemented here: linux/arch/s390/include/asm/uaceess.h.

uaccess is the pointer to copy_[to/from]_user actual implementation. It is setted up here (grep uaccess): arch/s390/kernel/setup.c. There are 4 implementations of uaccess, depening from mode:

uaccess_mvcos_switch, uaccess_pt, uaccess_mvcos and uaccess_std

For example uaccess_std is here: http://lxr.linux.no/#linux+v3.2.1/arch/s390/lib/uaccess_std.c

4 *  Standard user space access functions based on mvcp/mvcs and doing
5 *  interesting things in the secondary space mode.

...

82 size_t copy_to_user_std(size_t size, void __user *ptr, const void *x)
83 {
84        unsigned long tmp1, tmp2;
85
86        tmp1 = -256UL;
87        asm volatile(
88                "0: mvcs  0(%0,%1),0(%2),%3\n"

The mvcp/mvcs mechanism is used: http://publib.boulder.ibm.com/infocenter/zos/v1r11/topic/com.ibm.zos.r11.ieaa500/iea2a57031.htm