#include <KernelExport.h>
#include <arch/cpu.h>
#include <boot/kernel_args.h>
status_t
arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu)
{
return B_OK;
}
status_t
arch_cpu_init_percpu(kernel_args *args, int curr_cpu)
{
if (curr_cpu != 0)
panic("No SMP support on ARM yet!\n");
return 0;
}
status_t
arch_cpu_init(kernel_args *args)
{
return B_OK;
}
status_t
arch_cpu_init_post_vm(kernel_args *args)
{
return B_OK;
}
status_t
arch_cpu_init_post_modules(kernel_args *args)
{
return B_OK;
}
status_t
arch_cpu_shutdown(bool reboot)
{
while(1)
arch_cpu_idle();
return B_ERROR;
}
void
arch_cpu_sync_icache(void *address, size_t len)
{
uint32 Rd = 0;
asm volatile ("mcr p15, 0, %[c7format], c7, c5, 0"
: : [c7format] "r" (Rd) );
}
void
arch_cpu_invalidate_TLB_page(addr_t page)
{
dsb();
asm volatile ("mcr p15, 0, %0, c8, c3, 1"
: : "r" (page));
dsb();
isb();
}
void
arch_cpu_invalidate_tlb_range(intptr_t, addr_t start, addr_t end)
{
dsb();
int32 num_pages = end / B_PAGE_SIZE - start / B_PAGE_SIZE;
while (num_pages-- >= 0) {
asm volatile ("mcr p15, 0, %[c8format], c8, c6, 1"
: : [c8format] "r" (start) );
start += B_PAGE_SIZE;
}
dsb();
isb();
}
void
arch_cpu_invalidate_tlb_list(intptr_t, addr_t pages[], int num_pages)
{
dsb();
for (int i = 0; i < num_pages; i++) {
asm volatile ("mcr p15, 0, %[c8format], c8, c6, 1":
: [c8format] "r" (pages[i]) );
}
dsb();
isb();
}
void
arch_cpu_global_tlb_invalidate(void)
{
dsb();
uint32 Rd = 0;
asm volatile ("mcr p15, 0, %[c8format], c8, c7, 0"
: : [c8format] "r" (Rd) );
dsb();
isb();
}
void
arch_cpu_user_tlb_invalidate(intptr_t)
{
#warning WRITEME
}