aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/nios2/test-shadow-1.S
blob: 79ef69db1252ff59f85e17959e93d5a25fa74e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * Regression test for TCG indirect global lowering.
 *
 * Copyright Linaro Ltd 2022
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "semicall.h"

	.text
	.set noat
	.align	2
	.globl	main
	.type	main, @function

main:
	/* Initialize r0 in shadow register set 1. */
	movhi	at, 1			/* PRS=1, CRS=0, RSIE=0, PIE=0 */
	wrctl	status, at
	wrprs	zero, zero

	/* Change current register set to 1. */
	movi	at, 1 << 10		/* PRS=0, CRS=1, RSIE=0, PIE=0 */
	wrctl	estatus, at
	movia	ea, 1f
	eret

	/* Load address for callr, then end TB. */
1:	movia	at, 3f
	br	2f

	/* Test case! TCG abort on indirect lowering across brcond. */
2:	callr	at

	/* exit(0) */
3:	movi	r4, HOSTED_EXIT
	movi	r5, 0
	semihosting_call

	.size	main, . - main