summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2008-07-20 17:05:43 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:27:17 +0200
commit1fac2f5107e94102ca643ab9b031030bbcb1daa1 (patch)
tree4aac49598b75ace461ab2ce69aa765a5f6037222 /kern
parent311826c0b9e06edd1cc5cb7fc82a6c16614b28ce (diff)
2008-07-20 Samuel Thibault <samuel.thibault@ens-lyon.org>
* linux/pcmcia-cs/glue/wireless_glue.h (schedule_task): Add parameter to Debugger() call. * kern/lock_mon.c (retry_simple_lock, retry_bit_lock): Likewise. * kern/machine.c (Debugger): Remove declaration. 2008-07-19 Barry deFreese <bddebian@comcast.net> * device/dev_hdr.h (dev_name_lookup, dev_set_indirection): Add prototypes. * device/dev_pager.c: Include <vm/vm_user.h>. * device/ds_routines.c: Likewise. * device/subrs.c: Likewise. * device/device_init.c: Include <device/tty.h>. * device/ds_routines.h (iowait): Add prototype. * device/net_io.h (net_kmsg_collect): Add prototype. * device/net_io.c (hash_ent_remove, net_free_dead_infp, net_free_dead_entp, bpf_validate, bpf_eq, net_add_q_info, bpf_match): Add forward declarations. * device/subrs.h: New header. * i386/i386/fpu.h: Include <sys/types.h>. Change <i386/thread.h> include to <kern/thread.h>. (fp_save, fp_load, fp_free, fpu_module_init, fpu_set_state, fpu_get_state, fpnoextflt, fpextovrflt, fpexterrflt, init_fpu): Add prototypes. * i386/i386/gdt.h (gdt_init): Add prototype. * i386/i386/io_map.c: Include <vm/pmap.h>. * vm/vm_kern.c: Likewise. * i386/i386/ktss.h (ktss_init): Add prototype. * i386/i386/ldt.h (ldt_init): Add prototype. * i386/i386/loose_ends.h: New header. * i386/i386/loose_ends.c (delay): Complete prototype. * i386/i386/model_dep.h (startrtclock): Add prototype. * i386/i386/pcb.h (load_context, stack_attach, stack_detach, switch_ktss): Add prototypes. * i386/i386/pic.h (form_pic_mask, picinit): Add prototypes. * i386/i386/pit.c: Include <i386/pic.h>. * i386/i386at/kd_mouse.c: Likewise. * i386/i386/pit.h (clkstart): Add prototype. * i386/i386/trap.c: Include <i386/fpu.h>, <intel/read_fault.h>, <vm/vm_fault.h>. * i386/i386/trap.h (interrupted_pc): Add prototype. * i386/i386/user_ldt.c: Include <i386/pcb.h>. * i386/i386at/autoconf.h: New header. * i386/i386at/com.h: New header. * i386/i386at/com.c: Include <i386at/autoconf.h>, <i386at/com.h>. * i386/i386at/idt.h (idt_init): Add prototype. * i386/i386at/int_init.h: New header. * i386/i386at/kd.c: Include <i386/loose_ends.h>. * kern/debug.c: Likewise. * i386/i386at/kd_event.c: Include <device/ds_routines.h>. * i386/i386at/kd_mouse.c: Likewise. * i386/i386at/kd_mouse.c: Include <device/subrs.h>, <i386at/com.h>. * i386/i386at/lpr.c: Include <i386at/autoconf.h> * i386/i386at/model_dep.c: Include: <i386/fpu.h>, <i386/gdt.h>, <i386/ktss.h>, <i386/ldt.h>, <i386/pic.h>, <i386/pit.h>, <i386at/autoconf.h>, <i386at/idt.h>, <i386at/int_init.h>, <i386at/kd.h>, <i386at/rtc.h>. * i386/i386at/rtc.h (readtodc, writetodc): Add prototypes. * i386/intel/pmap.h: Include <mach/vm_prot.h>. (pmap_bootstrap, pmap_unmap_page_zero, pmap_zero_page, pmap_copy_page, kvtophys): Add prototypes. * i386/intel/read_fault.h: New header. * kern/ast.h (ast_init, ast_check): Add prototypes. * kern/debug.c (Debugger): Move prototype to... * kern/debug.h (Debugger): ... here. * kern/eventcount.h (evc_notify_abort): Add prototype. * kern/ipc_mig.c: Include <kern/syscall_subr.h>, <kern/ipc_tt.h>, <device/ds_routines.h> * kern/ipc_mig.h: New header. * kern/ipc_tt.h (mach_reply_port): Add prototype. * kern/machine.h: New header. * kern/processor.h (pset_sys_bootstrap): Move prototype outside of MACH_HOST check. * kern/sched_prim.h (thread_bind, compute_priority, thread_timeout_setup): Add prototypes. * kern/startup.c: Include <kern/machine.h>, <machine/pcb.h>. * kern/syscall_subr.c: Include <kern/syscall_subr.h>. (thread_depress_abort): Remove prototype. * kern/syscall_subr.h: Include <sys/types.h>, <mach/mach_types.h> (thread_depress_abort): Add prototype. * kern/syscall_sw.c: Include: <kern/debug.h>. * kern/task.h (consider_task_collect): Add prototype. * kern/thread.c: Include <kern/eventcount.h>, <kern/ipc_mig.h>, <kern/syscall_subr.h>. * kern/thread.h (stack_collect): Add prototype. * linux/pcmcia-cs/glue/pcmcia_glue.h (Debugger): Remove prototype. * util/putchar.c: Include <device/cons.h>. * util/putchar.h: New header. * util/puts.c: Include <device/cons.h>, <util/putchar.h>. * vm/memory_object.c: Include <vm/vm_map.h>. (memory_object_data_provided): Move function below memory_object_data_supply definition. * vm/vm_init.c: Include <vm/vm_fault.h>. * vm/vm_kern.h (projected_buffer_in_range): Add prototype. * vm/vm_map.c: Include <vm/pmap.h>, <vm/vm_resident.h>. (vm_map_delete, vm_map_copyout_page_list, vm_map_copy_page_discard): Add forward declaration. * vm/vm_map.h (vm_map_copyin_object, vm_map_submap, _vm_map_clip_start, _vm_map_clip_end): Add prototypes. * vm/vm_pageout.c: Include <device/net_io.h>, <kern/task.h>, <machine/locore.h>. * vm/vm_resident.h: New header. * vm/vm_user.c: Include <vm/vm_kern.h>. * vm/pmap.h (pmap_pageable, pmap_map_bd): Add prototype.
Diffstat (limited to 'kern')
-rw-r--r--kern/ast.h4
-rw-r--r--kern/debug.c2
-rw-r--r--kern/debug.h2
-rw-r--r--kern/eventcount.h2
-rw-r--r--kern/ipc_mig.c4
-rw-r--r--kern/ipc_mig.h65
-rw-r--r--kern/ipc_tt.h3
-rw-r--r--kern/lock_mon.c4
-rw-r--r--kern/machine.c1
-rw-r--r--kern/machine.h58
-rw-r--r--kern/processor.h2
-rw-r--r--kern/sched_prim.h9
-rw-r--r--kern/startup.c2
-rw-r--r--kern/syscall_subr.c4
-rw-r--r--kern/syscall_subr.h3
-rw-r--r--kern/syscall_sw.c1
-rw-r--r--kern/task.h1
-rw-r--r--kern/thread.c3
-rw-r--r--kern/thread.h1
19 files changed, 162 insertions, 9 deletions
diff --git a/kern/ast.h b/kern/ast.h
index 6fd509c..695eaac 100644
--- a/kern/ast.h
+++ b/kern/ast.h
@@ -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
/*