]>
Commit | Line | Data |
---|---|---|
2874c5fd | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
2392c8c8 SB |
2 | /* |
3 | * Copyright 2016-17 IBM Corp. | |
2392c8c8 SB |
4 | */ |
5 | #include <asm/ppc-opcode.h> | |
ab3759b5 | 6 | #include <asm/reg.h> |
2392c8c8 | 7 | |
2392c8c8 SB |
8 | /* |
9 | * Copy/paste instructions: | |
10 | * | |
11 | * copy RA,RB | |
12 | * Copy contents of address (RA) + effective_address(RB) | |
13 | * to internal copy-buffer. | |
14 | * | |
15 | * paste RA,RB | |
16 | * Paste contents of internal copy-buffer to the address | |
17 | * (RA) + effective_address(RB) | |
18 | */ | |
19 | static inline int vas_copy(void *crb, int offset) | |
20 | { | |
21 | asm volatile(PPC_COPY(%0, %1)";" | |
22 | : | |
23 | : "b" (offset), "b" (crb) | |
24 | : "memory"); | |
25 | ||
26 | return 0; | |
27 | } | |
28 | ||
29 | static inline int vas_paste(void *paste_address, int offset) | |
30 | { | |
31 | u32 cr; | |
32 | ||
33 | cr = 0; | |
34 | asm volatile(PPC_PASTE(%1, %2)";" | |
35 | "mfocrf %0, 0x80;" | |
36 | : "=r" (cr) | |
37 | : "b" (offset), "b" (paste_address) | |
38 | : "memory", "cr0"); | |
39 | ||
75743649 HM |
40 | /* We mask with 0xE to ignore SO */ |
41 | return (cr >> CR0_SHIFT) & 0xE; | |
2392c8c8 | 42 | } |