*LOTS* of small changes to make the kernel compatible with Be's KernelExport.h

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1683 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
lillo
2002-10-26 16:13:36 +00:00
parent 23d36867f6
commit 5cdacbaabb
39 changed files with 97 additions and 140 deletions
+14 -4
View File
@@ -38,7 +38,7 @@ extern _IMPEXP_KERNEL thread_id spawn_kernel_thread (
typedef ulong cpu_status;
extern _IMPEXP_KERNEL cpu_status disable_interrupts();
extern _IMPEXP_KERNEL cpu_status disable_interrupts(void);
extern _IMPEXP_KERNEL void restore_interrupts(cpu_status status);
@@ -85,10 +85,19 @@ typedef struct timer timer;
typedef struct qent qent;
typedef int32 (*timer_hook)(timer *);
/**
* The BeOS qent structure is probably part of a general double linked list
* interface used all over the kernel; a struct is required to have a qent
* entry struct as first element, so it can be linked to other elements
* easily. The key field is probably just an id, eventually used to order
* the list.
* Since we don't use this kind of interface, but we have to provide it
* to keep compatibility, we can use the qent struct for other purposes...
*/
struct qent {
int64 key;
qent *next;
qent *prev;
int64 key; /* We use this as the sched time */
qent *next; /* This is used as a pointer to next timer */
qent *prev; /* This can be used for callback args */
};
struct timer {
@@ -111,6 +120,7 @@ bool cancel_timer(timer *t);
--- */
extern _IMPEXP_KERNEL int send_signal_etc(pid_t thid, uint sig, uint32 flags);
extern _IMPEXP_KERNEL int has_signals_pending(void *thr);
/* ---
+2 -2
View File
@@ -25,13 +25,13 @@ extern "C" {
#include <timer.h>
#include <arch/thread_struct.h>
extern spinlock_t thread_spinlock;
extern spinlock thread_spinlock;
#define GRAB_THREAD_LOCK() acquire_spinlock(&thread_spinlock)
#define RELEASE_THREAD_LOCK() release_spinlock(&thread_spinlock)
extern struct thread_queue dead_q;
extern spinlock_t team_spinlock;
extern spinlock team_spinlock;
// NOTE: TEAM lock can be held over a THREAD lock acquisition,
// but not the other way (to avoid deadlock)
#define GRAB_TEAM_LOCK() acquire_spinlock(&team_spinlock)
+2 -2
View File
@@ -9,7 +9,7 @@
#include <cdefs.h>
int con_init(kernel_args *ka);
int kprintf(const char *fmt, ...) __PRINTFLIKE(1,2);
int kprintf_xy(int x, int y, const char *fmt, ...) __PRINTFLIKE(3,4);
void kprintf(const char *fmt, ...) __PRINTFLIKE(1,2);
void kprintf_xy(int x, int y, const char *fmt, ...) __PRINTFLIKE(3,4);
#endif
-6
View File
@@ -17,17 +17,11 @@ char dbg_putch(char c);
void dbg_puts(const char *s);
bool dbg_set_serial_debug(bool new_val);
bool dbg_get_serial_debug(void);
int dprintf(const char *fmt, ...) __PRINTFLIKE(1,2);
int panic(const char *fmt, ...) __PRINTFLIKE(1,2);
void kernel_debugger(const char *);
/* special return codes for kernel debugger command function*/
#define B_KDEBUG_CONT 2
#define B_KDEBUG_QUIT 3
int add_debugger_command(const char * name, int (*func)(int, char **), const char *desc);
int remove_debugger_command(const char * name, int (*func)(int, char **));
extern void dbg_save_registers(int *); /* arch provided */
#if DEBUG
+2 -5
View File
@@ -7,6 +7,7 @@
#include <stage2.h>
#include <arch/int.h>
#include <KernelExport.h>
/**
* @defgroup kernelint Interrupts
@@ -35,17 +36,13 @@
*/
#define B_NO_ENABLE_COUNTER 1
typedef int32 (*interrupt_handler) (void *data);
int int_init(kernel_args *ka);
int int_init2(kernel_args *ka);
int int_io_interrupt_handler(int vector);
long install_interrupt_handler(long, interrupt_handler, void *);
long remove_interrupt_handler (long, interrupt_handler, void *);
#define enable_interrupts arch_int_enable_interrupts
#define disable_interrupts arch_int_disable_interrupts
#define restore_interrupts arch_int_restore_interrupts
#define enable_interrupts arch_int_enable_interrupts
#define are_interrupts_enabled arch_int_is_interrupts_enabled
/** @fn long install_io_interrupt_handler(long interrupt, interrupt_handler handler, void *data, ulong flags);
+1 -5
View File
@@ -6,6 +6,7 @@
#define _KERNEL_SMP_H
#include <stage2.h>
#include <KernelExport.h>
// intercpu messages
enum {
@@ -35,10 +36,5 @@ int smp_get_num_cpus(void);
void smp_set_num_cpus(int num_cpus);
int smp_get_current_cpu(void);
// spinlock functions
typedef volatile int spinlock_t;
void acquire_spinlock(spinlock_t *lock);
void release_spinlock(spinlock_t *lock);
#endif
+1 -60
View File
@@ -7,6 +7,7 @@
*/
#include <stage2.h>
#include <KernelExport.h>
/**
* @defgroup Timer Timer structures (not architecture specific)
@@ -18,66 +19,6 @@
extern "C" {
#endif /* __cplusplus */
typedef struct timer timer;
typedef struct qent qent;
typedef int32 (*timer_hook)(timer *);
/**
* qent structure
*/
/**
* The BeOS qent structure is probably part of a general double linked list
* interface used all over the kernel; a struct is required to have a qent
* entry struct as first element, so it can be linked to other elements
* easily. The key field is probably just an id, eventually used to order
* the list.
* Since we don't use this kind of interface, but we have to provide it
* to keep compatibility, we can use the qent struct for other purposes...
*/
struct qent {
int64 key; /* We use this as the sched time */
qent *next; /* This is used as a pointer to next timer */
qent *prev; /* This can be used for callback args */
};
/**
* Timer event data structure
*/
struct timer {
/** qent entry for this timer event */
qent entry;
/** This just holds the timer operating mode (relative/absolute/periodic) */
uint16 flags;
/** Number of the CPU associated to this timer event */
uint16 cpu;
/** Hook function to be called on timer expiration */
timer_hook hook;
/** Expiration time in microseconds */
bigtime_t period;
};
/** @defgroup timermodes Timer operating modes
* @ingroup Timer
* @{
*/
/** @def B_ONE_SHOT_ABSOLUTE_TIMER the timer will fire once at the system
* time specified by period
*/
/** @def B_ONE_SHOT_RELATIVE_TIMER the timer will fire once in approximately
* period microseconds
*/
/** @def B_PERIODIC_TIMER the timer will fire every period microseconds,
* starting in period microseconds
*/
#define B_ONE_SHOT_ABSOLUTE_TIMER 1
#define B_ONE_SHOT_RELATIVE_TIMER 2
#define B_PERIODIC_TIMER 3
/** @} */
status_t add_timer(timer *event, timer_hook hook, bigtime_t period, int32 flags);
bool cancel_timer(timer *event);
void spin(bigtime_t microseconds);
/** kernel functions */
int timer_init(kernel_args *);
int timer_interrupt(void);