1 /* 2 * Copyright 2019 The Hafnium Authors. 3 * 4 * Use of this source code is governed by a BSD-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/BSD-3-Clause. 7 */ 8 9 #pragma once 10 11 #include "vmapi/hf/call.h" 12 #include "vmapi/hf/ffa.h" 13 14 #include "test/hftest.h" 15 16 ffa_vcpu_index_t get_current_vcpu_index(void); 17 18 void exception_handler_set_return_addr(uint64_t instr_addr); 19 20 bool exception_handler_skip_instruction(void); 21 22 bool exception_handler_skip_to_instruction(void); 23 24 bool exception_handler_yield_unknown(void); 25 26 bool exception_handler_yield_data_abort(void); 27 28 bool exception_handler_yield_instruction_abort(void); 29 30 int exception_handler_get_num(void); 31 32 void exception_handler_reset(void); 33 34 void exception_handler_send_exception_count(void); 35 36 int exception_handler_receive_exception_count(const void *recv_buf); 37 38 void exception_handler_set_last_interrupt(uint32_t int_id); 39 40 uint32_t exception_handler_get_last_interrupt(void); 41 check_npi(void)42static inline void check_npi(void) 43 { 44 uint32_t intid = hf_interrupt_get(); 45 ASSERT_EQ(intid, HF_NOTIFICATION_PENDING_INTID); 46 HFTEST_LOG("Received notification pending interrupt."); 47 exception_handler_set_last_interrupt(intid); 48 } 49