xref: /haiku/headers/private/kernel/arch/cpu.h (revision 1e36cfc2721ef13a187c6f7354dc9cbc485e89d3)
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 #include <boot/kernel_args.h>
14 
15 
16 #define PAGE_ALIGN(x) (((x) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1))
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 status_t arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu);
23 status_t arch_cpu_init(kernel_args *args);
24 status_t arch_cpu_init_percpu(kernel_args *args, int curr_cpu);
25 status_t arch_cpu_init_post_vm(kernel_args *args);
26 status_t arch_cpu_init_post_modules(kernel_args *args);
27 status_t arch_cpu_shutdown(bool reboot);
28 
29 void arch_cpu_invalidate_TLB_range(addr_t start, addr_t end);
30 void arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages);
31 void arch_cpu_user_TLB_invalidate(void);
32 void arch_cpu_global_TLB_invalidate(void);
33 
34 status_t arch_cpu_user_memcpy(void *to, const void *from, size_t size,
35 			addr_t *faultHandler);
36 ssize_t arch_cpu_user_strlcpy(char *to, const char *from, size_t size,
37 			addr_t *faultHandler);
38 status_t arch_cpu_user_memset(void *s, char c, size_t count,
39 			addr_t *faultHandler);
40 
41 void arch_cpu_idle(void);
42 void arch_cpu_sync_icache(void *address, size_t length);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #include <arch_cpu.h>
49 
50 #endif /* _KERNEL_ARCH_CPU_H */
51