summaryrefslogtreecommitdiff
path: root/arch/powerpc/lib/inst.c
blob: bf3126ee399da2f61297a7bd483bbf6c47ebb4e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright 2020, IBM Corporation.
 */

#include <linux/uaccess.h>
#include <asm/inst.h>

int probe_user_read_inst(struct ppc_inst *inst,
			 struct ppc_inst __user *nip)
{
	unsigned int val;
	int err;

	err = probe_user_read(&val, nip, sizeof(val));
	if (!err)
		*inst = ppc_inst(val);

	return err;
}

int probe_kernel_read_inst(struct ppc_inst *inst,
			   struct ppc_inst *src)
{
	unsigned int val;
	int err;

	err = probe_kernel_read(&val, src, sizeof(val));
	if (!err)
		*inst = ppc_inst(val);

	return err;
}