Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright 2016-17 IBM Corp.
0004  */
0005 #include <asm/ppc-opcode.h>
0006 #include <asm/reg.h>
0007 
0008 /*
0009  * Copy/paste instructions:
0010  *
0011  *  copy RA,RB
0012  *      Copy contents of address (RA) + effective_address(RB)
0013  *      to internal copy-buffer.
0014  *
0015  *  paste RA,RB
0016  *      Paste contents of internal copy-buffer to the address
0017  *      (RA) + effective_address(RB)
0018  */
0019 static inline int vas_copy(void *crb, int offset)
0020 {
0021     asm volatile(PPC_COPY(%0, %1)";"
0022         :
0023         : "b" (offset), "b" (crb)
0024         : "memory");
0025 
0026     return 0;
0027 }
0028 
0029 static inline int vas_paste(void *paste_address, int offset)
0030 {
0031     u32 cr;
0032 
0033     cr = 0;
0034     asm volatile(PPC_PASTE(%1, %2)";"
0035         "mfocrf %0, 0x80;"
0036         : "=r" (cr)
0037         : "b" (offset), "b" (paste_address)
0038         : "memory", "cr0");
0039 
0040     /* We mask with 0xE to ignore SO */
0041     return (cr >> CR0_SHIFT) & 0xE;
0042 }