xen/riscv: introduce <asm/bug.h>

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
Oleksii Kurochko authored and Jan Beulich committed 2023-08-14 10:01:52 +02:00
1 parent 603a24573a
commit 86bd2484f3
1 file changed
+37
+37
View File
@@ -0,0 +1,37 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2012 Regents of the University of California
* Copyright (C) 2021-2023 Vates
*
*/
#ifndef _ASM_RISCV_BUG_H
#define _ASM_RISCV_BUG_H
#ifndef __ASSEMBLY__
#define BUG_INSTR "ebreak"
/*
* The base instruction set has a fixed length of 32-bit naturally aligned
* instructions.
*
* There are extensions of variable length ( where each instruction can be
* any number of 16-bit parcels in length ).
*
* Compressed ISA is used now where the instruction length is 16 bit and
* 'ebreak' instruction, in this case, can be either 16 or 32 bit (
* depending on if compressed ISA is used or not )
*/
#define INSN_LENGTH_MASK _UL(0x3)
#define INSN_LENGTH_32 _UL(0x3)
#define BUG_INSN_32 _UL(0x00100073) /* ebreak */
#define BUG_INSN_16 _UL(0x9002) /* c.ebreak */
#define COMPRESSED_INSN_MASK _UL(0xffff)
#define GET_INSN_LENGTH(insn) \
(((insn) & INSN_LENGTH_MASK) == INSN_LENGTH_32 ? 4 : 2) \
#endif /* !__ASSEMBLY__ */
#endif /* _ASM_RISCV_BUG_H */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.