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 <stdint.h> 10 11 #include "hf/arch/vm/interrupts.h" 12 13 #include "hf/mm.h" 14 15 #include "hftest_common.h" 16 #include "test/hftest.h" 17 18 alignas(4096) uint8_t kstack[2 * 4096]; 19 kmain(const void * fdt_ptr)20void kmain(const void *fdt_ptr) 21 { 22 struct fdt fdt; 23 size_t fdt_len; 24 25 /* 26 * Initialize the stage-1 MMU and identity-map the entire address space. 27 */ 28 if ((VM_TOOLCHAIN == 1) && !hftest_mm_init()) { 29 HFTEST_LOG("Memory initialization failed."); 30 goto out; 31 } 32 33 /* 34 * Install the exception handler with no IRQ callback for now, so that 35 * exceptions are logged. 36 */ 37 exception_setup(NULL, NULL); 38 39 if (!fdt_size_from_header(fdt_ptr, &fdt_len) || 40 !fdt_init_from_ptr(&fdt, fdt_ptr, fdt_len)) { 41 HFTEST_LOG("Unable to init FDT."); 42 goto out; 43 } 44 45 hftest_command(&fdt); 46 47 out: 48 hftest_ctrl_finish(); 49 hftest_ctrl_reboot(); 50 } 51