1 /*
2  * Copyright 2018 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 <stdalign.h>
10 #include <stdint.h>
11 
12 #include "hf/arch/vm/interrupts.h"
13 
14 #include "test/hftest.h"
15 #include "test/hftest_impl.h"
16 
17 alignas(4096) uint8_t kstack[4096];
18 
19 extern void abort(void);
20 
kmain(const void * fdt_ptr)21 noreturn void kmain(const void *fdt_ptr)
22 {
23 	/*
24 	 * Initialize the stage-1 MMU and identity-map the entire address space.
25 	 */
26 	if (!hftest_mm_init()) {
27 		HFTEST_LOG_FAILURE();
28 		HFTEST_LOG(HFTEST_LOG_INDENT "Memory initialization failed");
29 		abort();
30 	}
31 
32 	/* Setup basic exception handling. */
33 	exception_setup(NULL, NULL);
34 
35 	hftest_service_main(fdt_ptr);
36 }
37