xref: /linux/arch/powerpc/include/asm/sstep.h (revision b8b572e1015f81b4e748417be2629dfe51ab99f9)
1*b8b572e1SStephen Rothwell /*
2*b8b572e1SStephen Rothwell  * Copyright (C) 2004 Paul Mackerras <paulus@au.ibm.com>, IBM
3*b8b572e1SStephen Rothwell  *
4*b8b572e1SStephen Rothwell  * This program is free software; you can redistribute it and/or
5*b8b572e1SStephen Rothwell  * modify it under the terms of the GNU General Public License
6*b8b572e1SStephen Rothwell  * as published by the Free Software Foundation; either version
7*b8b572e1SStephen Rothwell  * 2 of the License, or (at your option) any later version.
8*b8b572e1SStephen Rothwell  */
9*b8b572e1SStephen Rothwell 
10*b8b572e1SStephen Rothwell struct pt_regs;
11*b8b572e1SStephen Rothwell 
12*b8b572e1SStephen Rothwell /*
13*b8b572e1SStephen Rothwell  * We don't allow single-stepping an mtmsrd that would clear
14*b8b572e1SStephen Rothwell  * MSR_RI, since that would make the exception unrecoverable.
15*b8b572e1SStephen Rothwell  * Since we need to single-step to proceed from a breakpoint,
16*b8b572e1SStephen Rothwell  * we don't allow putting a breakpoint on an mtmsrd instruction.
17*b8b572e1SStephen Rothwell  * Similarly we don't allow breakpoints on rfid instructions.
18*b8b572e1SStephen Rothwell  * These macros tell us if an instruction is a mtmsrd or rfid.
19*b8b572e1SStephen Rothwell  * Note that IS_MTMSRD returns true for both an mtmsr (32-bit)
20*b8b572e1SStephen Rothwell  * and an mtmsrd (64-bit).
21*b8b572e1SStephen Rothwell  */
22*b8b572e1SStephen Rothwell #define IS_MTMSRD(instr)	(((instr) & 0xfc0007be) == 0x7c000124)
23*b8b572e1SStephen Rothwell #define IS_RFID(instr)		(((instr) & 0xfc0007fe) == 0x4c000024)
24*b8b572e1SStephen Rothwell #define IS_RFI(instr)		(((instr) & 0xfc0007fe) == 0x4c000064)
25*b8b572e1SStephen Rothwell 
26*b8b572e1SStephen Rothwell /* Emulate instructions that cause a transfer of control. */
27*b8b572e1SStephen Rothwell extern int emulate_step(struct pt_regs *regs, unsigned int instr);
28