diff options
Diffstat (limited to 'kern')
-rw-r--r-- | kern/ast.h | 4 | ||||
-rw-r--r-- | kern/debug.c | 2 | ||||
-rw-r--r-- | kern/debug.h | 2 | ||||
-rw-r--r-- | kern/eventcount.h | 2 | ||||
-rw-r--r-- | kern/ipc_mig.c | 4 | ||||
-rw-r--r-- | kern/ipc_mig.h | 65 | ||||
-rw-r--r-- | kern/ipc_tt.h | 3 | ||||
-rw-r--r-- | kern/lock_mon.c | 4 | ||||
-rw-r--r-- | kern/machine.c | 1 | ||||
-rw-r--r-- | kern/machine.h | 58 | ||||
-rw-r--r-- | kern/processor.h | 2 | ||||
-rw-r--r-- | kern/sched_prim.h | 9 | ||||
-rw-r--r-- | kern/startup.c | 2 | ||||
-rw-r--r-- | kern/syscall_subr.c | 4 | ||||
-rw-r--r-- | kern/syscall_subr.h | 3 | ||||
-rw-r--r-- | kern/syscall_sw.c | 1 | ||||
-rw-r--r-- | kern/task.h | 1 | ||||
-rw-r--r-- | kern/thread.c | 3 | ||||
-rw-r--r-- | kern/thread.h | 1 |
19 files changed, 162 insertions, 9 deletions
@@ -127,4 +127,8 @@ MACRO_END * be followed by ast_propagate(). */ +extern void ast_init (void); + +extern void ast_check (void); + #endif /* _KERN_AST_H_ */ diff --git a/kern/debug.c b/kern/debug.c index 2c9e761..6644340 100644 --- a/kern/debug.c +++ b/kern/debug.c @@ -33,10 +33,10 @@ #include <kern/debug.h> +#include <machine/loose_ends.h> #include <machine/model_dep.h> extern void cnputc(); -void Debugger() __attribute__ ((noreturn)); #if MACH_KDB extern int db_breakpoints_inserted; diff --git a/kern/debug.h b/kern/debug.h index 64fbf8a..287b152 100644 --- a/kern/debug.h +++ b/kern/debug.h @@ -60,4 +60,6 @@ extern void panic_init(void); extern void panic (const char *s, ...) __attribute__ ((noreturn)); +extern void Debugger (char *message) __attribute__ ((noreturn)); + #endif /* _mach_debug__debug_ */ diff --git a/kern/eventcount.h b/kern/eventcount.h index e2001de..6872a34 100644 --- a/kern/eventcount.h +++ b/kern/eventcount.h @@ -54,4 +54,6 @@ extern void evc_init(evc_t ev), extern kern_return_t evc_wait(natural_t ev_id); +extern void evc_notify_abort (thread_t thread); + #endif /* _KERN_EVENTCOUNT_H_ */ diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c index 3bf2c77..3f55da7 100644 --- a/kern/ipc_mig.c +++ b/kern/ipc_mig.c @@ -32,9 +32,11 @@ #include <kern/ast.h> #include <kern/debug.h> #include <kern/ipc_tt.h> +#include <kern/syscall_subr.h> #include <kern/thread.h> #include <kern/task.h> #include <kern/ipc_kobject.h> +#include <kern/ipc_tt.h> #include <vm/vm_map.h> #include <vm/vm_user.h> #include <ipc/port.h> @@ -49,7 +51,7 @@ #include <ipc/mach_port.h> #include <device/dev_hdr.h> #include <device/device_types.h> - +#include <device/ds_routines.h> /* * Routine: mach_msg_send_from_kernel diff --git a/kern/ipc_mig.h b/kern/ipc_mig.h new file mode 100644 index 0000000..f352bdc --- /dev/null +++ b/kern/ipc_mig.h @@ -0,0 +1,65 @@ +/* + * MIG IPC functions + * Copyright (C) 2008 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ +/* + * MIG IPC functions. + * + */ + +#ifndef _IPC_MIG_H_ +#define _IPC_MIG_H_ + +#include <mach/std_types.h> + +/* + * Routine: mach_msg_send_from_kernel + * Purpose: + * Send a message from the kernel. + * + * This is used by the client side of KernelUser interfaces + * to implement SimpleRoutines. Currently, this includes + * device_reply and memory_object messages. + * Conditions: + * Nothing locked. + * Returns: + * MACH_MSG_SUCCESS Sent the message. + * MACH_SEND_INVALID_DATA Bad destination port. + */ +extern mach_msg_return_t mach_msg_send_from_kernel( + mach_msg_header_t *msg, + mach_msg_size_t send_size); + +/* + * Routine: mach_msg_abort_rpc + * Purpose: + * Destroy the thread's ith_rpc_reply port. + * This will interrupt a mach_msg_rpc_from_kernel + * with a MACH_RCV_PORT_DIED return code. + * Conditions: + * Nothing locked. + */ +extern void mach_msg_abort_rpc (ipc_thread_t); + +extern mach_msg_return_t mach_msg_rpc_from_kernel( + mach_msg_header_t *msg, + mach_msg_size_t send_size, + mach_msg_size_t reply_size); + +#endif /* _IPC_MIG_H_ */ diff --git a/kern/ipc_tt.h b/kern/ipc_tt.h index e2009b9..78cb43a 100644 --- a/kern/ipc_tt.h +++ b/kern/ipc_tt.h @@ -86,4 +86,7 @@ convert_port_to_space(struct ipc_port *); extern void space_deallocate(ipc_space_t); +mach_port_t +mach_reply_port (void); + #endif /* _KERN_IPC_TT_H_ */ diff --git a/kern/lock_mon.c b/kern/lock_mon.c index 0d69ac1..7ffaeb6 100644 --- a/kern/lock_mon.c +++ b/kern/lock_mon.c @@ -348,7 +348,7 @@ decl_simple_lock_data(, *lock) return; db_printf("cpu %d looping on simple_lock(%x) called by %x\n", cpu_number(), lock, *(((int *)&lock) -1)); - Debugger(); + Debugger("simple_lock timeout"); count = 0; } } @@ -362,7 +362,7 @@ retry_bit_lock(index, addr) if (count++ > 1000000) { db_printf("cpu %d looping on bit_lock(%x, %x) called by %x\n", cpu_number(), index, addr, *(((int *)&index) -1)); - Debugger(); + Debugger("bit_lock timeout"); count = 0; } } diff --git a/kern/machine.c b/kern/machine.c index 97181a8..bcf394c 100644 --- a/kern/machine.c +++ b/kern/machine.c @@ -187,7 +187,6 @@ host_reboot(host, options) return (KERN_INVALID_HOST); if (options & RB_DEBUGGER) { - extern void Debugger(); Debugger("Debugger"); } else { #ifdef parisc diff --git a/kern/machine.h b/kern/machine.h new file mode 100644 index 0000000..af2b7e9 --- /dev/null +++ b/kern/machine.h @@ -0,0 +1,58 @@ +/* + * Machine abstraction functions + * Copyright (C) 2008 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ +/* + * Machine abstraction functions. + * + */ + +#ifndef _MACHINE_H_ +#define _MACHINE_H_ + +#include <mach/std_types.h> + +/* + * cpu_up: + * + * Flag specified cpu as up and running. Called when a processor comes + * online. + */ +extern void cpu_up (int); + +/* + * processor_assign() changes the processor set that a processor is + * assigned to. Any previous assignment in progress is overridden. + * Synchronizes with assignment completion if wait is TRUE. + */ +extern kern_return_t processor_assign (processor_t, processor_set_t, boolean_t); + +/* + * processor_shutdown() queues a processor up for shutdown. + * Any assignment in progress is overriden. It does not synchronize + * with the shutdown (can be called from interrupt level). + */ +extern kern_return_t processor_shutdown (processor_t); + +/* + * action_thread() shuts down processors or changes their assignment. + */ +extern void action_thread_continue (void); + +#endif /* _MACHINE_H_ */ diff --git a/kern/processor.h b/kern/processor.h index 7ff7124..9a6c944 100644 --- a/kern/processor.h +++ b/kern/processor.h @@ -237,12 +237,12 @@ typedef mach_port_t *processor_set_name_array_t; #ifdef KERNEL #if MACH_HOST -extern void pset_sys_bootstrap(void); extern void pset_sys_init(void); #endif /* MACH_HOST */ /* Pset internal functions */ +extern void pset_sys_bootstrap(void); extern void pset_reference(processor_set_t); extern void pset_deallocate(processor_set_t); extern void pset_remove_processor(processor_set_t, processor_t); diff --git a/kern/sched_prim.h b/kern/sched_prim.h index a5416a5..5311d16 100644 --- a/kern/sched_prim.h +++ b/kern/sched_prim.h @@ -108,7 +108,14 @@ extern void update_priority( thread_t thread); extern void compute_my_priority( thread_t thread); - +extern void thread_bind( + thread_t thread, + processor_t processor); +extern void compute_priority( + thread_t thread, + boolean_t resched); +extern void thread_timeout_setup( + register thread_t thread); /* * Routines defined as macros diff --git a/kern/startup.c b/kern/startup.c index 5eea5bc..e057e8f 100644 --- a/kern/startup.c +++ b/kern/startup.c @@ -34,6 +34,7 @@ #include <ipc/ipc_init.h> #include <kern/cpu_number.h> #include <kern/debug.h> +#include <kern/machine.h> #include <kern/mach_factor.h> #include <kern/mach_clock.h> #include <kern/printf.h> @@ -51,6 +52,7 @@ #include <vm/vm_object.h> #include <vm/vm_page.h> #include <machine/machspl.h> +#include <machine/pcb.h> #include <machine/pmap.h> #include <machine/model_dep.h> #include <mach/version.h> diff --git a/kern/syscall_subr.c b/kern/syscall_subr.c index 4db1f16..395b9b8 100644 --- a/kern/syscall_subr.c +++ b/kern/syscall_subr.c @@ -37,6 +37,7 @@ #include <kern/processor.h> #include <kern/sched.h> #include <kern/sched_prim.h> +#include <kern/syscall_subr.h> #include <kern/ipc_sched.h> #include <kern/task.h> #include <kern/thread.h> @@ -62,8 +63,7 @@ * lock and then be a good citizen and really suspend. */ -extern void thread_depress_priority(thread_t, mach_msg_timeout_t); -extern kern_return_t thread_depress_abort(thread_t); +void thread_depress_priority(thread_t, mach_msg_timeout_t); void swtch_continue(void) { diff --git a/kern/syscall_subr.h b/kern/syscall_subr.h index 2d2da14..2b8bcd3 100644 --- a/kern/syscall_subr.h +++ b/kern/syscall_subr.h @@ -24,6 +24,8 @@ * the rights to redistribute these changes. */ +#include <sys/types.h> +#include <mach/mach_types.h> #include <kern/kern_types.h> #ifndef _KERN_SYSCALL_SUBR_H_ @@ -33,5 +35,6 @@ extern int swtch(void); extern int swtch_pri(int); extern int thread_switch(mach_port_t, int, mach_msg_timeout_t); extern void thread_depress_timeout(thread_t); +extern kern_return_t thread_depress_abort(thread_t); #endif /* _KERN_SYSCALL_SUBR_H_ */ diff --git a/kern/syscall_sw.c b/kern/syscall_sw.c index 42109ee..bd3b874 100644 --- a/kern/syscall_sw.c +++ b/kern/syscall_sw.c @@ -29,6 +29,7 @@ #include <mach/port.h> #include <mach/kern_return.h> +#include <kern/debug.h> #include <kern/syscall_sw.h> /* Include declarations of the trap functions. */ diff --git a/kern/task.h b/kern/task.h index 1337a98..9d90243 100644 --- a/kern/task.h +++ b/kern/task.h @@ -149,6 +149,7 @@ extern kern_return_t task_assign( extern kern_return_t task_assign_default( task_t task, boolean_t assign_threads); +extern void consider_task_collect(void); /* * Internal only routines diff --git a/kern/thread.c b/kern/thread.c index 71f222c..f6b442a 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -42,12 +42,15 @@ #include <kern/ast.h> #include <kern/counters.h> #include <kern/debug.h> +#include <kern/eventcount.h> +#include <kern/ipc_mig.h> #include <kern/ipc_tt.h> #include <kern/mach_param.h> #include <kern/processor.h> #include <kern/queue.h> #include <kern/sched.h> #include <kern/sched_prim.h> +#include <kern/syscall_subr.h> #include <kern/thread.h> #include <kern/thread_swap.h> #include <kern/host.h> diff --git a/kern/thread.h b/kern/thread.h index 03522da..3959dfc 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -318,6 +318,7 @@ extern kern_return_t thread_assign( processor_set_t new_pset); extern kern_return_t thread_assign_default( thread_t thread); +extern void stack_collect(void); #endif /* |