1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Snippet used by the mvpg-sie.c test to check SIE PEI intercepts. 4 * 5 * Copyright (c) 2021 IBM Corp 6 * 7 * Authors: 8 * Janosch Frank <frankja@linux.ibm.com> 9 */ 10 #include <libcflat.h> 11 12 static inline void force_exit(void) 13 { 14 asm volatile(" diag 0,0,0x44\n"); 15 } 16 17 static inline int mvpg(unsigned long r0, void *dest, void *src) 18 { 19 register unsigned long reg0 asm ("0") = r0; 20 int cc; 21 22 asm volatile(" mvpg %1,%2\n" 23 " ipm %0\n" 24 " srl %0,28" 25 : "=d" (cc) : "a" (dest), "a" (src), "d" (reg0) 26 : "memory", "cc"); 27 return cc; 28 } 29 30 static void test_mvpg_real(void) 31 { 32 mvpg(0, (void *)0x5000, (void *)0x6000); 33 force_exit(); 34 } 35 36 __attribute__((section(".text"))) int main(void) 37 { 38 test_mvpg_real(); 39 test_mvpg_real(); 40 test_mvpg_real(); 41 return 0; 42 } 43