J-Alves | 84c24b5 | 2020-12-02 11:05:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 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 "hf/mm.h" |
| 15 | |
| 16 | #include "hftest_common.h" |
| 17 | #include "test/hftest.h" |
| 18 | |
| 19 | alignas(4096) uint8_t kstack[4096]; |
| 20 | |
| 21 | extern struct hftest_test hftest_begin[]; |
| 22 | extern struct hftest_test hftest_end[]; |
| 23 | |
| 24 | void kmain(void) |
| 25 | { |
| 26 | /* Dummy fdt. It is not really used */ |
| 27 | struct fdt fdt; |
| 28 | |
| 29 | /* |
| 30 | * Initialize the stage-1 MMU and identity-map the entire address space. |
| 31 | */ |
| 32 | if ((VM_TOOLCHAIN == 1) && !hftest_mm_init()) { |
| 33 | HFTEST_LOG("Memory initialization failed."); |
| 34 | goto out; |
| 35 | } |
| 36 | |
| 37 | /* |
| 38 | * Install the exception handler with no IRQ callback for now, so that |
| 39 | * exceptions are logged. |
| 40 | */ |
| 41 | exception_setup(NULL, NULL); |
| 42 | |
| 43 | hftest_use_list(hftest_begin, hftest_end - hftest_begin); |
| 44 | |
| 45 | hftest_command(&fdt); |
| 46 | |
| 47 | out: |
| 48 | hftest_ctrl_finish(); |
| 49 | } |