mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 09:14:19 +08:00
2874c5fd28
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
43 lines
817 B
C
43 lines
817 B
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Copyright 2016-17 IBM Corp.
|
|
*/
|
|
#include <asm/ppc-opcode.h>
|
|
#include <asm/reg.h>
|
|
|
|
/*
|
|
* Copy/paste instructions:
|
|
*
|
|
* copy RA,RB
|
|
* Copy contents of address (RA) + effective_address(RB)
|
|
* to internal copy-buffer.
|
|
*
|
|
* paste RA,RB
|
|
* Paste contents of internal copy-buffer to the address
|
|
* (RA) + effective_address(RB)
|
|
*/
|
|
static inline int vas_copy(void *crb, int offset)
|
|
{
|
|
asm volatile(PPC_COPY(%0, %1)";"
|
|
:
|
|
: "b" (offset), "b" (crb)
|
|
: "memory");
|
|
|
|
return 0;
|
|
}
|
|
|
|
static inline int vas_paste(void *paste_address, int offset)
|
|
{
|
|
u32 cr;
|
|
|
|
cr = 0;
|
|
asm volatile(PPC_PASTE(%1, %2)";"
|
|
"mfocrf %0, 0x80;"
|
|
: "=r" (cr)
|
|
: "b" (offset), "b" (paste_address)
|
|
: "memory", "cr0");
|
|
|
|
/* We mask with 0xE to ignore SO */
|
|
return (cr >> CR0_SHIFT) & 0xE;
|
|
}
|