[S390] Add real memory access functions

Add access function for real memory needed by s390 kdump backend.

Signed-off-by: Michael Holzheu <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
This commit is contained in:
Michael Holzheu 2011-10-30 15:16:39 +01:00 • committed by Martin Schwidefsky
commit 7f0bf656c6
3 changed files with 60 additions and 18 deletions

View file

@ -142,22 +142,6 @@ static int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count)
return memcpy_hsa(dest, src, count, TO_KERNEL);
}
static int memcpy_real_user(void __user *dest, unsigned long src, size_t count)
{
static char buf[4096];
int offs = 0, size;
while (offs < count) {
size = min(sizeof(buf), count - offs);
if (memcpy_real(buf, (void *) src + offs, size))
return -EFAULT;
if (copy_to_user(dest + offs, buf, size))
return -EFAULT;
offs += size;
}
return 0;
}
static int __init init_cpu_info(enum arch_id arch)
{
struct save_area *sa;
@ -346,8 +330,8 @@ static ssize_t zcore_read(struct file *file, char __user *buf, size_t count,
/* Copy from real mem */
size = count - mem_offs - hdr_count;
rc = memcpy_real_user(buf + hdr_count + mem_offs, mem_start + mem_offs,
size);
rc = copy_to_user_real(buf + hdr_count + mem_offs,
(void *) mem_start + mem_offs, size);
if (rc)
goto fail;