aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/zcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char/zcore.c')
-rw-r--r--drivers/s390/char/zcore.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 3438658b66b7..3166d85914f2 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -141,33 +141,6 @@ static int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count)
141 return memcpy_hsa(dest, src, count, TO_KERNEL); 141 return memcpy_hsa(dest, src, count, TO_KERNEL);
142} 142}
143 143
144static int memcpy_real(void *dest, unsigned long src, size_t count)
145{
146 unsigned long flags;
147 int rc = -EFAULT;
148 register unsigned long _dest asm("2") = (unsigned long) dest;
149 register unsigned long _len1 asm("3") = (unsigned long) count;
150 register unsigned long _src asm("4") = src;
151 register unsigned long _len2 asm("5") = (unsigned long) count;
152
153 if (count == 0)
154 return 0;
155 flags = __raw_local_irq_stnsm(0xf8UL); /* switch to real mode */
156 asm volatile (
157 "0: mvcle %1,%2,0x0\n"
158 "1: jo 0b\n"
159 " lhi %0,0x0\n"
160 "2:\n"
161 EX_TABLE(1b,2b)
162 : "+d" (rc), "+d" (_dest), "+d" (_src), "+d" (_len1),
163 "+d" (_len2), "=m" (*((long*)dest))
164 : "m" (*((long*)src))
165 : "cc", "memory");
166 __raw_local_irq_ssm(flags);
167
168 return rc;
169}
170
171static int memcpy_real_user(void __user *dest, unsigned long src, size_t count) 144static int memcpy_real_user(void __user *dest, unsigned long src, size_t count)
172{ 145{
173 static char buf[4096]; 146 static char buf[4096];
@@ -175,7 +148,7 @@ static int memcpy_real_user(void __user *dest, unsigned long src, size_t count)
175 148
176 while (offs < count) { 149 while (offs < count) {
177 size = min(sizeof(buf), count - offs); 150 size = min(sizeof(buf), count - offs);
178 if (memcpy_real(buf, src + offs, size)) 151 if (memcpy_real(buf, (void *) src + offs, size))
179 return -EFAULT; 152 return -EFAULT;
180 if (copy_to_user(dest + offs, buf, size)) 153 if (copy_to_user(dest + offs, buf, size))
181 return -EFAULT; 154 return -EFAULT;
@@ -663,7 +636,7 @@ static int __init zcore_reipl_init(void)
663 if (ipib_info.ipib < ZFCPDUMP_HSA_SIZE) 636 if (ipib_info.ipib < ZFCPDUMP_HSA_SIZE)
664 rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE); 637 rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE);
665 else 638 else
666 rc = memcpy_real(ipl_block, ipib_info.ipib, PAGE_SIZE); 639 rc = memcpy_real(ipl_block, (void *) ipib_info.ipib, PAGE_SIZE);
667 if (rc) { 640 if (rc) {
668 free_page((unsigned long) ipl_block); 641 free_page((unsigned long) ipl_block);
669 return rc; 642 return rc;