2 * Copyright 2007, François Revol, revol@free.fr.
3 * Distributed under the terms of the MIT License.
5 * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de.
6 * Distributed under the terms of the MIT License.
8 * Copyright 2001, Travis Geiselbrecht. All rights reserved.
9 * Distributed under the terms of the NewOS License.
13 #include <KernelExport.h>
16 #include <boot/kernel_args.h>
27 arch_cpu_preboot_init_percpu(kernel_args
*args
, int curr_cpu
)
30 //ppc:set_msr(get_msr() | MSR_FP_AVAILABLE);
32 // The current thread must be NULL for all CPUs till we have threads.
33 // Some boot code relies on this.
34 arch_thread_set_current_thread(NULL
);
41 arch_cpu_init_percpu(kernel_args
*args
, int curr_cpu
)
44 panic("No SMP support on ARM yet!\n");
51 arch_cpu_init(kernel_args
*args
)
53 arch_cpu_type
= args
->arch_args
.cpu_type
;
54 arch_fpu_type
= args
->arch_args
.fpu_type
;
55 arch_mmu_type
= args
->arch_args
.mmu_type
;
56 arch_platform
= args
->arch_args
.platform
;
57 arch_platform
= args
->arch_args
.machine
;
64 arch_cpu_init_post_vm(kernel_args
*args
)
71 arch_cpu_init_post_modules(kernel_args
*args
)
73 // add the functions to the commpage image
74 image_id image
= get_commpage_image();
81 arch_cpu_shutdown(bool reboot
)
92 arch_cpu_sync_icache(void *address
, size_t len
)
95 asm volatile ("mcr p15, 0, %[c7format], c7, c5, 0"
96 : : [c7format
] "r" (Rd
) );
101 arch_cpu_memory_read_barrier(void)
103 // TODO: check if we need more here
104 // (or just call the inline version?)
105 // cf. headers/private/kernel/arch/arm/arch_atomic.h
106 asm volatile ("" : : : "memory");
111 arch_cpu_memory_write_barrier(void)
113 // TODO: check if we need more here
114 // (or just call the inline version?)
115 // cf. headers/private/kernel/arch/arm/arch_atomic.h
116 asm volatile ("" : : : "memory");
121 arch_cpu_invalidate_TLB_range(addr_t start
, addr_t end
)
123 int32 num_pages
= end
/ B_PAGE_SIZE
- start
/ B_PAGE_SIZE
;
124 while (num_pages
-- >= 0) {
125 asm volatile ("mcr p15, 0, %[c8format], c8, c6, 1"
126 : : [c8format
] "r" (start
) );
127 start
+= B_PAGE_SIZE
;
133 arch_cpu_invalidate_TLB_list(addr_t pages
[], int num_pages
)
135 for (int i
= 0; i
< num_pages
; i
++) {
136 asm volatile ("mcr p15, 0, %[c8format], c8, c6, 1":
137 : [c8format
] "r" (pages
[i
]) );
143 arch_cpu_global_TLB_invalidate(void)
146 asm volatile ("mcr p15, 0, %[c8format], c8, c7, 0"
147 : : [c8format
] "r" (Rd
) );
152 arch_cpu_user_TLB_invalidate(void)
154 cpu_ops.flush_insn_pipeline();
155 cpu_ops.flush_atc_user();
156 cpu_ops.flush_insn_pipeline();