1 /* 2 * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 * 5 * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 6 * Distributed under the terms of the NewOS License. 7 */ 8 #ifndef _KERNEL_ARCH_CPU_H 9 #define _KERNEL_ARCH_CPU_H 10 11 12 #include <OS.h> 13 14 15 #define PAGE_ALIGN(x) (((x) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)) 16 17 18 struct kernel_args; 19 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 status_t arch_cpu_preboot_init_percpu(struct kernel_args *args, int curr_cpu); 26 status_t arch_cpu_init(struct kernel_args *args); 27 status_t arch_cpu_init_percpu(struct kernel_args *args, int curr_cpu); 28 status_t arch_cpu_init_post_vm(struct kernel_args *args); 29 status_t arch_cpu_init_post_modules(struct kernel_args *args); 30 status_t arch_cpu_shutdown(bool reboot); 31 32 void arch_cpu_invalidate_TLB_range(addr_t start, addr_t end); 33 void arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages); 34 void arch_cpu_user_TLB_invalidate(void); 35 void arch_cpu_global_TLB_invalidate(void); 36 37 status_t arch_cpu_user_memcpy(void *to, const void *from, size_t size, 38 addr_t *faultHandler); 39 ssize_t arch_cpu_user_strlcpy(char *to, const char *from, size_t size, 40 addr_t *faultHandler); 41 status_t arch_cpu_user_memset(void *s, char c, size_t count, 42 addr_t *faultHandler); 43 44 void arch_cpu_sync_icache(void *address, size_t length); 45 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #include <arch_cpu.h> 52 53 #define CACHE_LINE_ALIGN __attribute__((aligned(CACHE_LINE_SIZE))) 54 55 #endif /* _KERNEL_ARCH_CPU_H */ 56