.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * arch/arm/include/asm/ptrace.h |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 1996-2003 Russell King |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License version 2 as |
---|
8 | | - * published by the Free Software Foundation. |
---|
9 | 6 | */ |
---|
10 | 7 | #ifndef __ASM_ARM_PTRACE_H |
---|
11 | 8 | #define __ASM_ARM_PTRACE_H |
---|
.. | .. |
---|
167 | 164 | ((current_stack_pointer | (THREAD_SIZE - 1)) - 7) - 1; \ |
---|
168 | 165 | }) |
---|
169 | 166 | |
---|
| 167 | + |
---|
| 168 | +/* |
---|
| 169 | + * Update ITSTATE after normal execution of an IT block instruction. |
---|
| 170 | + * |
---|
| 171 | + * The 8 IT state bits are split into two parts in CPSR: |
---|
| 172 | + * ITSTATE<1:0> are in CPSR<26:25> |
---|
| 173 | + * ITSTATE<7:2> are in CPSR<15:10> |
---|
| 174 | + */ |
---|
| 175 | +static inline unsigned long it_advance(unsigned long cpsr) |
---|
| 176 | +{ |
---|
| 177 | + if ((cpsr & 0x06000400) == 0) { |
---|
| 178 | + /* ITSTATE<2:0> == 0 means end of IT block, so clear IT state */ |
---|
| 179 | + cpsr &= ~PSR_IT_MASK; |
---|
| 180 | + } else { |
---|
| 181 | + /* We need to shift left ITSTATE<4:0> */ |
---|
| 182 | + const unsigned long mask = 0x06001c00; /* Mask ITSTATE<4:0> */ |
---|
| 183 | + unsigned long it = cpsr & mask; |
---|
| 184 | + it <<= 1; |
---|
| 185 | + it |= it >> (27 - 10); /* Carry ITSTATE<2> to correct place */ |
---|
| 186 | + it &= mask; |
---|
| 187 | + cpsr &= ~mask; |
---|
| 188 | + cpsr |= it; |
---|
| 189 | + } |
---|
| 190 | + return cpsr; |
---|
| 191 | +} |
---|
| 192 | + |
---|
170 | 193 | #endif /* __ASSEMBLY__ */ |
---|
171 | 194 | #endif |
---|