diff options
author | Michael Holzheu <holzheu@linux.vnet.ibm.com> | 2011-10-30 10:16:39 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-10-30 10:16:42 -0400 |
commit | 7f0bf656c66e4292e965c95fd9de55c72b6578bb (patch) | |
tree | 5940a3c7ce75d64deb03a0a4f2199f64c497c1bf /drivers/s390/char | |
parent | 1943f53c9ca182fa233e5a17e89ef8e421d7819e (diff) |
[S390] Add real memory access functions
Add access function for real memory needed by s390 kdump backend.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char')
-rw-r--r-- | drivers/s390/char/zcore.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c index 3b94044027c2..f4f1da213e28 100644 --- a/drivers/s390/char/zcore.c +++ b/drivers/s390/char/zcore.c | |||
@@ -142,22 +142,6 @@ static int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count) | |||
142 | return memcpy_hsa(dest, src, count, TO_KERNEL); | 142 | return memcpy_hsa(dest, src, count, TO_KERNEL); |
143 | } | 143 | } |
144 | 144 | ||
145 | static int memcpy_real_user(void __user *dest, unsigned long src, size_t count) | ||
146 | { | ||
147 | static char buf[4096]; | ||
148 | int offs = 0, size; | ||
149 | |||
150 | while (offs < count) { | ||
151 | size = min(sizeof(buf), count - offs); | ||
152 | if (memcpy_real(buf, (void *) src + offs, size)) | ||
153 | return -EFAULT; | ||
154 | if (copy_to_user(dest + offs, buf, size)) | ||
155 | return -EFAULT; | ||
156 | offs += size; | ||
157 | } | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static int __init init_cpu_info(enum arch_id arch) | 145 | static int __init init_cpu_info(enum arch_id arch) |
162 | { | 146 | { |
163 | struct save_area *sa; | 147 | struct save_area *sa; |
@@ -346,8 +330,8 @@ static ssize_t zcore_read(struct file *file, char __user *buf, size_t count, | |||
346 | 330 | ||
347 | /* Copy from real mem */ | 331 | /* Copy from real mem */ |
348 | size = count - mem_offs - hdr_count; | 332 | size = count - mem_offs - hdr_count; |
349 | rc = memcpy_real_user(buf + hdr_count + mem_offs, mem_start + mem_offs, | 333 | rc = copy_to_user_real(buf + hdr_count + mem_offs, |
350 | size); | 334 | (void *) mem_start + mem_offs, size); |
351 | if (rc) | 335 | if (rc) |
352 | goto fail; | 336 | goto fail; |
353 | 337 | ||