1/* 2 * Copyright (c) 2019-2020 Cobham Gaisler AB 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7#include <zephyr/toolchain.h> 8#include <zephyr/linker/sections.h> 9#include <zephyr/arch/sparc/sparc.h> 10 11GTEXT(__sparc_trap_sw_set_pil) 12 13/* 14 * Set processor interrupt level 15 * 16 * Handler for SPARC trap 0x89: trap_instruction, defined as "Reserved for the 17 * operating system" by SPARC-ABI. 18 * 19 * entry: 20 * - %l0: psr 21 * - %l1: pc 22 * - %l2: npc 23 * - %i0: New processor interrupt level 24 * 25 * return: 26 * - %i0: Old processor interrupt level 27 */ 28SECTION_FUNC(TEXT, __sparc_trap_sw_set_pil) 29 /* %l5: new %psr */ 30 sll %i0, PSR_PIL_BIT, %i0 31 andn %l0, PSR_PIL, %l5 32 or %l5, %i0, %l5 33 34 wr %l5, %psr 35 nop 36 nop 37 nop 38 39 and %l0, PSR_PIL, %l3 40 srl %l3, PSR_PIL_BIT, %i0 41 42 jmp %l2 43 rett %l2 + 4 44