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 11 static inline void force_exit(void) 12 { 13 asm volatile(" diag 0,0,0x44\n"); 14 } 15 16 static inline int mvpg(unsigned long r0, void *dest, void *src) 17 { 18 register unsigned long reg0 asm ("0") = r0; 19 int cc; 20 21 asm volatile(" mvpg %1,%2\n" 22 " ipm %0\n" 23 " srl %0,28" 24 : "=d" (cc) : "a" (dest), "a" (src), "d" (reg0) 25 : "memory", "cc"); 26 return cc; 27 } 28 29 static void test_mvpg_real(void) 30 { 31 mvpg(0, (void *)0x5000, (void *)0x6000); 32 force_exit(); 33 } 34 35 __attribute__((section(".text"))) int main(void) 36 { 37 test_mvpg_real(); 38 test_mvpg_real(); 39 test_mvpg_real(); 40 return 0; 41 } 42