Andrew Scull | f0551c8 | 2018-12-15 20:38:47 +0000 | [diff] [blame] | 1 | /* |
Andrew Walbran | 692b325 | 2019-03-07 15:51:31 +0000 | [diff] [blame] | 2 | * Copyright 2018 The Hafnium Authors. |
Andrew Scull | f0551c8 | 2018-12-15 20:38:47 +0000 | [diff] [blame] | 3 | * |
Andrew Walbran | e959ec1 | 2020-06-17 15:01:09 +0100 | [diff] [blame] | 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. |
Andrew Scull | f0551c8 | 2018-12-15 20:38:47 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
Andrew Scull | f0551c8 | 2018-12-15 20:38:47 +0000 | [diff] [blame] | 9 | #include <stdint.h> |
| 10 | |
Raghu Krishnamurthy | fffe761 | 2020-12-08 14:57:28 -0800 | [diff] [blame] | 11 | #include "hf/arch/vm/interrupts.h" |
| 12 | |
Andrew Walbran | 1e7c774 | 2019-12-13 17:10:02 +0000 | [diff] [blame] | 13 | #include "test/hftest.h" |
Raghu Krishnamurthy | 50af660 | 2021-12-12 15:23:09 -0800 | [diff] [blame] | 14 | #include "test/hftest_impl.h" |
Andrew Scull | f0551c8 | 2018-12-15 20:38:47 +0000 | [diff] [blame] | 15 | |
| 16 | alignas(4096) uint8_t kstack[4096]; |
| 17 | |
Raghu Krishnamurthy | 50af660 | 2021-12-12 15:23:09 -0800 | [diff] [blame] | 18 | extern void abort(void); |
Raghu Krishnamurthy | 1c264f3 | 2021-02-27 20:37:13 -0800 | [diff] [blame] | 19 | |
Madhukar Pappireddy | 538b688 | 2024-08-20 16:50:52 -0500 | [diff] [blame] | 20 | void run_service_set_up(struct hftest_context *ctx, struct fdt *fdt) |
| 21 | { |
| 22 | hftest_service_set_up(ctx, fdt); |
| 23 | } |
| 24 | |
| 25 | noreturn void kmain(const void *fdt_ptr) |
Raghu Krishnamurthy | 1c264f3 | 2021-02-27 20:37:13 -0800 | [diff] [blame] | 26 | { |
| 27 | /* |
| 28 | * Initialize the stage-1 MMU and identity-map the entire address space. |
| 29 | */ |
| 30 | if (!hftest_mm_init()) { |
| 31 | HFTEST_LOG_FAILURE(); |
| 32 | HFTEST_LOG(HFTEST_LOG_INDENT "Memory initialization failed"); |
| 33 | abort(); |
| 34 | } |
| 35 | |
| 36 | /* Setup basic exception handling. */ |
| 37 | exception_setup(NULL, NULL); |
| 38 | |
| 39 | hftest_service_main(fdt_ptr); |
| 40 | } |