Some header work: removed unnecessary dependencies to stage2.h, fixed

some broken C++ export definitions, added missing licenses etc.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3152 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-05-03 16:03:26 +00:00
parent 32439967b9
commit 564cba312e
22 changed files with 140 additions and 191 deletions

View File

@ -2,14 +2,17 @@
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _BUS_H
#define _BUS_H
#ifndef KERNEL_BUS_H
#define KERNEL_BUS_H
#include <stage2.h>
#include <module.h>
int bus_init(kernel_args *ka);
int bus_man_init(kernel_args *ka);
struct kernel_args;
int bus_init(struct kernel_args *ka);
int bus_man_init(struct kernel_args *ka);
int bus_register_bus(const char *path);
@ -33,4 +36,4 @@ typedef struct device {
int bus_find_device(int n, id_list *vendor_ids, id_list *device_ids, device *dev);
#endif
#endif /* KERNEL_BUS_H */

View File

@ -5,11 +5,12 @@
#ifndef _KERNEL_CONSOLE_H
#define _KERNEL_CONSOLE_H
#include <stage2.h>
#include <cdefs.h>
#include <stdio.h>
int con_init(kernel_args *ka);
struct kernel_args;
int con_init(struct kernel_args *ka);
void kprintf(const char *fmt, ...) __PRINTFLIKE(1,2);
void kprintf_xy(int x, int y, const char *fmt, ...) __PRINTFLIKE(3,4);
#endif
#endif /* _KERNEL_CONSOLE_H */

View File

@ -1,44 +1,27 @@
/*
** Copyright 2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _KERNEL_CPU_H
#define _KERNEL_CPU_H
/**
* @file kernel/cpu.h
* @brief CPU Local per-CPU data structure
*/
#include <stage2.h>
#include <smp.h>
#include <timer.h>
/**
* @defgroup CPU CPU Structures (not architecture specific)
* @ingroup OpenBeOS_Kernel
* @{
*/
struct kernel_args;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* CPU local data structure
*/
/**
* One structure per cpu.
* The structure contains data that is local to the CPU,
* helping reduce the amount of cache thrashing.
*/
/* CPU local data structure */
typedef union cpu_ent {
/** The information structure, followed by alignment bytes to make it ?? bytes */
struct {
/** Number of this CPU, starting from 0 */
int cpu_num;
/** If set this will force a reschedule when the quantum timer expires */
// thread.c: used to force a reschedule at quantum expiration time
int preempted;
/** Quantum timer */
timer quantum_timer;
} info;
/** Alignment bytes */
uint32 align[16];
} cpu_ent;
@ -47,33 +30,18 @@ typedef union cpu_ent {
*/
extern cpu_ent cpu[MAX_BOOT_CPUS];
/**
* Perform pre-boot initialisation
* @param ka The kernel_args structure
*/
int cpu_preboot_init(kernel_args *ka);
/**
* Initialise a CPU
* @param ka The kernel_args structure
*/
int cpu_init(kernel_args *ka);
#ifdef __cplusplus
extern "C" {
#endif
/**
* Get a pointer to the CPU's local data structure
*/
/**
* This is declared as an inline function in this header
*/
int cpu_preboot_init(struct kernel_args *ka);
int cpu_init(struct kernel_args *ka);
cpu_ent *get_cpu_struct(void);
/**
* Inline declaration of get_cpu_struct(void)
*/
extern inline cpu_ent *get_cpu_struct(void) { return &cpu[smp_get_current_cpu()]; }
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* _KERNEL_CPU_H */
#endif /* _KERNEL_CPU_H */

View File

@ -5,14 +5,16 @@
#ifndef _KERNEL_DEBUG_H
#define _KERNEL_DEBUG_H
#include <kernel.h>
#include <stage2.h>
#include <cdefs.h>
struct kernel_args;
extern int dbg_register_file[2][14]; /* XXXmpetit -- must be made generic */
int dbg_init(kernel_args *ka);
int dbg_init2(kernel_args *ka);
int dbg_init(struct kernel_args *ka);
int dbg_init2(struct kernel_args *ka);
char dbg_putch(char c);
void dbg_puts(const char *s);
bool dbg_set_serial_debug(bool new_val);
@ -22,7 +24,6 @@ bool dbg_get_serial_debug(void);
#define B_KDEBUG_CONT 2
#define B_KDEBUG_QUIT 3
extern void dbg_save_registers(int *); /* arch provided */
#if DEBUG
# define ASSERT(x) \

View File

@ -6,7 +6,8 @@
#define _KERNEL_DEV_H
#include <image.h>
#include <stage2.h>
struct kernel_args;
int dev_init(kernel_args *ka);
image_id dev_load_dev_module(const char *name, const char *directory);

View File

@ -2,11 +2,11 @@
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _NEWOS_KERNEL_ARCH_DEVS_H
#define _NEWOS_KERNEL_ARCH_DEVS_H
#ifndef KERNEL_ARCH_DEVS_H
#define KERNEL_ARCH_DEVS_H
#include <stage2.h>
struct kernel_args;
int devs_init(kernel_args *ka);
int devs_init(struct kernel_args *ka);
#endif
#endif /* KERNEL_ARCH_DEVS_H */

View File

@ -2,11 +2,11 @@
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _FB_CONSOLE_DEV_H
#define _FB_CONSOLE_DEV_H
#ifndef KERNEL_FB_CONSOLE_H
#define KERNEL_FB_CONSOLE_H
#include <stage2.h>
struct kernel_args;
int fb_console_dev_init(kernel_args *ka);
int fb_console_dev_init(struct kernel_args *ka);
#endif
#endif /* KERNEL_FB_CONSOLE_H */

View File

@ -5,39 +5,17 @@
#ifndef _KERNEL_INT_H
#define _KERNEL_INT_H
#include <stage2.h>
#include <arch/int.h>
#include <KernelExport.h>
/**
* @defgroup kernelint Interrupts
* @ingroup OpenBeOS_Kernel
* @brief Interrupts for the kernel and device drivers
* @{
*/
#include <arch/int.h>
/**
* @defgroup Intreturns Interrupt Handler return codes
* @ingroup kernelint
* @{
*/
/** @def B_UNHANDLED_INTERRUPT interrupt wasn't handled by this handler */
/** @def B_HANDLED_INTERRUPT the handler handled the interrupt */
/** @def B_INVOKE_SCHEDULER the handler handled the interrupt and wants the
* scheduler invoked
*/
#define B_UNHANDLED_INTERRUPT 0
#define B_HANDLED_INTERRUPT 1
#define B_INVOKE_SCHEDULER 2
/** @} */
struct kernel_args;
/** @def B_NO_ENABLE_COUNTER add the handler but don't change whether or
* not the interrupt is currently enabled
*/
#define B_NO_ENABLE_COUNTER 1
/* adds the handler but don't change whether or not the interrupt is currently enabled */
#define B_NO_ENABLE_COUNTER 1
int int_init(kernel_args *ka);
int int_init2(kernel_args *ka);
int int_init(struct kernel_args *ka);
int int_init2(struct 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 *);
@ -45,26 +23,6 @@ long remove_interrupt_handler (long, interrupt_handler, void *);
#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);
*
* @note This function is used for devices that can generate an "actual"
* interrupt, i.e. where IRQ < 16
*/
long install_io_interrupt_handler(long,
interrupt_handler,
void *, ulong);
/** @fn long remove_io_interrupt_handler(long interrupt, interrupt_handler handler, void *data);
*
* @note This function is used for devices that can generate an "actual"
* interrupt, i.e. where IRQ < 16
*/
long remove_io_interrupt_handler (long,
interrupt_handler,
void *);
/** @} */
/* during kernel startup, interrupts are disabled */
extern bool kernel_startup;

View File

@ -8,9 +8,10 @@
#include <drivers/module.h>
#include <kernel.h>
#include <stage2.h>
extern status_t module_init(kernel_args *ka, module_info **sys_module_headers);
struct kernel_args;
extern status_t module_init(struct kernel_args *ka, module_info **sys_module_headers);
extern void module_test(void);
#endif /* _KRENEL_MODULE_H */

View File

@ -6,13 +6,14 @@
#define _KERNEL_MEMHEAP_H
#include <kernel.h>
#include <stage2.h>
struct kernel_args;
#define HEAP_SIZE 0x00400000
// 4 MB heap for the kernel
int heap_init(addr new_heap_base);
int heap_init_postsem(kernel_args *ka);
int heap_init_postsem(struct kernel_args *ka);
#endif /* _KERNEL_MEMHEAP_H */

View File

@ -5,7 +5,9 @@
#ifndef _PCI_BUS_H
#define _PCI_BUS_H
#include <stage2.h>
#include <SupportDefs.h>
struct kernel_args;
struct pci_cfg {
uint16 vendor_id;

View File

@ -1,17 +1,16 @@
/* sem.h
*
* Definitions here are for kernel use ONLY!
*
* For the actual definitions of the calls for sems please look in
* OS.h
*/
#ifndef _SEM_H
#define _SEM_H
/*
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef KERNEL_SEM_H
#define KERNEL_SEM_H
#include <OS.h>
#include <thread.h>
#include <stage2.h>
struct kernel_args;
/* user calls */
sem_id user_create_sem(int32 count, const char *name);
@ -28,8 +27,8 @@ status_t user_set_sem_owner(sem_id id, team_id team);
/* kernel calls */
extern sem_id create_sem_etc(int32 count, const char *name, team_id owner);
extern status_t sem_init(kernel_args *ka);
extern status_t sem_init(struct kernel_args *ka);
extern int sem_delete_owned_sems(team_id owner);
extern status_t sem_interrupt_thread(struct thread *t);
#endif /* _KERNEL_SEM_H */
#endif /* KERNEL_SEM_H */

View File

@ -2,12 +2,15 @@
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _KERNEL_SMP_H
#define _KERNEL_SMP_H
#ifndef KERNEL_SMP_H
#define KERNEL_SMP_H
#include <stage2.h>
#include <KernelExport.h>
struct kernel_args;
// intercpu messages
enum {
SMP_MSG_INVL_PAGE_RANGE = 0,
@ -23,8 +26,8 @@ enum {
SMP_MSG_FLAG_SYNC,
};
int smp_init(kernel_args *ka);
int smp_trap_non_boot_cpus(kernel_args *ka, int cpu);
int smp_init(struct kernel_args *ka);
int smp_trap_non_boot_cpus(struct kernel_args *ka, int cpu);
void smp_wake_up_all_non_boot_cpus(void);
void smp_wait_for_ap_cpus(kernel_args *ka);
void smp_send_ici(int target_cpu, int message, unsigned long data, unsigned long data2, unsigned long data3, void *data_ptr, int flags);
@ -36,5 +39,6 @@ int smp_get_num_cpus(void);
void smp_set_num_cpus(int num_cpus);
int smp_get_current_cpu(void);
#endif
int smp_intercpu_int_handler(void);
#endif /* KERNEL_SMP_H */

View File

@ -5,7 +5,6 @@
#define _STDIO_H
#include <ktypes.h>
#include <cdefs.h>
#include <stdarg.h>
#ifdef __cplusplus
@ -127,6 +126,17 @@ extern FILE __sF[];
#define EOF -1
// ToDo: that's only a temporary solution
#ifdef __GNUC__
# define __PRINTFLIKE(__fmt,__varargs) __attribute__((__format__ (__printf__, __fmt, __varargs)))
# define __SCANFLIKE(__fmt,__varargs) __attribute__((__format__ (__scanf__, __fmt, __varargs)))
# define __PURE __attribute__((__const__))
#else
# define __PRINTFLIKE(__fmt,__varargs)
# define __SCANFLIKE(__fmt,__varargs)
# define __PURE
#endif
int printf(char const *format, ...) __PRINTFLIKE(1,2);
int fprintf(FILE *stream, char const *format, ...) __PRINTFLIKE(2,3);
int sprintf(char *str, char const *format, ...) __PRINTFLIKE(2,3);

View File

@ -2,11 +2,10 @@
**
** Distributed under the terms of the OpenBeOS License.
*/
#ifndef _KERNEL_THREAD_TYPES_H
#define _KERNEL_THREAD_TYPES_H
#include <stage2.h>
#include <ktypes.h>
#include <cbuf.h>
#include <vm.h>

View File

@ -1,37 +1,28 @@
/*
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#ifndef _KERNEL_TIMER_H
#define _KERNEL_TIMER_H
/**
* @file kernel/timer.h
* @brief Timer structures and definitions
*/
#include <stage2.h>
#include <KernelExport.h>
/**
* @defgroup Timer Timer structures (not architecture specific)
* @ingroup OpenBeOS_Kernel
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif
/** kernel functions */
/* kernel functions */
int timer_init(kernel_args *);
int timer_interrupt(void);
/** these two are only to be used by the scheduler */
/* these two are only to be used by the scheduler */
int local_timer_cancel_event(timer *event);
int _local_timer_cancel_event(int curr_cpu, timer *event);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/** @} */
#endif /* _KERNEL_TIMER_H */
#endif
#endif /* _KERNEL_TIMER_H */

View File

@ -7,7 +7,6 @@
#define _KERNEL_VFS_H
#include <kernel.h>
#include <stage2.h>
#include <sys/stat.h>
#include <sys/select.h>
#include <signal.h>
@ -23,6 +22,7 @@
#include <vfs_types.h>
struct kernel_args;
struct file_descriptor;
struct selectsync;
struct pollfd;
@ -51,7 +51,7 @@ typedef struct io_context {
extern "C" {
#endif
int vfs_init(kernel_args *ka);
int vfs_init(struct kernel_args *ka);
int vfs_bootstrap_all_filesystems(void);
int vfs_register_filesystem(const char *name, struct fs_ops *calls);
void *vfs_new_io_context(void *parent_ioctx);

View File

@ -5,17 +5,20 @@
#ifndef _KERNEL_VM_H
#define _KERNEL_VM_H
#include <kernel.h>
#include <stage2.h>
#include <defines.h>
#include <vfs.h>
#include <vm_types.h>
#include <arch/vm_translation_map.h>
struct kernel_args;
//void vm_dump_areas(vm_address_space *aspace);
int vm_init(kernel_args *ka);
int vm_init_postsem(kernel_args *ka);
int vm_init_postthread(kernel_args *ka);
int vm_init_postsem(struct kernel_args *ka);
int vm_init_postthread(struct kernel_args *ka);
aspace_id vm_create_aspace(const char *name, addr base, addr size, bool kernel);
int vm_delete_aspace(aspace_id);

View File

@ -7,9 +7,11 @@
#include <kernel.h>
#include <vm.h>
#include <stage2.h>
int vm_cache_init(kernel_args *ka);
struct kernel_args;
int vm_cache_init(struct kernel_args *ka);
vm_cache *vm_cache_create(vm_store *store);
vm_cache_ref *vm_cache_ref_create(vm_cache *cache);
void vm_cache_acquire_ref(vm_cache_ref *cache_ref, bool acquire_store_ref);
@ -20,5 +22,4 @@ void vm_cache_remove_page(vm_cache_ref *cache_ref, vm_page *page);
int vm_cache_insert_region(vm_cache_ref *cache_ref, vm_region *region);
int vm_cache_remove_region(vm_cache_ref *cache_ref, vm_region *region);
#endif
#endif /* _KERNEL_VM_CACHE_H */

View File

@ -6,12 +6,14 @@
#define _KERNEL_VM_PAGE_H
#include <kernel.h>
#include <stage2.h>
#include <vm.h>
int vm_page_init(kernel_args *ka);
int vm_page_init2(kernel_args *ka);
int vm_page_init_postthread(kernel_args *ka);
struct kernel_args;
int vm_page_init(struct kernel_args *ka);
int vm_page_init2(struct kernel_args *ka);
int vm_page_init_postthread(struct kernel_args *ka);
int vm_mark_page_inuse(addr page);
int vm_mark_page_range_inuse(addr start_page, addr len);
@ -22,5 +24,4 @@ vm_page *vm_page_allocate_page_run(int state, addr len);
vm_page *vm_page_allocate_specific_page(addr page_num, int state);
vm_page *vm_lookup_page(addr page_num);
#endif
#endif /* _KERNEL_VM_PAGE_H */

View File

@ -2,13 +2,16 @@
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _NEWOS_KERNEL_ARCH_VM_TRANSLATION_MAP_H
#define _NEWOS_KERNEL_ARCH_VM_TRANSLATION_MAP_H
#ifndef KERNEL_VM_TRANSLATION_MAP_H
#define KERNEL_VM_TRANSLATION_MAP_H
#include <kernel.h>
#include <stage2.h>
#include <lock.h>
struct kernel_args;
typedef struct vm_translation_map_struct {
struct vm_translation_map_struct *next;
struct vm_translation_map_ops_struct *ops;
@ -34,15 +37,14 @@ typedef struct vm_translation_map_ops_struct {
} vm_translation_map_ops;
int vm_translation_map_create(vm_translation_map *new_map, bool kernel);
int vm_translation_map_module_init(kernel_args *ka);
int vm_translation_map_module_init2(kernel_args *ka);
void vm_translation_map_module_init_post_sem(kernel_args *ka);
int vm_translation_map_module_init(struct kernel_args *ka);
int vm_translation_map_module_init2(struct kernel_args *ka);
void vm_translation_map_module_init_post_sem(struct kernel_args *ka);
// quick function to map a page in regardless of map context. Used in VM initialization,
// before most vm data structures exist
int vm_translation_map_quick_map(kernel_args *ka, addr va, addr pa, unsigned int attributes, addr (*get_free_page)(kernel_args *));
int vm_translation_map_quick_map(struct kernel_args *ka, addr va, addr pa, unsigned int attributes, addr (*get_free_page)(kernel_args *));
// quick function to return the physical pgdir of a mapping, needed for a context switch
addr vm_translation_map_get_pgdir(vm_translation_map *map);
#endif
#endif /* KERNEL_VM_TRANSLATION_MAP_H */

View File

@ -1,8 +1,11 @@
/*
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _KERNEL_VM_TYPES_H
#define _KERNEL_VM_TYPES_H
#include <kernel.h>
#include <stage2.h>
#include <defines.h>
#include <vfs.h>
#include <arch/vm_translation_map.h>