From 5cdacbaabbd66673ada83b4d97d87126776484dc Mon Sep 17 00:00:00 2001 From: lillo Date: Sat, 26 Oct 2002 16:13:36 +0000 Subject: [PATCH] *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 --- headers/os/drivers/KernelExport.h | 18 ++++-- headers/os/kernel/thread_types.h | 4 +- headers/private/kernel/console.h | 4 +- headers/private/kernel/debug.h | 6 -- headers/private/kernel/int.h | 7 +-- headers/private/kernel/smp.h | 6 +- headers/private/kernel/timer.h | 61 +------------------ src/kernel/apps/shell/statements.c | 10 +-- .../core/addons/bus_managers/bus_init.c | 2 + .../core/addons/bus_managers/config_manager.c | 1 + src/kernel/core/addons/bus_managers/isa/isa.c | 1 + src/kernel/core/addons/bus_managers/pci/pci.c | 2 +- src/kernel/core/arch/x86/arch_selector.c | 2 +- src/kernel/core/arch/x86/arch_vm.c | 1 + .../core/arch/x86/arch_vm_translation_map.c | 2 +- src/kernel/core/cbuf.c | 4 +- src/kernel/core/console.c | 6 +- src/kernel/core/debug.c | 15 ++--- src/kernel/core/fs/bootfs.c | 1 + src/kernel/core/fs/devfs.c | 1 + src/kernel/core/fs/rootfs.c | 1 + src/kernel/core/heap.c | 1 + src/kernel/core/int.c | 16 ++++- src/kernel/core/pools.c | 1 + src/kernel/core/port.c | 4 +- src/kernel/core/sem.c | 12 ++-- src/kernel/core/signal.c | 4 +- src/kernel/core/smp.c | 16 ++--- src/kernel/core/syscalls.c | 2 +- src/kernel/core/sysctl.c | 2 +- src/kernel/core/team.c | 2 +- src/kernel/core/thread.c | 8 +-- src/kernel/core/timer.c | 4 +- src/kernel/core/vm/vm.c | 2 +- src/kernel/core/vm/vm_cache.c | 2 +- src/kernel/core/vm/vm_page.c | 2 +- .../core/vm/vm_store_anonymous_noswap.c | 1 + src/kernel/core/vm/vm_store_device.c | 1 + src/kernel/core/vm/vm_tests.c | 2 + 39 files changed, 97 insertions(+), 140 deletions(-) diff --git a/headers/os/drivers/KernelExport.h b/headers/os/drivers/KernelExport.h index 593a6ffa98..6f82cb02b4 100644 --- a/headers/os/drivers/KernelExport.h +++ b/headers/os/drivers/KernelExport.h @@ -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); /* --- diff --git a/headers/os/kernel/thread_types.h b/headers/os/kernel/thread_types.h index f7c9d318cc..60f59bd93a 100644 --- a/headers/os/kernel/thread_types.h +++ b/headers/os/kernel/thread_types.h @@ -25,13 +25,13 @@ extern "C" { #include #include -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) diff --git a/headers/private/kernel/console.h b/headers/private/kernel/console.h index b87c98f12d..b3a36e0538 100755 --- a/headers/private/kernel/console.h +++ b/headers/private/kernel/console.h @@ -9,7 +9,7 @@ #include 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 diff --git a/headers/private/kernel/debug.h b/headers/private/kernel/debug.h index 5d8a6c6373..8de793decc 100755 --- a/headers/private/kernel/debug.h +++ b/headers/private/kernel/debug.h @@ -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 diff --git a/headers/private/kernel/int.h b/headers/private/kernel/int.h index 14c3e31250..f76b841ab9 100755 --- a/headers/private/kernel/int.h +++ b/headers/private/kernel/int.h @@ -7,6 +7,7 @@ #include #include +#include /** * @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); diff --git a/headers/private/kernel/smp.h b/headers/private/kernel/smp.h index ab4ac1f73a..a94d6060ab 100755 --- a/headers/private/kernel/smp.h +++ b/headers/private/kernel/smp.h @@ -6,6 +6,7 @@ #define _KERNEL_SMP_H #include +#include // 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 diff --git a/headers/private/kernel/timer.h b/headers/private/kernel/timer.h index 21da3544a8..f2e763c061 100755 --- a/headers/private/kernel/timer.h +++ b/headers/private/kernel/timer.h @@ -7,6 +7,7 @@ */ #include +#include /** * @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); diff --git a/src/kernel/apps/shell/statements.c b/src/kernel/apps/shell/statements.c index e21a505b9f..9279a96a5b 100644 --- a/src/kernel/apps/shell/statements.c +++ b/src/kernel/apps/shell/statements.c @@ -142,7 +142,7 @@ err: } -static int parse_expression(scan_info *info,shell_value **out) +static int parse_expr(scan_info *info,shell_value **out) { (*out) = NULL; return parse_oper(info,out,MAX_LEVEL); @@ -288,7 +288,7 @@ static int handle_exit(scan_info *info) if(scan(info)) return SHE_SCAN_ERROR; - err = parse_expression(info,&expr); + err = parse_expr(info,&expr); if(err != SHE_NO_ERROR) return err; if(!(expr->isnumber)){ @@ -322,7 +322,7 @@ static int parse_rvl_expr(scan_info *info,shell_value **out) if(expect(info,SVO_PARENL)) return SVO_PARENL; - err = parse_expression(info,out); + err = parse_expr(info,out); if(err != SHE_NO_ERROR) return err; @@ -423,7 +423,7 @@ static int handle_load(scan_info *info) if(expect(info,SVO_LOAD)) return SVO_LOAD; - err = parse_expression(info,&value); + err = parse_expr(info,&value); if(err != SHE_NO_ERROR) return err; set_shell_var_with_value(var_name,value); @@ -446,7 +446,7 @@ static int handle_echo(scan_info *info) while(info->sym_code != SVO_END){ - err = parse_expression(info,&value); + err = parse_expr(info,&value); if(err != SHE_NO_ERROR) return err; diff --git a/src/kernel/core/addons/bus_managers/bus_init.c b/src/kernel/core/addons/bus_managers/bus_init.c index c1382467e0..674613b662 100755 --- a/src/kernel/core/addons/bus_managers/bus_init.c +++ b/src/kernel/core/addons/bus_managers/bus_init.c @@ -7,6 +7,8 @@ #include #include #include +#include + int bus_init(kernel_args *ka) { diff --git a/src/kernel/core/addons/bus_managers/config_manager.c b/src/kernel/core/addons/bus_managers/config_manager.c index bc9c71f9c6..4f96290e6b 100644 --- a/src/kernel/core/addons/bus_managers/config_manager.c +++ b/src/kernel/core/addons/bus_managers/config_manager.c @@ -12,6 +12,7 @@ #include #include #include +#include static pci_module_info *pcim = NULL; diff --git a/src/kernel/core/addons/bus_managers/isa/isa.c b/src/kernel/core/addons/bus_managers/isa/isa.c index 333362be9b..bcb3781129 100755 --- a/src/kernel/core/addons/bus_managers/isa/isa.c +++ b/src/kernel/core/addons/bus_managers/isa/isa.c @@ -8,6 +8,7 @@ #include #include #include +#include static status_t isa_rescan(void) { diff --git a/src/kernel/core/addons/bus_managers/pci/pci.c b/src/kernel/core/addons/bus_managers/pci/pci.c index d6c031ea85..e0479ef152 100755 --- a/src/kernel/core/addons/bus_managers/pci/pci.c +++ b/src/kernel/core/addons/bus_managers/pci/pci.c @@ -53,7 +53,7 @@ enum { static struct pci_device *pci_devices = NULL; static struct pci_bus *pci_busses = NULL; -static spinlock_t pci_config_lock = 0; /* lock for config space access */ +static spinlock pci_config_lock = 0; /* lock for config space access */ static int pci_mode = 1; /* The pci config mechanism we're using. * NB defaults to 1 as this is more common, but * checked at runtime diff --git a/src/kernel/core/arch/x86/arch_selector.c b/src/kernel/core/arch/x86/arch_selector.c index d942a46940..966f5cf807 100644 --- a/src/kernel/core/arch/x86/arch_selector.c +++ b/src/kernel/core/arch/x86/arch_selector.c @@ -32,7 +32,7 @@ void i386_selector_init( void *gdt ) // 0 on error selector_id i386_selector_add( selector_type type ) { - static int spinlock; + static spinlock spinlock; int state; uint32 mask; selector_id id = 0; diff --git a/src/kernel/core/arch/x86/arch_vm.c b/src/kernel/core/arch/x86/arch_vm.c index 3ee784ff53..175a261f76 100755 --- a/src/kernel/core/arch/x86/arch_vm.c +++ b/src/kernel/core/arch/x86/arch_vm.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/kernel/core/arch/x86/arch_vm_translation_map.c b/src/kernel/core/arch/x86/arch_vm_translation_map.c index 5d6789892b..435e05e142 100755 --- a/src/kernel/core/arch/x86/arch_vm_translation_map.c +++ b/src/kernel/core/arch/x86/arch_vm_translation_map.c @@ -62,7 +62,7 @@ static pdentry *kernel_pgdir_phys = NULL; static pdentry *kernel_pgdir_virt = NULL; static vm_translation_map *tmap_list; -static spinlock_t tmap_list_lock; +static spinlock tmap_list_lock; #define CHATTY_TMAP 0 diff --git a/src/kernel/core/cbuf.c b/src/kernel/core/cbuf.c index 0b6325569f..36939adb3e 100644 --- a/src/kernel/core/cbuf.c +++ b/src/kernel/core/cbuf.c @@ -24,9 +24,9 @@ static cbuf *cbuf_free_list; static sem_id free_list_sem; static cbuf *cbuf_free_noblock_list; -static spinlock_t noblock_spin; +static spinlock noblock_spin; -static spinlock_t cbuf_lowlevel_spinlock; +static spinlock cbuf_lowlevel_spinlock; static region_id cbuf_region_id; static cbuf *cbuf_region; static region_id cbuf_bitmap_region_id; diff --git a/src/kernel/core/console.c b/src/kernel/core/console.c index e1547f121c..433b374685 100644 --- a/src/kernel/core/console.c +++ b/src/kernel/core/console.c @@ -31,7 +31,7 @@ struct console_op_xy_struct { static int console_fd = -1; -int +void kprintf(const char *fmt, ...) { int ret = 0; @@ -45,11 +45,10 @@ kprintf(const char *fmt, ...) sys_write(console_fd, 0, temp, ret); } - return ret; } -int +void kprintf_xy(int x, int y, const char *fmt, ...) { int ret = 0; @@ -65,7 +64,6 @@ kprintf_xy(int x, int y, const char *fmt, ...) buf.y = y; sys_ioctl(console_fd, CONSOLE_OP_WRITEXY, &buf, ret + sizeof(buf.x) + sizeof(buf.y)); } - return ret; } diff --git a/src/kernel/core/debug.c b/src/kernel/core/debug.c index e608b78943..fa19b6d2f2 100644 --- a/src/kernel/core/debug.c +++ b/src/kernel/core/debug.c @@ -29,7 +29,7 @@ int dbg_register_file[2][14]; /* XXXmpetit -- must be made generic */ static bool serial_debug_on = false; -static spinlock_t dbg_spinlock = 0; +static spinlock dbg_spinlock = 0; static int debugger_on_cpu = -1; struct debugger_command @@ -250,7 +250,7 @@ kernel_debugger(const char * message) } -int +void panic(const char *fmt, ...) { int ret = 0; @@ -279,25 +279,22 @@ panic(const char *fmt, ...) kernel_debugger(NULL); restore_interrupts(state); - return ret; } -int +void dprintf(const char *fmt, ...) { va_list args; char temp[512]; - int ret = 0; if (serial_debug_on) { va_start(args, fmt); - ret = vsprintf(temp, fmt, args); + vsprintf(temp, fmt, args); va_end(args); dbg_puts(temp); } - return ret; } @@ -335,7 +332,7 @@ dbg_puts(const char *s) int -add_debugger_command(const char *name, int (*func)(int, char **), const char *desc) +add_debugger_command(char *name, int (*func)(int, char **), char *desc) { int flags; struct debugger_command *cmd; @@ -362,7 +359,7 @@ add_debugger_command(const char *name, int (*func)(int, char **), const char *de int -remove_debugger_command(const char * name, int (*func)(int, char **)) +remove_debugger_command(char * name, int (*func)(int, char **)) { int flags; struct debugger_command *cmd; diff --git a/src/kernel/core/fs/bootfs.c b/src/kernel/core/fs/bootfs.c index 1cb5cb0980..9f2e9bdbf0 100755 --- a/src/kernel/core/fs/bootfs.c +++ b/src/kernel/core/fs/bootfs.c @@ -14,6 +14,7 @@ #include #include #include +#include #include diff --git a/src/kernel/core/fs/devfs.c b/src/kernel/core/fs/devfs.c index 31c1f0241d..9a2b3bcfe7 100755 --- a/src/kernel/core/fs/devfs.c +++ b/src/kernel/core/fs/devfs.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include diff --git a/src/kernel/core/fs/rootfs.c b/src/kernel/core/fs/rootfs.c index d388260857..2bc3b7a5e3 100755 --- a/src/kernel/core/fs/rootfs.c +++ b/src/kernel/core/fs/rootfs.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/src/kernel/core/heap.c b/src/kernel/core/heap.c index fde8d9e2e1..b9c9b703fc 100644 --- a/src/kernel/core/heap.c +++ b/src/kernel/core/heap.c @@ -3,6 +3,7 @@ ** Distributed under the terms of the NewOS License. */ +#include #include #include #include diff --git a/src/kernel/core/int.c b/src/kernel/core/int.c index b8f8123aeb..746d6e9481 100644 --- a/src/kernel/core/int.c +++ b/src/kernel/core/int.c @@ -25,12 +25,26 @@ struct io_handler { struct io_vector { struct io_handler handler_list; - spinlock_t vector_lock; + spinlock vector_lock; }; static struct io_vector *io_vectors = NULL; +cpu_status +disable_interrupts() +{ + return arch_int_disable_interrupts(); +} + + +void +restore_interrupts(cpu_status status) +{ + arch_int_restore_interrupts(status); +} + + int int_init(kernel_args *ka) { diff --git a/src/kernel/core/pools.c b/src/kernel/core/pools.c index a98b40ec8a..ca351883f6 100644 --- a/src/kernel/core/pools.c +++ b/src/kernel/core/pools.c @@ -3,6 +3,7 @@ /* XXX - add documentation to this file! */ #include #include +#include #include #include #include diff --git a/src/kernel/core/port.c b/src/kernel/core/port.c index af0e8033f1..80fe506039 100644 --- a/src/kernel/core/port.c +++ b/src/kernel/core/port.c @@ -29,7 +29,7 @@ struct port_entry { port_id id; team_id owner; int32 capacity; - int lock; + spinlock lock; char *name; sem_id read_sem; sem_id write_sem; @@ -57,7 +57,7 @@ static bool ports_active = false; static port_id next_port = 0; -static int port_spinlock = 0; +static spinlock port_spinlock = 0; #define GRAB_PORT_LIST_LOCK() acquire_spinlock(&port_spinlock) #define RELEASE_PORT_LIST_LOCK() release_spinlock(&port_spinlock) #define GRAB_PORT_LOCK(s) acquire_spinlock(&(s).lock) diff --git a/src/kernel/core/sem.c b/src/kernel/core/sem.c index 87afc7997a..10467f447c 100644 --- a/src/kernel/core/sem.c +++ b/src/kernel/core/sem.c @@ -33,12 +33,12 @@ struct sem_entry { - sem_id id; - int count; + sem_id id; + int count; struct thread_queue q; - char *name; - int lock; - team_id owner; // if set to -1, means owned by a port + char *name; + spinlock lock; + team_id owner; // if set to -1, means owned by a port }; #define MAX_SEMS 4096 @@ -48,7 +48,7 @@ static region_id gSemRegion = 0; static bool gSemsActive = false; static sem_id gNextSemID = 0; -static int sem_spinlock = 0; +static spinlock sem_spinlock = 0; #define GRAB_SEM_LIST_LOCK() acquire_spinlock(&sem_spinlock) #define RELEASE_SEM_LIST_LOCK() release_spinlock(&sem_spinlock) #define GRAB_SEM_LOCK(s) acquire_spinlock(&(s).lock) diff --git a/src/kernel/core/signal.c b/src/kernel/core/signal.c index 167c5f2db4..fc26dd25c4 100644 --- a/src/kernel/core/signal.c +++ b/src/kernel/core/signal.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -177,8 +178,9 @@ send_signal_etc(pid_t tid, uint sig, uint32 flags) int -has_signals_pending(struct thread *t) +has_signals_pending(void *thr) { + struct thread *t = (struct thread *)thr; if (!t) t = thread_get_current_thread(); return (t->sig_pending & ~t->sig_block_mask); diff --git a/src/kernel/core/smp.c b/src/kernel/core/smp.c index 402e0951a4..d62a59e70c 100644 --- a/src/kernel/core/smp.c +++ b/src/kernel/core/smp.c @@ -42,17 +42,17 @@ struct smp_msg { #define MAILBOX_LOCAL 1 #define MAILBOX_BCAST 2 -static spinlock_t boot_cpu_spin[SMP_MAX_CPUS] = { 0, }; +static spinlock boot_cpu_spin[SMP_MAX_CPUS] = { 0, }; static struct smp_msg *free_msgs = NULL; static volatile int free_msg_count = 0; -static spinlock_t free_msg_spinlock = 0; +static spinlock free_msg_spinlock = 0; static struct smp_msg *smp_msgs[SMP_MAX_CPUS] = { NULL, }; -static spinlock_t cpu_msg_spinlock[SMP_MAX_CPUS] = { 0, }; +static spinlock cpu_msg_spinlock[SMP_MAX_CPUS] = { 0, }; static struct smp_msg *smp_broadcast_msgs = NULL; -static spinlock_t broadcast_msg_spinlock = 0; +static spinlock broadcast_msg_spinlock = 0; static bool ici_enabled = false; @@ -61,7 +61,7 @@ static int smp_num_cpus = 1; static int smp_process_pending_ici(int curr_cpu); void -acquire_spinlock(spinlock_t *lock) +acquire_spinlock(spinlock *lock) { if (smp_num_cpus > 1) { int curr_cpu = smp_get_current_cpu(); @@ -78,7 +78,7 @@ acquire_spinlock(spinlock_t *lock) static void -acquire_spinlock_nocheck(spinlock_t *lock) +acquire_spinlock_nocheck(spinlock *lock) { if (smp_num_cpus > 1) { while (1) { @@ -92,7 +92,7 @@ acquire_spinlock_nocheck(spinlock_t *lock) void -release_spinlock(spinlock_t *lock) +release_spinlock(spinlock *lock) { *lock = 0; } @@ -188,7 +188,7 @@ smp_finish_message_processing(int curr_cpu, struct smp_msg *msg, int source_mail // we were the last one to decrement the ref_count // it's our job to remove it from the list & possibly clean it up struct smp_msg **mbox = NULL; - spinlock_t *spinlock = NULL; + spinlock *spinlock = NULL; // clean up the message from one of the mailboxes switch(source_mailbox) { diff --git a/src/kernel/core/syscalls.c b/src/kernel/core/syscalls.c index 31712710a2..f0ecc29ec7 100644 --- a/src/kernel/core/syscalls.c +++ b/src/kernel/core/syscalls.c @@ -396,7 +396,7 @@ int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_re *call_ret = user_sigaction((int)arg0, (const struct sigaction *)arg1, (struct sigaction *)arg2); break; case SYSCALL_SEND_SIGNAL: - *call_ret = send_signal_etc((pid_t)arg0, (uint)arg1); + *call_ret = send_signal_etc((pid_t)arg0, (uint)arg1, B_DO_NOT_RESCHEDULE); break; case SYSCALL_SET_ALARM: *call_ret = sys_set_alarm((bigtime_t)INT32TOINT64(arg0, arg1), (uint32)arg2); diff --git a/src/kernel/core/sysctl.c b/src/kernel/core/sysctl.c index 61d4282ed4..4ade99174b 100644 --- a/src/kernel/core/sysctl.c +++ b/src/kernel/core/sysctl.c @@ -6,7 +6,7 @@ #include #include #include - +#include #include /* Not sure where to put this definition yet (sys/param.h?), diff --git a/src/kernel/core/team.c b/src/kernel/core/team.c index 82cb5c82ef..7bb733953a 100644 --- a/src/kernel/core/team.c +++ b/src/kernel/core/team.c @@ -44,7 +44,7 @@ static void *team_hash = NULL; static team_id next_team_id = 1; static struct team *kernel_team = NULL; -spinlock_t team_spinlock = 0; +spinlock team_spinlock = 0; static struct team *create_team_struct(const char *name, bool kernel); static void delete_team_struct(struct team *p); diff --git a/src/kernel/core/thread.c b/src/kernel/core/thread.c index 3106c35b68..d8333a70bf 100644 --- a/src/kernel/core/thread.c +++ b/src/kernel/core/thread.c @@ -42,7 +42,7 @@ struct thread_key { }; // global -spinlock_t thread_spinlock = 0; +spinlock thread_spinlock = 0; // thread list static struct thread *idle_threads[MAX_BOOT_CPUS]; @@ -1085,15 +1085,9 @@ void sys_exit_thread(status_t return_value) { struct thread *t = thread_get_current_thread(); - int state; - state = disable_interrupts(); - GRAB_THREAD_LOCK(); t->return_code = return_value; t->return_flags = THREAD_RETURN_EXIT; - RELEASE_THREAD_LOCK(); - restore_interrupts(state); - send_signal_etc(t->id, SIGKILLTHR, B_DO_NOT_RESCHEDULE); } diff --git a/src/kernel/core/timer.c b/src/kernel/core/timer.c index 1b434dfc16..b909d97256 100644 --- a/src/kernel/core/timer.c +++ b/src/kernel/core/timer.c @@ -21,7 +21,7 @@ #include static timer * volatile events[SMP_MAX_CPUS] = { NULL, }; -static spinlock_t timer_spinlock[SMP_MAX_CPUS] = { 0, }; +static spinlock timer_spinlock[SMP_MAX_CPUS] = { 0, }; int timer_init(kernel_args *ka) { @@ -56,7 +56,7 @@ int timer_interrupt() { bigtime_t sched_time; timer *event; - spinlock_t *spinlock; + spinlock *spinlock; int curr_cpu = smp_get_current_cpu(); int rc = B_HANDLED_INTERRUPT; diff --git a/src/kernel/core/vm/vm.c b/src/kernel/core/vm/vm.c index 1cc2b5a85e..260da3cd58 100755 --- a/src/kernel/core/vm/vm.c +++ b/src/kernel/core/vm/vm.c @@ -51,7 +51,7 @@ static void *aspace_table; static sem_id aspace_hash_sem; static int max_commit; -static spinlock_t max_commit_lock; +static spinlock max_commit_lock; // function declarations static vm_region *_vm_create_region_struct(vm_address_space *aspace, const char *name, int wiring, int lock); diff --git a/src/kernel/core/vm/vm_cache.c b/src/kernel/core/vm/vm_cache.c index 8367c99ace..b990eb32c3 100755 --- a/src/kernel/core/vm/vm_cache.c +++ b/src/kernel/core/vm/vm_cache.c @@ -21,7 +21,7 @@ /* hash table of pages keyed by cache they're in and offset */ #define PAGE_TABLE_SIZE 1024 /* make this dynamic */ static void *page_cache_table; -static spinlock_t page_cache_table_lock; +static spinlock page_cache_table_lock; struct page_lookup_key { off_t offset; diff --git a/src/kernel/core/vm/vm_page.c b/src/kernel/core/vm/vm_page.c index d2069b3ab8..b61328b79f 100755 --- a/src/kernel/core/vm/vm_page.c +++ b/src/kernel/core/vm/vm_page.c @@ -38,7 +38,7 @@ static vm_page *all_pages; static addr physical_page_offset; static unsigned int num_pages; -static spinlock_t page_lock; +static spinlock page_lock; static sem_id modified_pages_available; diff --git a/src/kernel/core/vm/vm_store_anonymous_noswap.c b/src/kernel/core/vm/vm_store_anonymous_noswap.c index 88cc3da61f..b2227ad9b5 100755 --- a/src/kernel/core/vm/vm_store_anonymous_noswap.c +++ b/src/kernel/core/vm/vm_store_anonymous_noswap.c @@ -9,6 +9,7 @@ #include #include #include +#include static void anonymous_destroy(struct vm_store *store) { diff --git a/src/kernel/core/vm/vm_store_device.c b/src/kernel/core/vm/vm_store_device.c index 9f48ff87ad..f36836d6bf 100755 --- a/src/kernel/core/vm/vm_store_device.c +++ b/src/kernel/core/vm/vm_store_device.c @@ -10,6 +10,7 @@ #include #include #include +#include struct device_store_data { addr base_addr; diff --git a/src/kernel/core/vm/vm_tests.c b/src/kernel/core/vm/vm_tests.c index 69c9752f0f..716c805a03 100755 --- a/src/kernel/core/vm/vm_tests.c +++ b/src/kernel/core/vm/vm_tests.c @@ -7,6 +7,8 @@ #include #include +#include + #include #include #include