2003-05-03 20:03:26 +04:00
|
|
|
/*
|
|
|
|
** Copyright 2002, Travis Geiselbrecht. All rights reserved.
|
|
|
|
** Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _KERNEL_CPU_H
|
|
|
|
#define _KERNEL_CPU_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <smp.h>
|
|
|
|
#include <timer.h>
|
2004-06-07 06:06:04 +04:00
|
|
|
#include <boot/kernel_args.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
|
2003-05-03 20:03:26 +04:00
|
|
|
/* CPU local data structure */
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
typedef union cpu_ent {
|
|
|
|
struct {
|
|
|
|
int cpu_num;
|
2003-05-03 20:03:26 +04:00
|
|
|
|
|
|
|
// thread.c: used to force a reschedule at quantum expiration time
|
2002-07-09 16:24:59 +04:00
|
|
|
int preempted;
|
2002-07-21 02:53:23 +04:00
|
|
|
timer quantum_timer;
|
2002-07-09 16:24:59 +04:00
|
|
|
} info;
|
|
|
|
uint32 align[16];
|
|
|
|
} cpu_ent;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defined in core/cpu.c
|
|
|
|
*/
|
|
|
|
extern cpu_ent cpu[MAX_BOOT_CPUS];
|
|
|
|
|
2003-05-03 20:03:26 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2003-05-03 20:03:26 +04:00
|
|
|
int cpu_preboot_init(struct kernel_args *ka);
|
|
|
|
int cpu_init(struct kernel_args *ka);
|
2002-07-09 16:24:59 +04:00
|
|
|
cpu_ent *get_cpu_struct(void);
|
|
|
|
|
|
|
|
extern inline cpu_ent *get_cpu_struct(void) { return &cpu[smp_get_current_cpu()]; }
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-05-03 20:03:26 +04:00
|
|
|
#endif /* _KERNEL_CPU_H */
|