blob: 52eeaf355231bf0ae8b87cec2a25e371479bbde8 [file] [log] [blame]
Sona Mathewc8f5a2e2025-02-04 15:22:01 -06001/*
2 * Copyright (c) 2024, Arm Limited. All rights reserved.
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include <arch_helpers.h>
7#include <debug.h>
8#include <realm_tests.h>
9#include <realm_helpers.h>
10#include <sync.h>
11
12 /* Try to enable Branch recording in R-EL1 via BRBCR_EL1 */
13
14bool test_realm_write_brbcr_el1_reg(void)
15{
16 unsigned long brbcr_el1;
17 bool ret_result = false;
18 realm_reset_undef_abort_count();
19
20 /* Install exception handler to catch undefined abort */
21 register_custom_sync_exception_handler(realm_sync_exception_handler);
22
23 brbcr_el1 = read_brbcr_el1();
24 brbcr_el1 |= BRBCR_EL1_INIT;
25 write_brbcr_el1(brbcr_el1);
26
27 read_brbfcr_el1();
28 read_brbts_el1();
29 read_brbinfinj_el1();
30 read_brbsrcinj_el1();
31 read_brbtgtinj_el1();
32 read_brbidr0_el1();
33 read_brbsrc11_el1();
34 read_brbtgt0_el1();
35 read_brbinf15_el1();
36
37 if (realm_get_undef_abort_count() == 11UL) {
38 ret_result = true;
39 }
40 unregister_custom_sync_exception_handler();
41 return ret_result;
42
43}