Files
haiku-beta6/headers/private/kernel/cpu.h
T

65 lines
1.5 KiB
C
Raw Normal View History

/*
* Copyright 2002-2006, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Copyright 2002, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
*/
2002-07-09 12:24:59 +00:00
#ifndef _KERNEL_CPU_H
#define _KERNEL_CPU_H
#include <smp.h>
#include <timer.h>
2005-10-25 16:59:12 +00:00
#include <boot/kernel_args.h>
2007-02-05 01:46:28 +00:00
#include <arch/cpu.h>
2002-07-09 12:24:59 +00:00
/* CPU local data structure */
typedef struct cpu_ent {
int cpu_num;
// thread.c: used to force a reschedule at quantum expiration time
int preempted;
timer quantum_timer;
// keeping track of CPU activity
bigtime_t active_time;
bigtime_t last_kernel_time;
bigtime_t last_user_time;
bool disabled;
2007-02-05 01:46:28 +00:00
// arch-specific stuff
arch_cpu_info arch;
} cpu_ent __attribute__((aligned(64)));
2002-07-09 12:24:59 +00:00
extern cpu_ent gCPU[MAX_BOOT_CPUS];
2002-07-09 12:24:59 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2002-07-09 12:24:59 +00:00
status_t cpu_preboot_init_percpu(struct kernel_args *args, int curr_cpu);
status_t cpu_init(struct kernel_args *args);
2007-02-05 01:46:28 +00:00
status_t cpu_init_percpu(kernel_args *ka, int curr_cpu);
status_t cpu_init_post_vm(struct kernel_args *args);
status_t cpu_init_post_modules(struct kernel_args *args);
bigtime_t cpu_get_active_time(int32 cpu);
2002-07-09 12:24:59 +00:00
cpu_ent *get_cpu_struct(void);
extern inline cpu_ent *get_cpu_struct(void) { return &gCPU[smp_get_current_cpu()]; }
2002-07-09 12:24:59 +00:00
void _user_clear_caches(void *address, size_t length, uint32 flags);
bool _user_cpu_enabled(int32 cpu);
status_t _user_set_cpu_enabled(int32 cpu, bool enabled);
2002-07-09 12:24:59 +00:00
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_CPU_H */