diff options
72 files changed, 856 insertions, 37 deletions
@@ -1,3 +1,110 @@ +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. + 2008-07-18 Andrei Barbu <andrei@0xab.com> * i386/i386/db_disasm.c (Iba): New macro. diff --git a/device/dev_hdr.h b/device/dev_hdr.h index d5b8770..340a2db 100644 --- a/device/dev_hdr.h +++ b/device/dev_hdr.h @@ -130,4 +130,20 @@ boolean_t dev_map(boolean_t (*)(), mach_port_t); #define device_lock(device) simple_lock(&(device)->lock) #define device_unlock(device) simple_unlock(&(device)->lock) +/* + * device name lookup + */ +extern boolean_t dev_name_lookup( + char * name, + dev_ops_t *ops, /* out */ + int *unit); /* out */ + +/* + * Change an entry in the indirection list. + */ +extern void dev_set_indirection( + char *name, + dev_ops_t ops, + int unit); + #endif /* _DEVICE_DEV_HDR_H_ */ diff --git a/device/dev_pager.c b/device/dev_pager.c index 68c978c..224be85 100644 --- a/device/dev_pager.c +++ b/device/dev_pager.c @@ -49,6 +49,7 @@ #include <vm/vm_page.h> #include <vm/vm_kern.h> +#include <vm/vm_user.h> #include <device/device_types.h> #include <device/ds_routines.h> diff --git a/device/device_init.c b/device/device_init.c index a2e4967..1da2a6f 100644 --- a/device/device_init.c +++ b/device/device_init.c @@ -36,7 +36,7 @@ #include <device/device_types.h> #include <device/device_port.h> - +#include <device/tty.h> extern void mach_device_init(); diff --git a/device/ds_routines.c b/device/ds_routines.c index 61eec99..943185e 100644 --- a/device/ds_routines.c +++ b/device/ds_routines.c @@ -81,6 +81,7 @@ #include <vm/memory_object.h> #include <vm/vm_map.h> #include <vm/vm_kern.h> +#include <vm/vm_user.h> #include <device/device_types.h> #include <device/dev_hdr.h> diff --git a/device/ds_routines.h b/device/ds_routines.h index f794303..24668b4 100644 --- a/device/ds_routines.h +++ b/device/ds_routines.h @@ -52,4 +52,6 @@ boolean_t ds_open_done(io_req_t); boolean_t ds_read_done(io_req_t); boolean_t ds_write_done(io_req_t); +void iowait (io_req_t ior); + #endif /* DS_ROUTINES_H */ diff --git a/device/net_io.c b/device/net_io.c index b565aa3..5f287cb 100644 --- a/device/net_io.c +++ b/device/net_io.c @@ -367,6 +367,36 @@ decl_simple_lock_data(,net_hash_header_lock) extern boolean_t net_do_filter(); /* CSPF */ extern int bpf_do_filter(); /* BPF */ +int hash_ent_remove ( + struct ifnet *ifp, + net_hash_header_t hp, + int used, + net_hash_entry_t *head, + net_hash_entry_t entp, + queue_entry_t *dead_p); + +void net_free_dead_infp (queue_entry_t dead_infp); +void net_free_dead_entp (queue_entry_t dead_entp); + +int bpf_validate( + bpf_insn_t f, + int bytes, + bpf_insn_t *match); + +int bpf_eq ( + bpf_insn_t f1, + bpf_insn_t f2, + register int bytes); + +int net_add_q_info (ipc_port_t rcv_port); + +int bpf_match ( + net_hash_header_t hash, + int n_keys, + unsigned int *keys, + net_hash_entry_t **hash_headpp, + net_hash_entry_t *entpp); + /* * ethernet_priority: diff --git a/device/net_io.h b/device/net_io.h index ce18182..073bdca 100644 --- a/device/net_io.h +++ b/device/net_io.h @@ -78,6 +78,8 @@ extern io_return_t net_write(struct ifnet *, int (*)(), io_req_t); extern vm_size_t net_kmsg_size; +extern void net_kmsg_collect (void); + #define net_kmsg_alloc() ((ipc_kmsg_t) kalloc(net_kmsg_size)) #define net_kmsg_free(kmsg) kfree((vm_offset_t) (kmsg), net_kmsg_size) diff --git a/device/subrs.c b/device/subrs.c index ea63a5c..9b2b9ad 100644 --- a/device/subrs.c +++ b/device/subrs.c @@ -30,6 +30,7 @@ #include <kern/debug.h> #include <kern/printf.h> #include <vm/vm_kern.h> +#include <vm/vm_user.h> #include <device/buf.h> #include <device/if_hdr.h> #include <device/if_ether.h> diff --git a/device/subrs.h b/device/subrs.h new file mode 100644 index 0000000..680aaa6 --- /dev/null +++ b/device/subrs.h @@ -0,0 +1,34 @@ +/* + * Random device 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. + */ +/* + * Random device functions. + * + */ + +#ifndef _SUBRS_H_ +#define _SUBRS_H_ + +#include <mach/std_types.h> + +extern void sleep (vm_offset_t channel, int priority); +extern void wakeup (vm_offset_t channel); + +#endif /* _SUBRS_H_ */ diff --git a/i386/i386/fpu.h b/i386/i386/fpu.h index 3e92de7..4237bea 100644 --- a/i386/i386/fpu.h +++ b/i386/i386/fpu.h @@ -32,8 +32,9 @@ * floating-point processor. */ +#include <sys/types.h> #include <i386/proc_reg.h> -#include <i386/thread.h> +#include <kern/thread.h> /* * FPU instructions. @@ -99,5 +100,19 @@ #endif /* NCPUS == 1 */ extern int fp_kind; +extern void fp_save(thread_t thread); +extern void fp_load(thread_t thread); +extern void fp_free(struct i386_fpsave_state *fps); +extern void fpu_module_init(void); +extern kern_return_t fpu_set_state( + thread_t thread, + struct i386_float_state *state); +extern kern_return_t fpu_get_state( + thread_t thread, + struct i386_float_state *state); +extern void fpnoextflt(void); +extern void fpextovrflt(void); +extern void fpexterrflt(void); +extern void init_fpu(void); #endif /* _I386_FPU_H_ */ diff --git a/i386/i386/gdt.h b/i386/i386/gdt.h index 558bd15..6513eda 100644 --- a/i386/i386/gdt.h +++ b/i386/i386/gdt.h @@ -59,4 +59,6 @@ extern struct real_descriptor gdt[GDTSZ]; #define fill_gdt_descriptor(segment, base, limit, access, sizebits) \ fill_descriptor(&gdt[segment/8], base, limit, access, sizebits) +extern void gdt_init(void); + #endif /* _I386_GDT_ */ diff --git a/i386/i386/io_map.c b/i386/i386/io_map.c index 7ed0e26..5b77552 100644 --- a/i386/i386/io_map.c +++ b/i386/i386/io_map.c @@ -26,6 +26,7 @@ #include <kern/printf.h> #include <mach/vm_param.h> +#include <vm/pmap.h> #include <vm/vm_kern.h> #include <vm/vm_map.h> diff --git a/i386/i386/ktss.h b/i386/i386/ktss.h index 3522e86..304a877 100644 --- a/i386/i386/ktss.h +++ b/i386/i386/ktss.h @@ -27,4 +27,6 @@ extern struct task_tss ktss; +extern void ktss_init(void); + #endif /* _I386_KTSS_ */ diff --git a/i386/i386/ldt.h b/i386/i386/ldt.h index 3c38109..f196c74 100644 --- a/i386/i386/ldt.h +++ b/i386/i386/ldt.h @@ -61,6 +61,8 @@ extern struct real_descriptor ldt[LDTSZ]; fill_gate((struct real_gate*)&ldt[selector/8], \ offset, dest_selector, access, word_count) +void ldt_init(void); + #endif /* !__ASSEMBLER__ */ #endif /* _I386_LDT_ */ diff --git a/i386/i386/loose_ends.c b/i386/i386/loose_ends.c index 825303f..d3108fd 100644 --- a/i386/i386/loose_ends.c +++ b/i386/i386/loose_ends.c @@ -43,6 +43,7 @@ int cpuspeed = 4; #define DELAY(n) { volatile int N = cpuspeed * (n); while (--N > 0); } void delay(n) + int n; { DELAY(n); } diff --git a/i386/i386/loose_ends.h b/i386/i386/loose_ends.h new file mode 100644 index 0000000..c085527 --- /dev/null +++ b/i386/i386/loose_ends.h @@ -0,0 +1,33 @@ +/* + * Other useful 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. + */ +/* + * Other useful functions? + * + */ + +#ifndef _LOOSE_ENDS_H_ +#define _LOOSE_ENDS_H_ + +#include <mach/std_types.h> + +extern void delay (int n); + +#endif /* _LOOSE_ENDS_H_ */ diff --git a/i386/i386/model_dep.h b/i386/i386/model_dep.h index c0cc5a7..c6685d0 100644 --- a/i386/i386/model_dep.h +++ b/i386/i386/model_dep.h @@ -48,4 +48,6 @@ extern void halt_all_cpus (boolean_t reboot) __attribute__ ((noreturn)); extern void resettodr (void); +extern void startrtclock (void); + #endif /* _I386AT_MODEL_DEP_H_ */ diff --git a/i386/i386/pcb.h b/i386/i386/pcb.h index e7d3363..dc9cbd7 100644 --- a/i386/i386/pcb.h +++ b/i386/i386/pcb.h @@ -58,4 +58,15 @@ extern vm_offset_t set_user_regs ( struct exec_info *exec_info, vm_size_t arg_size); +extern void load_context (thread_t new); + +extern void stack_attach ( + thread_t thread, + vm_offset_t stack, + void (*continuation)()); + +extern vm_offset_t stack_detach (thread_t thread); + +extern void switch_ktss (pcb_t pcb); + #endif /* _I386_PCB_H_ */ diff --git a/i386/i386/pic.h b/i386/i386/pic.h index c6f8a4b..7a177d8 100644 --- a/i386/i386/pic.h +++ b/i386/i386/pic.h @@ -176,4 +176,9 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define READ_IR_ONRD 0x00 #define READ_IS_ONRD 0x01 +#ifndef __ASSEMBLER__ +extern void form_pic_mask (void); +extern void picinit (void); +#endif + #endif /* _I386_PIC_H_ */ diff --git a/i386/i386/pit.c b/i386/i386/pit.c index 8dc1233..4f156d8 100644 --- a/i386/i386/pit.c +++ b/i386/i386/pit.c @@ -51,6 +51,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <kern/mach_clock.h> #include <i386/ipl.h> +#include <i386/pic.h> #include <i386/pit.h> #include <i386/pio.h> diff --git a/i386/i386/pit.h b/i386/i386/pit.h index b59d8c5..e65aae9 100644 --- a/i386/i386/pit.h +++ b/i386/i386/pit.h @@ -77,3 +77,5 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #if AT386 #define CLKNUM 1193167 #endif /* AT386 */ + +extern void clkstart(void); diff --git a/i386/i386/trap.c b/i386/i386/trap.c index faee218..dd6c23c 100644 --- a/i386/i386/trap.c +++ b/i386/i386/trap.c @@ -32,6 +32,8 @@ #include <mach/machine/eflags.h> #include <i386/trap.h> +#include <i386/fpu.h> +#include <intel/read_fault.h> #include <machine/machspl.h> /* for spl_t */ #include <mach/exception.h> @@ -39,6 +41,7 @@ #include "vm_param.h" #include <mach/machine/thread_status.h> +#include <vm/vm_fault.h> #include <vm/vm_kern.h> #include <vm/vm_map.h> diff --git a/i386/i386/trap.h b/i386/i386/trap.h index 8cee9e8..dfb57a1 100644 --- a/i386/i386/trap.h +++ b/i386/i386/trap.h @@ -33,6 +33,8 @@ char *trap_name(unsigned int trapnum); +unsigned int interrupted_pc(thread_t); + #endif /* !__ASSEMBLER__ */ #endif /* _I386_TRAP_H_ */ diff --git a/i386/i386/user_ldt.c b/i386/i386/user_ldt.c index 7646c35..e6bfc95 100644 --- a/i386/i386/user_ldt.c +++ b/i386/i386/user_ldt.c @@ -35,6 +35,7 @@ #include <vm/vm_kern.h> +#include <i386/pcb.h> #include <i386/seg.h> #include <i386/thread.h> #include <i386/user_ldt.h> diff --git a/i386/i386at/autoconf.h b/i386/i386at/autoconf.h new file mode 100644 index 0000000..4916d3e --- /dev/null +++ b/i386/i386at/autoconf.h @@ -0,0 +1,42 @@ +/* + * 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. + */ +/* + * Device auto configuration. + * + */ + +#ifndef _AUTOCONF_H_ +#define _AUTOCONF_H_ + +#include <mach/std_types.h> + +/* + * probeio: + * + * Probe and subsequently attach devices out on the AT bus. + * + * + */ +void probeio(void); + +extern void take_dev_irq ( + struct bus_device *dev); + +#endif /* _AUTOCONF_H_ */ diff --git a/i386/i386at/com.c b/i386/i386at/com.c index 300a60b..6e7dcbf 100644 --- a/i386/i386at/com.c +++ b/i386/i386at/com.c @@ -39,6 +39,8 @@ #include <i386/pio.h> #include <i386/machspl.h> #include <chips/busses.h> +#include <i386at/autoconf.h> +#include <i386at/com.h> #include <i386at/comreg.h> #include <device/cons.h> diff --git a/i386/i386at/com.h b/i386/i386at/com.h new file mode 100644 index 0000000..dca26a5 --- /dev/null +++ b/i386/i386at/com.h @@ -0,0 +1,45 @@ +/* + * Communication 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. + */ +/* + * Communication functions. + * + */ + +#ifndef _COM_H_ +#define _COM_H_ + +#include <mach/std_types.h> + +/* + * Set receive modem state from modem status register. + */ +extern void fix_modem_state(int unit, int modem_stat); + +extern void comtimer(void); + +/* + * Modem change (input signals) + */ +extern void commodem_intr(int unit, int stat); + +extern int comgetc(int unit); + +#endif /* _COM_H_ */ diff --git a/i386/i386at/idt.h b/i386/i386at/idt.h index 840bad1..1b3284f 100644 --- a/i386/i386at/idt.h +++ b/i386/i386at/idt.h @@ -34,4 +34,8 @@ #include <i386/idt-gen.h> +#ifndef __ASSEMBLER__ +extern void idt_init (void); +#endif + #endif /* _I386AT_IDT_ */ diff --git a/i386/i386at/int_init.h b/i386/i386at/int_init.h new file mode 100644 index 0000000..f4abef0 --- /dev/null +++ b/i386/i386at/int_init.h @@ -0,0 +1,34 @@ +/* + * 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. + */ +/* + * Initialization functions. + * + */ + +#ifndef _INT_INIT_H_ +#define _INT_INIT_H_ + +#include <mach/std_types.h> + +#ifndef __ASSEMBLER__ +extern void int_init (void); +#endif + +#endif /* _INT_INIT_H_ */ diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c index 75b56eb..6723752 100644 --- a/i386/i386at/kd.c +++ b/i386/i386at/kd.c @@ -85,6 +85,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <device/io_req.h> #include <device/buf.h> /* for struct uio (!) */ #include <vm/vm_kern.h> +#include <i386/loose_ends.h> #include <i386/vm_param.h> #include <i386/machspl.h> #include <i386/pio.h> diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c index 7688412..5d8d563 100644 --- a/i386/i386at/kd_event.c +++ b/i386/i386at/kd_event.c @@ -60,6 +60,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <string.h> #ifdef MACH_KERNEL +#include <device/ds_routines.h> #include <device/errno.h> #include <device/io_req.h> #else /* MACH_KERNEL */ diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c index 2ad3be2..9487c54 100644 --- a/i386/i386at/kd_mouse.c +++ b/i386/i386at/kd_mouse.c @@ -68,8 +68,10 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <sys/types.h> #include <kern/printf.h> #ifdef MACH_KERNEL +#include <device/ds_routines.h> #include <device/errno.h> #include <device/io_req.h> +#include <device/subrs.h> #else /* MACH_KERNEL */ #include <sys/file.h> #include <sys/errno.h> @@ -81,8 +83,10 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <sys/tty.h> #endif /* MACH_KERNEL */ #include <i386/ipl.h> +#include <i386/pic.h> #include <i386/pio.h> #include <chips/busses.h> +#include <i386at/com.h> #include <i386at/kd.h> #include <i386at/kd_queue.h> #include <i386at/i8250.h> diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c index 348159e..05edc7b 100644 --- a/i386/i386at/lpr.c +++ b/i386/i386at/lpr.c @@ -55,6 +55,7 @@ #include <i386/ipl.h> #include <i386/pio.h> #include <chips/busses.h> +#include <i386at/autoconf.h> #include <i386at/lprreg.h> extern void timeout(); diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index d67f709..d020c92 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -49,11 +49,22 @@ #include <kern/printf.h> #include <sys/time.h> #include <vm/vm_page.h> +#include <i386/fpu.h> +#include <i386/gdt.h> +#include <i386/ktss.h> +#include <i386/ldt.h> #include <i386/machspl.h> +#include <i386/pic.h> +#include <i386/pit.h> #include <i386/pmap.h> #include <i386/proc_reg.h> #include <i386/locore.h> #include <i386/model_dep.h> +#include <i386at/autoconf.h> +#include <i386at/idt.h> +#include <i386at/int_init.h> +#include <i386at/kd.h> +#include <i386at/rtc.h> /* Location of the kernel's symbol table. Both of these are 0 if none is available. */ @@ -369,7 +380,7 @@ void c_boot_entry(vm_offset_t bi) */ if (strstr(kernel_cmdline, "-d ")) { cninit(); /* need console for debugger */ - Debugger(); + Debugger("init"); } #endif /* MACH_KDB */ diff --git a/i386/i386at/rtc.h b/i386/i386at/rtc.h index e8d1967..ced39b9 100644 --- a/i386/i386at/rtc.h +++ b/i386/i386at/rtc.h @@ -134,4 +134,5 @@ struct rtc_st { } \ } - +extern int readtodc(u_int *tp); +extern int writetodc(void); diff --git a/i386/intel/pmap.h b/i386/intel/pmap.h index 0255f5a..b16d984 100644 --- a/i386/intel/pmap.h +++ b/i386/intel/pmap.h @@ -42,6 +42,7 @@ #include <mach/machine/vm_param.h> #include <mach/vm_statistics.h> #include <mach/kern_return.h> +#include <mach/vm_prot.h> #include <i386/proc_reg.h> /* @@ -363,6 +364,33 @@ pt_entry_t *pmap_pte(pmap_t pmap, vm_offset_t addr); #define pmap_attribute(pmap,addr,size,attr,value) \ (KERN_INVALID_ADDRESS) +/* + * Bootstrap the system enough to run with virtual memory. + * Allocate the kernel page directory and page tables, + * and direct-map all physical memory. + * Called with mapping off. + */ +extern void pmap_bootstrap(void); + +extern void pmap_unmap_page_zero (void); + +/* + * pmap_zero_page zeros the specified (machine independent) page. + */ +extern void pmap_zero_page (vm_offset_t); + +/* + * pmap_copy_page copies the specified (machine independent) pages. + */ +extern void pmap_copy_page (vm_offset_t, vm_offset_t); + +/* + * kvtophys(addr) + * + * Convert a kernel virtual address to a physical address + */ +extern vm_offset_t kvtophys (vm_offset_t); + #endif /* __ASSEMBLER__ */ #endif /* _PMAP_MACHINE_ */ diff --git a/i386/intel/read_fault.h b/i386/intel/read_fault.h new file mode 100644 index 0000000..8aa3f03 --- /dev/null +++ b/i386/intel/read_fault.h @@ -0,0 +1,35 @@ +/* + * Kernel read_fault on i386 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. + */ +/* + * Kernel read_fault on i386 functions. + * + */ + +#ifndef _READ_FAULT_H_ +#define _READ_FAULT_H_ + +#include <mach/std_types.h> + +extern kern_return_t intel_read_fault( + vm_map_t map, + vm_offset_t vaddr); + +#endif /* _READ_FAULT_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 /* diff --git a/linux/pcmcia-cs/glue/pcmcia_glue.h b/linux/pcmcia-cs/glue/pcmcia_glue.h index fc308ee..691c1b9 100644 --- a/linux/pcmcia-cs/glue/pcmcia_glue.h +++ b/linux/pcmcia-cs/glue/pcmcia_glue.h @@ -255,12 +255,6 @@ init_dev_name(struct net_device *dev, dev_node_t node) #define module_exit(a) /* - * Debugging convenience. - */ -extern void Debugger(void); - - -/* * TODO: We don't have `disable_irq_nosync', do we need it? This is used * by the axnet_cs client driver only. */ diff --git a/linux/pcmcia-cs/glue/wireless_glue.h b/linux/pcmcia-cs/glue/wireless_glue.h index 7883d35..05eef4b 100644 --- a/linux/pcmcia-cs/glue/wireless_glue.h +++ b/linux/pcmcia-cs/glue/wireless_glue.h @@ -65,7 +65,7 @@ static inline int schedule_task(struct tq_struct *task) { printk(KERN_INFO "schedule_task: not implemented, task=%p\n", task); - Debugger(); + Debugger("schedule_task"); return 0; /* fail */ } diff --git a/util/putchar.c b/util/putchar.c index e349d20..6f8e18e 100644 --- a/util/putchar.c +++ b/util/putchar.c @@ -21,6 +21,8 @@ * Author: Bryan Ford, University of Utah CSL */ +#include <device/cons.h> + int putchar(int c) { cnputc(c); diff --git a/util/putchar.h b/util/putchar.h new file mode 100644 index 0000000..2e65bd5 --- /dev/null +++ b/util/putchar.h @@ -0,0 +1,32 @@ +/* + * 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. + */ +/* + * Simple putchar implementation header. + * + */ + +#ifndef _PUTCHAR_H_ +#define _PUTCHAR_H_ + +#include <mach/std_types.h> + +extern int putchar(int c); + +#endif /* _PUTCHAR_H_ */ diff --git a/util/puts.c b/util/puts.c index c0eec03..0bd72e9 100644 --- a/util/puts.c +++ b/util/puts.c @@ -21,6 +21,9 @@ * Author: Bryan Ford, University of Utah CSL */ +#include <device/cons.h> +#include <util/putchar.h> + /* Simple puts() implementation that just uses putchar(). Note that our libc's printf() is implemented in terms of only puts() and putchar(), so that's all we need. */ diff --git a/vm/memory_object.c b/vm/memory_object.c index 6bef2c9..57dde76 100644 --- a/vm/memory_object.c +++ b/vm/memory_object.c @@ -41,6 +41,7 @@ #include <mach/mach_types.h> #include <mach/kern_return.h> +#include <vm/vm_map.h> #include <vm/vm_object.h> #include <mach/memory_object.h> #include <mach/boolean.h> @@ -81,23 +82,6 @@ decl_simple_lock_data(,memory_manager_default_lock) * argument conversion. Explicit deallocation is necessary. */ -/* - * If successful, destroys the map copy object. - */ -kern_return_t memory_object_data_provided(object, offset, data, data_cnt, - lock_value) - vm_object_t object; - vm_offset_t offset; - pointer_t data; - unsigned int data_cnt; - vm_prot_t lock_value; -{ - return memory_object_data_supply(object, offset, (vm_map_copy_t) data, - data_cnt, lock_value, FALSE, IP_NULL, - 0); -} - - kern_return_t memory_object_data_supply(object, offset, data_copy, data_cnt, lock_value, precious, reply_to, reply_to_type) register @@ -323,6 +307,24 @@ retry_lookup: return(result); } + +/* + * If successful, destroys the map copy object. + */ +kern_return_t memory_object_data_provided(object, offset, data, data_cnt, + lock_value) + vm_object_t object; + vm_offset_t offset; + pointer_t data; + unsigned int data_cnt; + vm_prot_t lock_value; +{ + return memory_object_data_supply(object, offset, (vm_map_copy_t) data, + data_cnt, lock_value, FALSE, IP_NULL, + 0); +} + + kern_return_t memory_object_data_error(object, offset, size, error_value) vm_object_t object; vm_offset_t offset; @@ -218,6 +218,28 @@ extern vm_offset_t pmap_grab_page (void); extern boolean_t pmap_valid_page(vm_offset_t x); /* + * Make the specified pages (by pmap, offset) + * pageable (or not) as requested. + */ +extern void pmap_pageable( + pmap_t pmap, + vm_offset_t start, + vm_offset_t end, + boolean_t pageable); + +/* + * Back-door routine for mapping kernel VM at initialization. + * Useful for mapping memory outside the range + * [phys_first_addr, phys_last_addr) (i.e., devices). + * Otherwise like pmap_map. + */ +extern vm_offset_t pmap_map_bd( + vm_offset_t virt, + vm_offset_t start, + vm_offset_t end, + vm_prot_t prot); + +/* * Routines defined as macros. */ #ifndef PMAP_ACTIVATE_USER diff --git a/vm/vm_init.c b/vm/vm_init.c index b76b11b..06317ac 100644 --- a/vm/vm_init.c +++ b/vm/vm_init.c @@ -37,6 +37,7 @@ #include <mach/machine/vm_types.h> #include <kern/zalloc.h> #include <kern/kalloc.h> +#include <vm/vm_fault.h> #include <vm/vm_object.h> #include <vm/vm_map.h> #include <vm/vm_page.h> diff --git a/vm/vm_kern.c b/vm/vm_kern.c index bb6c110..f29a014 100644 --- a/vm/vm_kern.c +++ b/vm/vm_kern.c @@ -43,6 +43,7 @@ #include <kern/debug.h> #include <kern/lock.h> #include <kern/thread.h> +#include <vm/pmap.h> #include <vm/vm_fault.h> #include <vm/vm_kern.h> #include <vm/vm_map.h> diff --git a/vm/vm_kern.h b/vm/vm_kern.h index 228c26d..ca93d7a 100644 --- a/vm/vm_kern.h +++ b/vm/vm_kern.h @@ -77,4 +77,9 @@ extern vm_map_t kernel_map; extern vm_map_t kernel_pageable_map; extern vm_map_t ipc_kernel_map; +extern boolean_t projected_buffer_in_range( + vm_map_t map, + vm_offset_t start, + vm_offset_t end); + #endif /* _VM_VM_KERN_H_ */ diff --git a/vm/vm_map.c b/vm/vm_map.c index 43afe91..260eb5a 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -42,13 +42,28 @@ #include <kern/assert.h> #include <kern/debug.h> #include <kern/zalloc.h> +#include <vm/pmap.h> #include <vm/vm_fault.h> #include <vm/vm_map.h> #include <vm/vm_object.h> #include <vm/vm_page.h> +#include <vm/vm_resident.h> #include <vm/vm_kern.h> #include <ipc/ipc_port.h> +/* Forward declarations */ +kern_return_t vm_map_delete( + vm_map_t map, + vm_offset_t start, + vm_offset_t end); + +kern_return_t vm_map_copyout_page_list( + vm_map_t dst_map, + vm_offset_t *dst_addr, /* OUT */ + vm_map_copy_t copy); + +void vm_map_copy_page_discard (vm_map_copy_t copy); + /* * Macros to copy a vm_map_entry. We must be careful to correctly * manage the wired page count. vm_map_entry_copy() creates a new diff --git a/vm/vm_map.h b/vm/vm_map.h index 40c828a..8961e1b 100644 --- a/vm/vm_map.h +++ b/vm/vm_map.h @@ -466,6 +466,42 @@ extern kern_return_t vm_map_pageable_common(vm_map_t, vm_offset_t, extern vm_object_t vm_submap_object; /* + * vm_map_copyin_object: + * + * Create a copy object from an object. + * Our caller donates an object reference. + */ +extern kern_return_t vm_map_copyin_object( + vm_object_t object, + vm_offset_t offset, /* offset of region in object */ + vm_size_t size, /* size of region in object */ + vm_map_copy_t *copy_result); /* OUT */ + +/* + * vm_map_submap: [ kernel use only ] + * + * Mark the given range as handled by a subordinate map. + * + * This range must have been created with vm_map_find using + * the vm_submap_object, and no other operations may have been + * performed on this range prior to calling vm_map_submap. + * + * Only a limited number of operations can be performed + * within this rage after calling vm_map_submap: + * vm_fault + * [Don't try vm_map_copyin!] + * + * To remove a submapping, one must first remove the + * range from the superior map, and then destroy the + * submap (if desired). [Better yet, don't try it.] + */ +extern kern_return_t vm_map_submap( + vm_map_t map, + vm_offset_t start, + vm_offset_t end, + vm_map_t submap); + +/* * Wait and wakeup macros for in_transition map entries. */ #define vm_map_entry_wait(map, interruptible) \ @@ -477,4 +513,22 @@ extern vm_object_t vm_submap_object; #define vm_map_entry_wakeup(map) thread_wakeup((event_t)&(map)->hdr) +/* + * This routine is called only when it is known that + * the entry must be split. + */ +extern void _vm_map_clip_start( + struct vm_map_header *map_header, + vm_map_entry_t entry, + vm_offset_t start); + +/* + * vm_map_clip_end: [ internal use only ] + * + * Asserts that the given entry ends at or before + * the specified address; if necessary, + * it splits the entry into two. + */ +void _vm_map_clip_end(); + #endif /* _VM_VM_MAP_H_ */ diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c index 6db1cb7..ba3b9ba 100644 --- a/vm/vm_pageout.c +++ b/vm/vm_pageout.c @@ -34,6 +34,7 @@ * The proverbial page-out daemon. */ +#include <device/net_io.h> #include <mach/mach_types.h> #include <mach/memory_object.h> #include <vm/memory_object_default.user.h> @@ -42,12 +43,14 @@ #include <mach/vm_statistics.h> #include <kern/counters.h> #include <kern/debug.h> +#include <kern/task.h> #include <kern/thread.h> #include <vm/pmap.h> #include <vm/vm_map.h> #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_pageout.h> +#include <machine/locore.h> #include <machine/vm_tuning.h> diff --git a/vm/vm_resident.h b/vm/vm_resident.h new file mode 100644 index 0000000..67f1807 --- /dev/null +++ b/vm/vm_resident.h @@ -0,0 +1,45 @@ +/* + * Resident memory management module 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. + */ +/* + * Resident memory management module functions. + * + */ + +#ifndef _VM_RESIDENT_H_ +#define _VM_RESIDENT_H_ + +#include <mach/std_types.h> + +/* + * vm_page_replace: + * + * Exactly like vm_page_insert, except that we first + * remove any existing page at the given offset in object + * and we don't do deactivate-behind. + * + * The object and page must be locked. + */ +extern void vm_page_replace ( + register vm_page_t mem, + register vm_object_t object, + register vm_offset_t offset); + +#endif /* _VM_RESIDENT_H_ */ diff --git a/vm/vm_user.c b/vm/vm_user.c index ebe9844..813b100 100644 --- a/vm/vm_user.c +++ b/vm/vm_user.c @@ -41,6 +41,7 @@ #include <kern/host.h> #include <kern/task.h> #include <vm/vm_fault.h> +#include <vm/vm_kern.h> #include <vm/vm_map.h> #include <vm/vm_object.h> #include <vm/vm_page.h> |