1 /* 2 * Copyright 2019 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <KernelExport.h> 8 9 #include <arch/cpu.h> 10 #include <boot/kernel_args.h> 11 #include <commpage.h> 12 #include <elf.h> 13 14 15 extern "C" void _exception_vectors(void); 16 17 18 status_t 19 arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu) 20 { 21 WRITE_SPECIALREG(VBAR_EL1, _exception_vectors); 22 return B_OK; 23 } 24 25 26 status_t 27 arch_cpu_init_percpu(kernel_args *args, int curr_cpu) 28 { 29 return 0; 30 } 31 32 33 status_t 34 arch_cpu_init(kernel_args *args) 35 { 36 return B_OK; 37 } 38 39 40 status_t 41 arch_cpu_init_post_vm(kernel_args *args) 42 { 43 return B_OK; 44 } 45 46 47 status_t 48 arch_cpu_init_post_modules(kernel_args *args) 49 { 50 return B_OK; 51 } 52 53 54 status_t 55 arch_cpu_shutdown(bool reboot) 56 { 57 // never reached 58 return B_ERROR; 59 } 60 61 62 void 63 arch_cpu_sync_icache(void *address, size_t len) 64 { 65 } 66 67 68 void 69 arch_cpu_memory_read_barrier(void) 70 { 71 } 72 73 74 void 75 arch_cpu_memory_write_barrier(void) 76 { 77 } 78 79 80 void 81 arch_cpu_invalidate_TLB_range(addr_t start, addr_t end) 82 { 83 arch_cpu_global_TLB_invalidate(); 84 } 85 86 87 void 88 arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages) 89 { 90 arch_cpu_global_TLB_invalidate(); 91 } 92 93 94 void 95 arch_cpu_global_TLB_invalidate(void) 96 { 97 asm( 98 "dsb ishst\n" 99 "tlbi vmalle1\n" 100 "dsb ish\n" 101 "isb\n" 102 ); 103 } 104 105 106 void 107 arch_cpu_user_TLB_invalidate(void) 108 { 109 arch_cpu_global_TLB_invalidate(); 110 } 111