162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2012 ARM Ltd.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef __ASM_BRK_IMM_H
762306a36Sopenharmony_ci#define __ASM_BRK_IMM_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/*
1062306a36Sopenharmony_ci * #imm16 values used for BRK instruction generation
1162306a36Sopenharmony_ci * 0x004: for installing kprobes
1262306a36Sopenharmony_ci * 0x005: for installing uprobes
1362306a36Sopenharmony_ci * 0x006: for kprobe software single-step
1462306a36Sopenharmony_ci * Allowed values for kgdb are 0x400 - 0x7ff
1562306a36Sopenharmony_ci * 0x100: for triggering a fault on purpose (reserved)
1662306a36Sopenharmony_ci * 0x400: for dynamic BRK instruction
1762306a36Sopenharmony_ci * 0x401: for compile time BRK instruction
1862306a36Sopenharmony_ci * 0x800: kernel-mode BUG() and WARN() traps
1962306a36Sopenharmony_ci * 0x9xx: tag-based KASAN trap (allowed values 0x900 - 0x9ff)
2062306a36Sopenharmony_ci * 0x55xx: Undefined Behavior Sanitizer traps ('U' << 8)
2162306a36Sopenharmony_ci * 0x8xxx: Control-Flow Integrity traps
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci#define KPROBES_BRK_IMM			0x004
2462306a36Sopenharmony_ci#define UPROBES_BRK_IMM			0x005
2562306a36Sopenharmony_ci#define KPROBES_BRK_SS_IMM		0x006
2662306a36Sopenharmony_ci#define FAULT_BRK_IMM			0x100
2762306a36Sopenharmony_ci#define KGDB_DYN_DBG_BRK_IMM		0x400
2862306a36Sopenharmony_ci#define KGDB_COMPILED_DBG_BRK_IMM	0x401
2962306a36Sopenharmony_ci#define BUG_BRK_IMM			0x800
3062306a36Sopenharmony_ci#define KASAN_BRK_IMM			0x900
3162306a36Sopenharmony_ci#define KASAN_BRK_MASK			0x0ff
3262306a36Sopenharmony_ci#define UBSAN_BRK_IMM			0x5500
3362306a36Sopenharmony_ci#define UBSAN_BRK_MASK			0x00ff
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define CFI_BRK_IMM_TARGET		GENMASK(4, 0)
3662306a36Sopenharmony_ci#define CFI_BRK_IMM_TYPE		GENMASK(9, 5)
3762306a36Sopenharmony_ci#define CFI_BRK_IMM_BASE		0x8000
3862306a36Sopenharmony_ci#define CFI_BRK_IMM_MASK		(CFI_BRK_IMM_TARGET | CFI_BRK_IMM_TYPE)
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#endif
41