summaryrefslogtreecommitdiff
path: root/src/arch/riscv/payload.S
blob: ce88bc3f640dfe8a322b2ce2a8964e37b300ec8e (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
/*
 * This file is part of the coreboot project.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

// "return" to a payload pointed to by a1 with
// an M-mode pointer (or, to upper levels, physical address)
// to the config string in a0.
	.global riscvpayload
riscvpayload:
	mv t0,a1
	csrw mepc, t0
	csrr t0, mstatus
	li t1, ~(3<<11)
	and t0, t0, t1
	li t2,  (1<<11)
	or t0, t0, t2
	csrw mstatus, t0

	// We're still in toolchain no mans land.
	.word 0x30200073
	//mret