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 #include "sysregs.h"
10 
11 #include "hf/arch/vm/interrupts.h"
12 
13 #include "primary_with_secondary.h"
14 #include "test/vmapi/arch/exception_handler.h"
15 #include "test/vmapi/ffa.h"
16 
SET_UP(sysregs)17 SET_UP(sysregs)
18 {
19 	exception_setup(NULL, exception_handler_skip_instruction);
20 }
21 
22 /**
23  * Test that accessing LOR registers would inject an exception.
24  */
TEST(sysregs,lor_exception)25 TEST(sysregs, lor_exception)
26 {
27 	EXPECT_EQ(hf_vm_get_id(), HF_PRIMARY_VM_ID);
28 	TRY_READ(MSR_LORC_EL1);
29 
30 	EXPECT_EQ(exception_handler_get_num(), 1);
31 }
32