diff -brNpu gnumach-1.2/ChangeLog gnumach-1.3/ChangeLog --- gnumach-1.2/ChangeLog Mon Jun 21 11:58:11 1999 +++ gnumach-1.3/ChangeLog Mon May 27 11:17:00 2002 @@ -1,3 +1,825 @@ +2002-05-27 Roland McGrath + + * Version 1.3 released. + +2002-05-23 Marcus Brinkmann + + * i386/i386at/model_dep.c: Include and + . + (machine_idle): New function. + * bogus/power_save.h (POWER_SAVE): Define to 1. + +2002-05-22 Roland McGrath + + * configure.in (VERSION): New substituted variable: set to 1.3 now. + (version.c): Add it to AC_OUTPUT. + * configure: Regenerated. + * Makefile.in (version): New variable, set from that. + Remove vpath directive for version.c, not found in build dir. + (topfiles): version.c -> version.c.in + * doc/Makefile.in (mach-version): Substituted instead of constant. + * version.c: File removed, replaced with ... + * version.c.in: ... this new file. + (version): Make it const. Use @VERSION@ for the number. + + * Makefile.in (debian-files): Add postinst and prerm. + (dist): Use gzip -9 instead of tar z. + + * linux/Files: Add missing files to the list: + linux/dev/drivers/net/eepro100.c + linux/src/include/asm-i386/hardirq.h + linux/src/include/asm-i386/spinlock.h + linux/src/include/linux/compatmac.h + linux/src/include/linux/spinlock.h + + * linux/src/drivers/net/eth16i.c (eth16i_check_signature): Fix syntax: + #ifdef 0 -> #if 0 + + * Makefile.in (%.migs_d, %.migu_d): Fix sed substitution to match + whatever target file name gcc comes up with. + (%.migs_d, %.migu_d, %.symc.o, %_user.c, %_server.c): + Depend on $(before-compile). + +2002-04-24 Marcus Brinkmann + + * debian/rules (DOCDIR): Move to + $(PREFIX)/share/doc/$(package-dev). + +2002-04-23 Roland McGrath + + * i386/i386/ldt.c (ldt_init): Fix fencepost error in segment limits. + +2002-04-19 Roland McGrath + + * gensym.awk: Emit \n\ at the end of lines inside strings. + * Makefile.in (%.symc: %.sym): Depend on gensym.awk. + +2002-03-29 Marcus Brinkmann + + * doc/mach.texi: End index entry with full stop. + +2002-03-05 Roland McGrath + + * kern/bootstrap.c: Include . + +2002-03-04 Roland McGrath + + * Makefile.in (%_interface.h %_server.c: %.srv): Pass -sheader switch + to mig, not -header. + +2001-11-23 Roland McGrath + + * i386/i386at/i386at_ds_routines.c (device_deallocate): Do nothing if + argument is DEVICE_NULL. + +2001-10-21 Marcus Brinkmann + + * linux/src/arch/i386/lib/delay.c: Convert HTML entities. + Reported by John Tobey . + +2001-10-13 Marcus Brinkmann + + * debian/changelog: Update for next release. + +2001-10-07 Roland McGrath + + * ddb/db_access.c: Fix obsolescent #else/#endif syntax. + * device/dev_name.c: Likewise. + * device/dev_pager.c: Likewise. + * device/ds_routines.c: Likewise. + * i386/i386/i386asm.sym: Likewise. + * include/device/device_reply.defs: Likewise. + * include/mach/memory_object.defs: Likewise. + * include/mach/memory_object_default.defs: Likewise. + + * i386/i386/locore.S: Fix sloppy asm syntax to avoid warnings from + newer assembler (%ecx -> %cl in byte insns). + + * kern/bootstrap.c (bootstrap_create): Fix inverted test logic for + compatibility case. Ignore trailing newlines after space for + compatibility detection. + Reported by Neal H Walfield . + +2001-10-06 Marcus Brinkmann + + * README: Replace `GNU mach' by `GNU Mach', and remove + obsolete paragraph about kmsg device. + +2001-10-06 Marcus Brinkmann + + * doc/mach.texi: Fix direntry. + +2001-10-05 Marcus Brinkmann + + * doc/mach.texi: Replace `path name' by `file name' in one place. + Replace `illegal' by `invalid' and `to to' by `to' everwhere. + + * debian/changelog: Prepare for next release. + +2001-10-04 Marcus Brinkmann + + * doc: New directory. + * doc/Makefile.in: New file. + * doc/gpl.texi: Likewise. + * doc/fdl.texi: Likewise. + * doc/mach.texi: Likewise. + * configure.in: Add doc/Makefile to AC_OUTPUT call. + * configure: Regenerated. + + * Makefile.in (dist): Create directories doc and debian. + (doc-files): New variable with documentation files. + (debian-files): New variable with Debian packaging files. + + * debian/rules (stamp-build): Build documentation. + (build-gnumach): Install the documentation into the gnumach + package. + * debian/postrm: New file to install info document. + * debian/prerm: New file to install info document. + +2001-10-01 Marcus Brinkmann + + * i386/i386/locore.S (tenmicrosec): Remove subroutine. + * i386/i386/pit.c (delaycount): Remove global variable. + (microdata): Likewise. + (clkstart): Do not call findspeed() and microfind(). + (findspeed): Remove function. + (spinwait): Likewise. + (microfind): Likewise. This function triggers a division by zero + trap on AMD K6 350Mhz+ and Athlon 1.1GHz+ machines (and in general + leads to bad results on fast cpus), and nothing uses this code anymore. + +2001-09-30 Roland McGrath + + * kern/bootstrap.c (bootstrap_create): Ignore trailing spaces when + checking boot module string for containing none. + +2001-09-18 Marcus Brinkmann + + * linux/dev/glue/misc.c: Do not include and + . + Remove global variable ___strtok. + Remove implementation of strspn, strpbrk, strtok and strstr. + * Makefile.in: Add strpbrk and strtok. + +2001-08-24 Roland McGrath + + * kern/bootstrap.c (bootstrap_create): Make setting of boot-args and + root-device no longer conditional on [! OSKIT_MACH]. + (bootstrap_create) [! OSKIT_MACH]: Parse FOO=BAR words out of the + multiboot command line and turn those into boot script variables. + + * Makefile.in (clib-routines): Add strsep. + * kern/strings.h (strsep, strchr): Declare them. + +2001-08-23 Roland McGrath + + * kern/bootstrap.c (bootstrap_create, user_bootstrap, + boot_script_exec_cmd, boot_script_task_resume): Add printfs at + various stages of startup. + +2001-08-21 Roland McGrath + + * i386/i386at/model_dep.c (use_all_mem): Turn variable into macro. + (init_alloc_aligned): Make this function static. + Initially skip memory < 16MB and then wrap around to get it last. + +2001-08-20 Roland McGrath + + Support "boot script" functionality in multiboot module strings. + * kern/bootstrap.c: Rewrite merged from oskit-branch. + * kern/boot_script.c, kern/boot_script.h: New files, + copied from boot/ directory in Hurd sources. + * Makefile.in (kern-cfiles): Add boot_script.c here. + (kern-files): Add boot_script.h here. + * NEWS: Mention the new feature. + +2001-08-18 Roland McGrath + + * i386/i386at/model_dep.c (boot_info): Define a struct, not a pointer. + (c_boot_entry): Copy the contents into it rather than setting the ptr. + (c_boot_entry, init_alloc_aligned, pmap_valid_page, mem_size_init): + Update uses. + (init_alloc_aligned): Don't need to skip the boot_info memory. + * kern/bootstrap.c (boot_info): Update decl. + (bootstrap_create): Update uses. + +2001-08-18 Marcus Brinkmann + + * linux/src/drivers/net/eepro100.c: File updated to version in + Linux 2.2.19. This time for real. + +2001-08-18 Marcus Brinkmann + + * debian/changelog: Update for next package upload. + * debian/control: Add gnumach-dbg package. + * debian/rules: New targets to build gnumach-dbg package. + Fix various bugs. + +2001-08-18 Marcus Brinkmann + + * i386/i386at/kd.c (kdintr): In event mode, make it so that + 0xE0 scancodes are received. + From Kalle Olavi Niemitalo . + + * i386/i386at/kd.h: New constants KAX_REVERSE, KAX_UNDERLINE, + KAX_BLINK, KAX_BOLD, KAX_DIM, KAX_INVISIBLE, KAX_COL_UNDERLINE, + KAX_COL_DIM. + * i386/i386at/kd.c: Increase K_MAXESC to 32. + New global variable color_table to map color values. + New globals kd_color and kd_attrflags. + (kdinit): Initialize these variables. + (kd_update_kd_attr): New function. + (kd_parserest): Redone to support more terminal attributes, + including colors. + +2001-08-18 Marcus Brinkmann + + * linux/src/drivers/net/eepro100.c: File updated to version in + Linux 2.2.19. + * linux/src/include/asm-i386/spinlock.h: New file from Linux 2.2.19. + * linux/src/include/asm-i386/hardirq.h: Likewise. + * linux/src/include/linux/spinlock.h: Likewise. + * linux/src/include/linux/compatmac.h: Likewise. + * linux/dev/drivers/net/eepro100.c: New file, modified version from + the above to glue it in gnumach. + Submitted by Kapil H. Paranjape . + +2001-08-17 Roland McGrath + + * Makefile.in (clib-routines): Add strchr. + (kernel-undef-bad): Depend on Makefile. + + * Makefile.in ($(srcdir)/configure, $(srcdir)/config.h.in): + Use $(srcdir) in deps. + (Makefile, config.h, config.status): Likewise. + +2001-07-29 Marcus Brinkmann + + * NEWS: Add items for this and other changes. + * configure.in: Define MACH_KMSG by default and document this in + the help output. + * configure: Regenerated. + * debian/rules: Do not enable kmsg explicitely. + +2001-07-18 Marcus Brinkmann + + * debian/rules: Add -isp to dpkg-gencontrol invocation. + Move documentation to /share/doc. + * debian/changelog: Update. + +2001-06-28 Marcus Brinkmann + + * linux/dev/drivers/block/ide.c (lba_capacity_is_ok): Do not + attempt to correct id->cyls, it is a short and for large disks the + number of cylinders necessary would not fit. Subsequent checks + for lba support would fail. + (current_capacity): Likewise for drive->cyl. + (do_identify): Store value returned by current_capacity in + CAPACITY. The check which corrects the number of bios cylinders + is not aggressive enough. Update it with the check in linux + kernel-2.2.19. + +2001-06-25 Marcus Brinkmann + + * i386/bogus/fpe.h (FPE): Define FPE to 0, as the floating point + emulation is broken anyway and blows up plex86. + +2001-06-17 Marcus Brinkmann + + * debian/rules: Update to current version. + +2001-06-13 Roland McGrath + + * linux/dev/glue/block.c (device_get_status: DEV_GET_RECORDS): + Always return 512 for DEV_GET_SIZE_RECORD_SIZE as DEV_GET_SIZE does. + +2001-05-27 Marcus Brinkmann + + * debian/rules: Add --enable-ncr53c8xx to configure. + +1999-10-06 OKUJI Yoshinori + + * linux/src/drivers/scsi/tmscsiw.c: Removed. + * linux/src/drivers/scsi/tmscsiw.h: Likewise. + * linux/src/drivers/scsi/dc390w.h: Likewise. + * i386/linux/device-drivers.h.in (CONFIG_SCSI_DC390W): Deleted. + * i386/linux/Drivers.in: Remove linux_DRIVER(dc390w, ...). Now + dc390w, dc390u, and dc390f are aliases to ncr53c8xx. + * i386/linux/configure: Regenerated. + * linux/Files: Likewise. + * i386/linux/Makefile.in (linux-scsi-files): Delete tmscsiw.c. + * linux/dev/drivers/scsi/hosts.c: Do not include dc390w.h. + Reported by Andreas Voegele . + +2001-05-20 Roland McGrath + + * kern/sched_prim.c (state_panic): New function, panic with some + info when a thread's state is bogus. + (thread_wakeup_prim): Use that instead of uninformative panic. + (thread_invoke): Likewise. + (thread_dispatch): Likewise. + +2001-05-12 Marcus Brinkmann + + * ipc/ipc_object.c (ipc_object_alloc): Remove initialization of + *namep, which was without effect. + +2001-04-29 Marcus Brinkmann + + * debian/changelog: New entries for past Debian uploads. + * debian/rules: Disable eatdma driver (breaks AMD K7), do + not enable com, lpr (com is redundant, lpr doesn't work), + move enabling of kmsg in its own line. + * debian/control: Add build dependency on mig and sharutils. + +2001-04-29 Marcus Brinkmann + + * device/chario.c: Set number of elements of tthiwat and ttlowat + to NSPEEDS rather than 16. Initialize the two new elements. + (chario_init): Initialize pdma_timeouts and pdma_water_mark for + B57600 and B115200. + +2001-04-27 Marcus Brinkmann + + * include/device/tty_status.h: New macros B57600 and B115200, + increase NSPEED accordingly. + * i386/i386at/com.c (divisorreg): New divisor 1. + +2001-04-04 Roland McGrath + + * ddb/db_access.h: Fix obsolescent #else/#endif syntax. + * ddb/db_aout.c: Likewise. + * ddb/db_break.c: Likewise. + * ddb/db_break.h: Likewise. + * ddb/db_command.c: Likewise. + * ddb/db_command.h: Likewise. + * ddb/db_cond.c: Likewise. + * ddb/db_examine.c: Likewise. + * ddb/db_expr.c: Likewise. + * ddb/db_ext_symtab.c: Likewise. + * ddb/db_input.c: Likewise. + * ddb/db_lex.c: Likewise. + * ddb/db_macro.c: Likewise. + * ddb/db_mp.c: Likewise. + * ddb/db_output.c: Likewise. + * ddb/db_print.c: Likewise. + * ddb/db_run.c: Likewise. + * ddb/db_sym.c: Likewise. + * ddb/db_task_thread.c: Likewise. + * ddb/db_task_thread.h: Likewise. + * ddb/db_trap.c: Likewise. + * ddb/db_variables.c: Likewise. + * ddb/db_watch.c: Likewise. + * ddb/db_watch.h: Likewise. + * ddb/db_write_cmd.c: Likewise. + * device/dev_pager.c: Likewise. + * device/device_port.h: Likewise. + * device/device_types_kernel.h: Likewise. + * device/ds_routines.h: Likewise. + * device/errno.h: Likewise. + * device/if_ether.h: Likewise. + * device/if_hdr.h: Likewise. + * device/io_req.h: Likewise. + * device/net_io.c: Likewise. + * device/net_io.h: Likewise. + * i386/i386/ast_check.c: Likewise. + * i386/i386/cswitch.S: Likewise. + * i386/i386/db_disasm.c: Likewise. + * i386/i386/db_interface.c: Likewise. + * i386/i386/db_trace.c: Likewise. + * i386/i386/debug.h: Likewise. + * i386/i386/debug_i386.c: Likewise. + * i386/i386/debug_trace.S: Likewise. + * i386/i386/eflags.h: Likewise. + * i386/i386/gdt.h: Likewise. + * i386/i386/hardclock.c: Likewise. + * i386/i386/idt-gen.h: Likewise. + * i386/i386/ipl.h: Likewise. + * i386/i386/ktss.h: Likewise. + * i386/i386/kttd_interface.c: Likewise. + * i386/i386/ldt.h: Likewise. + * i386/i386/lock.h: Likewise. + * i386/i386/locore.S: Likewise. + * i386/i386/mp_desc.h: Likewise. + * i386/i386/pic.c: Likewise. + * i386/i386/pic.h: Likewise. + * i386/i386/pio.h: Likewise. + * i386/i386/pit.h: Likewise. + * i386/i386/seg.h: Likewise. + * i386/i386/thread.h: Likewise. + * i386/i386/trap.c: Likewise. + * i386/i386/trap.h: Likewise. + * i386/i386/vm_param.h: Likewise. + * i386/i386/vm_tuning.h: Likewise. + * i386/i386at/autoconf.c: Likewise. + * i386/i386at/blit.c: Likewise. + * i386/i386at/conf.c: Likewise. + * i386/i386at/fd.c: Likewise. + * i386/i386at/idt.h: Likewise. + * i386/i386at/immc.c: Likewise. + * i386/i386at/kd.c: Likewise. + * i386/i386at/kd_event.c: Likewise. + * i386/i386at/kd_mouse.c: Likewise. + * i386/i386at/model_dep.c: Likewise. + * i386/i386at/rtc.c: Likewise. + * i386/include/mach/i386/asm.h: Likewise. + * i386/include/mach/i386/eflags.h: Likewise. + * i386/include/mach/i386/mach_i386.defs: Likewise. + * i386/include/mach/i386/multiboot.h: Likewise. + * i386/include/mach/i386/trap.h: Likewise. + * i386/include/mach/i386/vm_types.h: Likewise. + * i386/include/mach/sa/stdarg.h: Likewise. + * i386/intel/pmap.c: Likewise. + * i386/intel/pmap.h: Likewise. + * include/alloca.h: Likewise. + * include/device/device_types.defs: Likewise. + * include/device/device_types.h: Likewise. + * include/device/disk_status.h: Likewise. + * include/device/net_status.h: Likewise. + * include/mach/mach.defs: Likewise. + * include/mach/memory_object.defs: Likewise. + * include/mach/std_types.defs: Likewise. + * include/mach_debug/hash_info.h: Likewise. + * include/mach_debug/ipc_info.h: Likewise. + * include/mach_debug/mach_debug.defs: Likewise. + * include/mach_debug/mach_debug_types.defs: Likewise. + * include/mach_debug/mach_debug_types.h: Likewise. + * include/mach_debug/vm_info.h: Likewise. + * include/mach_debug/zone_info.h: Likewise. + * include/sys/ioctl.h: Likewise. + * include/sys/time.h: Likewise. + * ipc/ipc_entry.h: Likewise. + * ipc/ipc_hash.h: Likewise. + * ipc/ipc_init.c: Likewise. + * ipc/ipc_kmsg.c: Likewise. + * ipc/ipc_kmsg.h: Likewise. + * ipc/ipc_marequest.c: Likewise. + * ipc/ipc_marequest.h: Likewise. + * ipc/ipc_mqueue.c: Likewise. + * ipc/ipc_mqueue.h: Likewise. + * ipc/ipc_notify.c: Likewise. + * ipc/ipc_notify.h: Likewise. + * ipc/ipc_object.c: Likewise. + * ipc/ipc_object.h: Likewise. + * ipc/ipc_port.c: Likewise. + * ipc/ipc_port.h: Likewise. + * ipc/ipc_pset.c: Likewise. + * ipc/ipc_pset.h: Likewise. + * ipc/ipc_right.c: Likewise. + * ipc/ipc_right.h: Likewise. + * ipc/ipc_space.c: Likewise. + * ipc/ipc_space.h: Likewise. + * ipc/mach_debug.c: Likewise. + * ipc/mach_msg.c: Likewise. + * ipc/mach_msg.h: Likewise. + * ipc/mach_port.c: Likewise. + * kern/act.c: Likewise. + * kern/assert.h: Likewise. + * kern/ast.c: Likewise. + * kern/ast.h: Likewise. + * kern/bootstrap.c: Likewise. + * kern/counters.c: Likewise. + * kern/counters.h: Likewise. + * kern/debug.h: Likewise. + * kern/exception.c: Likewise. + * kern/host.h: Likewise. + * kern/ipc_host.c: Likewise. + * kern/ipc_host.h: Likewise. + * kern/ipc_kobject.c: Likewise. + * kern/ipc_mig.c: Likewise. + * kern/ipc_tt.c: Likewise. + * kern/ipc_tt.h: Likewise. + * kern/kalloc.h: Likewise. + * kern/lock_mon.c: Likewise. + * kern/mach_clock.c: Likewise. + * kern/mach_factor.c: Likewise. + * kern/mach_param.h: Likewise. + * kern/machine.c: Likewise. + * kern/processor.c: Likewise. + * kern/profile.c: Likewise. + * kern/queue.h: Likewise. + * kern/sched.h: Likewise. + * kern/startup.c: Likewise. + * kern/syscall_emulation.h: Likewise. + * kern/syscall_subr.c: Likewise. + * kern/syscall_subr.h: Likewise. + * kern/syscall_sw.c: Likewise. + * kern/syscall_sw.h: Likewise. + * kern/task.h: Likewise. + * kern/thread_swap.h: Likewise. + * kern/time_out.h: Likewise. + * kern/time_stamp.c: Likewise. + * kern/time_stamp.h: Likewise. + * kern/timer.c: Likewise. + * kern/timer.h: Likewise. + * kern/xpr.c: Likewise. + * kern/xpr.h: Likewise. + * kern/zalloc.c: Likewise. + * kern/zalloc.h: Likewise. + * linux/dev/drivers/block/ide.c: Likewise. + * linux/dev/include/linux/blk.h: Likewise. + * linux/src/include/linux/cdrom.h: Likewise. + * linux/src/include/linux/md.h: Likewise. + * util/cpu.h: Likewise. + * vm/memory_object.c: Likewise. + * vm/memory_object.h: Likewise. + * vm/pmap.h: Likewise. + * vm/vm_debug.c: Likewise. + * vm/vm_external.h: Likewise. + * vm/vm_fault.c: Likewise. + * vm/vm_fault.h: Likewise. + * vm/vm_kern.h: Likewise. + * vm/vm_map.c: Likewise. + * vm/vm_map.h: Likewise. + * vm/vm_object.h: Likewise. + * vm/vm_pageout.c: Likewise. + * vm/vm_pageout.h: Likewise. + * vm/vm_user.h: Likewise. + +2001-01-28 Roland McGrath + + * kern/zalloc.c (zalloc): Change panics for exhausted zone to include + the zone name. + +2001-01-09 Marcus Brinkmann + + * include/device/device_types.h: New get_status call + DEV_GET_RECORDS to get the number of records of a device (rather + than the number of bytes). Accordingly define + DEV_GET_RECORDS_DEVICE_RECORDS, DEV_GET_RECORDS_RECORD_SIZE and + DEV_GET_RECORDS_COUNT. + + * linux/dev/glue/block.c (device_get_status): Handle + DEV_GET_RECORDS. + +2000-11-26 David Welch + + * i386/Makefrag (i386-installed-headers): Removed dead files + from the list of headers to be installed + +2000-11-26 Marcus Brinkmann + + * linux/src/drivers/net/tulip.c: Updated to version + from Linux 2.2.17 (I am amazed that 2.2.x drivers work). + Suggested by Jason Henry Parker . + +2000-10-29 Roland McGrath + + Remove numerous dead header files. + Suggested by Igor Khavkine . + * i386/include/mach/i386/bios.h: Dead file removed. + * i386/include/mach/i386/code16.h: Dead file removed. + * i386/include/mach/i386/debug_reg.h: Dead file removed. + * i386/include/mach/i386/dpmi.h: Dead file removed. + * i386/include/mach/i386/far_ptr.h: Dead file removed. + * i386/include/mach/i386/paging.h: Dead file removed. + * i386/include/mach/i386/pio.h: Dead file removed. + * i386/include/mach/i386/pmode.h: Dead file removed. + * i386/include/mach/i386/proc_reg.h: Dead file removed. + * i386/include/mach/i386/seg.h: Dead file removed. + * i386/include/mach/i386/time_stamp.h: Dead file removed. + * i386/include/mach/i386/tss.h: Dead file removed. + * i386/include/mach/i386/vcpi.h: Dead file removed. + * i386/include/mach/proc_ops.h: Dead file removed. + * i386/include/mach/sa/sys/varargs.h: Dead file removed. + * i386/include/mach/setjmp.h: Dead file removed. + * include/mach/proc_ops.h: Dead file removed. + * Makefile.in (mach-headers): Remove proc_ops.h. + * i386/Makefrag (i386-installed-headers): Likewise. + (installed-headers): Don't touch this any more. + * i386/Files: Update for removed files. + +2000-09-29 Marcus Brinkmann + + * i386/i386at/conf.c (dev_name_list): Don't use MACH_COM to check + if com support is enabled, but NCOM, as it used to be. + +2000-09-24 OKUJI Yoshinori + + * linux/dev/glue/block.c: Reverted the changes at 2000-08-17. + Reported by Brent Fulgham . + +2000-09-19 Marcus Brinkmann + + * linux/dev/glue/block.c (init_partition): Move initialization + of MASK until it is asserted that gd is non-NULL. + +2000-08-17 OKUJI Yoshinori + + * linux/dev/glue/block.c (rdwr_partial): Mask the minor device + number with MINOR_SHIFT bits, when indexing the array of + partitions. Reported by Marius Vollmer . + (init_partition): Likewise. + (check_limit): Likewise. + (device_get_status): Likewise. + +2000-07-27 Marcus Brinkmann + + * Fix omissions in last change: + * linux/src/arch/i386/lib/delay.S: Now really delete the file. + * linux/src/arch/i386/lib/delay.c: Now really add the file. + +2000-07-04 Marcus Brinkmann + + * debian/changelog: Add entry for new Debian upload. + * linux/dev/drivers/scsi/seagate.c (WRITE_CONTROL, WRITE_DATA): + Added from linux 2.2.15. + (__asm__ constructs): Replace with equivalent C code from linux 2.2.15 + to support gcc-2.95. + * linux/src/drivers/scsi/in2000.h: Update asm code to linux 2.2.15. + * linux/src/drivers/scsi/ppa.c: Replace asm code with equivalent + C code from linux 2.2.15. + +2000-02-06 Stefan Weil + + * device/subrs.c: Fixed compiler warning. + * ddb/db_output.c, kern/bootstrap.c, kern/debug.c, kern/printf.c: + Replaced varargs.h by stdarg.h. Fixed prototypes (const char *fmt). + * ddb/db_output.h: Use prototype for db_printf. + * i386/Files: removed varargs.h. + * i386/i386/pit.h: Fixed compiler warning. + * i386/i386at/model_dep.c: Tried to fix compiler warning. + * i386/include/mach/sa/sys/varargs.h: Removed. + * i386/linux/Makefile.in: Removed delay.S, added delay.c. + * linux/dev/include/asm-i386/segment.h: Support gcc-2.95. + * linux/dev/include/asm-i386/string.h, + linux/src/include/asm-i386/string.h: Update from linux-2.2.14. + * linux/dev/lib/vsprintf.c: Fixed compiler warning. + * linux/src/include/asm-i386/delay.h: Update from linux-2.2.14. + * linux/src/arch/i386/lib/delay.c: Copy from linux-2.2.14. + * linux/src/include/asm-i386/string.h: Update from linux-2.2.14. + +1999-10-08 Thomas Bushnell, BSG + + * linux/src/drivers/net/3c59x.c: Updated to version 0.99L of the + driver from ftp://cesdis.gsfc.nasa.gov/linux/drivers/3c59x.c, in + order to support the 3c509c card, as requested by Jeff Bailey + . + +1999-09-17 Thomas Bushnell, BSG + + * linux/dev/drivers/block/ide.c (do_request) [MACH]: In "bad + access" printf, actually print the number of sectors of the + partition. + +1999-10-05 Roland McGrath + + * i386/intel/pmap.c (pmap_bootstrap): Use _start instead of start. + * i386/i386/trap.c (kernel_trap): Likewise. + +1999-10-04 Roland McGrath + + * configure.in: Remove AC_CHECK_TOOL(MAKE,...) check. + * Makefile.in (MAKE): Variable removed. We require GNU make anyway, + and it always sets MAKE. + * configure: Regenerated. + + * Makefile.in (clib-routines.o, check-clib-routines, clib-routines.d): + Remove these rules, replace with: + (kernel.o): New target, relocatable object linked from kernel objects. + (kernel-undef, kernel-undef-bad): New targets, glean undefined symbols + from kernel.o. + (clib-routines.o): New target, use those to select symbols from libc. + (clib-routines): Add some symbols; move defn to kernel linking page. + This variable is now a list of symbols allowed to be undefined, + rather than a prescriptive list of symbols always grabbed from libc. + (kernel): Rewrite this rules to just link kernel.o and clib-routines.o + together to make the kernel image. + +1999-09-15 Mark Kettenis + + * i386/i386/user_ldt.c: Fix user LDT management. + (i386_set_ldt): Prevent thrashing the LDT for the current thread. + Correctly calculate size of new LDT. Set base adress of the LDT + descriptor to the linear address of the LDT instead of the kernel + virtual address. Copy descriptors from the default LDT if there + is no old LDT for the current thread. Call switch_ktss if we are + setting a new LDT for the current thread. + (i386_get_ldt): Fix bug in copying out the descriptors. + +1999-09-09 Thomas Bushnell, BSG + + * linux/src/drivers/net/rtl8139.c (RX_BUF_LEN_IDX): Reduce from 3 + to 2. (64K exceeds the limits in linux/dev/glue/kmem.c:kmalloc.) + (rtl8129_open): If we fail to get the memory we need, then free + the IRQ before returning. + Reported by Daniel Kobras . + +1999-09-07 Thomas Bushnell, BSG + + * linux/src/drivers/net/yellowfin.c (yellowfin_probe): Return + correct value. Reported by Marcus Brinkmann + . + + * linux/dev/drivers/net/Space.c: Declare tc515_probe. Reported by + Marcus Brinkmann . + +1999-09-04 Thomas Bushnell, BSG + + * vm/vm_resident.c (vm_page_grab): Only block unprivileged + allocations over vm_page_external_limit if they are actually + external allocations. Reported by Mark Kettenis + (kettenis@wins.uva.nl>. + +1999-08-10 Thomas Bushnell, BSG + + * i386/i386at/model_dep.c (init_alloc_aligned): Revert previous + change except for the one to AVAIL_NEXT. All the rest of the + previous code was correct. Correction from Momchil Velikov + (velco@fadata.bg). + +1999-07-23 Roland McGrath + + * Drivers.macros (AC_DRIVER): Use `test' instead of `[ ... ]'. + Reported by "Momchil 'Velco' Velikov" . + +1999-07-20 Roland McGrath + + * linux/dev/drivers/block/genhd.c (check_partition): Change message + to say these are only the DOS partitions. + * i386/linux/dev/include/linux/autoconf.h (CONFIG_BSD_DISKLABEL, + CONFIG_SMD_DISKLABEL): #undef these. The dev/glue/block.c code + deals with BSD disklabels and expects the Linux genhd.c code to + handle only the DOS partitions; having genhd.c do BSD disklabels + too just confuses things. + + Force subdirectory targets so they get recompiled properly. + * i386/Makefile.in (linux/linux.o): Depend on FORCE instead of linux. + (FORCE): New target. + * i386/Makefrag (i386/sysdep.o, FORCE): Likewise. + +1999-07-11 Thomas Bushnell, BSG + + * i386/i386at/model_dep.c (init_alloc_aligned): Make the checks + correctly for addresses falling into skip regions. Reported by + Momchil Velikov (velco@fadata.bg). + +1999-07-01 Thomas Bushnell, BSG + + * i386/linux/Makefile.in: For each .o file in $(linux-objs) + include a corresponding .d file, unless `no_deps' is `t'. + (make-deps): New function. + (%.d): New pattern rules for building %.d from %.c and %.S. + +1999-06-29 Thomas Bushnell, BSG + + * vm/vm_resident.c (vm_page_grab): Don't bounce requests when + vm_page_external_count == vm_page_external_limit, so that before + initialization is complete we can still allocate memory without + relying on current_thread. + (vm_page_wait): Also block if we are over the external page + limit. + * vm/vm_pageout.c (vm_pageout_scan): Rewrite the + scan-for-pages-to-pageout loop to not crash when we hit the end of + the inactive queue; instead jump back to the + pause-for-a-little-while code. + +1999-06-27 Thomas Bushnell, BSG + + * vm/vm_resident.c (vm_page_external_count): Define variable. + (vm_page_grab): New argument `external'. All callers changed. + Keep track of number of externally managed pages. Don't let + non-privileged threads exceed the externally-managed page limit. + (vm_page_grab_contiguous_pages): New argument `external'. All + callers changed. Keep track of number of externally managed + pages. Don't let non-privileged threads exceed the + externally-managed page limit. + (vm_page_convert): New argument `external', handed off to + vm_page_grab. All callers changed. + (vm_page_release): New argument `external'. All callers + changed. Keep track of number of externally managed pages. + (vm_page_bootstrap): Initialize M->external. + (vm_page_external_limit): Define new variable. + (vm_page_grab_phys_addr, vm_page_alloc): Add new arg for + vm_page_grab. + (vm_page_free): Provide new arg to vm_page_release. + * vm/vm_page.h (vm_page_external_limit, vm_page_external_count): + New variables. + (struct vm_page): New members `external' and `extcounted'. + (vm_page_grab, vm_page_release, vm_page_convert): Specify new + argument. + * vm/vm_pageout.c (vm_pageout): Initialize vm_page_external_limit + and vm_page_external_target. + (VM_PAGE_EXTERNAL_LIMIT, VM_PAGE_EXTERNAL_TARGET): New macro. + (vm_page_external_target): New variable. + (vm_pageout_scan): Regard "too many externally managed pages" as a + reason to keep doing work, but if that's the only reason we're + doing work, then the only thing we do is schedule cleaning of + pages. Help keep track of the number of externally managed pages + that we care about. + * i386/intel/pmap.c (pmap_page_table_page_alloc): Add new arg for + vm_page_grab. + * linux/dev/glue/block.c (alloc_buffer, device_read): Likewise. + * vm/vm_map.c (vm_map_copy_steal_pages): Likewise. + * vm/vm_fault.c (vm_fault_page): Add new args for vm_page_grab and + vm_page_convert. + + * vm/vm_pageout.c (VM_PAGEOUT_BURST_WAIT): Reduce to 10ms/page. + (VM_PAGEOUT_EMPTY_WAIT): Reduce to 75 ms. + (VM_PAGE_FREE_RESERVED): Increase to 50 pages. + (VM_PAGEOUT_RESERVED_INTERNAL): Adjust to `(reserve) - 25'. + (VM_PAGEOUT_RESERVED_REALLY): Adjust to `(reserve) - 40'. + 1999-06-21 Thomas Bushnell, BSG * i386/Files: Don't mention i386/pc/Makerules, diff -brNpu gnumach-1.2/Drivers.macros gnumach-1.3/Drivers.macros --- gnumach-1.2/Drivers.macros Mon Jun 21 11:58:11 1999 +++ gnumach-1.3/Drivers.macros Mon May 27 11:17:00 2002 @@ -43,7 +43,7 @@ dnl `class'; see the comments on AC_DRIV AC_DEFUN(AC_DRIVER, [ [#] Checking for device driver option [$1] AC_ARG_ENABLE([$1],, -if [ "x$enableval" != xno ]; then +if test "x$enableval" != xno; then AC_DEFINE([$2]) device_drivers="$device_drivers [$3]" if test "${driver_class_[$4]_selected+set}" != set; then @@ -53,5 +53,3 @@ if test "${driver_class_[$4]_selected+se fi fi )]) - - diff -brNpu gnumach-1.2/Makefile.in gnumach-1.3/Makefile.in --- gnumach-1.2/Makefile.in Mon Jun 21 11:58:11 1999 +++ gnumach-1.3/Makefile.in Mon May 27 11:17:00 2002 @@ -19,6 +19,7 @@ srcdir=@srcdir@ systype=@systype@ prefix=@prefix@ +version = @VERSION@ exec_prefix=$(prefix) @@ -50,7 +51,6 @@ CC = @CC@ LD = @LD@ NM = @NM@ MIG = @MIG@ -MAKE = @MAKE@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ @@ -69,7 +69,7 @@ all-archs-configures = $(patsubst %,$(sr # Files distributed from the top level directory: topfiles = ChangeLog ChangeLog.0 ChangeLog.00 Drivers.macros Makefile.in \ README INSTALL config.guess config.sub configure configure.in \ - gensym.awk install-sh version.c NEWS aclocal.m4 COPYING + gensym.awk install-sh version.c.in NEWS aclocal.m4 COPYING # All the source in each directory. @@ -140,7 +140,7 @@ kern-cfiles = act.c ast.c bootstrap.c co machine.c pc_sample.c printf.c priority.c processor.c profile.c \ queue.c sched_prim.c startup.c strings.c syscall_emulation.c \ syscall_subr.c syscall_sw.c task.c thread.c thread_swap.c \ - time_stamp.c timer.c xpr.c zalloc.c elf-load.c + time_stamp.c timer.c xpr.c zalloc.c elf-load.c boot_script.c kern-files = $(kern-cfiles) \ act.h assert.h ast.h compat_xxx_defs.h counters.h cpu_number.h \ debug.h eventcount.h host.h ipc_host.h ipc_kobject.h ipc_sched.h \ @@ -148,7 +148,7 @@ kern-files = $(kern-cfiles) \ pc_sample.h processor.h queue.h refcount.h sched.h sched_prim.h \ shuttle.h strings.h syscall_emulation.h syscall_subr.h syscall_sw.h \ task.h thread.h thread_swap.h time_out.h time_stamp.h timer.h xpr.h \ - zalloc.h \ + zalloc.h boot_script.h \ mach.srv mach4.srv mach_debug.srv mach_host.srv # Still more trivia @@ -164,6 +164,11 @@ vm-files = $(vm-cfiles) memory_object_de memory_object.h pmap.h $(patsubst %,vm_%.h, \ external fault kern map object page pageout user) +# Documentation +doc-files = Makefile.in fdl.texi gpl.texi mach.texi + +# Debian packaging +debian-files = changelog control copyright README.Debian rules postinst prerm # Object files that go into the kernel image. (This will be augmented by the @@ -190,7 +195,6 @@ vpath %.c $(srcdir)/ddb # Version number objfiles += version.o -vpath version.c $(srcdir) # Header files installed for user use @@ -208,7 +212,7 @@ mach-headers= $(addprefix mach/, bootstr host_info.h kern_return.h mach_param.h mach_types.h \ machine.h macro_help.h memory_object.h message.h mig_errors.h \ msg_type.h multiboot.h norma_special_ports.h notify.h \ - pc_sample.h policy.h port.h proc_ops.h processor_info.h \ + pc_sample.h policy.h port.h processor_info.h \ profil.h profilparam.h rpc.h std_types.h syscall_sw.h \ task_info.h task_special_ports.h thread_info.h \ thread_special_ports.h thread_status.h thread_switch.h \ @@ -228,43 +232,6 @@ other-mach-headers := mig_support.h mach other-headers := alloca.h -# We steal routines from the C library and put them here. -# If we link against the C library directly, then we have to hope that we have -# correctly found all the dependencies that might bring in C library code. -# This method is much safer because it's easy to check this one object file -# for sanity. -objfiles += clib-routines.o - -clib-routines := memcpy memset bcopy bzero htonl htons ntohl ntohs -ifeq ($(enable_kdb),yes) -clib-routines += strstr -endif - -Wl-u = -Wl,-u, -clib-routines.o: Makefile - $(CC) -o $@ -r -nostartfiles -nostdlib -static -x c /dev/null \ - $(addprefix $(Wl-u),$(clib-routines)) \ - -L`dirname \`$(CC) --print-file-name=libc.a\`` -lc - -# This rule checks clib-routines and makes sure it doesn't have any -# extra symbols. -kernel: check-clib-routines -check-clib-routines: clib-routines.o - $(NM) -g $< | \ - awk '$(foreach sym,$(clib-routines),\ - $$3 == "$(sym)" || $$3 == "__$(sym)" ||) 0 \ - { match_cnt++; total_cnt++; next } \ - $$2 == "W" { weak_cnt++ } \ - { total_cnt++ } \ - END { exit total_cnt - (match_cnt + weak_cnt) }' - touch check-clib-routines - - -# Empty dependency file -clib-routines.d:; touch $@ - - - # Automatically generated source # User stubs @@ -332,10 +299,30 @@ check: # # Kernel Image # -# (The newline in this command makes it much easier to read in make output.) -kernel: $(objfiles) - $(LD) -o $@ $(LDFLAGS) \ - $(objfiles) + +# This is the list of routines we decide is OK to steal from the C library. +clib-routines := memcpy memmove memset bcopy bzero \ + strchr strstr strsep strpbrk strtok \ + htonl htons ntohl ntohs \ + etext edata end # actually ld magic, not libc + +#kernel.a: $(objfiles) +# @rm -f $@ +# $(AR) cq $@ $^ +kernel.o: $(objfiles) # kernel.a + $(LD) -r -o $@ $^ +kernel-undef: kernel.o + $(NM) -u $< | sed 's/^_*//' | sort -u > $@ +kernel-undef-bad: kernel-undef Makefile + sed '$(foreach r,$(clib-routines),/^$r$$/d;)' $< > $@ +clib-routines.o: kernel-undef kernel-undef-bad + if test -s kernel-undef-bad; \ + then cat kernel-undef-bad; exit 2; else true; fi + $(CC) -nostdlib -nostartfiles -r -static \ + -o $@ \ + `sed 's/^/-Wl,-u,/' $<` -x c /dev/null -lc +kernel: kernel.o clib-routines.o + $(LD) $(LDFLAGS) -o $@ $^ @@ -375,6 +362,7 @@ dist: mkdir gnumach-$(version) # Directories mkdir gnumach-$(version)/{bogus,chips,ddb,device,ipc,kern,scsi,util,vm,include} + mkdir gnumach-$(version)/{doc,debian} mkdir gnumach-$(version)/include/{mach,device,mach_debug,sys} mkdir gnumach-$(version)/include/mach/exec for dir in `cat $(all-archs-subdirs)`; do \ @@ -398,12 +386,14 @@ dist: cp $(addprefix $(srcdir)/include/,$(other-headers)) gnumach-$(version)/include cp $(addprefix $(srcdir)/include/sys/,$(other-sys-headers)) gnumach-$(version)/include/sys cp $(addprefix $(srcdir)/include/mach/,$(other-mach-headers)) gnumach-$(version)/include/mach + cp $(addprefix $(srcdir)/doc/,$(doc-files)) gnumach-$(version)/doc + cp $(addprefix $(srcdir)/debian/,$(debian-files)) gnumach-$(version)/debian # Files in arch dirs for file in `cat $(all-archs-files)`; do \ cp $(srcdir)/$$file gnumach-$(version)/`dirname $$file`; \ done chmod -R u=rwX,og=rX gnumach-$(version) - tar cfz gnumach-$(version).tar.gz gnumach-$(version) + tar cf - gnumach-$(version) | gzip -9vc > gnumach-$(version).tar.gz rm -rf gnumach-$(version) @@ -411,13 +401,19 @@ dist: # # Autoconf support # -$(srcdir)/configure: configure.in +$(srcdir)/configure: $(srcdir)/configure.in cd $(srcdir) && autoconf +$(srcdir)/config.h.in: $(srcdir)/acconfig.h + cd $(srcdir) && autoheader -Makefile: Makefile.in config.status +Makefile: $(srcdir)/Makefile.in config.status + ./config.status +config.h: stamp-configh ; +stamp-configh: $(srcdir)/config.h.in config.status ./config.status + touch $@ -config.status: configure +config.status: $(srcdir)/configure ./config.status --recheck vpath %.in $(srcdir) @@ -430,21 +426,22 @@ vpath configure $(srcdir) # # Building foo.h from foo.sym: -%.symc: %.sym - $(AWK) -f $(srcdir)/gensym.awk $< >$*.symc -%.symc.o: %.symc +%.symc: %.sym $(srcdir)/gensym.awk + $(AWK) -f $(word 2,$^) $< > $@ +%.symc.o: %.symc $(before-compile) $(CC) -S $(CPPFLAGS) $(CFLAGS) $(CPPFLAGS-$@) -x c -o $@ $< %.h: %.symc.o sed <$< -e 's/^[^*].*$$//' | \ sed -e 's/^[*]/#define/' -e 's/mAgIc[^-0-9]*//' >$@ # Building from foo.cli -%.h %_user.c: %.cli +%.h %_user.c: %.cli $(before-compile) $(MIG) $(MIGFLAGS) -header $*.h -user $*_user.c -server /dev/null $< # Building from foo.srv -%_interface.h %_server.c: %.srv - $(MIG) $(MIGFLAGS) -header $*_interface.h -server $*_server.c -user /dev/null $< +%_interface.h %_server.c: %.srv $(before-compile) + $(MIG) $(MIGFLAGS) -sheader $*_interface.h -server $*_server.c \ + -header /dev/null -user /dev/null $< # # Dependency generation @@ -470,13 +467,13 @@ endif # Here is how to make those dependency files -%.migs_d: %.srv +%.migs_d: %.srv $(before-compile) (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \ - sed -e 's/\.srv\.o:/_server.c $@:/' > $@) + sed -e 's/[^:]*:/$(@:.migs_d=_server.c) $@:/' > $@) -%.migu_d: %.cli +%.migu_d: %.cli $(before-compile) (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \ - sed -e 's/\.cli\.o:/_user.c $@:/' > $@) + sed -e 's/[^:]*:/$(@:.migu_d=_user.c) $@:/' > $@) %.migsh_d: %.migs_d sed -e 's/_server\.c /_interface.h /' -e 's/migs_d/migsh_d/' < $< > $@ diff -brNpu gnumach-1.2/NEWS gnumach-1.3/NEWS --- gnumach-1.2/NEWS Mon Jun 21 11:58:12 1999 +++ gnumach-1.3/NEWS Mon May 27 11:17:01 2002 @@ -1,3 +1,27 @@ +-*- Text -*- + +Changes between version 1.2 and version 1.3 + +The kernel now directly supports "boot scripts" in the form of multiboot +module names with the same syntax as the Hurd's `serverboot' program. +That is, instead of telling GRUB "module /boot/serverboot", you can give +GRUB a series of command like "module /hurd/ext2fs ${...}" where the +syntax after "module" is the same as in boot scripts for Hurd's `serverboot'. + +The kernel message device `kmsg' is now enabled by default. +--disable-kmsg turns it off. + +Large disks (>= 10GB) are now correctly supported, the new get_status +call DEV_GET_RECORDS can return the number of records of a device. + +Lots of tweaks have been done to the virtual memory management to make +it perform better on today's machines. + +The console supports ANSI escape sequences for colors and attributes. + +Support for the terminal speeds B57600 and B115200 has been added. + + Changes between version 1.1 and version 1.2 Many bug fixes. @@ -37,4 +61,3 @@ Bug in --enable-ncr53c7xx has been fixed Many thanks go to Marcus G. Daniels (marcus@cathcart.sysc.pdx.edu) for his very helpful testing of the 1.0 release and for his many improvements to the cross-compilation support. - diff -brNpu gnumach-1.2/README gnumach-1.3/README --- gnumach-1.2/README Mon Jun 21 11:58:11 1999 +++ gnumach-1.3/README Mon May 27 11:17:00 2002 @@ -1,5 +1,5 @@ -*- Text -*- -This is the GNU mach 1.2 distribution. +This is the GNU Mach 1.2 distribution. This kernel is derived from the Utah kernel source. We use it to run the Hurd on. It is being distributed by us so that we can more easily @@ -32,10 +32,6 @@ debugging the kernel, of course. We don because it adds considerably to the unpageable memory footprint of the kernel. -If you want to use the kmsg device, specify --enable-kmsg to -configure. It is disabled by default, because we assume that it is -unstable and there is no appropriate translator for it. - The specific switches you give to configure are always recorded in the file `config.status'. So you can always tell what options you used to build a particular kernel. @@ -43,4 +39,3 @@ build a particular kernel. Bug reports relating to this distribution should be sent to bug-hurd@gnu.org. Requests for assistance should be made on help-hurd@gnu.org. - diff -brNpu gnumach-1.2/bogus/power_save.h gnumach-1.3/bogus/power_save.h --- gnumach-1.2/bogus/power_save.h Mon Jun 21 11:58:12 1999 +++ gnumach-1.3/bogus/power_save.h Mon May 27 11:17:01 2002 @@ -1 +1 @@ -#define POWER_SAVE 0 +#define POWER_SAVE 1 diff -brNpu gnumach-1.2/configure gnumach-1.3/configure --- gnumach-1.2/configure Mon Jun 21 11:58:12 1999 +++ gnumach-1.3/configure Mon May 27 11:17:01 2002 @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12 +# Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -15,7 +15,7 @@ ac_default_prefix= ac_help="$ac_help --enable-kdb enable use of in-kernel debugger" ac_help="$ac_help - --enable-kmsg enable use of kmsg device" + --enable-kmsg enable use of kmsg device [default=yes]" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -54,6 +54,7 @@ mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 @@ -337,7 +338,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -507,9 +508,11 @@ ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross +ac_exeext= +ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -525,6 +528,9 @@ fi +VERSION=1.3 + + # # Deduce output var `systype' from configuration parms. # @@ -549,26 +555,26 @@ ac_configure=$ac_aux_dir/configure # Thi # Make sure we can run config.sub. -if $ac_config_sub sun4 >/dev/null 2>&1; then : +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:558: checking host system type" >&5 +echo "configure:564: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) - if host_alias=`$ac_config_guess`; then : + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac -host=`$ac_config_sub $host_alias` +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` @@ -611,6 +617,11 @@ if test "${enable_kmsg+set}" = set; then #define MACH_KMSG 1 EOF +else + cat >> confdefs.h <<\EOF +#define MACH_KMSG 1 +EOF + fi @@ -625,28 +636,30 @@ fi # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:633: checking for a BSD compatible install" >&5 +echo "configure:645: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. : else ac_cv_path_install="$ac_dir/$ac_prog -c" @@ -676,22 +689,25 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:687: checking for $ac_word" >&5 +echo "configure:702: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_AWK="$ac_prog" @@ -713,7 +729,7 @@ done echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:717: checking build system type" >&5 +echo "configure:733: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -724,7 +740,7 @@ NONE) esac ;; esac -build=`$ac_config_sub $build_alias` +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` @@ -739,15 +755,16 @@ fi # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:743: checking for $ac_word" >&5 +echo "configure:759: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="${ac_tool_prefix}gcc" @@ -772,15 +789,16 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:776: checking for $ac_word" >&5 +echo "configure:793: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -801,16 +819,17 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:805: checking for $ac_word" >&5 +echo "configure:823: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -849,21 +868,23 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:853: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:872: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext < conftest.$ac_ext << EOF + +#line 883 "configure" #include "confdefs.h" + main(){return(0);} EOF -if { (eval echo configure:867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -877,6 +898,12 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then @@ -887,13 +914,13 @@ else cross_linkable=yes fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:891: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:918: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:897: checking whether we are using GNU C" >&5 +echo "configure:924: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -902,7 +929,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -936,15 +963,16 @@ fi # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. set dummy ${ac_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:940: checking for $ac_word" >&5 +echo "configure:967: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$LD"; then ac_cv_prog_LD="$LD" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_LD="${ac_tool_prefix}ld" @@ -967,15 +995,16 @@ fi # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args. set dummy ${ac_tool_prefix}nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:971: checking for $ac_word" >&5 +echo "configure:999: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$NM"; then ac_cv_prog_NM="$NM" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_NM="${ac_tool_prefix}nm" @@ -999,15 +1028,16 @@ fi # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args. set dummy ${ac_tool_prefix}mig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1003: checking for $ac_word" >&5 +echo "configure:1032: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$MIG"; then ac_cv_prog_MIG="$MIG" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_MIG="${ac_tool_prefix}mig" @@ -1030,15 +1060,16 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "mig", so it can be a program name with args. set dummy mig; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1034: checking for $ac_word" >&5 +echo "configure:1064: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$MIG"; then ac_cv_prog_MIG="$MIG" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_MIG="mig" @@ -1061,71 +1092,6 @@ else fi fi -# Extract the first word of "${ac_tool_prefix}make", so it can be a program name with args. -set dummy ${ac_tool_prefix}make; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1068: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_MAKE'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$MAKE"; then - ac_cv_prog_MAKE="$MAKE" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_MAKE="${ac_tool_prefix}make" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -MAKE="$ac_cv_prog_MAKE" -if test -n "$MAKE"; then - echo "$ac_t""$MAKE" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -if test -z "$ac_cv_prog_MAKE"; then -if test -n "$ac_tool_prefix"; then - # Extract the first word of "make", so it can be a program name with args. -set dummy make; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1099: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_MAKE'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$MAKE"; then - ac_cv_prog_MAKE="$MAKE" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_MAKE="make" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_MAKE" && ac_cv_prog_MAKE="make" -fi -fi -MAKE="$ac_cv_prog_MAKE" -if test -n "$MAKE"; then - echo "$ac_t""$MAKE" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -else - MAKE="make" -fi -fi - # Set up `machine' link in build directory for easier header file location. @@ -1159,7 +1125,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1` in + case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -1238,7 +1204,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1249,7 +1215,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile version.c doc/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub +s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -1279,6 +1247,7 @@ s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g +s%@VERSION@%$VERSION%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g @@ -1287,6 +1256,7 @@ s%@host_os@%$host_os%g s%@systype@%$systype%g s%@cross_compiling@%$cross_compiling%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@AWK@%$AWK%g s%@build@%$build%g @@ -1299,7 +1269,6 @@ s%@cross_linkable@%$cross_linkable%g s%@LD@%$LD%g s%@NM@%$NM%g s%@MIG@%$MIG%g -s%@MAKE@%$MAKE%g s%@subdirs@%$subdirs%g CEOF @@ -1342,7 +1311,7 @@ EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff -brNpu gnumach-1.2/configure.in gnumach-1.3/configure.in --- gnumach-1.2/configure.in Mon Jun 21 11:58:12 1999 +++ gnumach-1.3/configure.in Mon May 27 11:17:01 2002 @@ -12,10 +12,12 @@ dnl "AS IS" CONDITION. THE FREE SOFTWAR dnl LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE dnl USE OF THIS SOFTWARE. - AC_INIT(kern/ipc_kobject.c) AC_PREREQ(2.12) +VERSION=1.3 +AC_SUBST(VERSION) + # # Deduce output var `systype' from configuration parms. # @@ -45,8 +47,8 @@ AC_ARG_ENABLE(kdb, [test "x$enableval" = xno || AC_DEFINE(MACH_KDB)]) AC_ARG_ENABLE(kmsg, -[ --enable-kmsg enable use of kmsg device], -[test "x$enableval" = xno || AC_DEFINE(MACH_KMSG)]) +[ --enable-kmsg enable use of kmsg device [default=yes]], +[test "x$enableval" = xno || AC_DEFINE(MACH_KMSG)], [AC_DEFINE(MACH_KMSG)]) # # Programs @@ -64,7 +66,6 @@ AC_CHECK_TOOL(LD, ld) AC_CHECK_TOOL(NM, nm) AC_CHECK_TOOL(MIG, mig, mig) -AC_CHECK_TOOL(MAKE, make, make) # Set up `machine' link in build directory for easier header file location. AC_LINK_FILES(${systype}/${systype},machine) @@ -74,4 +75,4 @@ AC_LINK_FILES(${systype}/${systype},mach AC_CONFIG_SUBDIRS(linux ${systype}) -AC_OUTPUT(Makefile) +AC_OUTPUT(Makefile version.c doc/Makefile) diff -brNpu gnumach-1.2/ddb/db_access.c gnumach-1.3/ddb/db_access.c --- gnumach-1.2/ddb/db_access.c Mon Jun 21 11:58:20 1999 +++ gnumach-1.3/ddb/db_access.c Mon May 27 11:17:01 2002 @@ -134,4 +134,4 @@ db_put_value(addr, size, value) db_put_task_value(addr, size, value, TASK_NULL); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_access.h gnumach-1.3/ddb/db_access.h --- gnumach-1.2/ddb/db_access.h Mon Jun 21 11:58:22 1999 +++ gnumach-1.3/ddb/db_access.h Mon May 27 11:17:01 2002 @@ -42,7 +42,7 @@ #ifndef DB_ACCESS_LEVEL #define DB_ACCESS_LEVEL DB_ACCESS_KERNEL -#endif DB_ACCESS_LEVEL +#endif /* DB_ACCESS_LEVEL */ #ifndef DB_VALID_KERN_ADDR #define DB_VALID_KERN_ADDR(addr) ((addr) >= VM_MIN_KERNEL_ADDRESS \ @@ -50,7 +50,7 @@ #define DB_VALID_ADDRESS(addr,user) ((user != 0) ^ DB_VALID_KERN_ADDR(addr)) #define DB_PHYS_EQ(task1,addr1,task2,addr2) 0 #define DB_CHECK_ACCESS(addr,size,task) db_is_current_task(task) -#endif DB_VALID_KERN_ADDR +#endif /* DB_VALID_KERN_ADDR */ extern int db_access_level; diff -brNpu gnumach-1.2/ddb/db_aout.c gnumach-1.3/ddb/db_aout.c --- gnumach-1.2/ddb/db_aout.c Mon Jun 21 11:58:20 1999 +++ gnumach-1.3/ddb/db_aout.c Mon May 27 11:17:01 2002 @@ -504,4 +504,4 @@ aout_db_line_at_pc(stab, sym, file, line #endif /* DB_NO_AOUT */ -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_break.c gnumach-1.3/ddb/db_break.c --- gnumach-1.2/ddb/db_break.c Mon Jun 21 11:58:20 1999 +++ gnumach-1.3/ddb/db_break.c Mon May 27 11:17:01 2002 @@ -730,4 +730,4 @@ db_listbreak_cmd() db_list_breakpoints(); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_break.h gnumach-1.3/ddb/db_break.h --- gnumach-1.2/ddb/db_break.h Mon Jun 21 11:58:22 1999 +++ gnumach-1.3/ddb/db_break.h Mon May 27 11:17:01 2002 @@ -83,4 +83,4 @@ extern db_breakpoint_t db_set_temp_break extern void db_delete_temp_breakpoint ( task_t task, db_breakpoint_t bkpt); -#endif _DDB_DB_BREAK_H_ +#endif /* _DDB_DB_BREAK_H_ */ diff -brNpu gnumach-1.2/ddb/db_command.c gnumach-1.3/ddb/db_command.c --- gnumach-1.2/ddb/db_command.c Mon Jun 21 11:58:20 1999 +++ gnumach-1.3/ddb/db_command.c Mon May 27 11:17:01 2002 @@ -314,10 +314,10 @@ void db_show_help(); extern void netipc_packet_print(), netipc_pcs_print(), db_show_all_uids(); extern void db_show_all_proxies(), db_show_all_principals(); extern void db_show_all_uids_verbose(); -#endif NORMA_IPC +#endif /* NORMA_IPC */ #if NORMA_VM extern void xmm_obj_print(), xmm_reply_print(); -#endif NORMA_VM +#endif /* NORMA_VM */ struct db_command db_show_all_cmds[] = { { "threads", db_show_all_threads, 0, 0 }, @@ -327,7 +327,7 @@ struct db_command db_show_all_cmds[] = { { "proxies", db_show_all_proxies, 0, 0 }, { "principals", db_show_all_principals, 0, 0 }, { "vuids", db_show_all_uids_verbose, 0, 0 }, -#endif NORMA_IPC +#endif /* NORMA_IPC */ { (char *)0 } }; @@ -351,11 +351,11 @@ struct db_command db_show_cmds[] = { #if NORMA_IPC { "packet", netipc_packet_print, 0, 0 }, { "pcs", netipc_pcs_print, 0, 0 }, -#endif NORMA_IPC +#endif /* NORMA_IPC */ #if NORMA_VM { "xmm_obj", xmm_obj_print, 0, 0 }, { "xmm_reply", xmm_reply_print, 0, 0 }, -#endif NORMA_VM +#endif /* NORMA_VM */ { (char *)0, } }; @@ -449,7 +449,7 @@ db_command_loop() extern int db_macro_level; #if NORMA_IPC extern int _node_self; /* node_self() may not be callable yet */ -#endif NORMA_IPC +#endif /* NORMA_IPC */ /* * Initialize 'prev' and 'next' to dot. @@ -594,4 +594,4 @@ db_option(modif, option) return(FALSE); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_command.h gnumach-1.3/ddb/db_command.h --- gnumach-1.2/ddb/db_command.h Mon Jun 21 11:58:22 1999 +++ gnumach-1.3/ddb/db_command.h Mon May 27 11:17:01 2002 @@ -67,4 +67,4 @@ struct db_command { struct db_command *more; /* another level of command */ }; -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_cond.c gnumach-1.3/ddb/db_cond.c --- gnumach-1.2/ddb/db_cond.c Mon Jun 21 11:58:20 1999 +++ gnumach-1.3/ddb/db_cond.c Mon May 27 11:17:01 2002 @@ -178,4 +178,4 @@ db_cond_cmd() bkpt->tb_cond = (cp - db_cond) + 1; } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_examine.c gnumach-1.3/ddb/db_examine.c --- gnumach-1.2/ddb/db_examine.c Mon Jun 21 11:58:20 1999 +++ gnumach-1.3/ddb/db_examine.c Mon May 27 11:17:01 2002 @@ -503,4 +503,4 @@ db_xcdump(addr, size, count, task) return(addr); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_expr.c gnumach-1.3/ddb/db_expr.c --- gnumach-1.2/ddb/db_expr.c Mon Jun 21 11:58:20 1999 +++ gnumach-1.3/ddb/db_expr.c Mon May 27 11:17:01 2002 @@ -388,4 +388,4 @@ db_expression(valuep) return (db_logical_or_expr(valuep)); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_ext_symtab.c gnumach-1.3/ddb/db_ext_symtab.c --- gnumach-1.2/ddb/db_ext_symtab.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_ext_symtab.c Mon May 27 11:17:01 2002 @@ -120,4 +120,4 @@ host_load_symbol_table(host, task, name, #endif /* MACH_DEBUG */ -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_input.c gnumach-1.3/ddb/db_input.c --- gnumach-1.2/ddb/db_input.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_input.c Mon May 27 11:17:01 2002 @@ -38,7 +38,7 @@ #ifndef DB_HISTORY_SIZE #define DB_HISTORY_SIZE 4000 -#endif DB_HISTORY_SIZE +#endif /* DB_HISTORY_SIZE */ /* * Character input and editing. @@ -375,4 +375,4 @@ db_check_interrupt() } } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_lex.c gnumach-1.3/ddb/db_lex.c --- gnumach-1.2/ddb/db_lex.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_lex.c Mon May 27 11:17:01 2002 @@ -452,4 +452,4 @@ db_lex() return (tEOF); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_macro.c gnumach-1.3/ddb/db_macro.c --- gnumach-1.2/ddb/db_macro.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_macro.c Mon May 27 11:17:01 2002 @@ -180,4 +180,4 @@ db_arg_variable(vp, valuep, flag, ap) return(0); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_mp.c gnumach-1.3/ddb/db_mp.c --- gnumach-1.2/ddb/db_mp.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_mp.c Mon May 27 11:17:01 2002 @@ -336,4 +336,4 @@ db_console() #endif /* NCPUS > 1 */ -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_output.c gnumach-1.3/ddb/db_output.c --- gnumach-1.2/ddb/db_output.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_output.c Mon May 27 11:17:01 2002 @@ -35,8 +35,8 @@ * Printf and character output for debugger. */ +#include #include -#include #include #include #include @@ -57,7 +57,7 @@ #ifndef DB_MAX_LINE #define DB_MAX_LINE 24 /* maximum line */ #define DB_MAX_WIDTH 80 /* maximum width */ -#endif DB_MAX_LINE +#endif /* DB_MAX_LINE */ #define DB_MIN_MAX_WIDTH 20 /* minimum max width */ #define DB_MIN_MAX_LINE 3 /* minimum max line */ @@ -209,16 +209,14 @@ extern void _doprnt(); /*VARARGS1*/ void -db_printf( fmt, va_alist) - char * fmt; - va_dcl +db_printf(const char *fmt, ...) { va_list listp; #ifdef db_printf_enter db_printf_enter(); /* optional multiP serialization */ #endif - va_start(listp); + va_start(listp, fmt); _doprnt(fmt, &listp, db_id_putc, db_radix, 0); va_end(listp); } @@ -227,14 +225,12 @@ db_printf( fmt, va_alist) /*VARARGS1*/ void -kdbprintf(fmt, va_alist) - char * fmt; - va_dcl +kdbprintf(const char *fmt, ...) { va_list listp; - va_start(listp); + va_start(listp, fmt); _doprnt(fmt, &listp, db_id_putc, db_radix, 0); va_end(listp); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_output.h gnumach-1.3/ddb/db_output.h --- gnumach-1.2/ddb/db_output.h Mon Jun 21 11:58:22 1999 +++ gnumach-1.3/ddb/db_output.h Mon May 27 11:17:01 2002 @@ -35,10 +35,6 @@ extern void db_force_whitespace(); extern int db_print_position(); extern void db_end_line(); -#if 1 -extern void db_printf(); -#else -extern void db_printf( char *fmt, ...); -#endif +extern void db_printf( const char *fmt, ...); diff -brNpu gnumach-1.2/ddb/db_print.c gnumach-1.3/ddb/db_print.c --- gnumach-1.2/ddb/db_print.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_print.c Mon May 27 11:17:01 2002 @@ -116,7 +116,7 @@ db_show_regs(addr, have_addr, count, mod #ifndef DB_TASK_NAME #define DB_TASK_NAME(task) /* no task name */ #define DB_TASK_NAME_TITLE "" /* no task name */ -#endif DB_TASK_NAME +#endif /* DB_TASK_NAME */ #ifndef db_thread_fp_used #define db_thread_fp_used(thread) FALSE @@ -508,4 +508,4 @@ db_show_port_id(addr, have_addr, count, db_printf("\n"); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_run.c gnumach-1.3/ddb/db_run.c --- gnumach-1.2/ddb/db_run.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_run.c Mon May 27 11:17:01 2002 @@ -438,4 +438,4 @@ db_in_single_step() return(db_run_mode != STEP_NONE && db_run_mode != STEP_CONTINUE); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_sym.c gnumach-1.3/ddb/db_sym.c --- gnumach-1.2/ddb/db_sym.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_sym.c Mon May 27 11:17:01 2002 @@ -520,4 +520,4 @@ struct db_sym_switch x_db[] = { }; -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_task_thread.c gnumach-1.3/ddb/db_task_thread.c --- gnumach-1.2/ddb/db_task_thread.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_task_thread.c Mon May 27 11:17:01 2002 @@ -300,4 +300,4 @@ db_get_task_thread(vp, valuep, flag, ap) return(0); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_task_thread.h gnumach-1.3/ddb/db_task_thread.h --- gnumach-1.2/ddb/db_task_thread.h Mon Jun 21 11:58:22 1999 +++ gnumach-1.3/ddb/db_task_thread.h Mon May 27 11:17:01 2002 @@ -48,4 +48,4 @@ extern boolean_t db_check_thread_address extern boolean_t db_get_next_thread(/* thread_t *, int */); extern void db_init_default_thread(); -#endif _DDB_DB_TASK_THREAD_H_ +#endif /* _DDB_DB_TASK_THREAD_H_ */ diff -brNpu gnumach-1.2/ddb/db_trap.c gnumach-1.3/ddb/db_trap.c --- gnumach-1.2/ddb/db_trap.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_trap.c Mon May 27 11:17:01 2002 @@ -104,4 +104,4 @@ db_trap(type, code) db_task_trap(type, code, !DB_VALID_KERN_ADDR(PC_REGS(DDB_REGS))); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_variables.c gnumach-1.3/ddb/db_variables.c --- gnumach-1.2/ddb/db_variables.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_variables.c Mon May 27 11:17:01 2002 @@ -238,4 +238,4 @@ db_set_cmd() db_read_write_variable(vp, &value, DB_VAR_SET, &aux_param); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_watch.c gnumach-1.3/ddb/db_watch.c --- gnumach-1.2/ddb/db_watch.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_watch.c Mon May 27 11:17:01 2002 @@ -315,4 +315,4 @@ db_find_watchpoint(map, addr, regs) return (FALSE); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_watch.h gnumach-1.3/ddb/db_watch.h --- gnumach-1.2/ddb/db_watch.h Mon Jun 21 11:58:22 1999 +++ gnumach-1.3/ddb/db_watch.h Mon May 27 11:17:01 2002 @@ -58,6 +58,6 @@ extern void db_set_watchpoint(/* task_t extern void db_delete_watchpoint(/* task_t task, db_addr_t addr */); extern void db_list_watchpoints(); -#endif _DDB_DB_WATCH_ +#endif /* _DDB_DB_WATCH_ */ -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ddb/db_write_cmd.c gnumach-1.3/ddb/db_write_cmd.c --- gnumach-1.2/ddb/db_write_cmd.c Mon Jun 21 11:58:21 1999 +++ gnumach-1.3/ddb/db_write_cmd.c Mon May 27 11:17:01 2002 @@ -106,4 +106,4 @@ db_write_cmd(address, have_addr, count, db_prev = addr - size; } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/debian/README.Debian gnumach-1.3/debian/README.Debian --- gnumach-1.2/debian/README.Debian Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/debian/README.Debian Mon May 27 11:17:01 2002 @@ -0,0 +1,10 @@ +GNU Mach for Debian +------------------- + +This is the GNU version of the Mach microkernel, currently used as the +basis for the GNU Hurd. + +Let us know if you have hardware troubles. +Compiling a fresh kernel with minimal hardware support is recommended. + +GNU Hurd Maintainers diff -brNpu gnumach-1.2/debian/changelog gnumach-1.3/debian/changelog --- gnumach-1.2/debian/changelog Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/debian/changelog Mon May 27 11:17:01 2002 @@ -0,0 +1,231 @@ +gnumach (1:20020421-1) unstable; urgency=low + + * Update to CVS 20020421. + * Patches applied to CVS code: cdromlock. + + -- Marcus Brinkmann Sun, 21 Apr 2002 18:53:13 +0200 + +gnumach (1:20011013-1) unstable; urgency=low + + * Update to CVS 20011013. + * Patches applied to CVS code: cdromlock. + + -- Marcus Brinkmann Sat, 13 Oct 2001 00:21:15 +0200 + +gnumach (1:20011005-2) unstable; urgency=low + + * Update to CVS 20011005. + * Patches applied to CVS code: cdromlock. + + -- Marcus Brinkmann Fri, 5 Oct 2001 21:14:51 +0200 + +gnumach (1:20010918-1) unstable; urgency=low + + * Update to CVS 2001918. + * Patches applied to CVS code: cdromlock. + + -- Marcus Brinkmann Tue, 18 Sep 2001 23:15:17 +0200 + +gnumach (1:20010818-1) unstable; urgency=low + + * Update to CVS 20010718. + * Patches applied to CVS code: cdromlock. + The other patches are in CVS now. + + * Wading through the bug list, there are some old bugs + fixed long ago, closes: #37954, #47948, #85302, #45792 + * debian/rules: Make it build via direct invocation, submitted + by Robert Bihlmeyer, closes: #101697. + + * control: New package gnumach-dbg. This kernel is not stripped and includes the + kernel-level debugger. + * debian/rules: Build this package. + + -- Marcus Brinkmann Sat, 18 Aug 2001 02:15:06 +0200 + +gnumach (1:20010718-1) unstable; urgency=low + + * Update to CVS 20010718. + * Patches applied to CVS code: cdromlock, color, kbd_enqueu. + + -- Marcus Brinkmann Wed, 18 Jul 2001 22:10:20 +0200 + +gnumach (1:1.2-11) unstable; urgency=low + + * debian/rules (stamp-configure): Add ncr53c8xx driver. + * Update to CVS 20010528. + * Patches applied to CVS code: cdromlock, color, kbd_enqueu. + + -- Marcus Brinkmann Sun, 27 May 2001 14:14:12 +0200 + +gnumach (1:1.2-10) unstable; urgency=low + + * debian/rules (stamp-configure): Disable eatadma driver, which + prevents booting on some AMD K7 motherboards. Reported by + Robert Bihlmeyer . + * Update to CVS 20010429, which contains support for high baud rates + (B57600, B115200). + * Patches applied to CVS code: cdromlock, color, kbd_enqueu. + + -- Marcus Brinkmann Sun, 29 Apr 2001 21:41:34 +0200 + +gnumach (1:1.2-9) unstable; urgency=low + + * Update to CVS 20010111, which contains a new interface for + block devices with a large number of blocks. + + -- Marcus Brinkmann Thu, 11 Jan 2001 23:45:49 +0100 + +gnumach (1:1.2-8) unstable; urgency=low + + * Applied patch by Alexey Dejneka to fix CD ROM + locking problem. + * debian/control: Add mig and sharutils to list of build dependencies + (sharutils for uudecode for fpu emu), closes: #74794. + * linux/src/drivers/net/tulip.c: Update from Linux 2.2.17, thanks + Jason Henry Parker + + -- Marcus Brinkmann Sun, 26 Nov 2000 03:46:08 +0100 + +gnumach (1:1.2-7) unstable; urgency=low + + * Update to CVS 20000929, which contains a fix for comX. + * debian/rules: Drop --enable-lpr, which doesn't work. + Drop --enable-com, which is already enforced. + + -- Marcus Brinkmann Fri, 29 Sep 2000 20:24:54 +0200 + +gnumach (1:1.2-5) unstable; urgency=low + + * Update to CVS 20000817, which contains a fix for + linux/dev/glue/block.c. + + -- Marcus Brinkmann Thu, 17 Aug 2000 03:22:30 +0200 + +gnumach (1:1.2-4) unstable; urgency=low + + * Add color support to gnumach. Set TERM to mach-color to get the full + effect. Thanks to Juli-Manel Merino Vidal for working + out the mapping between ANSI color codes and the bits to poke into the + attribute. + + -- Marcus Brinkmann Tue, 8 Aug 2000 21:00:50 +0200 + +gnumach (1:1.2-3) unstable; urgency=low + + * Snapshot from CVS 20000703. + * i386/i386at/kd.c: Receive 0xE0 scan codes (patch by Kalle Olavi Niemitalo). + * Patch to get it compile with gcc-2.95.1 or newer + ( by "Weil, Stefan 3732 EPE-24" + and Igor Khavkine ) + + -- Marcus Brinkmann Mon, 3 Jul 2000 21:05:42 +0200 + +gnumach (1:1.2-2) unstable; urgency=low + + * Snapshot from CVS 19990907. + * Reenable all network interfaces, because the problem is fixed. + * Gzip gnumach binary. + + -- Marcus Brinkmann Wed, 8 Sep 1999 00:15:39 +0200 + +gnumach (1:1.2-1) unstable; urgency=low + + * Snapshot from CVS 19990725. + * Start from official 1.2 release. + * Remove some network card drivers that seems to have no autodetection in + order to get a maximum set of cards enabled that allows GNU Mach to detect + at least one. + + -- Marcus Brinkmann Mon, 26 Jul 1999 01:31:31 +0200 + +gnumach (1:1.1.92-5) unstable; urgency=low + + * Snapshot from CVS 19990616. + * Marks dummy network driver still there. + + -- Marcus Brinkmann Thu, 17 Jun 1999 16:53:50 +0200 + +gnumach (1:1.1.92-4) unstable; urgency=low + + * Snapshot from CVS 19990602. + * Marks dummy network driver still there. + * Replaced linux/dev/drivers/block/genhd.c to avoid a bug. + + -- Marcus Brinkmann Sat, 5 Jun 1999 00:59:43 +0200 + +gnumach (1:1.1.92-2) unstable; urgency=low + + * Snapshot from CVS 19990524. + * Applied Marks dummy network driver. + * Enabled thousands more devices. + + -- Marcus Brinkmann Mon, 24 May 1999 18:00:19 +0200 + +gnumach (1:1.1.92-1) unstable; urgency=low + + * Snapshot from CVS 19990507. + + -- Marcus Brinkmann Fri, 7 May 1999 20:46:06 +0200 + +gnumach (1:1.1.90-2) unstable; urgency=low + + * Fix package administration information to reflect that maintainership + has been transferred to bug-hurd@gnu.org. + * Merge a few configuration fixes from Marcus Brinkmann. + * Install include files into /usr/include, for the benefit of people + without the /usr symlink. + + -- Gordon Matzigkeit Wed, 17 Feb 1999 16:50:54 -0600 + +gnumach (1:1.1.90-1) unstable; urgency=low + + * New version from OKUJI Yoshinori. + * Use DEB_{BUILD,HOST}_GNU_TYPE, in accordance with Marcus's new + cross-build proposal. + + -- Gordon Matzigkeit Tue, 11 Feb 1999 22:14:01 -0600 + +gnumach (19990116-1) unstable; urgency=low + + * New version from OKUJI Yoshinori. + * Added kmsg. + + -- Marcus Brinkmann Mon, 18 Jan 1999 17:11:58 +0100 + +gnumach (19981118-2) unstable; urgency=low + + * Split into gnumach and gnumach-dev. + * Added keyboard patch by Tudor Hulubei to fix some + keybord issues. + * Bumped Standards: version to 2.5.0.0. + + -- Marcus Brinkmann Sun, 3 Jan 1999 13:53:28 +0100 + +gnumach (19981118-1) unstable; urgency=low + + * New version from OKUJI Yoshinori . + This is not a new upstream version, but includes the Linux 2.0.36 driver. + * Strip the kernel. + + -- Marcus Brinkmann Sat, 19 Dec 1998 05:27:30 +0100 + +gnumach (19981025-1) unstable; urgency=low + + * New upstream snapshot. + + -- Marcus Brinkmann Sat, 7 Nov 1998 18:56:53 +0100 + +gnumach (1.1.3-2) unstable; urgency=low + + * Added CPU_TYPE_{I486,PENTIUM,PENTIUMPRO,POWERPC} to + ./include/mach/machine.h. This is needed for latest hurd release. + * Changed description (thank you, Santiagio). + + -- Marcus Brinkmann Sat, 1 Aug 1998 21:33:31 +0200 + +gnumach (1.1.3-1) unstable; urgency=low + + * Initial Version. + + -- Marcus Brinkmann Sat, 1 Aug 1998 21:33:31 +0200 diff -brNpu gnumach-1.2/debian/control gnumach-1.3/debian/control --- gnumach-1.2/debian/control Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/debian/control Mon May 27 11:17:01 2002 @@ -0,0 +1,32 @@ +Source: gnumach +Section: base +Priority: optional +Maintainer: GNU Hurd Maintainers +Standards-Version: 3.5.6.0 +Build-Depends: mig, sharutils + +Package: gnumach +Section: base +Priority: optional +Architecture: hurd-i386 +Description: The GNU version of the Mach microkernel + This is the Utah Mach microkernel used by the Hurd. + +Package: gnumach-dbg +Section: devel +Priority: extra +Provides: gnumach +Architecture: hurd-i386 +Description: The GNU version of the Mach microkernel for debugging + This is the Utah Mach microkernel used by the Hurd. + . + The version in this package is identical to the version found in the + gnumach package, except that it is not stripped and has the + kernel-level debugger compiled in. + +Package: gnumach-dev +Section: devel +Priority: optional +Architecture: hurd-i386 +Description: The GNU version of the Mach microkernel + These are the header files for the Utah Mach microkernel used by the Hurd. diff -brNpu gnumach-1.2/debian/copyright gnumach-1.3/debian/copyright --- gnumach-1.2/debian/copyright Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/debian/copyright Mon May 27 11:17:01 2002 @@ -0,0 +1,54 @@ +This package was originally debianized by Marcus Brinkmann + on Sat, 1 Aug 1998 21:26:37 +0200 + +It is currently maintained by its upstream authors, who can be reached +via . + +Sources are available from ftp://alpha.gnu.org/gnu/hurd/contrib/okuji/mach/ + +Copyright statement: + +Please look at the source files for individual copyrights. They are covered +by either of the following copyrights: + +Most of these files are licensed under the following terms: +/* + * Mach Operating System + * Copyright (c) 1993-1989 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ + +Some of these files are licensed under the following terms: + + 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; version 2 dated June, 1991. + + 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, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff -brNpu gnumach-1.2/debian/postinst gnumach-1.3/debian/postinst --- gnumach-1.2/debian/postinst Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/debian/postinst Mon May 27 11:17:01 2002 @@ -0,0 +1,3 @@ +#!/bin/sh -e + +install-info --quiet --section "Kernel" "Kernel" /usr/share/info/mach.info diff -brNpu gnumach-1.2/debian/prerm gnumach-1.3/debian/prerm --- gnumach-1.2/debian/prerm Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/debian/prerm Mon May 27 11:17:01 2002 @@ -0,0 +1,3 @@ +#!/bin/sh -e + +install-info --quiet --remove /usr/share/info/mach.info diff -brNpu gnumach-1.2/debian/rules gnumach-1.3/debian/rules --- gnumach-1.2/debian/rules Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/debian/rules Mon May 27 11:17:01 2002 @@ -0,0 +1,259 @@ +#!/usr/bin/make -f +############################ -*- Mode: Makefile -*- ########################### +## rules --- +## Author : Marcus Brinkmann +## Created On : Sat, 1 Aug 1998 21:33:31 +0200 +## Created On Node : localhost +## Last Modified By : Marcus Brinkmann +## Last Modified On : Sun, 8 Nov 1998 13:55:22 +0100 +## Last Machine Used: localhost +## Update Count : 1 +## Status : Unknown, Use with caution! +## HISTORY : +## Description : +## +############################################################################### + +# The name of the package (for example, `emacs'). +package := gnumach +package-dev := gnumach-dev +DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) + +# Configuration variables (these should be pretty generic) +CC = cc +CFLAGS = -O2 -g -pipe -Wall +LDFLAGS = -s +PREFIX = /usr +BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)/man +INFODIR = $(PREFIX)/share/info +DOCDIR = $(PREFIX)/share/doc/$(package) +DOCDIR-DEV = $(PREFIX)/share/doc/$(package-dev) + +# Package specific stuff. The idea is to try to make the rules +# generic (gradually). + +FILES_TO_CLEAN = debian/files machine +DIRS_TO_CLEAN = debian/tmp build build-dbg +STAMPS_TO_CLEAN = stamp-build stamp-configure + +install_file = install -o root -g root -m 644 +install_program = install -s -o root -g root -m 755 +install_script = install -o root -g root -m 755 +make_directory = install -d -o root -g root -m 755 + +define checkdir + test -f debian/rules +endef + +define checkroot + @test 0 = "`id -u`" || (echo need root priviledges; exit 1) +endef + +# disabled: +# ncr5380, ncr53c400, ncr53c406a +# hpj2577, hpj2573, hp27248b, hp2585, atp +drivers := --enable-floppy \ + --enable-ide \ + \ + --enable-advansys \ + --enable-buslogic \ + --enable-u1434f \ + --enable-ultrastor \ + --enable-aha152x --enable-aha2825 \ + --enable-aha1542 \ + --enable-aha1740 \ + --enable-aic7xxx \ + --enable-futuredomain \ + --enable-in2000 \ + --enable-pas16 \ + --enable-seagate \ + --enable-t128 --enable-t128f --enable-t228 \ + --enable-ncr53c7xx \ + --enable-eatapio \ + --enable-wd7000 \ + --enable-eata \ + --enable-am53c974 --enable-am79c974 \ + --enable-dtc3280 --enable-dtc3180 \ + --enable-ncr53c8xx --enable-dc390w --enable-dc390u --enable-dc390f \ + --enable-dc390t --enable-dc390 \ + --enable-ppa \ + --enable-qlogicfas \ + --enable-qlogicisp \ + --enable-gdth \ + \ + --enable-de4x5 --enable-de425 --enable-de434 --enable-de435 --enable-de450 --enable-de500 \ + --enable-eexpresspro100 \ + --enable-epic100 \ + --enable-hp100 \ + --enable-ne2kpci \ + --enable-pcnet32 \ + --enable-rtl8139 --enable-rtl8129 \ + --enable-viarhine \ + --enable-elcp --enable-tulip \ + --enable-yellowfin \ + \ + --enable-ac3200 \ + --enable-ul32 \ + \ + --enable-at1700 \ + --enable-ul \ + --enable-epic \ + --enable-wd80x3 \ + --enable-3c503 --enable-el2 \ + --enable-hplan --enable-hplanplus \ + --enable-seeq8005 \ + --enable-e2100 \ + --enable-ne2000 --enable-ne1000 \ + --enable-at1500 --enable-ne2100 \ + --enable-fmv18x \ + --enable-eth16i --enable-eth32 \ + --enable-el3 --enable-3c509 --enable-3c579 \ + --enable-vortex --enable-3c59x --enable-3c90x \ + --enable-3c515 \ + --enable-znet --enable-znote \ + --enable-eexpress --enable-eexpresspro \ + --enable-depca --enable-de100 --enable-de101 --enable-de200 \ + --enable-de201 --enable-de202 --enable-de210 --enable-de422 \ + --enable-ewrk3 --enable-de203 --enable-de204 --enable-de205 \ + --enable-apricot \ + --enable-el1 --enable-3c501 \ + --enable-wavelan \ + --enable-el16 --enable-3c507 \ + --enable-elplus --enable-3c505 \ + --enable-de600 --enable-de620 \ + --enable-skg16 \ + --enable-ni52 --enable-ni65 \ + --enable-lance \ + --enable-tlan + +stamp-configure: + $(checkdir) + -mkdir build + cd build && ../configure $(drivers) \ + --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) + touch stamp-configure + +stamp-configure-dbg: + $(checkdir) + -mkdir build-dbg + cd build-dbg && ../configure --enable-kdb $(drivers) \ + --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) + touch stamp-configure-dbg + +all build: stamp-build stamp-build-dbg +stamp-build: stamp-configure + $(checkdir) + cd build && $(MAKE) + cd build/doc && $(MAKE) + touch stamp-build + +stamp-build-dbg: stamp-configure-dbg + $(checkdir) + cd build-dbg && $(MAKE) + touch stamp-build-dbg + +clean: + $(checkdir) + -rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN) + -rm -rf $(DIRS_TO_CLEAN) + -rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ + -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ + -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` + +binary: binary-indep binary-arch + +# Build architecture-independent files here. + +binary-indep: build + $(checkdir) + $(checkroot) + -rm -rf debian/tmp + + $(make_directory) debian/tmp/DEBIAN debian/tmp$(DOCDIR-DEV) + + pfx=`cd debian/tmp && pwd` && cd build && $(MAKE) install-headers prefix=$$pfx + mv debian/tmp/include debian/tmp/usr/. + -find debian/tmp -type d | xargs chmod g-w + + $(install_file) NEWS debian/tmp$(DOCDIR-DEV) + $(install_file) ChangeLog debian/tmp$(DOCDIR-DEV)/ChangeLog + $(install_file) ChangeLog.0 debian/tmp$(DOCDIR-DEV) + $(install_file) ChangeLog.00 debian/tmp$(DOCDIR-DEV) + $(install_file) debian/changelog debian/tmp$(DOCDIR-DEV)/changelog.Debian + gzip -9frq debian/tmp$(DOCDIR-DEV)/. + $(install_file) debian/copyright debian/tmp$(DOCDIR-DEV) + ln -s ChangeLog.gz debian/tmp$(DOCDIR-DEV)/changelog.gz + + dpkg-gencontrol -isp -p$(package-dev) -Pdebian/tmp + chown -R root.root debian/tmp + dpkg --build debian/tmp .. + +binary-arch: binary-gnumach binary-gnumach-dbg + +binary-gnumach: stamp-build + $(checkdir) + $(checkroot) + -rm -rf debian/tmp + + $(make_directory) debian/tmp/DEBIAN debian/tmp$(DOCDIR) debian/tmp$(INFODIR) + + pfx=`cd debian/tmp && pwd` && cd build && $(MAKE) install-kernel prefix=$$pfx + strip --strip-all debian/tmp/boot/gnumach + gzip -9fq debian/tmp/boot/gnumach + -find debian/tmp -type d | xargs chmod g-w + $(install_file) build/doc/mach.info* debian/tmp$(INFODIR) + -gzip -9frq debian/tmp$(INFODIR) + + + $(install_file) README debian/tmp$(DOCDIR) + $(install_file) NEWS debian/tmp$(DOCDIR) + $(install_file) ChangeLog debian/tmp$(DOCDIR)/ChangeLog + $(install_file) ChangeLog.0 debian/tmp$(DOCDIR) + $(install_file) ChangeLog.00 debian/tmp$(DOCDIR) + $(install_file) i386/README-Drivers debian/tmp$(DOCDIR) + $(install_file) debian/README.Debian debian/tmp$(DOCDIR) + $(install_file) debian/changelog debian/tmp$(DOCDIR)/changelog.Debian + gzip -9frq debian/tmp$(DOCDIR)/. + $(install_file) debian/copyright debian/tmp$(DOCDIR) + ln -s ChangeLog.gz debian/tmp$(DOCDIR)/changelog.gz + + $(install_script) debian/postinst debian/tmp/DEBIAN + $(install_script) debian/prerm debian/tmp/DEBIAN + dpkg-gencontrol -isp -p$(package) -Pdebian/tmp + chown -R root.root debian/tmp + dpkg --build debian/tmp .. + +binary-gnumach-dbg: stamp-build-dbg + $(checkdir) + $(checkroot) + -rm -rf debian/tmp + + $(make_directory) debian/tmp/DEBIAN debian/tmp$(DOCDIR)-dbg + + pfx=`cd debian/tmp && pwd` && cd build-dbg && $(MAKE) install-kernel prefix=$$pfx + mv debian/tmp/boot/gnumach debian/tmp/boot/gnumach-dbg + gzip -9fq debian/tmp/boot/gnumach-dbg + -find debian/tmp -type d | xargs chmod g-w + + $(install_file) README debian/tmp$(DOCDIR)-dbg + $(install_file) NEWS debian/tmp$(DOCDIR)-dbg + $(install_file) ChangeLog debian/tmp$(DOCDIR)-dbg/ChangeLog + $(install_file) ChangeLog.0 debian/tmp$(DOCDIR)-dbg + $(install_file) ChangeLog.00 debian/tmp$(DOCDIR)-dbg + $(install_file) i386/README-Drivers debian/tmp$(DOCDIR)-dbg + $(install_file) debian/README.Debian debian/tmp$(DOCDIR)-dbg + $(install_file) debian/changelog debian/tmp$(DOCDIR)-dbg/changelog.Debian + gzip -9frq debian/tmp$(DOCDIR)-dbg/. + $(install_file) debian/copyright debian/tmp$(DOCDIR)-dbg + ln -s ChangeLog.gz debian/tmp$(DOCDIR)-dbg/changelog.gz + + dpkg-gencontrol -isp -p$(package)-dbg -Pdebian/tmp + chown -R root.root debian/tmp + dpkg --build debian/tmp .. + +binary-indep: build +# We have nothing to do here. + +.PHONY: build clean binary-indep binary-arch binary-gnumach binary-gnumach-dbg binary configure diff -brNpu gnumach-1.2/device/chario.c gnumach-1.3/device/chario.c --- gnumach-1.2/device/chario.c Mon Jun 21 11:58:23 1999 +++ gnumach-1.3/device/chario.c Mon May 27 11:17:01 2002 @@ -54,10 +54,12 @@ /* If you change these, check that tty_outq_size and tty_inq_size * is greater than largest tthiwat entry. */ -short tthiwat[16] = - { 100,100,100,100,100,100,100,200,200,400,400,400,650,650,1300,2000 }; -short ttlowat[16] = - { 30, 30, 30, 30, 30, 30, 30, 50, 50,120,120,120,125,125, 125, 125 }; +short tthiwat[NSPEEDS] = + { 100,100,100,100,100,100,100,200,200,400,400,400,650,650,1300,2000, + 2000,2000 }; +short ttlowat[NSPEEDS] = + { 30, 30, 30, 30, 30, 30, 30, 50, 50,120,120,120,125,125, 125, 125, + 125,125 }; /* * forward declarations @@ -122,6 +124,8 @@ void chario_init(void) pdma_timeouts[B9600] = _PR(960); pdma_timeouts[EXTA] = _PR(1440); /* >14400 baud */ pdma_timeouts[EXTB] = _PR(1920); /* >19200 baud */ + pdma_timeouts[B57600] = _PR(5760); + pdma_timeouts[B115200] = _PR(11520); for (i = B0; i < B300; i++) pdma_water_mark[i] = 0; @@ -143,6 +147,8 @@ void chario_init(void) pdma_water_mark[B9600] = i; pdma_water_mark[EXTA] = i; /* >14400 baud */ pdma_water_mark[EXTB] = i; /* >19200 baud */ + pdma_water_mark[B57600] = i; + pdma_water_mark[B115200] = i; return; } diff -brNpu gnumach-1.2/device/dev_name.c gnumach-1.3/device/dev_name.c --- gnumach-1.2/device/dev_name.c Mon Jun 21 11:58:23 1999 +++ gnumach-1.3/device/dev_name.c Mon May 27 11:17:01 2002 @@ -104,7 +104,7 @@ boolean_t dev_name_lookup(name, ops, uni #if 0 printf("lookup on name %s\n",name); -#endif 0 +#endif /* 0 */ /* * Find device type name (characters before digit) @@ -184,7 +184,7 @@ boolean_t dev_name_lookup(name, ops, uni */ #if 0 *unit = *unit * j + (c - 'a' +1); /* +1 to start 'a' at 1 */ -#endif 0 +#endif /* 0 */ *unit += (c - 'a' +1); } } diff -brNpu gnumach-1.2/device/dev_pager.c gnumach-1.3/device/dev_pager.c --- gnumach-1.2/device/dev_pager.c Mon Jun 21 11:58:23 1999 +++ gnumach-1.3/device/dev_pager.c Mon May 27 11:17:01 2002 @@ -333,7 +333,7 @@ kern_return_t device_pager_data_request( #ifdef lint protection_required++; -#endif lint +#endif /* lint */ if (device_pager_debug) printf("(device_pager)data_request: pager=%d, offset=0x%x, length=0x%x\n", @@ -352,9 +352,9 @@ kern_return_t device_pager_data_request( #if NORMA_VM object = vm_object_lookup(pager); -#else NORMA_VM +#else /* NORMA_VM */ object = vm_object_lookup(pager_request); -#endif NORMA_VM +#endif /* NORMA_VM */ if (object == VM_OBJECT_NULL) { (void) r_memory_object_data_error(pager_request, offset, length, @@ -700,7 +700,7 @@ kern_return_t device_pager_data_unlock( { #ifdef lint memory_object++; memory_control_port++; offset++; length++; desired_access++; -#endif lint +#endif /* lint */ panic("(device_pager)data_unlock: called"); return (KERN_FAILURE); @@ -714,7 +714,7 @@ kern_return_t device_pager_lock_complete { #ifdef lint memory_object++; pager_request_port++; offset++; length++; -#endif lint +#endif /* lint */ panic("(device_pager)lock_completed: called"); return (KERN_FAILURE); diff -brNpu gnumach-1.2/device/device_port.h gnumach-1.3/device/device_port.h --- gnumach-1.2/device/device_port.h Mon Jun 21 11:58:24 1999 +++ gnumach-1.3/device/device_port.h Mon May 27 11:17:01 2002 @@ -38,4 +38,4 @@ */ extern ipc_port_t master_device_port; -#endif _DEVICE_DEVICE_PORT_H_ +#endif /* _DEVICE_DEVICE_PORT_H_ */ diff -brNpu gnumach-1.2/device/device_types_kernel.h gnumach-1.3/device/device_types_kernel.h --- gnumach-1.2/device/device_types_kernel.h Mon Jun 21 11:58:24 1999 +++ gnumach-1.3/device/device_types_kernel.h Mon May 27 11:17:01 2002 @@ -41,4 +41,4 @@ extern device_t dev_port_lookup(/* struct ipc_port * */); extern struct ipc_port *convert_device_to_port(/* device_t */); -#endif _DEVICE_DEVICE_TYPES_KERNEL_H_ +#endif /* _DEVICE_DEVICE_TYPES_KERNEL_H_ */ diff -brNpu gnumach-1.2/device/ds_routines.c gnumach-1.3/device/ds_routines.c --- gnumach-1.2/device/ds_routines.c Mon Jun 21 11:58:23 1999 +++ gnumach-1.3/device/ds_routines.c Mon May 27 11:17:01 2002 @@ -163,7 +163,7 @@ ds_device_open(open_port, reply_port, re return (MIG_NO_REPLY); } } -#endif NORMA_DEVICE +#endif /* NORMA_DEVICE */ #endif /* ! i386 */ /* @@ -896,7 +896,7 @@ ds_device_read(device, reply_port, reply #ifdef lint *data = *data; *data_count = *data_count; -#endif lint +#endif /* lint */ #ifndef i386 /* @@ -996,7 +996,7 @@ ds_device_read_inband(device, reply_port #ifdef lint *data = *data; *data_count = *data_count; -#endif lint +#endif /* lint */ #ifndef i386 /* @@ -1332,7 +1332,7 @@ ds_device_map(device, protection, offset #ifdef lint unmap = unmap; -#endif lint +#endif /* lint */ if (protection & ~VM_PROT_ALL) return (KERN_INVALID_ARGUMENT); diff -brNpu gnumach-1.2/device/ds_routines.h gnumach-1.3/device/ds_routines.h --- gnumach-1.2/device/ds_routines.h Mon Jun 21 11:58:24 1999 +++ gnumach-1.3/device/ds_routines.h Mon May 27 11:17:01 2002 @@ -49,4 +49,4 @@ boolean_t ds_open_done(); boolean_t ds_read_done(); boolean_t ds_write_done(); -#endif DS_ROUTINES_H +#endif /* DS_ROUTINES_H */ diff -brNpu gnumach-1.2/device/errno.h gnumach-1.3/device/errno.h --- gnumach-1.2/device/errno.h Mon Jun 21 11:58:24 1999 +++ gnumach-1.3/device/errno.h Mon May 27 11:17:01 2002 @@ -42,4 +42,4 @@ #define ENOTTY D_INVALID_OPERATION #define ENOMEM D_NO_MEMORY -#endif _ERRNO_ +#endif /* _ERRNO_ */ diff -brNpu gnumach-1.2/device/if_ether.h gnumach-1.3/device/if_ether.h --- gnumach-1.2/device/if_ether.h Mon Jun 21 11:58:24 1999 +++ gnumach-1.3/device/if_ether.h Mon May 27 11:17:01 2002 @@ -52,6 +52,6 @@ struct ether_header { u_char etherbroadcastaddr[6]; extern char * ether_sprintf(); -#endif KERNEL +#endif /* KERNEL */ #endif /*_DEVICE_IF_ETHER_H_*/ diff -brNpu gnumach-1.2/device/if_hdr.h gnumach-1.3/device/if_hdr.h --- gnumach-1.2/device/if_hdr.h Mon Jun 21 11:58:24 1999 +++ gnumach-1.3/device/if_hdr.h Mon May 27 11:17:01 2002 @@ -147,4 +147,4 @@ struct ifnet { #define IFNET_SLOWHZ 1 /* granularity is 1 second */ -#endif _IF_HDR_ +#endif /* _IF_HDR_ */ diff -brNpu gnumach-1.2/device/io_req.h gnumach-1.3/device/io_req.h --- gnumach-1.2/device/io_req.h Mon Jun 21 11:58:24 1999 +++ gnumach-1.3/device/io_req.h Mon May 27 11:17:01 2002 @@ -138,4 +138,4 @@ void iodone(/* io_req_t */); zone_t io_inband_zone; /* for inband reads */ -#endif _IO_REQ_ +#endif /* _IO_REQ_ */ diff -brNpu gnumach-1.2/device/net_io.c gnumach-1.3/device/net_io.c --- gnumach-1.2/device/net_io.c Mon Jun 21 11:58:23 1999 +++ gnumach-1.3/device/net_io.c Mon May 27 11:17:01 2002 @@ -651,7 +651,7 @@ net_packet(ifp, kmsg, count, priority) if (netipc_net_packet(kmsg, count)) { return; } -#endif NORMA_ETHER +#endif /* NORMA_ETHER */ #if MACH_TTD /* diff -brNpu gnumach-1.2/device/net_io.h gnumach-1.3/device/net_io.h --- gnumach-1.2/device/net_io.h Mon Jun 21 11:58:24 1999 +++ gnumach-1.3/device/net_io.h Mon May 27 11:17:01 2002 @@ -77,4 +77,4 @@ extern vm_size_t net_kmsg_size; #define net_kmsg_alloc() ((ipc_kmsg_t) kalloc(net_kmsg_size)) #define net_kmsg_free(kmsg) kfree((vm_offset_t) (kmsg), net_kmsg_size) -#endif _DEVICE_NET_IO_H_ +#endif /* _DEVICE_NET_IO_H_ */ diff -brNpu gnumach-1.2/device/subrs.c gnumach-1.3/device/subrs.c --- gnumach-1.2/device/subrs.c Mon Jun 21 11:58:23 1999 +++ gnumach-1.3/device/subrs.c Mon May 27 11:17:01 2002 @@ -110,7 +110,7 @@ geteblk(size) register io_req_t ior; io_req_alloc(ior, 0); - ior->io_device = (device_t)0; + ior->io_device = (mach_device_t)0; ior->io_unit = 0; ior->io_op = 0; ior->io_mode = 0; diff -brNpu gnumach-1.2/doc/Makefile.in gnumach-1.3/doc/Makefile.in --- gnumach-1.2/doc/Makefile.in Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/doc/Makefile.in Mon May 27 11:17:01 2002 @@ -0,0 +1,65 @@ +# +# Copyright (C) 2001,02 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, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +mach-version := @VERSION@ +targets := mach.info + +# Variables from `configure'. +srcdir=@srcdir@ +prefix=@prefix@ + +infodir=$(prefix)/info + +DVIPS = dvips + +INSTALL_PROGRAM = @INSTALL_PROGRAM@ + +VPATH = $(srcdir) + +all: $(targets) + +# For each .info file we need a .d file. +-include $(patsubst %.info,%.d,$(filter %.info,$(targets))) /dev/null + +# Build dependencies from included files. +%.d: %.texi + set -e; (echo "$*.info $*.dvi: \\"; grep '^@include ' $< | \ + sed -e 's/^[^ ]*[ ]*\([^ ]*\).*$$/ \1 \\/'; \ + echo) > $@.new + mv -f $@.new $@ + +%.info: %.texi + @rm -f $@ $@-[0-9] $@-[0-9][0-9] + $(MAKEINFO) -I $(@D) -I $( version.texi.new + $(move-if-change) version.texi.new version.texi + touch $@ diff -brNpu gnumach-1.2/doc/fdl.texi gnumach-1.3/doc/fdl.texi --- gnumach-1.2/doc/fdl.texi Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/doc/fdl.texi Mon May 27 11:17:01 2002 @@ -0,0 +1,402 @@ +@node Free Documentation License +@appendix GNU Free Documentation License + +@cindex FDL, GNU Free Documentation License +@center Version 1.1, March 2000 + +@display +Copyright @copyright{} 2000 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +written document @dfn{free} in the sense of freedom: to assure everyone +the effective freedom to copy and redistribute it, with or without +modifying it, either commercially or noncommercially. Secondarily, +this License preserves for the author and publisher a way to get +credit for their work, while not being considered responsible for +modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work that contains a +notice placed by the copyright holder saying it can be distributed +under the terms of this License. The ``Document'', below, refers to any +such manual or work. Any member of the public is a licensee, and is +addressed as ``you''. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (For example, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, whose contents can be viewed and edited directly and +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup has been designed to thwart or discourage +subsequent modification by readers is not Transparent. A copy that is +not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain +@sc{ascii} without markup, Texinfo input format, La@TeX{} input format, +@acronym{SGML} or @acronym{XML} using a publicly available +@acronym{DTD}, and standard-conforming simple @acronym{HTML} designed +for human modification. Opaque formats include PostScript, +@acronym{PDF}, proprietary formats that can be read and edited only by +proprietary word processors, @acronym{SGML} or @acronym{XML} for which +the @acronym{DTD} and/or processing tools are not generally available, +and the machine-generated @acronym{HTML} produced by some word +processors for output purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + +@item +COPYING IN QUANTITY + +If you publish printed copies of the Document numbering more than 100, +and the Document's license notice requires Cover Texts, you must enclose +the copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a publicly-accessible computer-network location containing a complete +Transparent copy of the Document, free of added material, which the +general network-using public has access to download anonymously at no +charge using public-standard network protocols. If you use the latter +option, you must take reasonably prudent steps, when you begin +distribution of Opaque copies in quantity, to ensure that this +Transparent copy will remain thus accessible at the stated location +until at least one year after the last time you distribute an Opaque +copy (directly or through your agents or retailers) of that edition to +the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +@enumerate A +@item +Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +@item +List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has less than five). + +@item +State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +@item +Preserve all the copyright notices of the Document. + +@item +Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +@item +Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +@item +Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document's license notice. + +@item +Include an unaltered copy of this License. + +@item +Preserve the section entitled ``History'', and its title, and add to +it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section entitled ``History'' in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +@item +Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the ``History'' section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +@item +In any section entitled ``Acknowledgments'' or ``Dedications'', +preserve the section's title, and preserve in the section all the +substance and tone of each of the contributor acknowledgments +and/or dedications given therein. + +@item +Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +@item +Delete any section entitled ``Endorsements''. Such a section +may not be included in the Modified Version. + +@item +Do not retitle any existing section as ``Endorsements'' +or to conflict in title with any Invariant Section. +@end enumerate + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties---for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections entitled ``History'' +in the various original documents, forming one section entitled +``History''; likewise combine any sections entitled ``Acknowledgments'', +and any sections entitled ``Dedications''. You must delete all sections +entitled ``Endorsements.'' + +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, does not as a whole count as a Modified Version +of the Document, provided no compilation copyright is claimed for the +compilation. Such a compilation is called an ``aggregate'', and this +License does not apply to the other self-contained works thus compiled +with the Document, on account of their being thus compiled, if they +are not themselves derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one quarter +of the entire aggregate, the Document's Cover Texts may be placed on +covers that surround only the Document within the aggregate. +Otherwise they must appear on covers around the whole aggregate. + +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License provided that you also include the +original English version of this License. In case of a disagreement +between the translation and the original English version of this +License, the original English version will prevail. + +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +@uref{http://www.gnu.org/copyleft/}. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +@end enumerate + +@page +@appendixsubsec ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group + Copyright (C) @var{year} @var{your name}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with the Invariant Sections being @var{list their titles}, with the + Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}. + A copy of the license is included in the section entitled ``GNU + Free Documentation License''. +@end group +@end smallexample + +If you have no Invariant Sections, write ``with no Invariant Sections'' +instead of saying which ones are invariant. If you have no +Front-Cover Texts, write ``no Front-Cover Texts'' instead of +``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +@c Local Variables: +@c ispell-local-pdict: "ispell-dict" +@c End: + diff -brNpu gnumach-1.2/doc/gpl.texi gnumach-1.3/doc/gpl.texi --- gnumach-1.2/doc/gpl.texi Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/doc/gpl.texi Mon May 27 11:17:01 2002 @@ -0,0 +1,397 @@ +@node Copying +@appendix GNU GENERAL PUBLIC LICENSE + +@cindex GPL, GNU General Public License +@center Version 2, June 1991 + +@display +Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. +59 Temple Place -- Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@appendixsubsec Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software---to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + +@iftex +@appendixsubsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +@end iftex +@ifinfo +@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +@end ifinfo + +@enumerate +@item +This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The ``Program'', below, +refers to any such program or work, and a ``work based on the Program'' +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term ``modification''.) Each licensee is addressed as ``you''. + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + +@item +You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +@item +You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +@enumerate a +@item +You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +@item +You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any +part thereof, to be licensed as a whole at no charge to all third +parties under the terms of this License. + +@item +If the modified program normally reads commands interactively +when run, you must cause it, when started running for such +interactive use in the most ordinary way, to print or display an +announcement including an appropriate copyright notice and a +notice that there is no warranty (or else, saying that you provide +a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this +License. (Exception: if the Program itself is interactive but +does not normally print such an announcement, your work based on +the Program is not required to print an announcement.) +@end enumerate + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +@item +You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +@enumerate a +@item +Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections +1 and 2 above on a medium customarily used for software interchange; or, + +@item +Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your +cost of physically performing source distribution, a complete +machine-readable copy of the corresponding source code, to be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +@item +Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is +allowed only for noncommercial distribution and only if you +received the program in object code or executable form with such +an offer, in accord with Subsection b above.) +@end enumerate + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +@item +You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +@item +Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +@item +If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +@item +If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +@item +The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and ``any +later version'', you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +@item +If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +@iftex +@heading NO WARRANTY +@end iftex +@ifinfo +@center NO WARRANTY +@end ifinfo + +@item +BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + +@item +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. +@end enumerate + +@iftex +@heading END OF TERMS AND CONDITIONS +@end iftex +@ifinfo +@center END OF TERMS AND CONDITIONS +@end ifinfo + +@page +@unnumberedsec How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the ``copyright'' line and a pointer to where the full notice is found. + +@smallexample +@var{one line to give the program's name and an idea of what it does.} +Copyright (C) 19@var{yy} @var{name of author} + +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 +of the License, 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, Inc., +59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +@end smallexample + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +@smallexample +Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details +type `show w'. This is free software, and you are welcome +to redistribute it under certain conditions; type `show c' +for details. +@end smallexample + +The hypothetical commands @samp{show w} and @samp{show c} should show +the appropriate parts of the General Public License. Of course, the +commands you use may be called something other than @samp{show w} and +@samp{show c}; they could even be mouse-clicks or menu items---whatever +suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a ``copyright disclaimer'' for the program, if +necessary. Here is a sample; alter the names: + +@smallexample +@group +Yoyodyne, Inc., hereby disclaims all copyright +interest in the program `Gnomovision' +(which makes passes at compilers) written +by James Hacker. + +@var{signature of Ty Coon}, 1 April 1989 +Ty Coon, President of Vice +@end group +@end smallexample + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff -brNpu gnumach-1.2/doc/mach.texi gnumach-1.3/doc/mach.texi --- gnumach-1.2/doc/mach.texi Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/doc/mach.texi Mon May 27 11:17:01 2002 @@ -0,0 +1,7100 @@ +\input texinfo @c -*- Texinfo -*- +@setfilename mach.info +@settitle The GNU Mach Reference Manual +@setchapternewpage odd + +@comment Tell install-info what to do. +@dircategory Kernel +@direntry +* GNUMach: (mach). Using and programming the GNU Mach microkernel. +@end direntry + +@c Should have a glossary. +@c Unify some of our indices. +@syncodeindex pg cp +@syncodeindex vr fn +@syncodeindex tp fn + +@c Get the Mach version we are documenting. +@include version.texi +@set EDITION 0.4 +@set UPDATED 2001-09-01 +@c @set ISBN X-XXXXXX-XX-X + +@ifinfo +This file documents the GNU Mach microkernel. + +This is Edition @value{EDITION}, last updated @value{UPDATED}, of +@cite{The GNU Mach Reference Manual}, for Version @value{VERSION}. + +Copyright @copyright{} 2001 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Free Software Needs Free Documentation" and +"GNU Lesser General Public License", the Front-Cover texts being (a) +(see below), and with the Back-Cover Texts being (b) (see below). A +copy of the license is included in the section entitled "GNU Free +Documentation License". + +(a) The FSF's Front-Cover Text is: + + A GNU Manual + +(b) The FSF's Back-Cover Text is: + + You have freedom to copy and modify this GNU Manual, like GNU + software. Copies published by the Free Software Foundation raise + funds for GNU development. + +This work is based on manual pages under the following copyright and license: + +@noindent +Mach Operating System@* +Copyright @copyright{} 1991,1990 Carnegie Mellon University@* +All Rights Reserved. + +Permission to use, copy, modify and distribute this software and its +documentation is hereby granted, provided that both the copyright +notice and this permission notice appear in all copies of the +software, derivative works or modified versions, and any portions +thereof, and that both notices appear in supporting documentation. + +CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" +CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR +ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. +@end ifinfo + +@iftex +@shorttitlepage The GNU Mach Reference Manual +@end iftex +@titlepage +@center @titlefont{The GNU Mach} +@sp 1 +@center @titlefont{Reference Manual} +@sp 2 +@center Marcus Brinkmann +@center with +@center Gordon Matzigkeit, Gibran Hasnaoui, +@center Robert V. Baron, Richard P. Draves, Mary R. Thompson, Joseph S. Barrera +@sp 3 +@center Edition @value{EDITION} +@sp 1 +@center last updated @value{UPDATED} +@sp 1 +@center for version @value{VERSION} +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 2001 Free Software Foundation, Inc. +@c @sp 2 +@c Published by the Free Software Foundation @* +@c 59 Temple Place -- Suite 330, @* +@c Boston, MA 02111-1307 USA @* +@c ISBN @value{ISBN} @* + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Free Software Needs Free Documentation" and +"GNU Lesser General Public License", the Front-Cover texts being (a) +(see below), and with the Back-Cover Texts being (b) (see below). A +copy of the license is included in the section entitled "GNU Free +Documentation License". + +(a) The FSF's Front-Cover Text is: + + A GNU Manual + +(b) The FSF's Back-Cover Text is: + + You have freedom to copy and modify this GNU Manual, like GNU + software. Copies published by the Free Software Foundation raise + funds for GNU development. + +This work is based on manual pages under the following copyright and license: + +@noindent +Mach Operating System@* +Copyright @copyright{} 1991,1990 Carnegie Mellon University@* +All Rights Reserved. + +Permission to use, copy, modify and distribute this software and its +documentation is hereby granted, provided that both the copyright +notice and this permission notice appear in all copies of the +software, derivative works or modified versions, and any portions +thereof, and that both notices appear in supporting documentation. + +CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" +CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR +ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. +@end titlepage +@c @titlepage +@c @finalout +@c @title The GNU Mach Reference Manual +@c @author Marcus Brinkmann +@c @author Gordon Matzigkeit +@c @author Gibran Hasnaoui + +@c @author Robert V. Baron @c (rvb) +@c @author Richard P. Draves @c (rpd) +@c @author Mary R. Thompson @c (mrt) +@c @author Joseph S. Barrera @c (jsb) +@c @c The following occure rarely in the rcs commit logs of the man pages: +@c @c Dan Stodolsky, (danner) +@c @c David B. Golub, (dbg) +@c @c Terri Watson, (elf) +@c @c Lori Iannamico, (lli) [distribution coordinator] +@c @c Further authors of kernel_interfaces.ps: +@c @c David Black [OSF] +@c @c William Bolosky +@c @c Jonathan Chew +@c @c Alessandro Forin +@c @c Richard F. Rashid +@c @c Avadis Tevanian Jr. +@c @c Michael W. Young +@c @c See also +@c @c http://www.cs.cmu.edu/afs/cs/project/mach/public/www/people-former.html +@page + +@ifnottex +@node Top +@top Main Menu +This is Edition @value{EDITION}, last updated @value{UPDATED}, of +@cite{The GNU Mach Reference Manual}, for Version @value{VERSION} of the +GNU Mach microkernel. +@end ifnottex + +@menu +* Introduction:: How to use this manual. +* Installing:: Setting up GNU Mach on your computer. +* Bootstrap:: Running GNU Mach on your machine. +* Inter Process Communication:: Communication between process. +* Virtual Memory Interface:: Allocating and deallocating virtual memory. +* External Memory Management:: Handling memory pages in user space. +* Threads and Tasks:: Handling of threads and tasks. +* Host Interface:: Interface to a Mach host. +* Processors and Processor Sets:: Handling processors and sets of processors. +* Device Interface:: Accesing kernel devices. +* Kernel Debugger:: How to use the built-in kernel debugger. + +Appendices + +* Copying:: The GNU General Public License says how you + can copy and share the GNU Mach microkernel. +* Documentation License:: This manual is under the GNU Free + Documentation License. + +Indices + +* Concept Index:: Index of concepts and programs. +* Function and Data Index:: Index of functions, variables and data types. + + +@detailmenu + --- The Detailed Node Listing --- + +Introduction + +* Audience:: The people for whom this manual is written. +* Features:: Reasons to install and use GNU Mach. +* Overview:: Basic architecture of the Mach microkernel. +* History:: The story about Mach. + +Installing + +* Binary Distributions:: Obtaining ready-to-run GNU distributions. +* Compilation:: Building GNU Mach from its source code. +* Configuration:: Configuration options at compilation time. +* Cross-Compilation:: Building GNU Mach from another system. + +Bootstrap + +* Bootloader:: Starting the microkernel, or other OSes. +* Modules:: Starting the first task of the OS. + +Inter Process Communication + +* Major Concepts:: The concepts behind the Mach IPC system. +* Messaging Interface:: Composing, sending and receiving messages. +* Port Manipulation Interface:: Manipulating ports, port rights, port sets. + +Messaging Interface + +* Mach Message Call:: Sending and receiving messages. +* Message Format:: The format of Mach messages. +* Exchanging Port Rights:: Sending and receiving port rights. +* Memory:: Passing memory regions in messages. +* Message Send:: Sending messages. +* Message Receive:: Receiving messages. +* Atomicity:: Atomicity of port rights. + +Port Manipulation Interface + +* Port Creation:: How to create new ports and port sets. +* Port Destruction:: How to destroy ports and port sets. +* Port Names:: How to query and manipulate port names. +* Port Rights:: How to work with port rights. +* Ports and other Tasks:: How to move rights between tasks. +* Receive Rights:: How to work with receive rights. +* Port Sets:: How to work with port sets. +* Request Notifications:: How to request notifications for events. +@c * Inherited Ports:: How to work with the inherited system ports. + +Virtual Memory Interface + +* Memory Allocation:: Allocation of new virtual memory. +* Memory Deallocation:: Freeing unused virtual memory. +* Data Transfer:: Reading, writing and copying memory. +* Memory Attributes:: Tweaking memory regions. +* Mapping Memory Objects:: How to map memory objects. +* Memory Statistics:: How to get statistics about memory usage. + +External Memory Management + +* Memory Object Server:: The basics of external memory management. +* Memory Object Creation:: How new memory objects are created. +* Memory Object Termination:: How memory objects are terminated. +* Memory Objects and Data:: Data transfer to and from memory objects. +* Memory Object Locking:: How memory objects are locked. +* Memory Object Attributes:: Manipulating attributes of memory objects. +* Default Memory Manager:: Setting and using the default memory manager. + +Threads and Tasks + +* Thread Interface:: Manipulating threads. +* Task Interface:: Manipulating tasks. +* Profiling:: Profiling threads and tasks. + +Thread Interface + +* Thread Creation:: Creating threads. +* Thread Termination:: Terminating threads. +* Thread Information:: How to get informations on threads. +* Thread Settings:: How to set threads related informations. +* Thread Execution:: How to control the thread's machine state. +* Scheduling:: Operations on thread scheduling. +* Thread Special Ports:: How to handle the thread's special ports. +* Exceptions:: Managing exceptions. + +Scheduling + +* Thread Priority:: Changing the priority of a thread. +* Hand-Off Scheduling:: Switch to a new thread. +* Scheduling Policy:: Setting the scheduling policy. + +Task Interface + +* Task Creation:: Creating tasks. +* Task Termination:: Terminating tasks. +* Task Information:: Informations on tasks. +* Task Execution:: Thread scheduling in a task. +* Task Special Ports:: How to get and set the task's special ports. +* Syscall Emulation:: How to emulate system calls. + +Host Interface + +* Host Ports:: Ports representing a host. +* Host Information:: Query information about a host. +* Host Time:: Functions to query manipulate the host time. +* Host Reboot:: Rebooting the system. + +Processors and Processor Sets + +* Processor Set Interface:: How to work with processor sets. +* Processor Interface:: How to work with individual processors. + +Processor Set Interface + +* Processor Set Ports:: Ports representing a processor set. +* Processor Set Access:: How the processor sets are accessed. +* Processor Set Creation:: How new processor sets are created. +* Processor Set Destruction:: How processor sets are destroyed. +* Tasks and Threads on Sets:: Assigning tasks or threads to processor sets. +* Processor Set Priority:: Specifying the priority of a processor set. +* Processor Set Policy:: Changing the processor set policies. +* Processor Set Info:: Obtaining information about a processor set. + +Processor Interface + +* Hosted Processors:: Getting a list of all processors on a host. +* Processor Control:: Starting, stopping, controlling processors. +* Processors and Sets:: Combining processors into processor sets. +* Processor Info:: Obtaining information on processors. + +Device Interface + +* Device Open:: Opening hardware devices. +* Device Close:: Closing hardware devices. +* Device Read:: Reading data from the device. +* Device Write:: Writing data to the device. +* Device Map:: Mapping devices into virtual memory. +* Device Status:: Querying and manipulating a device. +* Device Filter:: Filtering packets arriving on a device. + +Kernel Debugger + +* Operation:: Basic architecture of the kernel debugger. +* Commands:: Available commands in the kernel debugger. +* Variables:: Access of variables from the kernel debugger. +* Expressions:: Usage of expressions in the kernel debugger. + +Documentation License + +* Free Documentation License:: The GNU Free Documentation License. +* CMU License:: The CMU license applies to the original Mach + kernel and its documentation. + +@end detailmenu +@end menu + + +@node Introduction +@chapter Introduction + +GNU Mach is the microkernel of the GNU Project. It is the base of the +operating system, and provides its functionality to the Hurd servers, +the GNU C Library and all user applications. The microkernel itself +does not provide much functionality of the system, just enough to make +it possible for the Hurd servers and the C library to implement the missing +features you would expect from a POSIX compatible operating system. + +@menu +* Audience:: The people for whom this manual is written. +* Features:: Reasons to install and use GNU Mach. +* Overview:: Basic architecture of the Mach microkernel. +* History:: The story about Mach. +@end menu + + +@node Audience +@section Audience + +This manual is designed to be useful to everybody who is interested in +using, administering, or programming the Mach microkernel. + +If you are an end-user and you are looking for help on running the Mach +kernel, the first few chapters of this manual describe the essential +parts of installing and using the kernel in the GNU operating system. + +The rest of this manual is a technical discussion of the Mach +programming interface and its implementation, and would not be helpful +until you want to learn how to extend the system or modify the kernel. + +This manual is organized according to the subsystems of Mach, and each +chapter begins with descriptions of conceptual ideas that are related to +that subsystem. If you are a programmer and want to learn more about, +say, the Mach IPC subsystem, you can skip to the IPC chapter +(@pxref{Inter Process Communication}), and read about the related +concepts and interface definitions. + + +@node Features +@section Features + +GNU Mach is not the most advanced microkernel known to the planet, +nor is it the fastest or smallest, but it has a rich set of interfaces and +some features which make it useful as the base of the Hurd system. + +@table @asis +@item it's free software +Anybody can use, modify, and redistribute it under the terms of the GNU +General Public License (@pxref{Copying}). GNU Mach is part of the GNU +system, which is a complete operating system licensed under the GPL. + +@item it's built to survive +As a microkernel, GNU Mach doesn't implement a lot of the features +commonly found in an operating system, but only the bare minimum +that is required to implement a full operating system on top of it. +This means that a lot of the operating system code is maintained outside +of GNU Mach, and while this code may go through a complete redesign, the +code of the microkernel can remain comparatively stable. + +@item it's scalable +Mach is particularly well suited for SMP and network cluster techniques. +Thread support is provided at the kernel level, and the kernel itself +takes advantage of that. Network transparency at the IPC level makes +resources of the system available across machine boundaries (with NORMA +IPC, currently not available in GNU Mach). + +@item it exists +The Mach microkernel is real software that works Right Now. +It is not a research or a proposal. You don't have to wait at all +before you can start using and developing it. Mach has been used in +many operating systems in the past, usually as the base for a single +UNIX server. In the GNU system, Mach is the base of a functional +multi-server operating system, the Hurd. +@end table + + +@node Overview +@section Overview + +@c This paragraph by Gordon Matzigkeit from the Hurd manual. +An operating system kernel provides a framework for programs to share a +computer's hardware resources securely and efficiently. This requires +that the programs are seperated and protected from each other. To make +running multiple programs in parallel useful, there also needs to be a +facility for programs to exchange information by communication. + +The Mach microkernel provides abstractions of the underlying hardware +resources like devices and memory. It organizes the running programs +into tasks and threads (points of execution in the tasks). In addition, +Mach provides a rich interface for inter-process communication. + +What Mach does not provide is a POSIX compatible programming interface. +In fact, it has no understanding of file systems, POSIX process semantics, +network protocols and many more. All this is implemented in tasks +running on top of the microkernel. In the GNU operating system, the Hurd +servers and the C library share the responsibility to implement the POSIX +interface, and the additional interfaces which are specific to the GNU +system. + + +@node History +@section History + +XXX A few lines about the history of Mach here. + + +@node Installing +@chapter Installing + +Before you can use the Mach microkernel in your system you'll need to install +it and all components you want to use with it, e.g. the rest of the operating +system. You also need a bootloader to load the kernel from the storage +medium and run it when the computer is started. + +GNU Mach is only available for Intel i386-compatible architectures +(such as the Pentium) currently. If you have a different architecture +and want to run the GNU Mach microkernel, you will need to port the +kernel and all other software of the system to your machine's architecture. +Porting is an involved process which requires considerable programming skills, +and it is not recommended for the faint-of-heart. +If you have the talent and desire to do a port, contact +@email{bug-hurd@@gnu.org} in order to coordinate the effort. + +@menu +* Binary Distributions:: Obtaining ready-to-run GNU distributions. +* Compilation:: Building GNU Mach from its source code. +* Configuration:: Configuration options at compile time. +* Cross-Compilation:: Building GNU Mach from another system. +@end menu + + +@node Binary Distributions +@section Binary Distributions + +By far the easiest and best way to install GNU Mach and the operating +system is to obtain a GNU binary distribution. The GNU operating +system consists of GNU Mach, the Hurd, the C library and many applications. +Without the GNU operating system, you will only have a microkernel, which +is not very useful by itself, without the other programs. + +Building the whole operating system takes a huge effort, and you are well +advised to not do it yourself, but to get a binary distribution of the +GNU operating system. The distribution also includes a binary of the +GNU Mach microkernel. + +Information on how to obtain the GNU system can be found in the Hurd +info manual. + + +@node Compilation +@section Compilation + +If you already have a running GNU system, and only want to recompile +the kernel, for example to select a different set of included hardware +drivers, you can easily do this. You need the GNU C compiler and +MiG, the Mach interface generator, which both come in their own +packages. + +Building and installing the kernel is as easy as with any other GNU +software package. The configure script is used to configure the source +and set the compile time options. The compilation is done by running: + +@example +make +@end example + +To install the kernel and its header files, just enter the command: + +@example +make install +@end example + +This will install the kernel into $(prefix)/boot/gnumach and the header +files into $(prefix)/include. You can also only install the kernel or +the header files. For this, the two targets install-kernel and +install-headers are provided. + + +@node Configuration +@section Configuration + +The following options can be passed to the configure script as command +line arguments and control what components are built into the kernel, or +where it is installed. + +The default for an option is to be disabled, unless otherwise noted. + +@table @code +@item --prefix @var{prefix} +Sets the prefix to PREFIX. The default prefix is the empty string, which +is the correct value for the GNU system. The prefix is prepended to all +file names at installation time. + +@item --enable-kdb +Enables the in-kernel debugger. This is only useful if you actually +anticipate debugging the kernel. It is not enabled by default because +it adds considerably to the unpageable memory footprint of the kernel. +@xref{Kernel Debugger}. + +@item --enable-kmsg +Enables the kernel message device kmsg. + +@item --enable-lpr +Enables the parallel port devices lpr%d. + +@item --enable-floppy +Enables the PC floppy disk controller devices fd%d. + +@item --enable-ide +Enables the IDE controller devices hd%d, hd%ds%d. +@end table + +The following options enable drivers for various SCSI controller. +SCSI devices are named sd%d (disks) or cd%d (CD ROMs). + +@table @code +@item --enable-advansys +Enables the AdvanSys SCSI controller devices sd%d, cd%d. + +@item --enable-buslogic +Enables the BusLogic SCSI controller devices sd%d, cd%d. + +@item --disable-flashpoint +Only meaningful in conjunction with @option{--enable-buslogic}. Omits the +FlshPoint support. This option is enabled by default if +@option{--enable-buslogic} is specified. + +@item --enable-u1434f +Enables the UltraStor 14F/34F SCSI controller devices sd%d, cd%d. + +@item --enable-ultrastor +Enables the UltraStor SCSI controller devices sd%d, cd%d. + +@item --enable-aha152x +@itemx --enable-aha2825 +Enables the Adaptec AHA-152x/2825 SCSI controller devices sd%d, cd%d. + +@item --enable-aha1542 +Enables the Adaptec AHA-1542 SCSI controller devices sd%d, cd%d. + +@item --enable-aha1740 +Enables the Adaptec AHA-1740 SCSI controller devices sd%d, cd%d. + +@item --enable-aic7xxx +Enables the Adaptec AIC7xxx SCSI controller devices sd%d, cd%d. + +@item --enable-futuredomain +Enables the Future Domain 16xx SCSI controller devices sd%d, cd%d. + +@item --enable-in2000 +Enables the Always IN 2000 SCSI controller devices sd%d, cd%d. + +@item --enable-ncr5380 +@itemx --enable-ncr53c400 +Enables the generic NCR5380/53c400 SCSI controller devices sd%d, cd%d. + +@item --enable-ncr53c406a +Enables the NCR53c406a SCSI controller devices sd%d, cd%d. + +@item --enable-pas16 +Enables the PAS16 SCSI controller devices sd%d, cd%d. + +@item --enable-seagate +Enables the Seagate ST02 and Future Domain TMC-8xx SCSI controller +devices sd%d, cd%d. + +@item --enable-t128 +@itemx --enable-t128f +@itemx --enable-t228 +Enables the Trantor T128/T128F/T228 SCSI controller devices sd%d, cd%d. + +@item --enable-ncr53c7xx +Enables the NCR53C7,8xx SCSI controller devices sd%d, cd%d. + +@item --enable-eatadma +Enables the EATA-DMA (DPT, NEC, AT&T, SNI, AST, Olivetti, Alphatronix) +SCSI controller devices sd%d, cd%d. + +@item --enable-eatapio +Enables the EATA-PIO (old DPT PM2001, PM2012A) SCSI controller devices +sd%d, cd%d. + +@item --enable-wd7000 +Enables the WD 7000 SCSI controller devices sd%d, cd%d. + +@item --enable-eata +Enables the EATA ISA/EISA/PCI (DPT and generic EATA/DMA-compliant boards) +SCSI controller devices sd%d, cd%d. + +@item --enable-am53c974 +@itemx --enable-am79c974 +Enables the AM53/79C974 SCSI controller devices sd%d, cd%d. + +@item --enable-dtc3280 +@itemx --enable-dtc3180 +Enables the DTC3180/3280 SCSI controller devices sd%d, cd%d. + +@item --enable-ncr53c8xx +@itemx --enable-dc390w +@itemx --enable-dc390u +@itemx --enable-dc390f +Enables the NCR53C8XX SCSI controller devices sd%d, cd%d. + +@item --enable-dc390t +@itemx --enable-dc390 +Enables the Tekram DC-390(T) SCSI controller devices sd%d, cd%d. + +@item --enable-ppa +Enables the IOMEGA Parallel Port ZIP drive device sd%d. + +@item --enable-qlogicfas +Enables the Qlogic FAS SCSI controller devices sd%d, cd%d. + +@item --enable-qlogicisp +Enables the Qlogic ISP SCSI controller devices sd%d, cd%d. + +@item --enable-gdth +Enables the GDT SCSI Disk Array controller devices sd%d, cd%d. +@end table + +The following options enable drivers for various ethernet cards. +NIC device names are usually eth%d, except for the pocket adaptors. + +GNU Mach does only autodetect one ethernet card. To enable any further +cards, the source code has to be edited. +@c XXX Reference to the source code. + +@table @code +@item --enable-ne2000 +@itemx --enable-ne1000 +Enables the NE2000/NE1000 ISA netword card devices eth%d. + +@item --enable-3c503 +@itemx --enable-el2 +Enables the 3Com 503 (Etherlink II) netword card devices eth%d. + +@item --enable-3c509 +@itemx --enable-3c579 +@itemx --enable-el3 +Enables the 3Com 509/579 (Etherlink III) netword card devices eth%d. + +@item --enable-wd80x3 +Enables the WD80X3 netword card devices eth%d. + +@item --enable-3c501 +@itemx --enable-el1 +Enables the 3COM 501 netword card devices eth%d. + +@item --enable-ul +Enables the SMC Ultra netword card devices eth%d. + +@item --enable-ul32 +Enables the SMC Ultra 32 netword card devices eth%d. + +@item --enable-hplanplus +Enables the HP PCLAN+ (27247B and 27252A) netword card devices eth%d. + +@item --enable-hplan +Enables the HP PCLAN (27245 and other 27xxx series) netword card devices eth%d. + +@item --enable-3c59x +@itemx --enable-3c90x +@itemx --enable-vortex +Enables the 3Com 590/900 series (592/595/597/900/905) "Vortex/Boomerang" +netword card devices eth%d. + +@item --enable-seeq8005 +Enables the Seeq8005 netword card devices eth%d. + +@item --enable-hp100 +@itemx --enable-hpj2577 +@itemx --enable-hpj2573 +@itemx --enable-hp27248b +@itemx --enable-hp2585 +Enables the HP 10/100VG PCLAN (ISA, EISA, PCI) netword card devices +eth%d. + +@item --enable-ac3200 +Enables the Ansel Communications EISA 3200 netword card devices eth%d. + +@item --enable-e2100 +Enables the Cabletron E21xx netword card devices eth%d. + +@item --enable-at1700 +Enables the AT1700 (Fujitsu 86965) netword card devices eth%d. + +@item --enable-eth16i +@itemx --enable-eth32 +Enables the ICL EtherTeam 16i/32 netword card devices eth%d. + +@item --enable-znet +@itemx --enable-znote +Enables the Zenith Z-Note netword card devices eth%d. + +@item --enable-eexpress +Enables the EtherExpress 16 netword card devices eth%d. + +@item --enable-eexpresspro +Enables the EtherExpressPro netword card devices eth%d. + +@item --enable-eexpresspro100 +Enables the Intel EtherExpressPro PCI 10+/100B/100+ netword card devices +eth%d. + +@item --enable-depca +@itemx --enable-de100 +@itemx --enable-de101 +@itemx --enable-de200 +@itemx --enable-de201 +@itemx --enable-de202 +@itemx --enable-de210 +@itemx --enable-de422 +Enables the DEPCA, DE10x, DE200, DE201, DE202, DE210, DE422 netword card +devices eth%d. + +@item --enable-ewrk3 +@itemx --enable-de203 +@itemx --enable-de204 +@itemx --enable-de205 +Enables the EtherWORKS 3 (DE203, DE204, DE205) netword card devices +eth%d. + +@item --enable-de4x5 +@itemx --enable-de425 +@itemx --enable-de434 +@itemx --enable-435 +@itemx --enable-de450 +@itemx --enable-500 +Enables the DE425, DE434, DE435, DE450, DE500 netword card devices +eth%d. + +@item --enable-apricot +Enables the Apricot XEN-II on board ethernet netword card devices eth%d. + +@item --enable-wavelan +Enables the AT&T WaveLAN & DEC RoamAbout DS netword card devices eth%d. + +@item --enable-3c507 +@itemx --enable-el16 +Enables the 3Com 507 netword card devices eth%d. + +@item --enable-3c505 +@itemx --enable-elplus +Enables the 3Com 505 netword card devices eth%d. + +@item --enable-de600 +Enables the D-Link DE-600 netword card devices eth%d. + +@item --enable-de620 +Enables the D-Link DE-620 netword card devices eth%d. + +@item --enable-skg16 +Enables the Schneider & Koch G16 netword card devices eth%d. + +@item --enable-ni52 +Enables the NI5210 netword card devices eth%d. + +@item --enable-ni65 +Enables the NI6510 netword card devices eth%d. + +@item --enable-atp +Enables the AT-LAN-TEC/RealTek pocket adaptor netword card devices atp%d. + +@item --enable-lance +@itemx --enable-at1500 +@itemx --enable-ne2100 +Enables the AMD LANCE and PCnet (AT1500 and NE2100) netword card devices eth%d. + +@item --enable-elcp +@itemx --enable-tulip +Enables the DECchip Tulip (dc21x4x) PCI netword card devices eth%d. + +@item --enable-fmv18x +Enables the FMV-181/182/183/184 netword card devices eth%d. + +@item --enable-3c515 +Enables the 3Com 515 ISA Fast EtherLink netword card devices eth%d. + +@item --enable-pcnet32 +Enables the AMD PCI PCnet32 (PCI bus NE2100 cards) netword card devices +eth%d. + +@item --enable-ne2kpci +Enables the PCI NE2000 netword card devices eth%d. + +@item --enable-yellowfin +Enables the Packet Engines Yellowfin Gigabit-NIC netword card devices +eth%d. + +@item --enable-rtl8139 +@itemx --enable-rtl8129 +Enables the RealTek 8129/8139 (not 8019/8029!) netword card devices +eth%d. + +@item --enable-epic +@itemx --enable-epic100 +Enables the SMC 83c170/175 EPIC/100 (EtherPower II) netword card devices eth%d. + +@item --enable-tlan +Enables the TI ThunderLAN netword card devices eth%d. + +@item --enable-viarhine +Enables the VIA Rhine netword card devices eth%d. +@end table + + +@node Cross-Compilation +@section Cross-Compilation + +Another way to install the kernel is to use an existing operating system +in order to compile the kernel binary. +This is called @dfn{cross-compiling}, because it is done between two +different platforms. If the pre-built kernels are not working for +you, and you can't ask someone to compile a custom kernel for your +machine, this is your last chance to get a kernel that boots on your +hardware. + +Luckily, the kernel does have light dependencies. You don't even +need a cross compiler if your build machine has a compiler and is +the same architecture as the system you want to run GNU Mach on. + +You need a cross-mig, though. + +XXX More info needed. + + +@node Bootstrap +@chapter Bootstrap + +Bootstrapping@footnote{The term @dfn{bootstrapping} refers to a Dutch +legend about a boy who was able to fly by pulling himself up by his +bootstraps. In computers, this term refers to any process where a +simple system activates a more complicated system.} is the procedure by +which your machine loads the microkernel and transfers control to the +operating system. + + +@menu +* Bootloader:: Starting the microkernel, or other OSes. +* Modules:: Starting the first task of the OS. +@end menu + +@node Bootloader +@section Bootloader + +The @dfn{bootloader} is the first software that runs on your machine. +Many hardware architectures have a very simple startup routine which +reads a very simple bootloader from the beginning of the internal hard +disk, then transfers control to it. Other architectures have startup +routines which are able to understand more of the contents of the hard +disk, and directly start a more advanced bootloader. + +@cindex GRUB +@cindex GRand Unified Bootloader +Currently, @dfn{GRUB}@footnote{The GRand Unified Bootloader, available +from @uref{http://www.uruk.org/grub/}.} is the preferred GNU bootloader. +GRUB provides advanced functionality, and is capable of loading several +different kernels (such as Mach, Linux, DOS, and the *BSD family). +@xref{Top, , Introduction, grub, GRUB Manual}. + +GNU Mach conforms to the Multiboot specification which defines an +interface between the bootloader and the components that run very early +at startup. GNU Mach can be started by any bootloader which supports +the multiboot standard. After the bootloader loaded the kernel image to +a designated address in the system memory, it jumps into the startup +code of the kernel. This code initializes the kernel and detects the +available hardware devices. Afterwards, the first system task is +started. @xref{Top, , Overview, multiboot, Multiboot Specification}. + + +@node Modules +@section Modules +@pindex serverboot + +Because the microkernel does not provide filesystem support and other +features necessary to load the first system task from a storage medium, +the first task is loaded by the bootloader as a module to a specified +address. In the GNU system, this first program is the @code{serverboot} +executable. GNU Mach inserts the host control port and the device +master port into this task and appends the port numbers to the command +line before executing it. + +The @code{serverboot} program is responsible for loading and executing +the rest of the Hurd servers. Rather than containing specific +instructions for starting the Hurd, it follows general steps given in a +user-supplied boot script. + +XXX More about boot scripts. + + +@node Inter Process Communication +@chapter Inter Process Communication + +This chapter describes the details of the Mach IPC system. First the +actual calls concerned with sending and receiving messages are +discussed, then the details of the port system are described in detail. + +@menu +* Major Concepts:: The concepts behind the Mach IPC system. +* Messaging Interface:: Composing, sending and receiving messages. +* Port Manipulation Interface:: Manipulating ports, port rights, port sets. +@end menu + + +@node Major Concepts +@section Major Concepts +@cindex interprocess communication (IPC) +@cindex IPC (interprocess communication) +@cindex communication between tasks +@cindex remote procedure calls (RPC) +@cindex RPC (remote procedure calls) +@cindex messages + +The Mach kernel provides message-oriented, capability-based interprocess +communication. The interprocess communication (IPC) primitives +efficiently support many different styles of interaction, including +remote procedure calls (RPC), object-oriented distributed programming, +streaming of data, and sending very large amounts of data. + +The IPC primitives operate on three abstractions: messages, ports, and +port sets. User tasks access all other kernel services and abstractions +via the IPC primitives. + +The message primitives let tasks send and receive messages. Tasks send +messages to ports. Messages sent to a port are delivered reliably +(messages may not be lost) and are received in the order in which they +were sent. Messages contain a fixed-size header and a variable amount +of typed data following the header. The header describes the +destination and size of the message. + +The IPC implementation makes use of the VM system to efficiently +transfer large amounts of data. The message body can contain the +address of a region in the sender's address space which should be +transferred as part of the message. When a task receives a message +containing an out-of-line region of data, the data appears in an unused +portion of the receiver's address space. This transmission of +out-of-line data is optimized so that sender and receiver share the +physical pages of data copy-on-write, and no actual data copy occurs +unless the pages are written. Regions of memory up to the size of a +full address space may be sent in this manner. + +Ports hold a queue of messages. Tasks operate on a port to send and +receive messages by exercising capabilities for the port. Multiple +tasks can hold send capabilities, or rights, for a port. Tasks can also +hold send-once rights, which grant the ability to send a single message. +Only one task can hold the receive capability, or receive right, for a +port. Port rights can be transferred between tasks via messages. The +sender of a message can specify in the message body that the message +contains a port right. If a message contains a receive right for a +port, then the receive right is removed from the sender of the message +and the right is transferred to the receiver of the message. While the +receive right is in transit, tasks holding send rights can still send +messages to the port, and they are queued until a task acquires the +receive right and uses it to receive the messages. + +Tasks can receive messages from ports and port sets. The port set +abstraction allows a single thread to wait for a message from any of +several ports. Tasks manipulate port sets with a capability, or +port-set right, which is taken from the same space as the port +capabilities. The port-set right may not be transferred in a message. +A port set holds receive rights, and a receive operation on a port set +blocks waiting for a message sent to any of the constituent ports. A +port may not belong to more than one port set, and if a port is a member +of a port set, the holder of the receive right can't receive directly +from the port. + +Port rights are a secure, location-independent way of naming ports. The +port queue is a protected data structure, only accessible via the +kernel's exported message primitives. Rights are also protected by the +kernel; there is no way for a malicious user task to guess a port name +and send a message to a port to which it shouldn't have access. Port +rights do not carry any location information. When a receive right for +a port moves from task to task, and even between tasks on different +machines, the send rights for the port remain unchanged and continue to +function. + +@node Messaging Interface +@section Messaging Interface + +This section describes how messages are composed, sent and received +within the Mach IPC system. + +@menu +* Mach Message Call:: Sending and receiving messages. +* Message Format:: The format of Mach messages. +* Exchanging Port Rights:: Sending and receiving port rights. +* Memory:: Passing memory regions in messages. +* Message Send:: Sending messages. +* Message Receive:: Receiving messages. +* Atomicity:: Atomicity of port rights. +@end menu + + +@node Mach Message Call +@subsection Mach Message Call + +To use the @code{mach_msg} call, you can include the header files +@file{mach/port.h} and @file{mach/message.h}. + +@deftypefun mach_msg_return_t mach_msg (@w{mach_msg_header_t *@var{msg}}, @w{mach_msg_option_t @var{option}}, @w{mach_msg_size_t @var{send_size}}, @w{mach_msg_size_t @var{rcv_size}}, @w{mach_port_t @var{rcv_name}}, @w{mach_msg_timeout_t @var{timeout}}, @w{mach_port_t @var{notify}}) +The @code{mach_msg} function is used to send and receive messages. Mach +messages contain typed data, which can include port rights and +references to large regions of memory. + +@var{msg} is the address of a buffer in the caller's address space. +Message buffers should be aligned on long-word boundaries. The message +options @var{option} are bit values, combined with bitwise-or. One or +both of @code{MACH_SEND_MSG} and @code{MACH_RCV_MSG} should be used. +Other options act as modifiers. When sending a message, @var{send_size} +specifies the size of the message buffer. Otherwise zero should be +supplied. When receiving a message, @var{rcv_size} specifies the size +of the message buffer. Otherwise zero should be supplied. When +receiving a message, @var{rcv_name} specifies the port or port set. +Otherwise @code{MACH_PORT_NULL} should be supplied. When using the +@code{MACH_SEND_TIMEOUT} and @code{MACH_RCV_TIMEOUT} options, +@var{timeout} specifies the time in milliseconds to wait before giving +up. Otherwise @code{MACH_MSG_TIMEOUT_NONE} should be supplied. When +using the @code{MACH_SEND_NOTIFY}, @code{MACH_SEND_CANCEL}, and +@code{MACH_RCV_NOTIFY} options, @var{notify} specifies the port used for +the notification. Otherwise @code{MACH_PORT_NULL} should be supplied. + +If the option argument is @code{MACH_SEND_MSG}, it sends a message. The +@var{send_size} argument specifies the size of the message to send. The +@code{msgh_remote_port} field of the message header specifies the +destination of the message. + +If the option argument is @code{MACH_RCV_MSG}, it receives a message. +The @var{rcv_size} argument specifies the size of the message buffer +that will receive the message; messages larger than @var{rcv_size} are +not received. The @var{rcv_name} argument specifies the port or port +set from which to receive. + +If the option argument is @code{MACH_SEND_MSG|MACH_RCV_MSG}, then +@code{mach_msg} does both send and receive operations. If the send +operation encounters an error (any return code other than +@code{MACH_MSG_SUCCESS}), then the call returns immediately without +attempting the receive operation. Semantically the combined call is +equivalent to separate send and receive calls, but it saves a system +call and enables other internal optimizations. + +If the option argument specifies neither @code{MACH_SEND_MSG} nor +@code{MACH_RCV_MSG}, then @code{mach_msg} does nothing. + +Some options, like @code{MACH_SEND_TIMEOUT} and @code{MACH_RCV_TIMEOUT}, +share a supporting argument. If these options are used together, they +make independent use of the supporting argument's value. +@end deftypefun + +@deftp {Data type} mach_msg_timeout_t +This is a @code{natural_t} used by the timeout mechanism. The units are +milliseconds. The value to be used when there is no timeout is +@code{MACH_MSG_TIMEOUT_NONE}. +@end deftp + + +@node Message Format +@subsection Message Format +@cindex message format +@cindex format of a message +@cindex composing messages +@cindex message composition + +A Mach message consists of a fixed size message header, a +@code{mach_msg_header_t}, followed by zero or more data items. Data +items are typed. Each item has a type descriptor followed by the actual +data (or the address of the data, for out-of-line memory regions). + +The following data types are related to Mach ports: + +@deftp {Data type} mach_port_t +The @code{mach_port_t} data type is an unsigned integer type which +represents a port name in the task's port name space. In GNU Mach, this +is an @code{unsigned int}. +@end deftp + +@c This is defined elsewhere. +@c @deftp {Data type} mach_port_seqno_t +@c The @code{mach_port_seqno_t} data type is an unsigned integer type which +@c represents a sequence number of a message. In GNU Mach, this is an +@c @code{unsigned int}. +@c @end deftp + +The following data types are related to Mach messages: + +@deftp {Data type} mach_msg_bits_t +The @code{mach_msg_bits_t} data type is an @code{unsigned int} used to +store various flags for a message. +@end deftp + +@deftp {Data type} mach_msg_size_t +The @code{mach_msg_size_t} data type is an @code{unsigned int} used to +store the size of a message. +@end deftp + +@deftp {Data type} mach_msg_id_t +The @code{mach_msg_id_t} data type is an @code{integer_t} typically used to +convey a function or operation id for the receiver. +@end deftp + +@deftp {Data type} mach_msg_header_t +This structure is the start of every message in the Mach IPC system. It +has the following members: + +@table @code +@item mach_msg_bits_t msgh_bits +The @code{msgh_bits} field has the following bits defined, all other +bits should be zero: + +@table @code +@item MACH_MSGH_BITS_REMOTE_MASK +@itemx MACH_MSGH_BITS_LOCAL_MASK +The remote and local bits encode @code{mach_msg_type_name_t} values that +specify the port rights in the @code{msgh_remote_port} and +@code{msgh_local_port} fields. The remote value must specify a send or +send-once right for the destination of the message. If the local value +doesn't specify a send or send-once right for the message's reply port, +it must be zero and msgh_local_port must be @code{MACH_PORT_NULL}. + +@item MACH_MSGH_BITS_COMPLEX +The complex bit must be specified if the message body contains port +rights or out-of-line memory regions. If it is not specified, then the +message body carries no port rights or memory, no matter what the type +descriptors may seem to indicate. +@end table + +@code{MACH_MSGH_BITS_REMOTE} and @code{MACH_MSGH_BITS_LOCAL} macros +return the appropriate @code{mach_msg_type_name_t} values, given a +@code{msgh_bits} value. The @code{MACH_MSGH_BITS} macro constructs a +value for @code{msgh_bits}, given two @code{mach_msg_type_name_t} +values. + +@item mach_msg_size_t msgh_size +The @code{msgh_size} field in the header of a received message contains +the message's size. The message size, a byte quantity, includes the +message header, type descriptors, and in-line data. For out-of-line +memory regions, the message size includes the size of the in-line +address, not the size of the actual memory region. There are no +arbitrary limits on the size of a Mach message, the number of data items +in a message, or the size of the data items. + +@item mach_port_t msgh_remote_port +The @code{msgh_remote_port} field specifies the destination port of the +message. The field must carry a legitimate send or send-once right for +a port. + +@item mach_port_t msgh_local_port +The @code{msgh_local_port} field specifies an auxiliary port right, +which is conventionally used as a reply port by the recipient of the +message. The field must carry a send right, a send-once right, +@code{MACH_PORT_NULL}, or @code{MACH_PORT_DEAD}. + +@item mach_port_seqno_t msgh_seqno +The @code{msgh_seqno} field provides a sequence number for the message. +It is only valid in received messages; its value in sent messages is +overwritten. +@c XXX The "MESSAGE RECEIVE" section discusses message sequence numbers. + +@item mach_msg_id_t msgh_id +The @code{mach_msg} call doesn't use the @code{msgh_id} field, but it +conventionally conveys an operation or function id. +@end table +@end deftp + +@deftypefn Macro mach_msg_bits_t MACH_MSGH_BITS (@w{mach_msg_type_name_t @var{remote}}, @w{mach_msg_type_name_t @var{local}}) +This macro composes two @code{mach_msg_type_name_t} values that specify +the port rights in the @code{msgh_remote_port} and +@code{msgh_local_port} fields of a @code{mach_msg} call into an +appropriate @code{mach_msg_bits_t} value. +@end deftypefn + +@deftypefn Macro mach_msg_type_name_t MACH_MSGH_BITS_REMOTE (@w{mach_msg_bits_t @var{bits}}) +This macro extracts the @code{mach_msg_type_name_t} value for the remote +port right in a @code{mach_msg_bits_t} value. +@end deftypefn + +@deftypefn Macro mach_msg_type_name_t MACH_MSGH_BITS_LOCAL (@w{mach_msg_bits_t @var{bits}}) +This macro extracts the @code{mach_msg_type_name_t} value for the local +port right in a @code{mach_msg_bits_t} value. +@end deftypefn + +@deftypefn Macro mach_msg_bits_t MACH_MSGH_BITS_PORTS (@w{mach_msg_bits_t @var{bits}}) +This macro extracts the @code{mach_msg_bits_t} component consisting of +the @code{mach_msg_type_name_t} values for the remote and local port +right in a @code{mach_msg_bits_t} value. +@end deftypefn + +@deftypefn Macro mach_msg_bits_t MACH_MSGH_BITS_OTHER (@w{mach_msg_bits_t @var{bits}}) +This macro extracts the @code{mach_msg_bits_t} component consisting of +everything except the @code{mach_msg_type_name_t} values for the remote +and local port right in a @code{mach_msg_bits_t} value. +@end deftypefn + +Each data item has a type descriptor, a @code{mach_msg_type_t} or a +@code{mach_msg_type_long_t}. The @code{mach_msg_type_long_t} type +descriptor allows larger values for some fields. The +@code{msgtl_header} field in the long descriptor is only used for its +inline, longform, and deallocate bits. + +@deftp {Data type} mach_msg_type_name_t +This is an @code{unsigned int} and can be used to hold the +@code{msgt_name} component of the @code{mach_msg_type_t} and +@code{mach_msg_type_long_t} structure. +@end deftp + +@deftp {Data type} mach_msg_type_size_t +This is an @code{unsigned int} and can be used to hold the +@code{msgt_size} component of the @code{mach_msg_type_t} and +@code{mach_msg_type_long_t} structure. +@end deftp + +@deftp {Data type} mach_msg_type_number_t +This is an @code{natural_t} and can be used to hold the +@code{msgt_number} component of the @code{mach_msg_type_t} and +@code{mach_msg_type_long_t} structure. +@c XXX This is used for the size of arrays, too. Mmh? +@end deftp + +@deftp {Data type} mach_msg_type_t +This structure has the following members: + +@table @code +@item unsigned int msgt_name : 8 +The @code{msgt_name} field specifies the data's type. The following +types are predefined: + +@table @code +@item MACH_MSG_TYPE_UNSTRUCTURED +@item MACH_MSG_TYPE_BIT +@item MACH_MSG_TYPE_BOOLEAN +@item MACH_MSG_TYPE_INTEGER_16 +@item MACH_MSG_TYPE_INTEGER_32 +@item MACH_MSG_TYPE_CHAR +@item MACH_MSG_TYPE_BYTE +@item MACH_MSG_TYPE_INTEGER_8 +@item MACH_MSG_TYPE_REAL +@item MACH_MSG_TYPE_STRING +@item MACH_MSG_TYPE_STRING_C +@item MACH_MSG_TYPE_PORT_NAME +@end table + +The following predefined types specify port rights, and receive special +treatment. The next section discusses these types in detail. The type +@c XXX cross ref +@code{MACH_MSG_TYPE_PORT_NAME} describes port right names, when no +rights are being transferred, but just names. For this purpose, it +should be used in preference to @code{MACH_MSG_TYPE_INTEGER_32}. + +@table @code +@item MACH_MSG_TYPE_MOVE_RECEIVE +@item MACH_MSG_TYPE_MOVE_SEND +@item MACH_MSG_TYPE_MOVE_SEND_ONCE +@item MACH_MSG_TYPE_COPY_SEND +@item MACH_MSG_TYPE_MAKE_SEND +@item MACH_MSG_TYPE_MAKE_SEND_ONCE +@end table + +@item msgt_size : 8 +The @code{msgt_size} field specifies the size of each datum, in bits. For +example, the msgt_size of @code{MACH_MSG_TYPE_INTEGER_32} data is 32. + +@item msgt_number : 12 +The @code{msgt_number} field specifies how many data elements comprise +the data item. Zero is a legitimate number. + +The total length specified by a type descriptor is @w{@code{(msgt_size * +msgt_number)}}, rounded up to an integral number of bytes. In-line data +is then padded to an integral number of long-words. This ensures that +type descriptors always start on long-word boundaries. It implies that +message sizes are always an integral multiple of a long-word's size. + +@item msgt_inline : 1 +The @code{msgt_inline} bit specifies, when @code{FALSE}, that the data +actually resides in an out-of-line region. The address of the memory +region (a @code{vm_offset_t} or @code{vm_address_t}) follows the type +descriptor in the message body. The @code{msgt_name}, @code{msgt_size}, +and @code{msgt_number} fields describe the memory region, not the +address. + +@item msgt_longform : 1 +The @code{msgt_longform} bit specifies, when @code{TRUE}, that this type +descriptor is a @code{mach_msg_type_long_t} instead of a +@code{mach_msg_type_t}. The @code{msgt_name}, @code{msgt_size}, and +@code{msgt_number} fields should be zero. Instead, @code{mach_msg} uses +the following @code{msgtl_name}, @code{msgtl_size}, and +@code{msgtl_number} fields. + +@item msgt_deallocate : 1 +The @code{msgt_deallocate} bit is used with out-of-line regions. When +@code{TRUE}, it specifies that the memory region should be deallocated +from the sender's address space (as if with @code{vm_deallocate}) when +the message is sent. + +@item msgt_unused : 1 +The @code{msgt_unused} bit should be zero. +@end table +@end deftp + +@deftypefn Macro boolean_t MACH_MSG_TYPE_PORT_ANY (mach_msg_type_name_t type) +This macro returns @code{TRUE} if the given type name specifies a port +type, otherwise it returns @code{FALSE}. +@end deftypefn + +@deftypefn Macro boolean_t MACH_MSG_TYPE_PORT_ANY_SEND (mach_msg_type_name_t type) +This macro returns @code{TRUE} if the given type name specifies a port +type with a send or send-once right, otherwise it returns @code{FALSE}. +@end deftypefn + +@deftypefn Macro boolean_t MACH_MSG_TYPE_PORT_ANY_RIGHT (mach_msg_type_name_t type) +This macro returns @code{TRUE} if the given type name specifies a port +right type which is moved, otherwise it returns @code{FALSE}. +@end deftypefn + +@deftp {Data type} mach_msg_type_long_t +This structure has the following members: + +@table @code +@item mach_msg_type_t msgtl_header +Same meaning as @code{msgt_header}. +@c XXX cross ref + +@item unsigned short msgtl_name +Same meaning as @code{msgt_name}. + +@item unsigned short msgtl_size +Same meaning as @code{msgt_size}. + +@item unsigned int msgtl_number +Same meaning as @code{msgt_number}. +@end table +@end deftp + + +@node Exchanging Port Rights +@subsection Exchanging Port Rights +@cindex sending port rights +@cindex receiving port rights +@cindex moving port rights + +Each task has its own space of port rights. Port rights are named with +positive integers. Except for the reserved values +@w{@code{MACH_PORT_NULL (0)}@footnote{In the Hurd system, we don't make +the assumption that @code{MACH_PORT_NULL} is zero and evaluates to +false, but rather compare port names to @code{MACH_PORT_NULL} +explicitely}} and @w{@code{MACH_PORT_DEAD (~0)}}, this is a full 32-bit +name space. When the kernel chooses a name for a new right, it is free +to pick any unused name (one which denotes no right) in the space. + +There are five basic kinds of rights: receive rights, send rights, +send-once rights, port-set rights, and dead names. Dead names are not +capabilities. They act as place-holders to prevent a name from being +otherwise used. + +A port is destroyed, or dies, when its receive right is deallocated. +When a port dies, send and send-once rights for the port turn into dead +names. Any messages queued at the port are destroyed, which deallocates +the port rights and out-of-line memory in the messages. + +Tasks may hold multiple user-references for send rights and dead names. +When a task receives a send right which it already holds, the kernel +increments the right's user-reference count. When a task deallocates a +send right, the kernel decrements its user-reference count, and the task +only loses the send right when the count goes to zero. + +Send-once rights always have a user-reference count of one, although a +port can have multiple send-once rights, because each send-once right +held by a task has a different name. In contrast, when a task holds +send rights or a receive right for a port, the rights share a single +name. + +A message body can carry port rights; the @code{msgt_name} +(@code{msgtl_name}) field in a type descriptor specifies the type of +port right and how the port right is to be extracted from the caller. +The values @code{MACH_PORT_NULL} and @code{MACH_PORT_DEAD} are always +valid in place of a port right in a message body. In a sent message, +the following @code{msgt_name} values denote port rights: + +@table @code +@item MACH_MSG_TYPE_MAKE_SEND +The message will carry a send right, but the caller must supply a +receive right. The send right is created from the receive right, and +the receive right's make-send count is incremented. + +@item MACH_MSG_TYPE_COPY_SEND +The message will carry a send right, and the caller should supply a send +right. The user reference count for the supplied send right is not +changed. The caller may also supply a dead name and the receiving task +will get @code{MACH_PORT_DEAD}. + +@item MACH_MSG_TYPE_MOVE_SEND +The message will carry a send right, and the caller should supply a send +right. The user reference count for the supplied send right is +decremented, and the right is destroyed if the count becomes zero. +Unless a receive right remains, the name becomes available for +recycling. The caller may also supply a dead name, which loses a user +reference, and the receiving task will get @code{MACH_PORT_DEAD}. + +@item MACH_MSG_TYPE_MAKE_SEND_ONCE +The message will carry a send-once right, but the caller must supply a +receive right. The send-once right is created from the receive right. + +@item MACH_MSG_TYPE_MOVE_SEND_ONCE +The message will carry a send-once right, and the caller should supply a +send-once right. The caller loses the supplied send-once right. The +caller may also supply a dead name, which loses a user reference, and +the receiving task will get @code{MACH_PORT_DEAD}. + +@item MACH_MSG_TYPE_MOVE_RECEIVE +The message will carry a receive right, and the caller should supply a +receive right. The caller loses the supplied receive right, but retains +any send rights with the same name. +@end table + +If a message carries a send or send-once right, and the port dies while +the message is in transit, then the receiving task will get +@code{MACH_PORT_DEAD} instead of a right. The following +@code{msgt_name} values in a received message indicate that it carries +port rights: + +@table @code +@item MACH_MSG_TYPE_PORT_SEND +This name is an alias for @code{MACH_MSG_TYPE_MOVE_SEND}. The message +carried a send right. If the receiving task already has send and/or +receive rights for the port, then that name for the port will be reused. +Otherwise, the new right will have a new name. If the task already has +send rights, it gains a user reference for the right (unless this would +cause the user-reference count to overflow). Otherwise, it acquires the +send right, with a user-reference count of one. + +@item MACH_MSG_TYPE_PORT_SEND_ONCE +This name is an alias for @code{MACH_MSG_TYPE_MOVE_SEND_ONCE}. The +message carried a send-once right. The right will have a new name. + +@item MACH_MSG_TYPE_PORT_RECEIVE +This name is an alias for @code{MACH_MSG_TYPE_MOVE_RECEIVE}. The +message carried a receive right. If the receiving task already has send +rights for the port, then that name for the port will be reused. +Otherwise, the right will have a new name. The make-send count of the +receive right is reset to zero, but the port retains other attributes +like queued messages, extant send and send-once rights, and requests for +port-destroyed and no-senders notifications. +@end table + +When the kernel chooses a new name for a port right, it can choose any +name, other than @code{MACH_PORT_NULL} and @code{MACH_PORT_DEAD}, which +is not currently being used for a port right or dead name. It might +choose a name which at some previous time denoted a port right, but is +currently unused. + + +@node Memory +@subsection Memory +@cindex sending memory +@cindex receiving memory + +A message body can contain the address of a region in the sender's +address space which should be transferred as part of the message. The +message carries a logical copy of the memory, but the kernel uses VM +techniques to defer any actual page copies. Unless the sender or the +receiver modifies the data, the physical pages remain shared. + +An out-of-line transfer occurs when the data's type descriptor specifies +@code{msgt_inline} as @code{FALSE}. The address of the memory region (a +@code{vm_offset_t} or @code{vm_address_t}) should follow the type +descriptor in the message body. The type descriptor and the address +contribute to the message's size (@code{send_size}, @code{msgh_size}). +The out-of-line data does not contribute to the message's size. + +The name, size, and number fields in the type descriptor describe the +type and length of the out-of-line data, not the in-line address. +Out-of-line memory frequently requires long type descriptors +(@code{mach_msg_type_long_t}), because the @code{msgt_number} field is +too small to describe a page of 4K bytes. + +Out-of-line memory arrives somewhere in the receiver's address space as +new memory. It has the same inheritance and protection attributes as +newly @code{vm_allocate}'d memory. The receiver has the responsibility +of deallocating (with @code{vm_deallocate}) the memory when it is no +longer needed. Security-conscious receivers should exercise caution +when using out-of-line memory from untrustworthy sources, because the +memory may be backed by an unreliable memory manager. + +Null out-of-line memory is legal. If the out-of-line region size is +zero (for example, because @code{msgtl_number} is zero), then the +region's specified address is ignored. A received null out-of-line +memory region always has a zero address. + +Unaligned addresses and region sizes that are not page multiples are +legal. A received message can also contain memory with unaligned +addresses and funny sizes. In the general case, the first and last +pages in the new memory region in the receiver do not contain only data +from the sender, but are partly zero.@footnote{Sending out-of-line +memory with a non-page-aligned address, or a size which is not a page +multiple, works but with a caveat. The extra bytes in the first and +last page of the received memory are not zeroed, so the receiver can +peek at more data than the sender intended to transfer. This might be a +security problem for the sender.} The received address points to the +start of the data in the first page. This possibility doesn't +complicate deallocation, because @code{vm_deallocate} does the right +thing, rounding the start address down and the end address up to +deallocate all arrived pages. + +Out-of-line memory has a deallocate option, controlled by the +@code{msgt_deallocate} bit. If it is @code{TRUE} and the out-of-line +memory region is not null, then the region is implicitly deallocated +from the sender, as if by @code{vm_deallocate}. In particular, the +start and end addresses are rounded so that every page overlapped by the +memory region is deallocated. The use of @code{msgt_deallocate} +effectively changes the memory copy into a memory movement. In a +received message, @code{msgt_deallocate} is @code{TRUE} in type +descriptors for out-of-line memory. + +Out-of-line memory can carry port rights. + + +@node Message Send +@subsection Message Send +@cindex sending messages + +The send operation queues a message to a port. The message carries a +copy of the caller's data. After the send, the caller can freely modify +the message buffer or the out-of-line memory regions and the message +contents will remain unchanged. + +Message delivery is reliable and sequenced. Messages are not lost, and +messages sent to a port, from a single thread, are received in the order +in which they were sent. + +If the destination port's queue is full, then several things can happen. +If the message is sent to a send-once right (@code{msgh_remote_port} +carries a send-once right), then the kernel ignores the queue limit and +delivers the message. Otherwise the caller blocks until there is room +in the queue, unless the @code{MACH_SEND_TIMEOUT} or +@code{MACH_SEND_NOTIFY} options are used. If a port has several blocked +senders, then any of them may queue the next message when space in the +queue becomes available, with the proviso that a blocked sender will not +be indefinitely starved. + +These options modify @code{MACH_SEND_MSG}. If @code{MACH_SEND_MSG} is +not also specified, they are ignored. + +@table @code +@item MACH_SEND_TIMEOUT +The timeout argument should specify a maximum time (in milliseconds) for +the call to block before giving up.@footnote{If MACH_SEND_TIMEOUT is +used without MACH_SEND_INTERRUPT, then the timeout duration might not be +accurate. When the call is interrupted and automatically retried, the +original timeout is used. If interrupts occur frequently enough, the +timeout interval might never expire.} If the message can't be queued +before the timeout interval elapses, then the call returns +@code{MACH_SEND_TIMED_OUT}. A zero timeout is legitimate. + +@item MACH_SEND_NOTIFY +The notify argument should specify a receive right for a notify port. +If the send were to block, then instead the message is queued, +@code{MACH_SEND_WILL_NOTIFY} is returned, and a msg-accepted +notification is requested. If @code{MACH_SEND_TIMEOUT} is also +specified, then @code{MACH_SEND_NOTIFY} doesn't take effect until the +timeout interval elapses. + +With @code{MACH_SEND_NOTIFY}, a task can forcibly queue to a send right +one message at a time. A msg-accepted notification is sent to the the +notify port when another message can be forcibly queued. If an attempt +is made to use @code{MACH_SEND_NOTIFY} before then, the call returns a +@code{MACH_SEND_NOTIFY_IN_PROGRESS} error. + +The msg-accepted notification carries the name of the send right. If +the send right is deallocated before the msg-accepted notification is +generated, then the msg-accepted notification carries the value +@code{MACH_PORT_NULL}. If the destination port is destroyed before the +notification is generated, then a send-once notification is generated +instead. + +@item MACH_SEND_INTERRUPT +If specified, the @code{mach_msg} call will return +@code{MACH_SEND_INTERRUPTED} if a software interrupt aborts the call. +Otherwise, the send operation will be retried. + +@item MACH_SEND_CANCEL +The notify argument should specify a receive right for a notify port. +If the send operation removes the destination port right from the +caller, and the removed right had a dead-name request registered for it, +and notify is the notify port for the dead-name request, then the +dead-name request may be silently canceled (instead of resulting in a +port-deleted notification). + +This option is typically used to cancel a dead-name request made with +the @code{MACH_RCV_NOTIFY} option. It should only be used as an optimization. +@end table + +The send operation can generate the following return codes. These +return codes imply that the call did nothing: + +@table @code +@item MACH_SEND_MSG_TOO_SMALL +The specified send_size was smaller than the minimum size for a message. + +@item MACH_SEND_NO_BUFFER +A resource shortage prevented the kernel from allocating a message +buffer. + +@item MACH_SEND_INVALID_DATA +The supplied message buffer was not readable. + +@item MACH_SEND_INVALID_HEADER +The @code{msgh_bits} value was invalid. + +@item MACH_SEND_INVALID_DEST +The @code{msgh_remote_port} value was invalid. + +@item MACH_SEND_INVALID_REPLY +The @code{msgh_local_port} value was invalid. + +@item MACH_SEND_INVALID_NOTIFY +When using @code{MACH_SEND_CANCEL}, the notify argument did not denote a +valid receive right. +@end table + +These return codes imply that some or all of the message was destroyed: + +@table @code +@item MACH_SEND_INVALID_MEMORY +The message body specified out-of-line data that was not readable. + +@item MACH_SEND_INVALID_RIGHT +The message body specified a port right which the caller didn't possess. + +@item MACH_SEND_INVALID_TYPE +A type descriptor was invalid. + +@item MACH_SEND_MSG_TOO_SMALL +The last data item in the message ran over the end of the message. +@end table + +These return codes imply that the message was returned to the caller +with a pseudo-receive operation: + +@table @code +@item MACH_SEND_TIMED_OUT +The timeout interval expired. + +@item MACH_SEND_INTERRUPTED +A software interrupt occurred. + +@item MACH_SEND_INVALID_NOTIFY +When using @code{MACH_SEND_NOTIFY}, the notify argument did not denote a +valid receive right. + +@item MACH_SEND_NO_NOTIFY +A resource shortage prevented the kernel from setting up a msg-accepted +notification. + +@item MACH_SEND_NOTIFY_IN_PROGRESS +A msg-accepted notification was already requested, and hasn't yet been +generated. +@end table + +These return codes imply that the message was queued: + +@table @code +@item MACH_SEND_WILL_NOTIFY +The message was forcibly queued, and a msg-accepted notification was +requested. + +@item MACH_MSG_SUCCESS +The message was queued. +@end table + +Some return codes, like @code{MACH_SEND_TIMED_OUT}, imply that the +message was almost sent, but could not be queued. In these situations, +the kernel tries to return the message contents to the caller with a +pseudo-receive operation. This prevents the loss of port rights or +memory which only exist in the message. For example, a receive right +which was moved into the message, or out-of-line memory sent with the +deallocate bit. + +The pseudo-receive operation is very similar to a normal receive +operation. The pseudo-receive handles the port rights in the message +header as if they were in the message body. They are not reversed. +After the pseudo-receive, the message is ready to be resent. If the +message is not resent, note that out-of-line memory regions may have +moved and some port rights may have changed names. + +The pseudo-receive operation may encounter resource shortages. This is +similar to a @code{MACH_RCV_BODY_ERROR} return code from a receive +operation. When this happens, the normal send return codes are +augmented with the @code{MACH_MSG_IPC_SPACE}, @code{MACH_MSG_VM_SPACE}, +@code{MACH_MSG_IPC_KERNEL}, and @code{MACH_MSG_VM_KERNEL} bits to +indicate the nature of the resource shortage. + +The queueing of a message carrying receive rights may create a circular +loop of receive rights and messages, which can never be received. For +example, a message carrying a receive right can be sent to that receive +right. This situation is not an error, but the kernel will +garbage-collect such loops, destroying the messages and ports involved. + + +@node Message Receive +@subsection Message Receive + +The receive operation dequeues a message from a port. The receiving +task acquires the port rights and out-of-line memory regions carried in +the message. + +The @code{rcv_name} argument specifies a port or port set from which to +receive. If a port is specified, the caller must possess the receive +right for the port and the port must not be a member of a port set. If +no message is present, then the call blocks, subject to the +@code{MACH_RCV_TIMEOUT} option. + +If a port set is specified, the call will receive a message sent to any +of the member ports. It is permissible for the port set to have no +member ports, and ports may be added and removed while a receive from +the port set is in progress. The received message can come from any of +the member ports which have messages, with the proviso that a member +port with messages will not be indefinitely starved. The +@code{msgh_local_port} field in the received message header specifies +from which port in the port set the message came. + +The @code{rcv_size} argument specifies the size of the caller's message +buffer. The @code{mach_msg} call will not receive a message larger than +@code{rcv_size}. Messages that are too large are destroyed, unless the +@code{MACH_RCV_LARGE} option is used. + +The destination and reply ports are reversed in a received message +header. The @code{msgh_local_port} field names the destination port, +from which the message was received, and the @code{msgh_remote_port} +field names the reply port right. The bits in @code{msgh_bits} are also +reversed. The @code{MACH_MSGH_BITS_LOCAL} bits have the value +@code{MACH_MSG_TYPE_PORT_SEND} if the message was sent to a send right, +and the value @code{MACH_MSG_TYPE_PORT_SEND_ONCE} if was sent to a +send-once right. The @code{MACH_MSGH_BITS_REMOTE} bits describe the +reply port right. + +A received message can contain port rights and out-of-line memory. The +@code{msgh_local_port} field does not receive a port right; the act of +receiving the message destroys the send or send-once right for the +destination port. The msgh_remote_port field does name a received port +right, the reply port right, and the message body can carry port rights +and memory if @code{MACH_MSGH_BITS_COMPLEX} is present in msgh_bits. +Received port rights and memory should be consumed or deallocated in +some fashion. + +In almost all cases, @code{msgh_local_port} will specify the name of a +receive right, either @code{rcv_name} or if @code{rcv_name} is a port +set, a member of @code{rcv_name}. If other threads are concurrently +manipulating the receive right, the situation is more complicated. If +the receive right is renamed during the call, then +@code{msgh_local_port} specifies the right's new name. If the caller +loses the receive right after the message was dequeued from it, then +@code{mach_msg} will proceed instead of returning +@code{MACH_RCV_PORT_DIED}. If the receive right was destroyed, then +@code{msgh_local_port} specifies @code{MACH_PORT_DEAD}. If the receive +right still exists, but isn't held by the caller, then +@code{msgh_local_port} specifies @code{MACH_PORT_NULL}. + +Received messages are stamped with a sequence number, taken from the +port from which the message was received. (Messages received from a +port set are stamped with a sequence number from the appropriate member +port.) Newly created ports start with a zero sequence number, and the +sequence number is reset to zero whenever the port's receive right moves +between tasks. When a message is dequeued from the port, it is stamped +with the port's sequence number and the port's sequence number is then +incremented. The dequeue and increment operations are atomic, so that +multiple threads receiving messages from a port can use the +@code{msgh_seqno} field to reconstruct the original order of the +messages. + +These options modify @code{MACH_RCV_MSG}. If @code{MACH_RCV_MSG} is not +also specified, they are ignored. + +@table @code +@item MACH_RCV_TIMEOUT +The timeout argument should specify a maximum time (in milliseconds) for +the call to block before giving up.@footnote{If MACH_RCV_TIMEOUT is used +without MACH_RCV_INTERRUPT, then the timeout duration might not be +accurate. When the call is interrupted and automatically retried, the +original timeout is used. If interrupts occur frequently enough, the +timeout interval might never expire.} If no message arrives before the +timeout interval elapses, then the call returns +@code{MACH_RCV_TIMED_OUT}. A zero timeout is legitimate. + +@item MACH_RCV_NOTIFY +The notify argument should specify a receive right for a notify port. +If receiving the reply port creates a new port right in the caller, then +the notify port is used to request a dead-name notification for the new +port right. + +@item MACH_RCV_INTERRUPT +If specified, the @code{mach_msg} call will return +@code{MACH_RCV_INTERRUPTED} if a software interrupt aborts the call. +Otherwise, the receive operation will be retried. + +@item MACH_RCV_LARGE +If the message is larger than @code{rcv_size}, then the message remains +queued instead of being destroyed. The call returns +@code{MACH_RCV_TOO_LARGE} and the actual size of the message is returned +in the @code{msgh_size} field of the message header. +@end table + +The receive operation can generate the following return codes. These +return codes imply that the call did not dequeue a message: + +@table @code +@item MACH_RCV_INVALID_NAME +The specified @code{rcv_name} was invalid. + +@item MACH_RCV_IN_SET +The specified port was a member of a port set. + +@item MACH_RCV_TIMED_OUT +The timeout interval expired. + +@item MACH_RCV_INTERRUPTED +A software interrupt occurred. + +@item MACH_RCV_PORT_DIED +The caller lost the rights specified by @code{rcv_name}. + +@item MACH_RCV_PORT_CHANGED +@code{rcv_name} specified a receive right which was moved into a port +set during the call. + +@item MACH_RCV_TOO_LARGE +When using @code{MACH_RCV_LARGE}, and the message was larger than +@code{rcv_size}. The message is left queued, and its actual size is +returned in the @code{msgh_size} field of the message buffer. +@end table + +These return codes imply that a message was dequeued and destroyed: + +@table @code +@item MACH_RCV_HEADER_ERROR +A resource shortage prevented the reception of the port rights in the +message header. + +@item MACH_RCV_INVALID_NOTIFY +When using @code{MACH_RCV_NOTIFY}, the notify argument did not denote a +valid receive right. + +@item MACH_RCV_TOO_LARGE +When not using @code{MACH_RCV_LARGE}, a message larger than +@code{rcv_size} was dequeued and destroyed. +@end table + +In these situations, when a message is dequeued and then destroyed, the +reply port and all port rights and memory in the message body are +destroyed. However, the caller receives the message's header, with all +fields correct, including the destination port but excepting the reply +port, which is @code{MACH_PORT_NULL}. + +These return codes imply that a message was received: + +@table @code +@item MACH_RCV_BODY_ERROR +A resource shortage prevented the reception of a port right or +out-of-line memory region in the message body. The message header, +including the reply port, is correct. The kernel attempts to transfer +all port rights and memory regions in the body, and only destroys those +that can't be transferred. + +@item MACH_RCV_INVALID_DATA +The specified message buffer was not writable. The calling task did +successfully receive the port rights and out-of-line memory regions in +the message. + +@item MACH_MSG_SUCCESS +A message was received. +@end table + +Resource shortages can occur after a message is dequeued, while +transferring port rights and out-of-line memory regions to the receiving +task. The @code{mach_msg} call returns @code{MACH_RCV_HEADER_ERROR} or +@code{MACH_RCV_BODY_ERROR} in this situation. These return codes always +carry extra bits (bitwise-ored) that indicate the nature of the resource +shortage: + +@table @code +@item MACH_MSG_IPC_SPACE +There was no room in the task's IPC name space for another port name. + +@item MACH_MSG_VM_SPACE +There was no room in the task's VM address space for an out-of-line +memory region. + +@item MACH_MSG_IPC_KERNEL +A kernel resource shortage prevented the reception of a port right. + +@item MACH_MSG_VM_KERNEL +A kernel resource shortage prevented the reception of an out-of-line +memory region. +@end table + +If a resource shortage prevents the reception of a port right, the port +right is destroyed and the caller sees the name @code{MACH_PORT_NULL}. +If a resource shortage prevents the reception of an out-of-line memory +region, the region is destroyed and the caller receives a zero address. +In addition, the @code{msgt_size} (@code{msgtl_size}) field in the +data's type descriptor is changed to zero. If a resource shortage +prevents the reception of out-of-line memory carrying port rights, then +the port rights are always destroyed if the memory region can not be +received. A task never receives port rights or memory regions that it +isn't told about. + + +@node Atomicity +@subsection Atomicity + +The @code{mach_msg} call handles port rights in a message header +atomically. Port rights and out-of-line memory in a message body do not +enjoy this atomicity guarantee. The message body may be processed +front-to-back, back-to-front, first out-of-line memory then port rights, +in some random order, or even atomically. + +For example, consider sending a message with the destination port +specified as @code{MACH_MSG_TYPE_MOVE_SEND} and the reply port specified +as @code{MACH_MSG_TYPE_COPY_SEND}. The same send right, with one +user-reference, is supplied for both the @code{msgh_remote_port} and +@code{msgh_local_port} fields. Because @code{mach_msg} processes the +message header atomically, this succeeds. If @code{msgh_remote_port} +were processed before @code{msgh_local_port}, then @code{mach_msg} would +return @code{MACH_SEND_INVALID_REPLY} in this situation. + +On the other hand, suppose the destination and reply port are both +specified as @code{MACH_MSG_TYPE_MOVE_SEND}, and again the same send +right with one user-reference is supplied for both. Now the send +operation fails, but because it processes the header atomically, +mach_msg can return either @code{MACH_SEND_INVALID_DEST} or +@code{MACH_SEND_INVALID_REPLY}. + +For example, consider receiving a message at the same time another +thread is deallocating the destination receive right. Suppose the reply +port field carries a send right for the destination port. If the +deallocation happens before the dequeuing, then the receiver gets +@code{MACH_RCV_PORT_DIED}. If the deallocation happens after the +receive, then the @code{msgh_local_port} and the @code{msgh_remote_port} +fields both specify the same right, which becomes a dead name when the +receive right is deallocated. If the deallocation happens between the +dequeue and the receive, then the @code{msgh_local_port} and +@code{msgh_remote_port} fields both specify @code{MACH_PORT_DEAD}. +Because the header is processed atomically, it is not possible for just +one of the two fields to hold @code{MACH_PORT_DEAD}. + +The @code{MACH_RCV_NOTIFY} option provides a more likely example. +Suppose a message carrying a send-once right reply port is received with +@code{MACH_RCV_NOTIFY} at the same time the reply port is destroyed. If +the reply port is destroyed first, then @code{msgh_remote_port} +specifies @code{MACH_PORT_DEAD} and the kernel does not generate a +dead-name notification. If the reply port is destroyed after it is +received, then @code{msgh_remote_port} specifies a dead name for which +the kernel generates a dead-name notification. It is not possible to +receive the reply port right and have it turn into a dead name before +the dead-name notification is requested; as part of the message header +the reply port is received atomically. + + +@node Port Manipulation Interface +@section Port Manipulation Interface + +This section describes the interface to create, destroy and manipulate +ports, port rights and port sets. + +@cindex IPC space port +@cindex port representing an IPC space +@deftp {Data type} ipc_space_t +This is a @code{task_t} (and as such a @code{mach_port_t}), which holds +a port name associated with a port that represents an IPC space in the +kernel. An IPC space is used by the kernel to manage the port names and +rights available to a task. The IPC space doesn't get a port name of +its own. Instead the port name of the task containing the IPC space is +used to name the IPC space of the task (as is indicated by the fact that +the type of @code{ipc_space_t} is actually @code{task_t}). + +The IPC spaces of tasks are the only ones accessible outside of +the kernel. +@end deftp + +@menu +* Port Creation:: How to create new ports and port sets. +* Port Destruction:: How to destroy ports and port sets. +* Port Names:: How to query and manipulate port names. +* Port Rights:: How to work with port rights. +* Ports and other Tasks:: How to move rights between tasks. +* Receive Rights:: How to work with receive rights. +* Port Sets:: How to work with port sets. +* Request Notifications:: How to request notifications for events. +@c * Inherited Ports:: How to work with the inherited system ports. +@end menu + + +@node Port Creation +@subsection Port Creation + +@deftypefun kern_return_t mach_port_allocate (@w{ipc_space_t @var{task}}, @w{mach_port_right_t @var{right}}, @w{mach_port_t *@var{name}}) +The @code{mach_port_allocate} function creates a new right in the +specified task. The new right's name is returned in @var{name}, which +may be any name that wasn't in use. + +The @var{right} argument takes the following values: + +@table @code +@item MACH_PORT_RIGHT_RECEIVE +@code{mach_port_allocate} creates a port. The new port is not a member +of any port set. It doesn't have any extant send or send-once rights. +Its make-send count is zero, its sequence number is zero, its queue +limit is @code{MACH_PORT_QLIMIT_DEFAULT}, and it has no queued messages. +@var{name} denotes the receive right for the new port. + +@var{task} does not hold send rights for the new port, only the receive +right. @code{mach_port_insert_right} and @code{mach_port_extract_right} +can be used to convert the receive right into a combined send/receive +right. + +@item MACH_PORT_RIGHT_PORT_SET +@code{mach_port_allocate} creates a port set. The new port set has no +members. + +@item MACH_PORT_RIGHT_DEAD_NAME +@code{mach_port_allocate} creates a dead name. The new dead name has +one user reference. +@end table + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_VALUE} if @var{right} was invalid, @code{KERN_NO_SPACE} if +there was no room in @var{task}'s IPC name space for another right and +@code{KERN_RESOURCE_SHORTAGE} if the kernel ran out of memory. + +The @code{mach_port_allocate} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + +@deftypefun mach_port_t mach_reply_port () +The @code{mach_reply_port} system call creates a reply port in the +calling task. + +@code{mach_reply_port} creates a port, giving the calling task the +receive right for the port. The call returns the name of the new +receive right. + +This is very much like creating a receive right with the +@code{mach_port_allocate} call, with two differences. First, +@code{mach_reply_port} is a system call and not an RPC (which requires a +reply port). Second, the port created by @code{mach_reply_port} may be +optimized for use as a reply port. + +The function returns @code{MACH_PORT_NULL} if a resource shortage +prevented the creation of the receive right. +@end deftypefun + +@deftypefun kern_return_t mach_port_allocate_name (@w{ipc_space_t @var{task}}, @w{mach_port_right_t @var{right}}, @w{mach_port_t @var{name}}) +The function @code{mach_port_allocate_name} creates a new right in the +specified task, with a specified name for the new right. @var{name} +must not already be in use for some right, and it can't be the reserved +values @code{MACH_PORT_NULL} and @code{MACH_PORT_DEAD}. + +The @var{right} argument takes the following values: + +@table @code +@item MACH_PORT_RIGHT_RECEIVE +@code{mach_port_allocate_name} creates a port. The new port is not a +member of any port set. It doesn't have any extant send or send-once +rights. Its make-send count is zero, its sequence number is zero, its +queue limit is @code{MACH_PORT_QLIMIT_DEFAULT}, and it has no queued +messages. @var{name} denotes the receive right for the new port. + +@var{task} does not hold send rights for the new port, only the receive +right. @code{mach_port_insert_right} and @code{mach_port_extract_right} +can be used to convert the receive right into a combined send/receive +right. + +@item MACH_PORT_RIGHT_PORT_SET +@code{mach_port_allocate_name} creates a port set. The new port set has +no members. + +@item MACH_PORT_RIGHT_DEAD_NAME +@code{mach_port_allocate_name} creates a new dead name. The new dead +name has one user reference. +@end table + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_VALUE} if @var{right} was invalid or @var{name} was +@code{MACH_PORT_NULL} or @code{MACH_PORT_DEAD}, @code{KERN_NAME_EXISTS} +if @var{name} was already in use for a port right and +@code{KERN_RESOURCE_SHORTAGE} if the kernel ran out of memory. + +The @code{mach_port_allocate_name} call is actually an RPC to +@var{task}, normally a send right for a task port, but potentially any +send right. In addition to the normal diagnostic return codes from the +call's server (normally the kernel), the call may return @code{mach_msg} +return codes. +@end deftypefun + + +@node Port Destruction +@subsection Port Destruction + +@deftypefun kern_return_t mach_port_deallocate (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}) +The function @code{mach_port_deallocate} releases a user reference for a +right in @var{task}'s IPC name space. It allows a task to release a +user reference for a send or send-once right without failing if the port +has died and the right is now actually a dead name. + +If @var{name} denotes a dead name, send right, or send-once right, then +the right loses one user reference. If it only had one user reference, +then the right is destroyed. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{name} did not denote a right and +@code{KERN_INVALID_RIGHT} if @var{name} denoted an invalid right. + +The @code{mach_port_deallocate} call is actually an RPC to +@var{task}, normally a send right for a task port, but potentially any +send right. In addition to the normal diagnostic return codes from the +call's server (normally the kernel), the call may return @code{mach_msg} +return codes. +@end deftypefun + +@deftypefun kern_return_t mach_port_destroy (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}) +The function @code{mach_port_destroy} deallocates all rights denoted by +a name. The name becomes immediately available for reuse. + +For most purposes, @code{mach_port_mod_refs} and +@code{mach_port_deallocate} are preferable. + +If @var{name} denotes a port set, then all members of the port set are +implicitly removed from the port set. + +If @var{name} denotes a receive right that is a member of a port set, +the receive right is implicitly removed from the port set. If there is +a port-destroyed request registered for the port, then the receive right +is not actually destroyed, but instead is sent in a port-destroyed +notification to the backup port. If there is no registered +port-destroyed request, remaining messages queued to the port are +destroyed and extant send and send-once rights turn into dead names. If +those send and send-once rights have dead-name requests registered, then +dead-name notifications are generated for them. + +If @var{name} denotes a send-once right, then the send-once right is +used to produce a send-once notification for the port. + +If @var{name} denotes a send-once, send, and/or receive right, and it +has a dead-name request registered, then the registered send-once right +is used to produce a port-deleted notification for the name. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{name} did not denote a right. + +The @code{mach_port_destroy} call is actually an RPC to +@var{task}, normally a send right for a task port, but potentially any +send right. In addition to the normal diagnostic return codes from the +call's server (normally the kernel), the call may return @code{mach_msg} +return codes. +@end deftypefun + + +@node Port Names +@subsection Port Names + +@deftypefun kern_return_t mach_port_names (@w{ipc_space_t @var{task}}, @w{mach_port_array_t *@var{names}}, @w{mach_msg_type_number_t *@var{ncount}}, @w{mach_port_type_array_t *@var{types}}, @w{mach_msg_type_number_t *@var{tcount}}) +The function @code{mach_port_names} returns information about +@var{task}'s port name space. For each name, it also returns what type +of rights @var{task} holds. (The same information returned by +@code{mach_port_type}.) @var{names} and @var{types} are arrays that are +automatically allocated when the reply message is received. The user +should @code{vm_deallocate} them when the data is no longer needed. + +@code{mach_port_names} will return in @var{names} the names of the +ports, port sets, and dead names in the task's port name space, in no +particular order and in @var{ncount} the number of names returned. It +will return in @var{types} the type of each corresponding name, which +indicates what kind of rights the task holds with that name. +@var{tcount} should be the same as @var{ncount}. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_RESOURCE_SHORTAGE} if the kernel ran out of memory. + +The @code{mach_port_names} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + +@deftypefun kern_return_t mach_port_type (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_port_type_t *@var{ptype}}) +The function @code{mach_port_type} returns information about +@var{task}'s rights for a specific name in its port name space. The +returned @var{ptype} is a bitmask indicating what rights @var{task} +holds for the port, port set or dead name. The bitmask is composed of +the following bits: + +@table @code +@item MACH_PORT_TYPE_SEND +The name denotes a send right. + +@item MACH_PORT_TYPE_RECEIVE +The name denotes a receive right. + +@item MACH_PORT_TYPE_SEND_ONCE +The name denotes a send-once right. + +@item MACH_PORT_TYPE_PORT_SET +The name denotes a port set. + +@item MACH_PORT_TYPE_DEAD_NAME +The name is a dead name. + +@item MACH_PORT_TYPE_DNREQUEST +A dead-name request has been registered for the right. + +@item MACH_PORT_TYPE_MAREQUEST +A msg-accepted request for the right is pending. + +@item MACH_PORT_TYPE_COMPAT +The port right was created in the compatibility mode. +@end table + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid and +@code{KERN_INVALID_NAME} if @var{name} did not denote a right. + +The @code{mach_port_type} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + +@deftypefun kern_return_t mach_port_rename (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{old_name}}, @w{mach_port_t @var{new_name}}) +The function @code{mach_port_rename} changes the name by which a port, +port set, or dead name is known to @var{task}. @var{old_name} is the +original name and @var{new_name} the new name for the port right. +@var{new_name} must not already be in use, and it can't be the +distinguished values @code{MACH_PORT_NULL} and @code{MACH_PORT_DEAD}. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{old_name} did not denote a right, +@code{KERN_INVALID_VALUE} if @var{new_name} was @code{MACH_PORT_NULL} or +@code{MACH_PORT_DEAD}, @code{KERN_NAME_EXISTS} if @code{new_name} +already denoted a right and @code{KERN_RESOURCE_SHORTAGE} if the kernel +ran out of memory. + +The @code{mach_port_rename} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + + +@node Port Rights +@subsection Port Rights + +@deftypefun kern_return_t mach_port_get_refs (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_port_right_t @var{right}}, @w{mach_port_urefs_t *@var{refs}}) +The function @code{mach_port_get_refs} returns the number of user +references a task has for a right. + +The @var{right} argument takes the following values: +@itemize @bullet +@item @code{MACH_PORT_RIGHT_SEND} +@item @code{MACH_PORT_RIGHT_RECEIVE} +@item @code{MACH_PORT_RIGHT_SEND_ONCE} +@item @code{MACH_PORT_RIGHT_PORT_SET} +@item @code{MACH_PORT_RIGHT_DEAD_NAME} +@end itemize + +If @var{name} denotes a right, but not the type of right specified, then +zero is returned. Otherwise a positive number of user references is +returned. Note that a name may simultaneously denote send and receive +rights. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_VALUE} if @var{right} was invalid and +@code{KERN_INVALID_NAME} if @var{name} did not denote a right. + +The @code{mach_port_get_refs} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + +@deftypefun kern_return_t mach_port_mod_refs (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_port_right_t @var{right}}, @w{mach_port_delta_t @var{delta}}) +The function @code{mach_port_mod_refs} requests that the number of user +references a task has for a right be changed. This results in the right +being destroyed, if the number of user references is changed to zero. +The task holding the right is @var{task}, @var{name} should denote the +specified right. @var{right} denotes the type of right being modified. +@var{delta} is the signed change to the number of user references. + +The @var{right} argument takes the following values: +@itemize @bullet +@item @code{MACH_PORT_RIGHT_SEND} +@item @code{MACH_PORT_RIGHT_RECEIVE} +@item @code{MACH_PORT_RIGHT_SEND_ONCE} +@item @code{MACH_PORT_RIGHT_PORT_SET} +@item @code{MACH_PORT_RIGHT_DEAD_NAME} +@end itemize + +The number of user references for the right is changed by the amount +@var{delta}, subject to the following restrictions: port sets, receive +rights, and send-once rights may only have one user reference. The +resulting number of user references can't be negative. If the resulting +number of user references is zero, the effect is to deallocate the +right. For dead names and send rights, there is an +implementation-defined maximum number of user references. + +If the call destroys the right, then the effect is as described for +@code{mach_port_destroy}, with the exception that +@code{mach_port_destroy} simultaneously destroys all the rights denoted +by a name, while @code{mach_port_mod_refs} can only destroy one right. +The name will be available for reuse if it only denoted the one right. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_VALUE} if @var{right} was invalid or the +user-reference count would become negative, @code{KERN_INVALID_NAME} if +@var{name} did not denote a right, @code{KERN_INVALID_RIGHT} if +@var{name} denoted a right, but not the specified right and +@code{KERN_UREFS_OVERFLOW} if the user-reference count would overflow. + +The @code{mach_port_mod_refs} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + + +@node Ports and other Tasks +@subsection Ports and other Tasks + +@deftypefun kern_return_t mach_port_insert_right (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_port_t @var{right}}, @w{mach_msg_type_name_t @var{right_type}}) +The function @var{mach_port_insert_right} inserts into @var{task} the +caller's right for a port, using a specified name for the right in the +target task. + +The specified @var{name} can't be one of the reserved values +@code{MACH_PORT_NULL} or @code{MACH_PORT_DEAD}. The @var{right} can't +be @code{MACH_PORT_NULL} or @code{MACH_PORT_DEAD}. + +The argument @var{right_type} specifies a right to be inserted and how +that right should be extracted from the caller. It should be a value +appropriate for @var{msgt_name}; see @code{mach_msg}. @c XXX cross ref + +If @var{right_type} is @code{MACH_MSG_TYPE_MAKE_SEND}, +@code{MACH_MSG_TYPE_MOVE_SEND}, or @code{MACH_MSG_TYPE_COPY_SEND}, then +a send right is inserted. If the target already holds send or receive +rights for the port, then @var{name} should denote those rights in the +target. Otherwise, @var{name} should be unused in the target. If the +target already has send rights, then those send rights gain an +additional user reference. Otherwise, the target gains a send right, +with a user reference count of one. + +If @var{right_type} is @code{MACH_MSG_TYPE_MAKE_SEND_ONCE} or +@code{MACH_MSG_TYPE_MOVE_SEND_ONCE}, then a send-once right is inserted. +The name should be unused in the target. The target gains a send-once +right. + +If @var{right_type} is @code{MACH_MSG_TYPE_MOVE_RECEIVE}, then a receive +right is inserted. If the target already holds send rights for the +port, then name should denote those rights in the target. Otherwise, +name should be unused in the target. The receive right is moved into +the target task. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_VALUE} if @var{right} was not a port right or +@var{name} was @code{MACH_PORT_NULL} or @code{MACH_PORT_DEAD}, +@code{KERN_NAME_EXISTS} if @var{name} already denoted a right, +@code{KERN_INVALID_CAPABILITY} if @var{right} was @code{MACH_PORT_NULL} +or @code{MACH_PORT_DEAD} @code{KERN_RIGHT_EXISTS} if @var{task} already +had rights for the port, with a different name, +@code{KERN_UREFS_OVERFLOW} if the user-reference count would overflow +and @code{KERN_RESOURCE_SHORTAGE} if the kernel ran out of memory. + +The @code{mach_port_insert_right} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + +@deftypefun kern_return_t mach_port_extract_right (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_msg_type_name_t @var{desired_type}}, @w{mach_port_t *@var{right}}, @w{mach_msg_type_name_t *@var{acquired_type}}) +The function @var{mach_port_extract_right} extracts a port right from +the target @var{task} and returns it to the caller as if the task sent +the right voluntarily, using @var{desired_type} as the value of +@var{msgt_name}. @xref{Mach Message Call}. + +The returned value of @var{acquired_type} will be +@code{MACH_MSG_TYPE_PORT_SEND} if a send right is extracted, +@code{MACH_MSG_TYPE_PORT_RECEIVE} if a receive right is extracted, and +@code{MACH_MSG_TYPE_PORT_SEND_ONCE} if a send-once right is extracted. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{name} did not denote a right, +@code{KERN_INVALID_RIGHT} if @var{name} denoted a right, but an invalid one, +@code{KERN_INVALID_VALUE} if @var{desired_type} was invalid. + +The @code{mach_port_extract_right} call is actually an RPC to +@var{task}, normally a send right for a task port, but potentially any +send right. In addition to the normal diagnostic return codes from the +call's server (normally the kernel), the call may return @code{mach_msg} +return codes. +@end deftypefun + + +@node Receive Rights +@subsection Receive Rights + +@deftp {Data type} mach_port_seqno_t +The @code{mach_port_seqno_t} data type is an @code{unsigned int} which +contains the sequence number of a port. +@end deftp + +@deftp {Data type} mach_port_mscount_t +The @code{mach_port_mscount_t} data type is an @code{unsigned int} which +contains the make-send count for a port. +@end deftp + +@deftp {Data type} mach_port_msgcount_t +The @code{mach_port_msgcount_t} data type is an @code{unsigned int} which +contains a number of messages. +@end deftp + +@deftp {Data type} mach_port_rights_t +The @code{mach_port_rights_t} data type is an @code{unsigned int} which +contains a number of rights for a port. +@end deftp + +@deftp {Data type} mach_port_status_t +This structure contains some status information about a port, which can +be queried with @code{mach_port_get_receive_status}. It has the following +members: + +@table @code +@item mach_port_t mps_pset +The containing port set. + +@item mach_port_seqno_t mps_seqno +The sequence number. + +@item mach_port_mscount_t mps_mscount +The make-send count. + +@item mach_port_msgcount_t mps_qlimit +The maximum number of messages in the queue. + +@item mach_port_msgcount_t mps_msgcount +The current number of messages in the queue. + +@item mach_port_rights_t mps_sorights +The number of send-once rights that exist. + +@item boolean_t mps_srights +@code{TRUE} if send rights exist. + +@item boolean_t mps_pdrequest +@code{TRUE} if port-deleted notification is requested. + +@item boolean_t mps_nsrequest +@code{TRUE} if no-senders notification is requested. +@end table +@end deftp + +@deftypefun kern_return_t mach_port_get_receive_status (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_port_status_t *@var{status}}) +The function @code{mach_port_get_receive_status} returns the current +status of the specified receive right. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{name} did not denote a right and +@code{KERN_INVALID_RIGHT} if @var{name} denoted a right, but not a +receive right. + +The @code{mach_port_get_receive_status} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + +@deftypefun kern_return_t mach_port_set_mscount (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_port_mscount_t @var{mscount}}) +The function @code{mach_port_set_mscount} changes the make-send count of +@var{task}'s receive right named @var{name} to @var{mscount}. All +values for @var{mscount} are valid. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{name} did not denote a right and +@code{KERN_INVALID_RIGHT} if @var{name} denoted a right, but not a +receive right. + +The @code{mach_port_set_mscount} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + +@deftypefun kern_return_t mach_port_set_qlimit (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_port_msgcount_t @var{qlimit}}) +The function @code{mach_port_set_qlimit} changes the queue limit +@var{task}'s receive right named @var{name} to @var{qlimit}. Valid +values for @var{qlimit} are between zero and +@code{MACH_PORT_QLIMIT_MAX}, inclusive. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{name} did not denote a right, +@code{KERN_INVALID_RIGHT} if @var{name} denoted a right, but not a +receive right and @code{KERN_INVALID_VALUE} if @var{qlimit} was invalid. + +The @code{mach_port_set_qlimit} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + +@deftypefun kern_return_t mach_port_set_seqno (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_port_seqno_t @var{seqno}}) +The function @code{mach_port_set_seqno} changes the sequence number +@var{task}'s receive right named @var{name} to @var{seqno}. All +sequence number values are valid. The next message received from the +port will be stamped with the specified sequence number. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{name} did not denote a right and +@code{KERN_INVALID_RIGHT} if @var{name} denoted a right, but not a +receive right. + +The @code{mach_port_set_seqno} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + + +@node Port Sets +@subsection Port Sets + +@deftypefun kern_return_t mach_port_get_set_status (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_port_array_t *@var{members}}, @w{mach_msg_type_number_t *@var{count}}) +The function @code{mach_port_get_set_status} returns the members of a +port set. @var{members} is an array that is automatically allocated +when the reply message is received. The user should +@code{vm_deallocate} it when the data is no longer needed. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{name} did not denote a right, +@code{KERN_INVALID_RIGHT} if @var{name} denoted a right, but not a +receive right and @code{KERN_RESOURCE_SHORTAGE} if the kernel ran out of +memory. + +The @code{mach_port_get_set_status} call is actually an RPC to +@var{task}, normally a send right for a task port, but potentially any +send right. In addition to the normal diagnostic return codes from the +call's server (normally the kernel), the call may return @code{mach_msg} +return codes. +@end deftypefun + +@deftypefun kern_return_t mach_port_move_member (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{member}}, @w{mach_port_t @var{after}}) +The function @var{mach_port_move_member} moves the receive right +@var{member} into the port set @var{after}. If the receive right is +already a member of another port set, it is removed from that set first +(the whole operation is atomic). If the port set is +@code{MACH_PORT_NULL}, then the receive right is not put into a port +set, but removed from its current port set. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_NAME} if @var{member} or @var{after} did not denote a +right, @code{KERN_INVALID_RIGHT} if @var{member} denoted a right, but +not a receive right or @var{after} denoted a right, but not a port set, +and @code{KERN_NOT_IN_SET} if @var{after} was @code{MACH_PORT_NULL}, but +@code{member} wasn't currently in a port set. + +The @code{mach_port_move_member} call is actually an RPC to @var{task}, +normally a send right for a task port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + + +@node Request Notifications +@subsection Request Notifications + +@deftypefun kern_return_t mach_port_request_notification (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{mach_msg_id_t @var{variant}}, @w{mach_port_mscount_t @var{sync}}, @w{mach_port_t @var{notify}}, @w{mach_msg_type_name_t @var{notify_type}}, @w{mach_port_t *@var{previous}}) +The function @code{mach_port_request_notification} registers a request +for a notification and supplies the send-once right @var{notify} to +which the notification will be sent. The @var{notify_type} denotes the +IPC type for the send-once right, which can be +@code{MACH_MSG_TYPE_MAKE_SEND_ONCE} or +@code{MACH_MSG_TYPE_MOVE_SEND_ONCE}. It is an atomic swap, returning +the previously registered send-once right (or @code{MACH_PORT_NULL} for +none) in @var{previous}. A previous notification request may be +cancelled by providing @code{MACH_PORT_NULL} for @var{notify}. + +The @var{variant} argument takes the following values: + +@table @code +@item MACH_NOTIFY_PORT_DESTROYED +@var{sync} must be zero. The @var{name} must specify a receive right, +and the call requests a port-destroyed notification for the receive +right. If the receive right were to have been destroyed, say by +@code{mach_port_destroy}, then instead the receive right will be sent in +a port-destroyed notification to the registered send-once right. + +@item MACH_NOTIFY_DEAD_NAME +The call requests a dead-name notification. @var{name} specifies send, +receive, or send-once rights for a port. If the port is destroyed (and +the right remains, becoming a dead name), then a dead-name notification +which carries the name of the right will be sent to the registered +send-once right. If @var{notify} is not null and sync is non-zero, the +name may specify a dead name, and a dead-name notification is +immediately generated. + +Whenever a dead-name notification is generated, the user reference count +of the dead name is incremented. For example, a send right with two +user refs has a registered dead-name request. If the port is destroyed, +the send right turns into a dead name with three user refs (instead of +two), and a dead-name notification is generated. + +If the name is made available for reuse, perhaps because of +@code{mach_port_destroy} or @code{mach_port_mod_refs}, or the name +denotes a send-once right which has a message sent to it, then the +registered send-once right is used to generate a port-deleted +notification. + +@item MACH_NOTIFY_NO_SENDERS +The call requests a no-senders notification. @var{name} must specify a +receive right. If @var{notify} is not null, and the receive right's +make-send count is greater than or equal to the sync value, and it has +no extant send rights, than an immediate no-senders notification is +generated. Otherwise the notification is generated when the receive +right next loses its last extant send right. In either case, any +previously registered send-once right is returned. + +The no-senders notification carries the value the port's make-send count +had when it was generated. The make-send count is incremented whenever +@code{MACH_MSG_TYPE_MAKE_SEND} is used to create a new send right from +the receive right. The make-send count is reset to zero when the +receive right is carried in a message. +@end table + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_TASK} if @var{task} was invalid, +@code{KERN_INVALID_VALUE} if @var{variant} was invalid, +@code{KERN_INVALID_NAME} if @var{name} did not denote a right, +@code{KERN_INVALID_RIGHT} if @var{name} denoted an invalid right and +@code{KERN_INVALID_CAPABILITY} if @var{notify} was invalid. + +When using @code{MACH_NOTIFY_PORT_DESTROYED}, the function returns +@code{KERN_INVALID_VALUE} if @var{sync} wasn't zero. + +When using @code{MACH_NOTIFY_DEAD_NAME}, the function returns +@code{KERN_RESOURCE_SHORTAGE} if the kernel ran out of memory, +@code{KERN_INVALID_ARGUMENT} if @var{name} denotes a dead name, but +@var{sync} is zero or @var{notify} is @code{MACH_PORT_NULL}, and +@code{KERN_UREFS_OVERFLOW} if @var{name} denotes a dead name, but +generating an immediate dead-name notification would overflow the name's +user-reference count. + +The @code{mach_port_request_notification} call is actually an RPC to +@var{task}, normally a send right for a task port, but potentially any +send right. In addition to the normal diagnostic return codes from the +call's server (normally the kernel), the call may return @code{mach_msg} +return codes. +@end deftypefun + +@c The inherited ports concept is not used in the Hurd, +@c and so the _SLOT macros are not defined in GNU Mach. + +@c @node Inherited Ports +@c @subsection Inherited Ports + +@c @deftypefun kern_return_t mach_ports_register (@w{task_t @var{target_task}, @w{port_array_t @var{init_port_set}}, @w{int @var{init_port_array_count}}) +@c @deftypefunx kern_return_t mach_ports_lookup (@w{task_t @var{target_task}, @w{port_array_t *@var{init_port_set}}, @w{int *@var{init_port_array_count}}) +@c @code{mach_ports_register} manipulates the inherited ports array, +@c @code{mach_ports_lookup} is used to acquire specific parent ports. +@c @var{target_task} is the task to be affected. @var{init_port_set} is an +@c array of system ports to be registered, or returned. Although the array +@c size is given as variable, the kernel will only accept a limited number +@c of ports. @var{init_port_array_count} is the number of ports returned +@c in @var{init_port_set}. + +@c @code{mach_ports_register} registers an array of well-known system ports +@c with the kernel on behalf of a specific task. Currently the ports to be +@c registered are: the port to the Network Name Server, the port to the +@c Environment Manager, and a port to the Service server. These port +@c values must be placed in specific slots in the init_port_set. The slot +@c numbers are given by the global constants defined in @file{mach_init.h}: +@c @code{NAME_SERVER_SLOT}, @code{ENVIRONMENT_SLOT}, and +@c @code{SERVICE_SLOT}. These ports may later be retrieved with +@c @code{mach_ports_lookup}. + +@c When a new task is created (see @code{task_create}), the child task will +@c be given access to these ports. Only port send rights may be +@c registered. Furthermore, the number of ports which may be registered is +@c fixed and given by the global constant @code{MACH_PORT_SLOTS_USED} +@c Attempts to register too many ports will fail. + +@c It is intended that this mechanism be used only for task initialization, +@c and then only by runtime support modules. A parent task has three +@c choices in passing these system ports to a child task. Most commonly it +@c can do nothing and its child will inherit access to the same +@c @var{init_port_set} that the parent has; or a parent task may register a +@c set of ports it wishes to have passed to all of its children by calling +@c @code{mach_ports_register} using its task port; or it may make necessary +@c modifications to the set of ports it wishes its child to see, and then +@c register those ports using the child's task port prior to starting the +@c child's thread(s). The @code{mach_ports_lookup} call which is done by +@c @code{mach_init} in the child task will acquire these initial ports for +@c the child. + +@c Tasks other than the Network Name Server and the Environment Mangager +@c should not need access to the Service port. The Network Name Server port +@c is the same for all tasks on a given machine. The Environment port is +@c the only port likely to have different values for different tasks. + +@c Since the number of ports which may be registered is limited, ports +@c other than those used by the runtime system to initialize a task should +@c be passed to children either through an initial message, or through the +@c Network Name Server for public ports, or the Environment Manager for +@c private ports. + +@c The function returns @code{KERN_SUCCESS} if the memory was allocated, +@c and @code{KERN_INVALID_ARGUMENT} if an attempt was made to register more +@c ports than the current kernel implementation allows. +@c @end deftypefun + + +@node Virtual Memory Interface +@chapter Virtual Memory Interface + +@cindex virtual memory map port +@cindex port representing a virtual memory map +@deftp {Data type} vm_task_t +This is a @code{task_t} (and as such a @code{mach_port_t}), which holds +a port name associated with a port that represents a virtual memory map +in the kernel. An virtual memory map is used by the kernel to manage +the address space of a task. The virtual memory map doesn't get a port +name of its own. Instead the port name of the task provided with the +virtual memory is used to name the virtual memory map of the task (as is +indicated by the fact that the type of @code{vm_task_t} is actually +@code{task_t}). + +The virtual memory maps of tasks are the only ones accessible outside of +the kernel. +@end deftp + +@menu +* Memory Allocation:: Allocation of new virtual memory. +* Memory Deallocation:: Freeing unused virtual memory. +* Data Transfer:: Reading, writing and copying memory. +* Memory Attributes:: Tweaking memory regions. +* Mapping Memory Objects:: How to map memory objects. +* Memory Statistics:: How to get statistics about memory usage. +@end menu + +@node Memory Allocation +@section Memory Allocation + +@deftypefun kern_return_t vm_allocate (@w{vm_task_t @var{target_task}}, @w{vm_address_t *@var{address}}, @w{vm_size_t @var{size}}, @w{boolean_t @var{anywhere}}) +The function @code{vm_allocate} allocates a region of virtual memory, +placing it in the specified @var{task}'s address space. + +The starting address is @var{address}. If the @var{anywhere} option is +false, an attempt is made to allocate virtual memory starting at this +virtual address. If this address is not at the beginning of a virtual +page, it will be rounded down to one. If there is not enough space at +this address, no memory will be allocated. If the @var{anywhere} option +is true, the input value of this address will be ignored, and the space +will be allocated wherever it is available. In either case, the address +at which memory was actually allocated will be returned in +@var{address}. + +@var{size} is the number of bytes to allocate (rounded by the system in +a machine dependent way to an integral number of virtual pages). + +If @var{anywhere} is true, the kernel should find and allocate any +region of the specified size, and return the address of the resulting +region in address address, rounded to a virtual page boundary if there +is sufficient space. + +The physical memory is not actually allocated until the new virtual +memory is referenced. By default, the kernel rounds all addresses down +to the nearest page boundary and all memory sizes up to the nearest page +size. The global variable @code{vm_page_size} contains the page size. +@code{mach_task_self} returns the value of the current task port which +should be used as the @var{target_task} argument in order to allocate +memory in the caller's address space. For languages other than C, these +values can be obtained by the calls @code{vm_statistics} and +@code{mach_task_self}. Initially, the pages of allocated memory will be +protected to allow all forms of access, and will be inherited in child +tasks as a copy. Subsequent calls to @code{vm_protect} and +@code{vm_inherit} may be used to change these properties. The allocated +region is always zero-filled. + +The function returns @code{KERN_SUCCESS} if the memory was successfully +allocated, @code{KERN_INVALID_ADDRESS} if an invalid address was +specified and @code{KERN_NO_SPACE} if there was not enough space left to +satisfy the request. +@end deftypefun + + +@node Memory Deallocation +@section Memory Deallocation + +@deftypefun kern_return_t vm_deallocate (@w{vm_task_t @var{target_task}}, @w{vm_address_t @var{address}}, @w{vm_size_t @var{size}}) +@code{vm_deallocate} relinquishes access to a region of a @var{task}'s +address space, causing further access to that memory to fail. This +address range will be available for reallocation. @var{address} is the +starting address, which will be rounded down to a page boundary. +@var{size} is the number of bytes to deallocate, which will be rounded +up to give a page boundary. Note, that because of the rounding to +virtual page boundaries, more than @var{size} bytes may be deallocated. +Use @code{vm_page_size} or @code{vm_statistics} to find out the current +virtual page size. + +This call may be used to deallocte memory that was passed to a task in a +message (via out of line data). In that case, the rounding should cause +no trouble, since the region of memory was allocated as a set of pages. + +The @code{vm_deallocate} call affects only the task specified by the +@var{target_task}. Other tasks which may have access to this memory may +continue to reference it. + +The function returns @code{KERN_SUCCESS} if the memory was successfully +deallocated and @code{KERN_INVALID_ADDRESS} if an invalid or +non-allocated address was specified. +@end deftypefun + + +@node Data Transfer +@section Data Transfer + +@deftypefun kern_return_t vm_read (@w{vm_task_t @var{target_task}}, @w{vm_address_t @var{address}}, @w{vm_size_t @var{size}}, @w{vm_offset_t *@var{data}}, @w{mach_msg_type_number_t *@var{data_count}}) +The function @code{vm_read} allows one task's virtual memory to be read +by another task. The @var{target_task} is the task whose memory is to +be read. @var{address} is the first address to be read and must be on a +page boundary. @var{size} is the number of bytes of data to be read and +must be an integral number of pages. @var{data} is the array of data +copied from the given task, and @var{data_count} is the size of the data +array in bytes (will be an integral number of pages). + +Note that the data array is returned in a newly allocated region; the +task reading the data should @code{vm_deallocate} this region when it is +done with the data. + +The function returns @code{KERN_SUCCESS} if the memory was successfully +read, @code{KERN_INVALID_ADDRESS} if an invalid or non-allocated address +was specified or there was not @var{size} bytes of data following the +address, @code{KERN_INVALID_ARGUMENT} if the address does not start on a +page boundary or the size is not an integral number of pages, +@code{KERN_PROTECTION_FAILURE} if the address region in the target task +is protected against reading and @code{KERN_NO_SPACE} if there was not +enough room in the callers virtual memory to allocate space for the data +to be returned. +@end deftypefun + +@deftypefun kern_return_t vm_write (@w{vm_task_t @var{target_task}}, @w{vm_address_t @var{address}}, @w{vm_offset_t @var{data}}, @w{mach_msg_type_number_t @var{data_count}}) +The function @code{vm_write} allows a task to write to the vrtual memory +of @var{target_task}. @var{address} is the starting address in task to +be affected. @var{data} is an array of bytes to be written, and +@var{data_count} the size of the @var{data} array. + +The current implementation requires that @var{address}, @var{data} and +@var{data_count} all be page-aligned. Otherwise, +@code{KERN_INVALID_ARGUMENT} is returned. + +The function returns @code{KERN_SUCCESS} if the memory was successfully +written, @code{KERN_INVALID_ADDRESS} if an invalid or non-allocated +address was specified or there was not @var{data_count} bytes of +allocated memory starting at @var{address} and +@code{KERN_PROTECTION_FAILURE} if the address region in the target task +is protected against writing. +@end deftypefun + +@deftypefun kern_return_t vm_copy (@w{vm_task_t @var{target_task}}, @w{vm_address_t @var{source_address}}, @w{vm_size_t @var{count}}, @w{vm_offset_t @var{dest_address}}) +The function @code{vm_copy} causes the source memory range to be copied +to the destination address. The source and destination memory ranges +may overlap. The destination address range must already be allocated +and writable; the source range must be readable. + +@code{vm_copy} is equivalent to @code{vm_read} followed by +@code{vm_write}. + +The current implementation requires that @var{address}, @var{data} and +@var{data_count} all be page-aligned. Otherwise, +@code{KERN_INVALID_ARGUMENT} is returned. + +The function returns @code{KERN_SUCCESS} if the memory was successfully +written, @code{KERN_INVALID_ADDRESS} if an invalid or non-allocated +address was specified or there was insufficient memory allocated at one +of the addresses and @code{KERN_PROTECTION_FAILURE} if the destination +region was not writable or the source region was not readable. +@end deftypefun + + +@node Memory Attributes +@section Memory Attributes + +@deftypefun kern_return_t vm_region (@w{vm_task_t @var{target_task}}, @w{vm_address_t *@var{address}}, @w{vm_size_t *@var{size}}, @w{vm_prot_t *@var{protection}}, @w{vm_prot_t *@var{max_protection}}, @w{vm_inherit_t *@var{inheritance}}, @w{boolean_t *@var{shared}}, @w{memory_object_name_t *@var{object_name}}, @w{vm_offset_t *@var{offset}}) +The function @code{vm_region} returns a description of the specified +region of @var{target_task}'s virtual address space. @code{vm_region} +begins at @var{address} and looks forward through memory until it comes +to an allocated region. If address is within a region, then that region +is used. Various bits of information about the region are returned. If +@var{address} was not within a region, then @var{address} is set to the +start of the first region which follows the incoming value. In this way +an entire address space can be scanned. + +The @var{size} returned is the size of the located region in bytes. +@var{protection} is the current protection of the region, +@var{max_protection} is the maximum allowable protection for this +region. @var{inheritance} is the inheritance attribute for this region. +@var{shared} tells if the region is shared or not. The port +@var{object_name} identifies the memory object associated with this +region, and @var{offset} is the offset into the pager object that this +region begins at. +@c XXX cross ref pager_init + +The function returns @code{KERN_SUCCESS} if the memory region was +successfully located and the information returned and @code{KERN_NO_SPACE} if +there is no region at or above @var{address} in the specified task. +@end deftypefun + +@deftypefun kern_return_t vm_protect (@w{vm_task_t @var{target_task}}, @w{vm_address_t @var{address}}, @w{vm_size_t @var{size}}, @w{boolean_t @var{set_maximum}}, @w{vm_prot_t @var{new_protection}}) +The function @code{vm_protect} sets the virtual memory access privileges +for a range of allocated addresses in @var{target_task}'s virtual +address space. The protection argument describes a combination of read, +write, and execute accesses that should be @emph{permitted}. + +@var{address} is the starting address, which will be rounded down to a +page boundary. @var{size} is the size in bytes of the region for which +protection is to change, and will be rounded up to give a page boundary. +If @var{set_maximum} is set, make the protection change apply to the +maximum protection associated with this address range; otherwise, the +current protection on this range is changed. If the maximum protection +is reduced below the current protection, both will be changed to reflect +the new maximum. @var{new_protection} is the new protection value for +this region; a set of: @code{VM_PROT_READ}, @code{VM_PROT_WRITE}, +@code{VM_PROT_EXECUTE}. + +The enforcement of virtual memory protection is machine-dependent. +Nominally read access requires @code{VM_PROT_READ} permission, write +access requires @code{VM_PROT_WRITE} permission, and execute access +requires @code{VM_PROT_EXECUTE} permission. However, some combinations +of access rights may not be supported. In particular, the kernel +interface allows write access to require @code{VM_PROT_READ} and +@code{VM_PROT_WRITE} permission and execute access to require +@code{VM_PROT_READ} permission. + +The function returns @code{KERN_SUCCESS} if the memory was successfully +protected, @code{KERN_INVALID_ADDRESS} if an invalid or non-allocated +address was specified and @code{KERN_PROTECTION_FAILURE} if an attempt +was made to increase the current or maximum protection beyond the +existing maximum protection value. +@end deftypefun + +@deftypefun kern_return_t vm_inherit (@w{vm_task_t @var{target_task}}, @w{vm_address_t @var{address}}, @w{vm_size_t @var{size}}, @w{vm_inherit_t @var{new_inheritance}}) +The function @code{vm_inherit} specifies how a region of +@var{target_task}'s address space is to be passed to child tasks at the +time of task creation. Inheritance is an attribute of virtual pages, so +@var{address} to start from will be rounded down to a page boundary and +@var{size}, the size in bytes of the region for wihch inheritance is to +change, will be rounded up to give a page boundary. How this memory is +to be inherited in child tasks is specified by @var{new_inheritance}. +Inheritance is specified by using one of these following three values: + +@table @code +@item VM_INHERIT_SHARE +Child tasks will share this memory with this task. + +@item VM_INHERIT_COPY +Child tasks will receive a copy of this region. + +@item VM_INHERIT_NONE +This region will be absent from child tasks. +@end table + +Setting @code{vm_inherit} to @code{VM_INHERIT_SHARE} and forking a child +task is the only way two Mach tasks can share physical memory. Remember +that all the theads of a given task share all the same memory. + +The function returns @code{KERN_SUCCESS} if the memory inheritance was +successfully set and @code{KERN_INVALID_ADDRESS} if an invalid or +non-allocated address was specified. +@end deftypefun + +@deftypefun kern_return_t vm_wire (@w{host_priv_t @var{host_priv}}, @w{vm_task_t @var{target_task}}, @w{vm_address_t @var{address}}, @w{vm_size_t @var{size}}, @w{vm_prot_t @var{access}}) +The function @code{vm_wire} allows privileged applications to control +memory pageability. @var{host_priv} is the privileged host port for the +host on which @var{target_task} resides. @var{address} is the starting +address, which will be rounded down to a page boundary. @var{size} is +the size in bytes of the region for which protection is to change, and +will be rounded up to give a page boundary. @var{access} specifies the +types of accesses that must not cause page faults. + +The semantics of a successful @code{vm_wire} operation are that memory +in the specified range will not cause page faults for any accesses +included in access. Data memory can be made non-pageable (wired) with a +access argument of @code{VM_PROT_READ | VM_PROT_WRITE}. A special case +is that @code{VM_PROT_NONE} makes the memory pageable. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_HOST} if @var{host_priv} was not the privileged host +port, @code{KERN_INVALID_TASK} if @var{task} was not a valid task, +@code{KERN_INVALID_VALUE} if @var{access} specified an invalid access +mode, @code{KERN_FAILURE} if some memory in the specified range is not +present or has an inappropriate protection value, and +@code{KERN_INVALID_ARGUMENT} if unwiring (@var{access} is +@code{VM_PROT_NONE}) and the memory is not already wired. + +The @code{vm_wire} call is actually an RPC to @var{host_priv}, normally +a send right for a privileged host port, but potentially any send right. +In addition to the normal diagnostic return codes from the call's server +(normally the kernel), the call may return @code{mach_msg} return codes. +@end deftypefun + +@deftypefun kern_return_t vm_machine_attribute (@w{vm_task_t @var{task}}, @w{vm_address_t @var{address}}, @w{vm_size_t @var{size}}, @w{vm_prot_t @var{access}}, @w{vm_machine_attribute_t @var{attribute}}, @w{vm_machine_attribute_val_t @var{value}}) +The function @code{vm_machine_attribute} specifies machine-specific +attributes for a VM mapping, such as cachability, migrability, +replicability. This is used on machines that allow the user control +over the cache (this is the case for MIPS architectures) or placement of +memory pages as in NUMA architectures (Non-Uniform Memory Access time) +such as the IBM ACE multiprocessor. + +Machine-specific attributes can be consider additions to the +machine-independent ones such as protection and inheritance, but they +are not guaranteed to be supported by any given machine. Moreover, +implementations of Mach on new architectures might find the need for new +attribute types and or values besides the ones defined in the initial +implementation. + +The types currently defined are +@table @code +@item MATTR_CACHE +Controls caching of memory pages + +@item MATTR_MIGRATE +Controls migrability of memory pages + +@item MATTR_REPLICATE +Controls replication of memory pages +@end table + +Corresponding values, and meaning of a specific call to +@code{vm_machine_attribute} +@table @code +@item MATTR_VAL_ON +Enables the attribute. Being enabled is the default value for any +applicable attribute. + +@item MATTR_VAL_OFF +Disables the attribute, making memory non-cached, or non-migratable, or +non-replicatable. + +@item MATTR_VAL_GET +Returns the current value of the attribute for the memory segment. If +the attribute does not apply uniformly to the given range the value +returned applies to the initial portion of the segment only. + +@item MATTR_VAL_CACHE_FLUSH +Flush the memory pages from the Cache. The size value in this case +might be meaningful even if not a multiple of the page size, depending +on the implementation. + +@item MATTR_VAL_ICACHE_FLUSH +Same as above, applied to the Instruction Cache alone. + +@item MATTR_VAL_DCACHE_FLUSH +Same as above, applied to the Data Cache alone. +@end table + +The function returns @code{KERN_SUCCESS} if call succeeded, and +@code{KERN_INVALID_ARGUMENT} if @var{task} is not a task, or +@var{address} and @var{size} do not define a valid address range in +task, or @var{attribute} is not a valid attribute type, or it is not +implemented, or @var{value} is not a permissible value for attribute. +@end deftypefun + + +@node Mapping Memory Objects +@section Mapping Memory Objects + +@deftypefun kern_return_t vm_map (@w{vm_task_t @var{target_task}}, @w{vm_address_t *@var{address}}, @w{vm_size_t @var{size}}, @w{vm_address_t @var{mask}}, @w{boolean_t @var{anywhere}}, @w{memory_object_t @var{memory_object}}, @w{vm_offset_t @var{offset}}, @w{boolean_t @var{copy}}, @w{vm_prot_t @var{cur_protection}}, @w{vm_prot_t @var{max_protection}}, @w{vm_inherit_t @var{inheritance}}) +The function @code{vm_map} maps a region of virtual memory at the +specified address, for which data is to be supplied by the given memory +object, starting at the given offset within that object. In addition to +the arguments used in @code{vm_allocate}, the @code{vm_map} call allows +the specification of an address alignment parameter, and of the initial +protection and inheritance values. +@c XXX See the descriptions of vm_allocate, vm_protect , and vm_inherit + +If the memory object in question is not currently in use, the kernel +will perform a @code{memory_object_init} call at this time. If the copy +parameter is asserted, the specified region of the memory object will be +copied to this address space; changes made to this object by other tasks +will not be visible in this mapping, and changes made in this mapping +will not be visible to others (or returned to the memory object). + +The @code{vm_map} call returns once the mapping is established. +Completion of the call does not require any action on the part of the +memory manager. + +Warning: Only memory objects that are provided by bona fide memory +managers should be used in the @code{vm_map} call. A memory manager +must implement the memory object interface described elsewhere in this +manual. If other ports are used, a thread that accesses the mapped +virtual memory may become permanently hung or may receive a memory +exception. + +@var{target_task} is the task to be affected. The starting address is +@var{address}. If the @var{anywhere} option is used, this address is +ignored. The address actually allocated will be returned in +@var{address}. @var{size} is the number of bytes to allocate (rounded by +the system in a machine dependent way). The alignment restriction is +specified by @var{mask}. Bits asserted in this mask must not be +asserted in the address returned. If @var{anywhere} is set, the kernel +should find and allocate any region of the specified size, and return +the address of the resulting region in @var{address}. + +@var{memory_object} is the port that represents the memory object: used +by user tasks in @code{vm_map}; used by the make requests for data or +other management actions. If this port is @code{MEMORY_OBJECT_NULL}, +then zero-filled memory is allocated instead. Within a memory object, +@var{offset} specifes an offset in bytes. This must be page aligned. +If @var{copy} is set, the range of the memory object should be copied to +the target task, rather than mapped read-write. + +The function returns @code{KERN_SUCCESS} if the object is mapped, +@code{KERN_NO_SPACE} if no unused region of the task's virtual address +space that meets the address, size, and alignment criteria could be +found, and @code{KERN_INVALID_ARGUMENT} if an invalid argument was provided. +@end deftypefun + + +@node Memory Statistics +@section Memory Statistics + +@deftp {Data type} vm_statistics_data_t +This structure is returned in @var{vm_stats} by the @code{vm_statistics} +function and provides virtual memory statistics for the system. It has +the following members: + +@table @code +@item long pagesize +The page size in bytes. + +@item long free_count +The number of free pages. + +@item long active_count +The umber of active pages. + +@item long inactive_count +The number of inactive pages. + +@item long wire_count +The number of pages wired down. + +@item long zero_fill_count +The number of zero filled pages. + +@item long reactivations +The number of reactivated pages. + +@item long pageins +The number of pageins. + +@item long pageouts +The number of pageouts. + +@item long faults +The number of faults. + +@item long cow_faults +The number of copy-on-writes. + +@item long lookups +The number of object cache lookups. + +@item long hits +The number of object cache hits. +@end table +@end deftp + +@deftypefun kern_return_t vm_statistics (@w{vm_task_t @var{target_task}}, @w{vm_statistics_data_t *@var{vm_stats}}) +The function @code{vm_statistics} returns the statistics about the +kernel's use of virtual memory since the kernel was booted. +@code{pagesize} can also be found as a global variable +@code{vm_page_size} which is set at task initialization and remains +constant for the life of the task. +@end deftypefun + + +@node External Memory Management +@chapter External Memory Management + +@menu +* Memory Object Server:: The basics of external memory management. +* Memory Object Creation:: How new memory objects are created. +* Memory Object Termination:: How memory objects are terminated. +* Memory Objects and Data:: Data transfer to and from memory objects. +* Memory Object Locking:: How memory objects are locked. +* Memory Object Attributes:: Manipulating attributes of memory objects. +* Default Memory Manager:: Setting and using the default memory manager. +@end menu + + +@node Memory Object Server +@section Memory Object Server + +@deftypefun boolean_t memory_object_server (@w{msg_header_t *@var{in_msg}}, @w{msg_header_t *@var{out_msg}}) +@deftypefunx boolean_t memory_object_default_server (@w{msg_header_t *@var{in_msg}}, @w{msg_header_t *@var{out_msg}}) +@deftypefunx boolean_t seqnos_memory_object_server (@w{msg_header_t *@var{in_msg}}, @w{msg_header_t *@var{out_msg}}) +@deftypefunx boolean_t seqnos_memory_object_default_server (@w{msg_header_t *@var{in_msg}}, @w{msg_header_t *@var{out_msg}}) +A memory manager is a server task that responds to specific messages +from the kernel in order to handle memory management functions for the +kernel. + +In order to isolate the memory manager from the specifics of message +formatting, the remote procedure call generator produces a procedure, +@code{memory_object_server}, to handle a received message. This +function does all necessary argument handling, and actually calls one of +the following functions: @code{memory_object_init}, +@code{memory_object_data_write}, @code{memory_object_data_return}, +@code{memory_object_data_request}, @code{memory_object_data_unlock}, +@code{memory_object_lock_completed}, @code{memory_object_copy}, +@code{memory_object_terminate}. The @strong{default memory manager} may +get two additional requests from the kernel: @code{memory_object_create} +and @code{memory_object_data_initialize}. The remote procedure call +generator produces a procedure @code{memory_object_default_server} to +handle those functions specific to the default memory manager. + +The @code{seqnos_memory_object_server} and +@code{seqnos_memory_object_default_server} differ from +@code{memory_object_server} and @code{memory_object_default_server} in +that they supply message sequence numbers to the server interfaces. +They call the @code{seqnos_memory_object_*} functions, which complement +the @code{memory_object_*} set of functions. + +The return value from the @code{memory_object_server} function indicates +that the message was appropriate to the memory management interface +(returning @code{TRUE}), or that it could not handle this message +(returning @code{FALSE}). + +The @var{in_msg} argument is the message that has been received from the +kernel. The @var{out_msg} is a reply message, but this is not used for +this server. + +The function returns @code{TRUE} to indicate that the message in +question was applicable to this interface, and that the appropriate +routine was called to interpret the message. It returns @code{FALSE} to +indicate that the message did not apply to this interface, and that no +other action was taken. +@end deftypefun + + +@node Memory Object Creation +@section Memory Object Creation + +@deftypefun kern_return_t memory_object_init (@w{memory_object_t @var{memory_object}}, @w{memory_object_control_t @var{memory_control}}, @w{memory_object_name_t @var{memory_object_name}}, @w{vm_size_t @var{memory_object_page_size}}) +@deftypefunx kern_return_t seqnos_memory_object_init (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{memory_control}}, @w{memory_object_name_t @var{memory_object_name}}, @w{vm_size_t @var{memory_object_page_size}}) +The function @code{memory_object_init} serves as a notification that the +kernel has been asked to map the given memory object into a task's +virtual address space. Additionally, it provides a port on which the +memory manager may issue cache management requests, and a port which the +kernel will use to name this data region. In the event that different +each will perform a @code{memory_object_init} call with new request and +name ports. The virtual page size that is used by the calling kernel is +included for planning purposes. + +When the memory manager is prepared to accept requests for data for this +object, it must call @code{memory_object_ready} with the attribute. +Otherwise the kernel will not process requests on this object. To +reject all mappings of this object, the memory manager may use +@code{memory_object_destroy}. + +The argument @var{memory_object} is the port that represents the memory +object data, as supplied to the kernel in a @code{vm_map} call. +@var{memory_control} is the request port to which a response is +requested. (In the event that a memory object has been supplied to more +than one the kernel that has made the request.) +@var{memory_object_name} is a port used by the kernel to refer to the +memory object data in reponse to @code{vm_region} calls. +@code{memory_object_page_size} is the page size to be used by this +kernel. All data sizes in calls involving this kernel must be an +integral multiple of the page size. Note that different kernels, +indicated by a different @code{memory_control}, may have different page +sizes. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + +@deftypefun kern_return_t memory_object_ready (@w{memory_object_control_t @var{memory_control}}, @w{boolean_t @var{may_cache_object}}, @w{memory_object_copy_strategy_t @var{copy_strategy}}) +The function @code{memory_object_ready} informs the kernel that the +memory manager is ready to receive data or unlock requests on behalf of +the clients. The argument @var{memory_control} is the port, provided by +the kernel in a @code{memory_object_init} call, to which cache +management requests may be issued. If @var{may_cache_object} is set, +the kernel may keep data associated with this memory object, even after +virtual memory references to it are gone. + +@var{copy_strategy} tells how the kernel should copy regions of the +associated memory object. There are three possible caching strategies: +@code{MEMORY_OBJECT_COPY_NONE} which specifies that nothing special +should be done when data in the object is copied; +@code{MEMORY_OBJECT_COPY_CALL} which specifies that the memory manager +should be notified via a @code{memory_object_copy} call before any part +of the object is copied; and @code{MEMORY_OBJECT_COPY_DELAY} which +guarantees that the memory manager does not externally modify the data +so that the kernel can use its normal copy-on-write algorithms. +@code{MEMORY_OBJECT_COPY_DELAY} is the strategy most commonly used. + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + + +@node Memory Object Termination +@section Memory Object Termination + +@deftypefun kern_return_t memory_object_terminate (@w{memory_object_t @var{memory_object}}, @w{memory_object_control_t @var{memory_control}}, @w{memory_object_name_t @var{memory_object_name}}) +@deftypefunx kern_return_t seqnos_memory_object_terminate (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{memory_control}}, @w{memory_object_name_t @var{memory_object_name}}) +The function @code{memory_object_terminate} indicates that the kernel +has completed its use of the given memory object. All rights to the +memory object control and name ports are included, so that the memory +manager can destroy them (using @code{mach_port_deallocate}) after doing +appropriate bookkeeping. The kernel will terminate a memory object only +after all address space mappings of that memory object have been +deallocated, or upon explicit request by the memory manager. + +The argument @var{memory_object} is the port that represents the memory +object data, as supplied to the kernel in a @code{vm_map} call. +@var{memory_control} is the request port to which a response is +requested. (In the event that a memory object has been supplied to more +than one the kernel that has made the request.) +@var{memory_object_name} is a port used by the kernel to refer to the +memory object data in reponse to @code{vm_region} calls. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + +@deftypefun kern_return_t memory_object_destroy (@w{memory_object_control_t @var{memory_control}}, @w{kern_return_t @var{reason}}) +The function @code{memory_object_destroy} tells the kernel to shut down +the memory object. As a result of this call the kernel will no longer +support paging activity or any @code{memory_object} calls on this +object, and all rights to the memory object port, the memory control +port and the memory name port will be returned to the memory manager in +a memory_object_terminate call. If the memory manager is concerned that +any modified cached data be returned to it before the object is +terminated, it should call @code{memory_object_lock_request} with +@var{should_flush} set and a lock value of @code{VM_PROT_WRITE} before +making this call. + +The argument @var{memory_control} is the port, provided by the kernel in +a @code{memory_object_init} call, to which cache management requests may +be issued. @var{reason} is an error code indicating why the object +must be destroyed. +@c The error code is currently ingnored. + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + + +@node Memory Objects and Data +@section Memory Objects and Data + +@deftypefun kern_return_t memory_object_data_return (@w{memory_object_t @var{memory_object}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{data}}, @w{vm_size_t @var{data_count}}, @w{boolean_t @var{dirty}}, @w{boolean_t @var{kernel_copy}}) +@deftypefunx kern_return_t seqnos_memory_object_data_return (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{data}}, @w{vm_size_t @var{data_count}}, @w{boolean_t @var{dirty}}, @w{boolean_t @var{kernel_copy}}) +The function @code{memory_object_data_return} provides the memory +manager with data that has been modified while cached in physical +memory. Once the memory manager no longer needs this data (e.g., it has +been written to another storage medium), it should be deallocated using +@code{vm_deallocate}. + +The argument @var{memory_object} is the port that represents the memory +object data, as supplied to the kernel in a @code{vm_map} call. +@var{memory_control} is the request port to which a response is +requested. (In the event that a memory object has been supplied to more +than one the kernel that has made the request.) @var{offset} is the +offset within a memory object to which this call refers. This will be +page aligned. @var{data} is the data which has been modified while +cached in physical memory. @var{data_count} is the amount of data to be +written, in bytes. This will be an integral number of memory object +pages. + +The kernel will also use this call to return precious pages. If an +unmodified precious age is returned, @var{dirty} is set to @code{FALSE}, +otherwise it is @code{TRUE}. If @var{kernel_copy} is @code{TRUE}, the +kernel kept a copy of the page. Precious data remains precious if the +kernel keeps a copy. The indication that the kernel kept a copy is only +a hint if the data is not precious; the cleaned copy may be discarded +without further notifying the manager. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + +@deftypefun kern_return_t memory_object_data_request (@w{memory_object_t @var{memory_object}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{length}}, @w{vm_prot_t @var{desired_access}}) +@deftypefunx kern_return_t seqnos_memory_object_data_request (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{length}}, @w{vm_prot_t @var{desired_access}}) +The function @code{memory_object_data_request} is a request for data +from the specified memory object, for at least the access specified. +The memory manager is expected to return at least the specified data, +with as much access as it can allow, using +@code{memory_object_data_supply}. If the memory manager is unable to +provide the data (for example, because of a hardware error), it may use +the @code{memory_object_data_error} call. The +@code{memory_object_data_unavailable} call may be used to tell the +kernel to supply zero-filled memory for this region. + +The argument @var{memory_object} is the port that represents the memory +object data, as supplied to the kernel in a @code{vm_map} call. +@var{memory_control} is the request port to which a response is +requested. (In the event that a memory object has been supplied to more +than one the kernel that has made the request.) @var{offset} is the +offset within a memory object to which this call refers. This will be +page aligned. @var{length} is the number of bytes of data, starting at +@var{offset}, to which this call refers. This will be an integral +number of memory object pages. @var{desired_access} is a protection +value describing the memory access modes which must be permitted on the +specified cached data. One or more of: @code{VM_PROT_READ}, +@code{VM_PROT_WRITE} or @code{VM_PROT_EXECUTE}. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + +@deftypefun kern_return_t memory_object_data_supply (@w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{data}}, @w{vm_size_t @var{data_count}}, @w{vm_prot_t @var{lock_value}}, @w{boolean_t @var{precious}}, @w{mach_port_t @var{reply}}) +The function @code{memory_object_data_supply} supplies the kernel with +data for the specified memory object. Ordinarily, memory managers +should only provide data in reponse to @code{memory_object_data_request} +calls from the kernel (but they may provide data in advance as desired). +When data already held by this kernel is provided again, the new data is +ignored. The kernel may not provide any data (or protection) +consistency among pages with different virtual page alignments within +the same object. + +The argument @var{memory_control} is the port, provided by the kernel in +a @code{memory_object_init} call, to which cache management requests may +be issued. @var{offset} is an offset within a memory object in bytes. +This must be page aligned. @var{data} is the data that is being +provided to the kernel. This is a pointer to the data. +@var{data_count} is the amount of data to be provided. Only whole +virtual pages of data can be accepted; partial pages will be discarded. + +@var{lock_value} is a protection value indicating those forms of access +that should @strong{not} be permitted to the specified cached data. The +lock values must be one or more of the set: @code{VM_PROT_NONE}, +@code{VM_PROT_READ}, @code{VM_PROT_WRITE}, @code{VM_PROT_EXECUTE} and +@code{VM_PROT_ALL} as defined in @file{mach/vm_prot.h}. + +If @var{precious} is @code{FALSE}, the kernel treats the data as a +temporary and may throw it away if it hasn't been changed. If the +@var{precious} value is @code{TRUE}, the kernel treats its copy as a +data repository and promises to return it to the manager; the manager +may tell the kernel to throw it away instead by flushing and not +cleaning the data (see @code{memory_object_lock_request}). + +If @var{reply_to} is not @code{MACH_PORT_NULL}, the kernel will send a +completion message to the provided port (see +@code{memory_object_supply_completed}). + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + +@deftypefun kern_return_t memory_object_supply_completed (@w{memory_object_t @var{memory_object}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{length}}, @w{kern_return_t @var{result}}, @w{vm_offset_t @var{error_offset}}) +@deftypefunx kern_return_t seqnos_memory_object_supply_completed (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{length}}, @w{kern_return_t @var{result}}, @w{vm_offset_t @var{error_offset}}) +The function @code{memory_object_supply_completed} indicates that a +previous @code{memory_object_data_supply} has been completed. Note that +this call is made on whatever port was specified in the +@code{memory_object_data_supply} call; that port need not be the memory +object port itself. No reply is expected after this call. + +The argument @var{memory_object} is the port that represents the memory +object data, as supplied to the kernel in a @code{vm_map} call. +@var{memory_control} is the request port to which a response is +requested. (In the event that a memory object has been supplied to more +than one the kernel that has made the request.) @var{offset} is the +offset within a memory object to which this call refers. @var{length} +is the length of the data covered by the lock request. The @var{result} +parameter indicates what happened during the supply. If it is not +@code{KERN_SUCCESS}, then @var{error_offset} identifies the first offset +at which a problem occurred. The pagein operation stopped at this +point. Note that the only failures reported by this mechanism are +@code{KERN_MEMORY_PRESENT}. All other failures (invalid argument, error +on pagein of supplied data in manager's address space) cause the entire +operation to fail. + + +@end deftypefun + +@deftypefun kern_return_t memory_object_data_error (@w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{size}}, @w{kern_return_t @var{reason}}) +The function @code{memory_object_data_error} indicates that the memory +manager cannot return the data requested for the given region, +specifying a reason for the error. This is typically used when a +hardware error is encountered. + +The argument @var{memory_control} is the port, provided by the kernel in +a @code{memory_object_init} call, to which cache management requests may +be issued. @var{offset} is an offset within a memory object in bytes. +This must be page aligned. @var{data} is the data that is being +provided to the kernel. This is a pointer to the data. @var{size} is +the amount of cached data (starting at @var{offset}) to be handled. +This must be an integral number of the memory object page size. +@var{reason} is an error code indicating what type of error occured. +@c The error code is currently ingnored. + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + +@deftypefun kern_return_t memory_object_data_unavailable (@w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{size}}, @w{kern_return_t @var{reason}}) +The function @code{memory_object_data_unavailable} indicates that the +memory object does not have data for the given region and that the +kernel should provide the data for this range. The memory manager may +use this call in three different situations. + +@enumerate +@item +The object was created by @code{memory_object_create} and the kernel has +not yet provided data for this range (either via a +@code{memory_object_data_initialize}, @code{memory_object_data_write} or +a @code{memory_object_data_return} for the object. + +@item +The object was created by an @code{memory_object_data_copy} and the +kernel should copy this region from the original memory object. + +@item +The object is a normal user-created memory object and the kernel should +supply unlocked zero-filled pages for the range. +@end enumerate + +The argument @var{memory_control} is the port, provided by the kernel in +a @code{memory_object_init} call, to which cache management requests may +be issued. @var{offset} is an offset within a memory object, in bytes. +This must be page aligned. @var{size} is the amount of cached data +(starting at @var{offset}) to be handled. This must be an integral +number of the memory object page size. + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + +@deftypefun kern_return_t memory_object_copy (@w{memory_object_t @var{old_memory_object}}, @w{memory_object_control_t @var{old_memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{length}}, @w{memory_object_t @var{new_memory_object}}) +@deftypefunx kern_return_t seqnos_memory_object_copy (@w{memory_object_t @var{old_memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{old_memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{length}}, @w{memory_object_t @var{new_memory_object}}) +The function @code{memory_object_copy} indicates that a copy has been +made of the specified range of the given original memory object. This +call includes only the new memory object itself; a +@code{memory_object_init} call will be made on the new memory object +after the currently cached pages of the original object are prepared. +After the memory manager receives the init call, it must reply with the +@code{memory_object_ready} call to assert the "ready" attribute. The +kernel will use the new memory object, control and name ports to refer +to the new copy. + +This call is made when the original memory object had the caching +parameter set to @code{MEMORY_OBJECT_COPY_CALL} and a user of the object +has asked the kernel to copy it. + +Cached pages from the original memory object at the time of the copy +operation are handled as follows: Readable pages may be silently copied +to the new memory object (with all access permissions). Pages not +copied are locked to prevent write access. + +The new memory object is @strong{temporary}, meaning that the memory +manager should not change its contents or allow the memory object to be +mapped in another client. The memory manager may use the +@code{memory_object_data_unavailable} call to indicate that the +appropriate pages of the original memory object may be used to fulfill +the data request. + +The argument @var{old_memory_object} is the port that represents the old +memory object data. @var{old_memory_control} is the kernel port for the +old object. @var{offset} is the offset within a memory object to which +this call refers. This will be page aligned. @var{length} is the +number of bytes of data, starting at @var{offset}, to which this call +refers. This will be an integral number of memory object pages. +@var{new_memory_object} is a new memory object created by the kernel; +see synopsis for further description. Note that all port rights +(including receive rights) are included for the new memory object. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + +The remaining interfaces in this section are obsolet. + +@deftypefun kern_return_t memory_object_data_write (@w{memory_object_t @var{memory_object}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{data}}, @w{vm_size_t @var{data_count}}) +@deftypefunx kern_return_t seqnos_memory_object_data_write (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{data}}, @w{vm_size_t @var{data_count}}) +The function @code{memory_object_data_write} provides the memory manager +with data that has been modified while cached in physical memory. It is the old form of @code{memory_object_data_return}. Once +the memory manager no longer needs this data (e.g., it has been written +to another storage medium), it should be deallocated using +@code{vm_deallocate}. + +The argument @var{memory_object} is the port that represents the memory +object data, as supplied to the kernel in a @code{vm_map} call. +@var{memory_control} is the request port to which a response is +requested. (In the event that a memory object has been supplied to more +than one the kernel that has made the request.) @var{offset} is the +offset within a memory object to which this call refers. This will be +page aligned. @var{data} is the data which has been modified while +cached in physical memory. @var{data_count} is the amount of data to be +written, in bytes. This will be an integral number of memory object +pages. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + +@deftypefun kern_return_t memory_object_data_provided (@w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{data}}, @w{vm_size_t @var{data_count}}, @w{vm_prot_t @var{lock_value}}) +The function @code{memory_object_data_provided} supplies the kernel with +data for the specified memory object. It is the old form of +@code{memory_object_data_supply}. Ordinarily, memory managers should +only provide data in reponse to @code{memory_object_data_request} calls +from the kernel. The @var{lock_value} specifies what type of access +will not be allowed to the data range. The lock values must be one or +more of the set: @code{VM_PROT_NONE}, @code{VM_PROT_READ}, +@code{VM_PROT_WRITE}, @code{VM_PROT_EXECUTE} and @code{VM_PROT_ALL} as +defined in @file{mach/vm_prot.h}. + +The argument @var{memory_control} is the port, provided by the kernel in +a @code{memory_object_init} call, to which cache management requests may +be issued. @var{offset} is an offset within a memory object in bytes. +This must be page aligned. @var{data} is the data that is being +provided to the kernel. This is a pointer to the data. +@var{data_count} is the amount of data to be provided. This must be an +integral number of memory object pages. @var{lock_value} is a +protection value indicating those forms of access that should +@strong{not} be permitted to the specified cached data. + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + + +@node Memory Object Locking +@section Memory Object Locking + +@deftypefun kern_return_t memory_object_lock_request (@w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{size}}, @w{memory_object_return_t @var{should_clean}}, @w{boolean_t @var{should_flush}}, @w{vm_prot_t @var{lock_value}}, @w{mach_port_t @var{reply_to}}) +The function @code{memory_object_lock_request} allows a memory manager +to make cache management requests. As specified in arguments to the +call, the kernel will: +@itemize +@item +clean (i.e., write back using @code{memory_object_data_supply} or +@code{memory_object_data_write}) any cached data which has been modified +since the last time it was written + +@item +flush (i.e., remove any uses of) that data from memory + +@item +lock (i.e., prohibit the specified uses of) the cached data +@end itemize + +Locks applied to cached data are not cumulative; new lock values +override previous ones. Thus, data may also be unlocked using this +primitive. The lock values must be one or more of the following values: +@code{VM_PROT_NONE}, @code{VM_PROT_READ}, @code{VM_PROT_WRITE}, +@code{VM_PROT_EXECUTE} and @code{VM_PROT_ALL} as defined in +@file{mach/vm_prot.h}. + +Only data which is cached at the time of this call is affected. When a +running thread requires a prohibited access to cached data, the kernel +will issue a @code{memory_object_data_unlock} call specifying the forms +of access required. + +Once all of the actions requested by this call have been completed, the +kernel issues a @code{memory_object_lock_completed} call on the +specified reply port. + +The argument @var{memory_control} is the port, provided by the kernel in +a @code{memory_object_init} call, to which cache management requests may +be issued. @var{offset} is an offset within a memory object, in bytes. +This must be page aligned. @var{size} is the amount of cached data +(starting at @var{offset}) to be handled. This must be an integral +number of the memory object page size. If @var{should_clean} is set, +modified data should be written back to the memory manager. If +@var{should_flush} is set, the specified cached data should be +invalidated, and all uses of that data should be revoked. +@var{lock_value} is a protection value indicating those forms of access +that should @strong{not} be permitted to the specified cached data. +@var{reply_to} is a port on which a @code{memory_object_lock_comleted} +call should be issued, or @code{MACH_PORT_NULL} if no acknowledgement is +desired. + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + +@deftypefun kern_return_t memory_object_lock_completed (@w{memory_object_t @var{memory_object}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{length}}) +@deftypefunx kern_return_t seqnos_memory_object_lock_completed (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{length}}) +The function @code{memory_object_lock_completed} indicates that a +previous @code{memory_object_lock_request} has been completed. Note +that this call is made on whatever port was specified in the +@code{memory_object_lock_request} call; that port need not be the memory +object port itself. No reply is expected after this call. + +The argument @var{memory_object} is the port that represents the memory +object data, as supplied to the kernel in a @code{vm_map} call. +@var{memory_control} is the request port to which a response is +requested. (In the event that a memory object has been supplied to more +than one the kernel that has made the request.) @var{offset} is the +offset within a memory object to which this call refers. @var{length} +is the length of the data covered by the lock request. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + +@deftypefun kern_return_t memory_object_data_unlock (@w{memory_object_t @var{memory_object}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{length}}, @w{vm_prot_t @var{desired_access}}) +@deftypefunx kern_return_t seqnos_memory_object_data_unlock (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{length}}, @w{vm_prot_t @var{desired_access}}) +The function @code{memory_object_data_unlock} is a request that the +memory manager permit at least the desired access to the specified data +cached by the kernel. A call to @code{memory_object_lock_request} is +expected in response. + +The argument @var{memory_object} is the port that represents the memory +object data, as supplied to the kernel in a @code{vm_map} call. +@var{memory_control} is the request port to which a response is +requested. (In the event that a memory object has been supplied to more +than one the kernel that has made the request.) @var{offset} is the +offset within a memory object to which this call refers. This will be +page aligned. @var{length} is the number of bytes of data, starting at +@var{offset}, to which this call refers. This will be an integral +number of memory object pages. @var{desired_access} a protection value +describing the memory access modes which must be permitted on the +specified cached data. One or more of: @code{VM_PROT_READ}, +@code{VM_PROT_WRITE} or @code{VM_PROT_EXECUTE}. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + + +@node Memory Object Attributes +@section Memory Object Attributes + +@deftypefun kern_return_t memory_object_get_attributes (@w{memory_object_control_t @var{memory_control}}, @w{boolean_t *@var{object_ready}}, @w{boolean_t *@var{may_cache_object}}, @w{memory_object_copy_strategy_t *@var{copy_strategy}}) +The function @code{memory_object_get_attribute} retrieves the current +attributes associated with the memory object. + +The argument @var{memory_control} is the port, provided by the kernel in +a @code{memory_object_init} call, to which cache management requests may +be issued. If @var{object_ready} is set, the kernel may issue new data +and unlock requests on the associated memory object. If +@var{may_cache_object} is set, the kernel may keep data associated with +this memory object, even after virtual memory references to it are gone. +@var{copy_strategy} tells how the kernel should copy regions of the +associated memory object. + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + +@deftypefun kern_return_t memory_object_change_attributes (@w{memory_object_control_t @var{memory_control}}, @w{boolean_t @var{may_cache_object}}, @w{memory_object_copy_strategy_t @var{copy_strategy}}, @w{mach_port_t @var{reply_to}}) +The function @code{memory_object_change_attribute} sets +performance-related attributes for the specified memory object. If the +caching attribute is asserted, the kernel is permitted (and encouraged) +to maintain cached data for this memory object even after no virtual +address space contains this data. + +There are three possible caching strategies: +@code{MEMORY_OBJECT_COPY_NONE} which specifies that nothing special +should be done when data in the object is copied; +@code{MEMORY_OBJECT_COPY_CALL} which specifies that the memory manager +should be notified via a @code{memory_object_copy} call before any part +of the object is copied; and @code{MEMORY_OBJECT_COPY_DELAY} which +guarantees that the memory manager does not externally modify the data +so that the kernel can use its normal copy-on-write algorithms. +@code{MEMORY_OBJECT_COPY_DELAY} is the strategy most commonly used. + +The argument @var{memory_control} is the port, provided by the kernel in +a @code{memory_object_init} call, to which cache management requests may +be issued. If @var{may_cache_object} is set, the kernel may keep data +associated with this memory object, even after virtual memory references +to it are gone. @var{copy_strategy} tells how the kernel should copy +regions of the associated memory object. @var{reply_to} is a port on +which a @code{memory_object_change_comleted} call will be issued upon +completion of the attribute change, or @code{MACH_PORT_NULL} if no +acknowledgement is desired. + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + +@deftypefun kern_return_t memory_object_change_completed (@w{memory_object_t @var{memory_object}}, @w{boolean_t @var{may_cache_object}}, @w{memory_object_copy_strategy_t @var{copy_strategy}}) +@deftypefunx kern_return_t seqnos_memory_object_change_completed (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{boolean_t @var{may_cache_object}}, @w{memory_object_copy_strategy_t @var{copy_strategy}}) +The function @code{memory_object_change_completed} indicates the +completion of an attribute change call. + +@c Warning: This routine does NOT contain a memory_object_control_t because +@c the memory_object_change_attributes call may cause memory object +@c termination (by uncaching the object). This would yield an invalid +@c port. +@end deftypefun + +The following interface is obsoleted by @code{memory_object_ready} and +@code{memory_object_change_attributes}. If the old form +@code{memory_object_set_attributes} is used to make a memory object +ready, the kernel will write back data using the old +@code{memory_object_data_write} interface rather than +@code{memory_object_data_return}.. + +@deftypefun kern_return_t memory_object_set_attributes (@w{memory_object_control_t @var{memory_control}}, @w{boolean @var{object_ready}}, @w{boolean_t @var{may_cache_object}}, @w{memory_object_copy_strategy_t @var{copy_strategy}}) +The function @code{memory_object_set_attribute} controls how the the +memory object. The kernel will only make data or unlock requests when +the ready attribute is asserted. If the caching attribute is asserted, +the kernel is permitted (and encouraged) to maintain cached data for +this memory object even after no virtual address space contains this +data. + +There are three possible caching strategies: +@code{MEMORY_OBJECT_COPY_NONE} which specifies that nothing special +should be done when data in the object is copied; +@code{MEMORY_OBJECT_COPY_CALL} which specifies that the memory manager +should be notified via a @code{memory_object_copy} call before any part +of the object is copied; and @code{MEMORY_OBJECT_COPY_DELAY} which +guarantees that the memory manager does not externally modify the data +so that the kernel can use its normal copy-on-write algorithms. +@code{MEMORY_OBJECT_COPY_DELAY} is the strategy most commonly used. + +The argument @var{memory_control} is the port, provided by the kernel in +a @code{memory_object_init} call, to which cache management requests may +be issued. If @var{object_ready} is set, the kernel may issue new data +and unlock requests on the associated memory object. If +@var{may_cache_object} is set, the kernel may keep data associated with +this memory object, even after virtual memory references to it are gone. +@var{copy_strategy} tells how the kernel should copy regions of the +associated memory object. + +This routine does not receive a reply message (and consequently has no +return value), so only message transmission errors apply. +@end deftypefun + + +@node Default Memory Manager +@section Default Memory Manager + +@deftypefun kern_return_t vm_set_default_memory_manager (@w{host_t @var{host}}, @w{mach_port_t *@var{default_manager}}) +The function @code{vm_set_default_memory_manager} sets the kernel's +default memory manager. It sets the port to which newly-created +temporary memory objects are delivered by @code{memory_object_create} to +the host. The old memory manager port is returned. If +@var{default_manager} is @code{MACH_PORT_NULL} then this routine just returns +the current default manager port without changing it. + +The argument @var{host} is a task port to the kernel whose default +memory manager is to be changed. @var{default_manager} is an in/out +parameter. As input, @var{default_manager} is the port that the new +memory manager is listening on for @code{memory_object_create} calls. +As output, it is the old default memory manager's port. + +The function returns @code{KERN_SUCCESS} if the new memory manager is +installed, and @code{KERN_INVALID_ARGUMENT} if this task does not have +the privileges required for this call. +@end deftypefun + +@deftypefun kern_return_t memory_object_create (@w{memory_object_t @var{old_memory_object}}, @w{memory_object_t @var{new_memory_object}}, @w{vm_size_t @var{new_object_size}}, @w{memory_object_control_t @var{new_control}}, @w{memory_object_name_t @var{new_name}}, @w{vm_size_t @var{new_page_size}}) +@deftypefunx kern_return_t seqnos_memory_object_create (@w{memory_object_t @var{old_memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_t @var{new_memory_object}}, @w{vm_size_t @var{new_object_size}}, @w{memory_object_control_t @var{new_control}}, @w{memory_object_name_t @var{new_name}}, @w{vm_size_t @var{new_page_size}}) +The function @code{memory_object_create} is a request that the given +memory manager accept responsibility for the given memory object created +by the kernel. This call will only be made to the system +@strong{default memory manager}. The memory object in question +initially consists of zero-filled memory; only memory pages that are +actually written will ever be provided to +@code{memory_object_data_request} calls, the default memory manager must +use @code{memory_object_data_unavailable} for any pages that have not +previously been written. + +No reply is expected after this call. Since this call is directed to +the default memory manager, the kernel assumes that it will be ready to +handle data requests to this object and does not need the confirmation +of a @code{memory_object_set_attributes} call. + +The argument @var{old_memory_object} is a memory object provided by the +default memory manager on which the kernel can make +@code{memory_object_create} calls. @var{new_memory_object} is a new +memory object created by the kernel; see synopsis for further +description. Note that all port rights (including receive rights) are +included for the new memory object. @var{new_object_size} is the +maximum size of the new object. @var{new_control} is a port, created by +the kernel, on which a memory manager may issue cache management +requests for the new object. @var{new_name} a port used by the kernel +to refer to the new memory object data in response to @code{vm_region} +calls. @var{new_page_size} is the page size to be used by this kernel. +All data sizes in calls involving this kernel must be an integral +multiple of the page size. Note that different kernels, indicated by +different a @code{memory_control}, may have different page sizes. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + +@deftypefun kern_return_t memory_object_data_initialize (@w{memory_object_t @var{memory_object}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{data}}, @w{vm_size_t @var{data_count}}) +@deftypefunx kern_return_t seqnos_memory_object_data_initialize (@w{memory_object_t @var{memory_object}}, @w{mach_port_seqno_t @var{seqno}}, @w{memory_object_control_t @var{memory_control}}, @w{vm_offset_t @var{offset}}, @w{vm_offset_t @var{data}}, @w{vm_size_t @var{data_count}}) +The function @code{memory_object_data_initialize} provides the memory +manager with initial data for a kernel-created memory object. If the +memory manager already has been supplied data (by a previous +@code{memory_object_data_initialize}, @code{memory_object_data_write} or +@code{memory_object_data_return}), then this data should be ignored. +Otherwise, this call behaves exactly as does +@code{memory_object_data_return} on memory objects created by the kernel +via @code{memory_object_create} and thus will only be made to default +memory managers. This call will not be made on objects created via +@code{memory_object_copy}. + +The argument @var{memory_object} the port that represents the memory +object data, as supplied by the kernel in a @code{memory_object_create} +call. @var{memory_control} is the request port to which a response is +requested. (In the event that a memory object has been supplied to more +than one the kernel that has made the request.) @var{offset} is the +offset within a memory object to which this call refers. This will be +page aligned. @var{data} os the data which has been modified while +cached in physical memory. @var{data_count} is the amount of data to be +written, in bytes. This will be an integral number of memory object +pages. + +The function should return @code{KERN_SUCCESS}, but since this routine +is called by the kernel, which does not wait for a reply message, this +value is ignored. +@end deftypefun + + +@node Threads and Tasks +@chapter Threads and Tasks + +@menu +* Thread Interface:: Manipulating threads. +* Task Interface:: Manipulating tasks. +* Profiling:: Profiling threads and tasks. +@end menu + + +@node Thread Interface +@section Thread Interface + +@cindex thread port +@cindex port representing a thread +@deftp {Data type} thread_t +This is a @code{mach_port_t} and used to hold the port name of a +thread port that represents the thread. Manipulations of the thread are +implemented as remote procedure calls to the thread port. A thread can +get a port to itself with the @code{mach_thread_self} system call. +@end deftp + +@menu +* Thread Creation:: Creating new threads. +* Thread Termination:: Terminating existing threads. +* Thread Information:: How to get informations on threads. +* Thread Settings:: How to set threads related informations. +* Thread Execution:: How to control the thread's machine state. +* Scheduling:: Operations on thread scheduling. +* Thread Special Ports:: How to handle the thread's special ports. +* Exceptions:: Managing exceptions. +@end menu + + +@node Thread Creation +@subsection Thread Creation + +@deftypefun kern_return_t thread_create (@w{task_t @var{parent_task}}, @w{thread_t *@var{child_thread}}) +The function @code{thread_create} creates a new thread within the task +specified by @var{parent_task}. The new thread has no processor state, +and has a suspend count of 1. To get a new thread to run, first +@code{thread_create} is called to get the new thread's identifier, +(@var{child_thread}). Then @code{thread_set_state} is called to set a +processor state, and finally @code{thread_resume} is called to get the +thread scheduled to execute. + +When the thread is created send rights to its thread kernel port are +given to it and returned to the caller in @var{child_thread}. The new +thread's exception port is set to @code{MACH_PORT_NULL}. + +The function returns @code{KERN_SUCCESS} if a new thread has been +created, @code{KERN_INVALID_ARGUMENT} if @var{parent_task} is not a +valid task and @code{KERN_RESOURCE_SHORTAGE} if some critical kernel +resource is not available. +@end deftypefun + + +@node Thread Termination +@subsection Thread Termination + +@deftypefun kern_return_t thread_terminate (@w{thread_t @var{target_thread}}) +The function @code{thread_terminate} destroys the thread specified by +@var{target_thread}. + +The function returns @code{KERN_SUCCESS} if the thread has been killed +and @code{KERN_INVALID_ARGUMENT} if @var{target_thread} is not a thread. +@end deftypefun + + +@node Thread Information +@subsection Thread Information + +@deftypefun thread_t mach_thread_self () +The @code{mach_thread_self} system call returns the calling thread's +thread port. + +@code{mach_thread_self} has an effect equivalent to receiving a send +right for the thread port. @code{mach_thread_self} returns the name of +the send right. In particular, successive calls will increase the +calling task's user-reference count for the send right. + +@c author{marcus} +As a special exception, the kernel will overrun the user reference count +of the thread name port, so that this function can not fail for that +reason. Because of this, the user should not deallocate the port right +if an overrun might have happened. Otherwise the reference count could +drop to zero and the send right be destroyed while the user still +expects to be able to use it. As the kernel does not make use of the +number of extant send rights anyway, this is safe to do (the thread port +itself is not destroyed, even when there are no send rights anymore). + +The function returns @code{MACH_PORT_NULL} if a resource shortage +prevented the reception of the send right or if the thread port is +currently null and @code{MACH_PORT_DEAD} if the thread port is currently +dead. +@end deftypefun + +@deftypefun kern_return_t thread_info (@w{thread_t @var{target_thread}}, @w{int @var{flavor}}, @w{thread_info_t @var{thread_info}}, @w{mach_msg_type_number_t *@var{thread_infoCnt}}) +The function @code{thread_info} returns the selected information array +for a thread, as specified by @var{flavor}. + +@var{thread_info} is an array of integers that is supplied by the caller +and returned filled with specified information. @var{thread_infoCnt} is +supplied as the maximum number of integers in @var{thread_info}. On +return, it contains the actual number of integers in @var{thread_info}. +The maximum number of integers returned by any flavor is +@code{THREAD_INFO_MAX}. + +The type of information returned is defined by @var{flavor}, which can +be one of the following: + +@table @code +@item THREAD_BASIC_INFO +The function returns basic information about the thread, as defined by +@code{thread_basic_info_t}. This includes the user and system time, the +run state, and scheduling priority. The number of integers returned is +@code{THREAD_BASIC_INFO_COUNT}. + +@item THREAD_SCHED_INFO +The function returns information about the schduling policy for the +thread as defined by @code{thread_sched_info_t}. The number of integers +returned is @code{THREAD_SCHED_INFO_COUNT}. +@end table + +The function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{target_thread} is not a thread or +@var{flavor} is not recognized. The function returns +@code{MIG_ARRAY_TOO_LARGE} if the returned info array is too large for +@var{thread_info}. In this case, @var{thread_info} is filled as much as +possible and @var{thread_infoCnt} is set to the number of elements that +would have been returned if there were enough room. +@end deftypefun + +@deftp {Data type} {struct thread_basic_info} +This structure is returned in @var{thread_info} by the +@code{thread_info} function and provides basic information about the +thread. You can cast a variable of type @code{thread_info_t} to a +pointer of this type if you provided it as the @var{thread_info} +parameter for the @code{THREAD_BASIC_INFO} flavor of @code{thread_info}. +It has the following members: + +@table @code +@item time_value_t user_time +user run time + +@item time_value_t system_time +system run time +@item int cpu_usage +Scaled cpu usage percentage. The scale factor is @code{TH_USAGE_SCALE}. + +@item int base_priority +The base scheduling priority of the thread. + +@item int cur_priority +The current scheduling priority of the thread. + +@item integer_t run_state +The run state of the thread. The possible vlues of this field are: +@table @code +@item TH_STATE_RUNNING +The thread is running normally. + +@item TH_STATE_STOPPED +The thread is suspended. + +@item TH_STATE_WAITING +The thread is waiting normally. + +@item TH_STATE_UNINTERRUPTIBLE +The thread is in an uninterruptible wait. + +@item TH_STATE_HALTED +The thread is halted at a clean point. +@end table + +@item flags +Various flags. The possible values of this field are: +@table @code +@item TH_FLAGS_SWAPPED +The thread is swapped out. + +@item TH_FLAGS_IDLE +The thread is an idle thread. +@end table + +@item int suspend_count +The suspend count for the thread. + +@item int sleep_time +The number of seconds that the thread has been sleeping. + +@item time_value_t creation_time +The time stamp of creation. +@end table +@end deftp + +@deftp {Data type} thread_basic_info_t +This is a pointer to a @code{struct thread_basic_info}. +@end deftp + +@deftp {Data type} {struct thread_sched_info} +This structure is returned in @var{thread_info} by the +@code{thread_info} function and provides schedule information about the +thread. You can cast a variable of type @code{thread_info_t} to a +pointer of this type if you provided it as the @var{thread_info} +parameter for the @code{THREAD_SCHED_INFO} flavor of @code{thread_info}. +It has the following members: + +@table @code +@item int policy +The scheduling policy of the thread, @ref{Scheduling Policy}. + +@item integer_t data +Policy-dependent scheduling information, @ref{Scheduling Policy}. + +@item int base_priority +The base scheduling priority of the thread. + +@item int max_priority +The maximum scheduling priority of the thread. + +@item int cur_priority +The current scheduling priority of the thread. + +@item int depressed +@code{TRUE} if the thread is depressed. + +@item int depress_priority +The priority the thread was depressed from. +@end table +@end deftp + +@deftp {Data type} thread_sched_info_t +This is a pointer to a @code{struct thread_sched_info}. +@end deftp + + +@node Thread Settings +@subsection Thread Settings + +@deftypefun kern_return_t thread_wire (@w{host_priv_t @var{host_priv}}, @w{thread_t @var{thread}}, @w{boolean_t @var{wired}}) +The function @code{thread_wire} controls the VM privilege level of the +thread @var{thread}. A VM-privileged thread never waits inside the +kernel for memory allocation from the kernel's free list of pages or for +allocation of a kernel stack. + +Threads that are part of the default pageout path should be +VM-privileged, to prevent system deadlocks. Threads that are not part +of the default pageout path should not be VM-privileged, to prevent the +kernel's free list of pages from being exhausted. + +The functions returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_ARGUMENT} if @var{host_priv} or @var{thread} was +invalid. + +The @code{thread_wire} call is actually an RPC to @var{host_priv}, +normally a send right for a privileged host port, but potentially any +send right. In addition to the normal diagnostic return codes from the +call's server (normally the kernel), the call may return @code{mach_msg} +return codes. +@c See also: vm_wire(2), vm_set_default_memory_manager(2). +@end deftypefun + + +@node Thread Execution +@subsection Thread Execution + +@deftypefun kern_return_t thread_suspend (@w{thread_t @var{target_thread}}) +Increments the thread's suspend count and prevents the thread from +executing any more user level instructions. In this context a user +level instruction is either a machine instruction executed in user mode +or a system trap instruction including page faults. Thus if a thread is +currently executing within a system trap the kernel code may continue to +execute until it reaches the system return code or it may supend within +the kernel code. In either case, when the thread is resumed the system +trap will return. This could cause unpredictible results if the user +did a suspend and then altered the user state of the thread in order to +change its direction upon a resume. The call @code{thread_abort} is +provided to allow the user to abort any system call that is in progress +in a predictable way. + +The suspend count may become greater than one with the effect that it +will take more than one resume call to restart the thread. + +The function returns @code{KERN_SUCCESS} if the thread has been +suspended and @code{KERN_INVALID_ARGUMENT} if @var{target_thread} is not +a thread. +@end deftypefun + +@deftypefun kern_return_t thread_resume (@w{thread_t @var{target_thread}}) +Decrements the threads's suspend count. If the count becomes zero the +thread is resumed. If it is still positive, the thread is left +suspended. The suspend count may not become negative. + +The function returns @code{KERN_SUCCESS} if the thread has been resumed, +@code{KERN_FAILURE} if the suspend count is already zero and +@code{KERN_INVALID_ARGUMENT} if @var{target_thread} is not a thread. +@end deftypefun + +@deftypefun kern_return_t thread_abort (@w{thread_t @var{target_thread}}) +The function @code{thread_abort} aborts the kernel primitives: +@code{mach_msg}, @code{msg_send}, @code{msg_receive} and @code{msg_rpc} +and page-faults, making the call return a code indicating that it was +interrupted. The call is interrupted whether or not the thread (or task +containing it) is currently suspended. If it is supsended, the thread +receives the interupt when it is resumed. + +A thread will retry an aborted page-fault if its state is not modified +before it is resumed. @code{msg_send} returns @code{SEND_INTERRUPTED}; +@code{msg_receive} returns @code{RCV_INTERRUPTED}; @code{msg_rpc} +returns either @code{SEND_INTERRUPTED} or @code{RCV_INTERRUPTED}, +depending on which half of the RPC was interrupted. + +The main reason for this primitive is to allow one thread to cleanly +stop another thread in a manner that will allow the future execution of +the target thread to be controlled in a predictable way. +@code{thread_suspend} keeps the target thread from executing any further +instructions at the user level, including the return from a system call. +@code{thread_get_state}/@code{thread_set_state} allows the examination +or modification of the user state of a target thread. However, if a +suspended thread was executing within a system call, it also has +associated with it a kernel state. This kernel state can not be +modified by @code{thread_set_state} with the result that when the thread +is resumed the system call may return changing the user state and +possibly user memory. @code{thread_abort} aborts the kernel call from +the target thread's point of view by resetting the kernel state so that +the thread will resume execution at the system call return with the +return code value set to one of the interrupted codes. The system call +itself will either be entirely completed or entirely aborted, depending +on the precise moment at which the abort was received. Thus if the +thread's user state has been changed by @code{thread_set_state}, it will +not be modified by any unexpected system call side effects. + +For example to simulate a Unix signal, the following sequence of calls +may be used: + +@enumerate +@item +@code{thread_suspend}: Stops the thread. + +@item +@code{thread_abort}: Interrupts any system call in progress, setting the +return value to `interrupted'. Since the thread is stopped, it will not +return to user code. + +@item +@code{thread_set_state}: Alters thread's state to simulate a procedure +call to the signal handler + +@item +@code{thread_resume}: Resumes execution at the signal handler. If the +thread's stack has been correctly set up, the thread may return to the +interrupted system call. (Of course, the code to push an extra stack +frame and change the registers is VERY machine-dependent.) +@end enumerate + +Calling @code{thread_abort} on a non-suspended thread is pretty risky, +since it is very difficult to know exactly what system trap, if any, the +thread might be executing and whether an interrupt return would cause +the thread to do something useful. + +The function returns @code{KERN_SUCCESS} if the thread received an +interrupt and @code{KERN_INVALID_ARGUMENT} if @var{target_thread} is not +a thread. +@end deftypefun + +@deftypefun kern_return_t thread_get_state (@w{thread_t @var{target_thread}}, @w{int @var{flavor}}, @w{thread_state_t @var{old_state}}, @w{mach_msg_type_number_t *@var{old_stateCnt}}) +The function @code{thread_get_state} returns the execution state +(e.g. the machine registers) of @var{target_thread} as specified by +@var{flavor}. The @var{old_state} is an array of integers that is +provided by the caller and returned filled with the specified +information. @var{old_stateCnt} is input set to the maximum number of +integers in @var{old_state} and returned equal to the actual number of +integers in @var{old_state}. + +@var{target_thread} may not be @code{mach_thread_self()}. + +The definition of the state structures can be found in +@file{machine/thread_status.h}. + +The function returns @code{KERN_SUCCESS} if the state has been returned, +@code{KERN_INVALID_ARGUMENT} if @var{target_thread} is not a thread or +is @code{mach_thread_self} or @var{flavor} is unrecogized for this machine. +The function returns @code{MIG_ARRAY_TOO_LARGE} if the returned state is +too large for @var{old_state}. In this case, @var{old_state} is filled +as much as possible and @var{old_stateCnt} is set to the number of +elements that would have been returned if there were enough room. +@end deftypefun + +@deftypefun kern_return_t thread_set_state (@w{thread_t @var{target_thread}}, @w{int @var{flavor}}, @w{thread_state_t @var{new_state}}, @w{mach_msg_type_number_t @var{new_state_count}}) +The function @code{thread_set_state} sets the execution state (e.g. the +machine registers) of @var{target_thread} as specified by @var{flavor}. +The @var{new_state} is an array of integers. @var{new_state_count} is +the number of elements in @var{new_state}. The entire set of registers +is reset. This will do unpredictable things if @var{target_thread} is +not suspended. + +@var{target_thread} may not be @code{mach_thread_self}. + +The definition of the state structures can be found in +@file{machine/thread_status.h}. + +The function returns @code{KERN_SUCCESS} if the state has been set and +@code{KERN_INVALID_ARGUMENT} if @var{target_thread} is not a thread or +is @code{mach_thread_self} or @var{flavor} is unrecogized for this +machine. +@end deftypefun + + +@node Scheduling +@subsection Scheduling + +@menu +* Thread Priority:: Changing the priority of a thread. +* Hand-Off Scheduling:: Switching to a new thread. +* Scheduling Policy:: Setting the scheduling policy. +@end menu + + +@node Thread Priority +@subsubsection Thread Priority + +Threads have three priorities associated with them by the system, a +priority, a maximum priority, and a scheduled priority. The scheduled +priority is used to make scheduling decisions about the thread. It is +determined from the priority by the policy (for timesharing, this means +adding an increment derived from cpu usage). The priority can be set +under user control, but may never exceed the maximum priority. Changing +the maximum priority requires presentation of the control port for the +thread's processor set; since the control port for the default processor +set is privileged, users cannot raise their maximum priority to unfairly +compete with other users on that set. Newly created threads obtain +their priority from their task and their max priority from the thread. + +@deftypefun kern_return_t thread_priority (@w{thread_t @var{thread}}, @w{int @var{prority}}, @w{boolean_t @var{set_max}}) +The function @code{thread_priority} changes the priority and optionally +the maximum priority of @var{thread}. Priorities range from 0 to 31, +where lower numbers denote higher priorities. If the new priority is +higher than the priority of the current thread, preemption may occur as +a result of this call. The maximum priority of the thread is also set +if @var{set_max} is @code{TRUE}. This call will fail if @var{priority} +is greater than the current maximum priority of the thread. As a +result, this call can only lower the value of a thread's maximum +priority. + +The functions returns @code{KERN_SUCCESS} if the operation completed +successfully, @code{KERN_INVALID_ARGUMENT} if @var{thread} is not a +thread or @var{priority} is out of range (not in 0..31), and +@code{KERN_FAILURE} if the requested operation would violate the +thread's maximum priority (thread_priority). +@end deftypefun + +@deftypefun kern_return_t thread_max_priority (@w{thread_t @var{thread}}, @w{processor_set_t @var{processor_set}}, @w{int @var{priority}}) +The function @code{thread_max_priority} changes the maximum priority of +the thread. Because it requires presentation of the corresponding +processor set port, this call can reset the maximum priority to any +legal value. + +The functions returns @code{KERN_SUCCESS} if the operation completed +successfully, @code{KERN_INVALID_ARGUMENT} if @var{thread} is not a +thread or @var{processor_set} is not a control port for a processor set +or @var{priority} is out of range (not in 0..31), and +@code{KERN_FAILURE} if the thread is not assigned to the processor set +whose control port was presented. +@end deftypefun + + +@node Hand-Off Scheduling +@subsubsection Hand-Off Scheduling + +@deftypefun kern_return_t thread_switch (@w{thread_t @var{new_thread}}, @w{int @var{option}}, @w{int @var{time}}) +The function @code{thread_switch} provides low-level access to the +scheduler's context switching code. @var{new_thread} is a hint that +implements hand-off scheduling. The operating system will attempt to +switch directly to the new thread (by passing the normal logic that +selects the next thread to run) if possible. Since this is a hint, it +may be incorrect; it is ignored if it doesn't specify a thread on the +same host as the current thread or if that thread can't be switched to +(i.e., not runnable or already running on another processor). In this +case, the normal logic to select the next thread to run is used; the +current thread may continue running if there is no other appropriate +thread to run. + +Options for @var{option} are defined in @file{mach/thread_switch.h} and +specify the interpretation of @var{time}. The possible values for +@var{option} are: + +@table @code +@item SWITCH_OPTION_NONE +No options, the time argument is ignored. + +@item SWITCH_OPTION_WAIT +The thread is blocked for the specified time. This can be aborted by +@code{thread_abort}. + +@item SWITCH_OPTION_DEPRESS +The thread's priority is depressed to the lowest possible value for the +specified time. This can be aborted by @code{thread_depress_abort}. +This depression is independent of operations that change the thread's +priority (e.g. @code{thread_priority} will not abort the depression). +The minimum time and units of time can be obtained as the +@code{min_timeout} value from @code{host_info}. The depression is also +aborted when the current thread is next run (either via hand­off +scheduling or because the processor set has nothing better to do). +@end table + +@code{thread_switch} is often called when the current thread can proceed +no further for some reason; the various options and arguments allow +information about this reason to be transmitted to the kernel. The +@var{new_thread} argument (handoff scheduling) is useful when the +identity of the thread that must make progress before the current thread +runs again is known. The @code{WAIT} option is used when the amount of +time that the current thread must wait before it can do anything useful +can be estimated and is fairly long. The @code{DEPRESS} option is used +when the amount of time that must be waited is fairly short, especially +when the identity of the thread that is being waited for is not known. + +Users should beware of calling @code{thread_switch} with an invalid hint +(e.g. @code{MACH_PORT_NULL}) and no option. Because the time-sharing +scheduler varies the priority of threads based on usage, this may result +in a waste of cpu time if the thread that must be run is of lower +priority. The use of the @code{DEPRESS} option in this situation is +highly recommended. + +@code{thread_switch} ignores policies. Users relying on the preemption +semantics of a fixed time policy should be aware that +@code{thread_switch} ignores these semantics; it will run the specified +@var{new_thread} indepent of its priority and the priority of any other +threads that could be run instead. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_ARGUMENT} if @var{thread} is not a thread or +@var{option} is not a recognized option, and @code{KERN_FAILURE} if +@code{kern_depress_abort} failed because the thread was not depressed. +@end deftypefun + +@deftypefun kern_return_t thread_depress_abort (@w{thread_t @var{thread}}) +The function @code{thread_depress_abort} cancels any priority depression +for @var{thread} caused by a @code{swtch_pri} or @code{thread_switch} +call. + +The function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{thread} is not a valid thread. +@end deftypefun + +@deftypefun boolean_t swtch () +@c XXX Clear up wording. +The system trap @code{swtch} attempts to switch the current thread off +the processor. The return value indicates if more than the current +thread is running in the processor set. This is useful for lock +management routines. + +The call returns @code{FALSE} if the thread is justified in becoming a +resource hog by continuing to spin because there's nothing else useful +that the processor could do. @code{TRUE} is returned if the thread +should make one more check on the lock and then be a good citizen and +really suspend. +@end deftypefun + +@deftypefun boolean_t swtch_pri (@w{int @var{priority}}) +The system trap @code{swtch_pri} attempts to switch the current thread +off the processor as @code{swtch} does, but depressing the priority of +the thread to the minimum possible value during the time. +@var{priority} is not used currently. + +The return value is as for @code{swtch}. +@end deftypefun + + +@node Scheduling Policy +@subsubsection Scheduling Policy + +@deftypefun kern_return_t thread_policy (@w{thread_t @var{thread}}, @w{int @var{policy}}, @w{int @var{data}}) +The function @code{thread_policy} changes the scheduling policy for +@var{thread} to @var{policy}. + +@var{data} is policy-dependent scheduling information. There are +currently two supported policies: @code{POLICY_TIMESHARE} and +@code{POLICY_FIXEDPRI} defined in @file{mach/policy.h}; this file is +included by @file{mach.h}. @var{data} is meaningless for timesharing, +but is the quantum to be used (in milliseconds) for the fixed priority +policy. To be meaningful, this quantum must be a multiple of the basic +system quantum (min_quantum) which can be obtained from +@code{host_info}. The system will always round up to the next multiple +of the quantum. + +Processor sets may restrict the allowed policies, so this call will fail +if the processor set to which @var{thread} is currently assigned does +not permit @var{policy}. + +The function returns @code{KERN_SUCCESS} if the call succeeded. +@code{KERN_INVALID_ARGUMENT} if @var{thread} is not a thread or +@var{policy} is not a recognized policy, and @code{KERN_FAILURE} if the +processor set to which @var{thread} is currently assigned does not +permit @var{policy}. +@end deftypefun + + +@node Thread Special Ports +@subsection Thread Special Ports + +@deftypefun kern_return_t thread_get_special_port (@w{thread_t @var{thread}}, @w{int @var{which_port}}, @w{mach_port_t *@var{special_port}}) +The function @code{thread_get_special_port} returns send rights to one +of a set of special ports for the thread specified by @var{thread}. + +The possible values for @var{which_port} are @code{THREAD_KERNEL_PORT} +and @code{THREAD_EXCEPTION_PORT}. A thread also has access to its +task's special ports. + +The function returns @code{KERN_SUCCESS} if the port was returned and +@code{KERN_INVALID_ARGUMENT} if @var{thread} is not a thread or +@var{which_port} is an invalid port selector. +@end deftypefun + +@deftypefun kern_return_t thread_get_kernel_port (@w{thread_t @var{thread}}, @w{mach_port_t *@var{kernel_port}}) +The function @code{thread_get_kernel_port} is equivalent to the function +@code{thread_get_special_port} with the @var{which_port} argument set to +@code{THREAD_KERNEL_PORT}. +@end deftypefun + +@deftypefun kern_return_t thread_get_exception_port (@w{thread_t @var{thread}}, @w{mach_port_t *@var{exception_port}}) +The function @code{thread_get_exception_port} is equivalent to the +function @code{thread_get_special_port} with the @var{which_port} +argument set to @code{THREAD_EXCEPTION_PORT}. +@end deftypefun + +@deftypefun kern_return_t thread_set_special_port (@w{thread_t @var{thread}}, @w{int @var{which_port}}, @w{mach_port_t @var{special_port}}) +The function @code{thread_set_special_port} sets one of a set of special +ports for the thread specified by @var{thread}. + +The possible values for @var{which_port} are @code{THREAD_KERNEL_PORT} +and @code{THREAD_EXCEPTION_PORT}. A thread also has access to its +task's special ports. + +The function returns @code{KERN_SUCCESS} if the port was set and +@code{KERN_INVALID_ARGUMENT} if @var{thread} is not a thread or +@var{which_port} is an invalid port selector. +@end deftypefun + +@deftypefun kern_return_t thread_set_kernel_port (@w{thread_t @var{thread}}, @w{mach_port_t @var{kernel_port}}) +The function @code{thread_set_kernel_port} is equivalent to the function +@code{thread_set_special_port} with the @var{which_port} argument set to +@code{THREAD_KERNEL_PORT}. +@end deftypefun + +@deftypefun kern_return_t thread_set_exception_port (@w{thread_t @var{thread}}, @w{mach_port_t @var{exception_port}}) +The function @code{thread_set_exception_port} is equivalent to the +function @code{thread_set_special_port} with the @var{which_port} +argument set to @code{THREAD_EXCEPTION_PORT}. +@end deftypefun + + +@node Exceptions +@subsection Exceptions + +@deftypefun kern_return_t catch_exception_raise (@w{mach_port_t @var{exception_port}}, @w{thread_t @var{thread}}, @w{task_t @var{task}}, @w{int @var{exception}}, @w{int @var{code}}, @w{int @var{subcode}}) +XXX Fixme +@end deftypefun + +@deftypefun kern_return_t exception_raise (@w{mach_port_t @var{exception_port}}, @w{mach_port_t @var{thread}}, @w{mach_port_t @var{task}}, @w{integer_t @var{exception}}, @w{integer_t @var{code}}, @w{integer_t @var{subcode}}) +XXX Fixme +@end deftypefun + +@deftypefun kern_return_t evc_wait (@w{unsigned int @var{event}}) +@c XXX This is for user space drivers, the description is incomplete. +The system trap @code{evc_wait} makes the calling thread wait for the +event specified by @var{event}. + +The call returns @code{KERN_SUCCESS} if the event has occured, +@code{KERN_NO_SPACE} if another thread is waiting for the same event and +@code{KERN_INVALID_ARGUMENT} if the event object is invalid. +@end deftypefun + + +@node Task Interface +@section Task Interface + +@cindex task port +@cindex port representing a task +@deftp {Data type} task_t +This is a @code{mach_port_t} and used to hold the port name of a task +port that represents the thread. Manipulations of the task are +implemented as remote procedure calls to the task port. A task can get +a port to itself with the @code{mach_task_self} system call. + +The task port name is also used to identify the task's IPC space +(@pxref{Port Manipulation Interface}) and the task's virtual memory map +(@pxref{Virtual Memory Interface}). +@end deftp + +@menu +* Task Creation:: Creating tasks. +* Task Termination:: Terminating tasks. +* Task Information:: Informations on tasks. +* Task Execution:: Thread scheduling in a task. +* Task Special Ports:: How to get and set the task's special ports. +* Syscall Emulation:: How to emulate system calls. +@end menu + + +@node Task Creation +@subsection Task Creation + +@deftypefun kern_return_t task_create (@w{task_t @var{parent_task}}, @w{boolean_t @var{inherit_memory}}, @w{task_t *@var{child_task}}) +The function @code{task_create} creates a new task from +@var{parent_task}; the resulting task (@var{child_task}) acquires shared +or copied parts of the parent's address space (see @code{vm_inherit}). +The child task initially contains no threads. + +If @var{inherit_memory} is set, the child task's address space is built +from the parent task according to its memory inheritance values; +otherwise, the child task is given an empty address space. + +The child task gets the three special ports created or copied for it at +task creation. The @code{TASK_KERNEL_PORT} is created and send rights +for it are given to the child and returned to the caller. +@c The following is only relevant if MACH_IPC_COMPAT is used. +@c The @code{TASK_NOTIFY_PORT} is created and receive, ownership and send rights +@c for it are given to the child. The caller has no access to it. +The @code{TASK_BOOTSTRAP_PORT} and the @code{TASK_EXCEPTION_PORT} are +inherited from the parent task. The new task can get send rights to +these ports with the call @code{task_get_special_port}. + +The function returns @code{KERN_SUCCESS} if a new task has been created, +@code{KERN_INVALID_ARGUMENT} if @var{parent_task} is not a valid task +port and @code{KERN_RESOURCE_SHORTAGE} if some critical kernel resource +is unavailable. +@end deftypefun + + +@node Task Termination +@subsection Task Termination + +@deftypefun kern_return_t task_terminate (@w{task_t @var{target_task}}) +The function @code{task_terminate} destroys the task specified by +@var{target_task} and all its threads. All resources that are used only +by this task are freed. Any port to which this task has receive and +ownership rights is destroyed. + +The function returns @code{KERN_SUCCESS} if the task has been killed, +@code{KERN_INVALID_ARGUMENT} if @var{target_task} is not a task. +@end deftypefun + + +@node Task Information +@subsection Task Information +@deftypefun task_t mach_task_self () +The @code{mach_task_self} system call returns the calling thread's task +port. + +@code{mach_task_self} has an effect equivalent to receiving a send right +for the task port. @code{mach_task_self} returns the name of the send +right. In particular, successive calls will increase the calling task's +user-reference count for the send right. + +As a special exception, the kernel will overrun the user reference count +of the task name port, so that this function can not fail for that +reason. Because of this, the user should not deallocate the port right +if an overrun might have happened. Otherwise the reference count could +drop to zero and the send right be destroyed while the user still +expects to be able to use it. As the kernel does not make use of the +number of extant send rights anyway, this is safe to do (the task port +itself is not destroyed, even when there are no send rights anymore). + +The funcion returns @code{MACH_PORT_NULL} if a resource shortage +prevented the reception of the send right, @code{MACH_PORT_NULL} if the +task port is currently null, @code{MACH_PORT_DEAD} if the task port is +currently dead. +@end deftypefun + +@deftypefun kern_return_t task_threads (@w{task_t @var{target_task}}, @w{thread_array_t *@var{thread_list}}, @w{mach_msg_type_number_t *@var{thread_count}}) +The function @code{task_threads} gets send rights to the kernel port for +each thread contained in @var{target_task}. @var{thread_list} is an +array that is created as a result of this call. The caller may wish to +@code{vm_deallocate} this array when the data is no longer needed. + +The function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{target_task} is not a task. +@end deftypefun + +@deftypefun kern_return_t task_info (@w{task_t @var{target_task}}, @w{int @var{flavor}}, @w{task_info_t @var{task_info}}, @w{mach_msg_type_number_t *@var{task_info_count}}) +The function @code{task_info} returns the selected information array for +a task, as specified by @var{flavor}. @var{task_info} is an array of +integers that is supplied by the caller, and filled with specified +information. @var{task_info_count} is supplied as the maximum number of +integers in @var{task_info}. On return, it contains the actual number +of integers in @var{task_info}. The maximum number of integers returned +by any flavor is @code{TASK_INFO_MAX}. + +The type of information returned is defined by @var{flavor}, which can +be one of the following: + +@table @code +@item TASK_BASIC_INFO +The function returns basic information about the task, as defined by +@code{task_basic_info_t}. This includes the user and system time and +memory consumption. The number of integers returned is +@code{TASK_BASIC_INFO_COUNT}. + +@item TASK_EVENTS_INFO +The function returns information about events for the task as defined by +@code{thread_sched_info_t}. This includes statistics about virtual +memory and IPC events like pageouts, pageins and messages sent and +received. The number of integers returned is +@code{TASK_EVENTS_INFO_COUNT}. + +@item TASK_THREAD_TIMES_INFO +The function returns information about the total time for live threads +as defined by @code{task_thread_times_info_t}. The number of integers +returned is @code{TASK_THREAD_TIMES_INFO_COUNT}. +@end table + +The function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{target_task} is not a thread or +@var{flavor} is not recognized. The function returns +@code{MIG_ARRAY_TOO_LARGE} if the returned info array is too large for +@var{task_info}. In this case, @var{task_info} is filled as much as +possible and @var{task_infoCnt} is set to the number of elements that +would have been returned if there were enough room. +@end deftypefun + +@deftp {Data type} {struct task_basic_info} +This structure is returned in @var{task_info} by the @code{task_info} +function and provides basic information about the task. You can cast a +variable of type @code{task_info_t} to a pointer of this type if you +provided it as the @var{task_info} parameter for the +@code{TASK_BASIC_INFO} flavor of @code{task_info}. It has the following +members: + +@table @code +@item integer_t suspend_count +suspend count for task + +@item integer_t base_priority +base scheduling priority + +@item vm_size_t virtual_size +number of virtual pages + +@item vm_size_t resident_size +number of resident pages + +@item time_value_t user_time +total user run time for terminated threads + +@item time_value_t system_time +total system run time for terminated threads + +@item time_value_t creation_time +creation time stamp +@end table +@end deftp + +@deftp {Data type} task_basic_info_t +This is a pointer to a @code{struct task_basic_info}. +@end deftp + +@deftp {Data type} {struct task_events_info} +This structure is returned in @var{task_info} by the @code{task_info} +function and provides event statistics for the task. You can cast a +variable of type @code{task_info_t} to a pointer of this type if you +provided it as the @var{task_info} parameter for the +@code{TASK_EVENTS_INFO} flavor of @code{task_info}. It has the +following members: + +@table @code +@item natural_t faults +number of page faults + +@item natural_t zero_fills +number of zero fill pages + +@item natural_t reactivations +number of reactivated pages + +@item natural_t pageins +number of actual pageins + +@item natural_t cow_faults +number of copy-on-write faults + +@item natural_t messages_sent +number of messages sent + +@item natural_t messages_received +number of messages received +@end table +@end deftp + +@deftp {Data type} task_events_info_t +This is a pointer to a @code{struct task_events_info}. +@end deftp + +@deftp {Data type} {struct task_thread_times_info} +This structure is returned in @var{task_info} by the @code{task_info} +function and provides event statistics for the task. You can cast a +variable of type @code{task_info_t} to a pointer of this type if you +provided it as the @var{task_info} parameter for the +@code{TASK_THREAD_TIMES_INFO} flavor of @code{task_info}. It has the +following members: + +@table @code +@item time_value_t user_time +total user run time for live threads + +@item time_value_t system_time +total system run time for live threads +@end table +@end deftp + +@deftp {Data type} task_thread_times_info_t +This is a pointer to a @code{struct task_thread_times_info}. +@end deftp + + +@node Task Execution +@subsection Task Execution + +@deftypefun kern_return_t task_suspend (@w{task_t @var{target_task}}) +The function @code{task_suspend} increments the task's suspend count and +stops all threads in the task. As long as the suspend count is positive +newly created threads will not run. This call does not return until all +threads are suspended. + +The count may become greater than one, with the effect that it will take +more than one resume call to restart the task. + +The function returns @code{KERN_SUCCESS} if the task has been suspended +and @code{KERN_INVALID_ARGUMENT} if @var{target_task} is not a task. +@end deftypefun + +@deftypefun kern_return_t task_resume (@w{task_t @var{target_task}}) +The function @code{task_resume} decrements the task's suspend count. If +it becomes zero, all threads with zero suspend counts in the task are +resumed. The count may not become negative. + +The function returns @code{KERN_SUCCESS} if the task has been resumed, +@code{KERN_FAILURE} if the suspend count is already at zero and +@code{KERN_INVALID_ARGUMENT} if @var{target_task} is not a task. +@end deftypefun + +@c XXX Should probably be in the "Scheduling" node of the Thread Interface. +@deftypefun kern_return_t task_priority (@w{task_t @var{task}}, @w{int @var{priority}}, @w{boolean_t @var{change_threads}}) +The priority of a task is used only for creation of new threads; a new +thread's priority is set to the enclosing task's priority. +@code{task_priority} changes this task priority. It also sets the +priorities of all threads in the task to this new priority if +@var{change_threads} is @code{TRUE}. Existing threads are not affected +otherwise. If this priority change violates the maximum priority of +some threads, as many threads as possible will be changed and an error +code will be returned. + +The function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_ARGUMENT} if @var{task} is not a task, or +@var{priority} is not a valid priority and @code{KERN_FAILURE} if +@var{change_threads} was @code{TRUE} and the attempt to change the +priority of at least one existing thread failed because the new priority +would have exceeded that thread's maximum priority. +@end deftypefun + +@deftypefun kern_return_t task_ras_control (@w{task_t @var{target_task}}, @w{vm_address_t @var{start_pc}}, @w{vm_address_t @var{end_pc}}, @w{int @var{flavor}}) +The function @code{task_ras_control} manipulates a task's set of +restartable atomic sequences. If a sequence is installed, and any +thread in the task is preempted within the range +[@var{start_pc},@var{end_pc}], then the thread is resumed at +@var{start_pc}. This enables applications to build atomic sequences +which, when executed to completion, will have executed atomically. +Restartable atomic sequences are intended to be used on systems that do +not have hardware support for low-overhead atomic primitives. + +As a thread can be rolled-back, the code in the sequence should have no +side effects other than a final store at @var{end_pc}. The kernel does +not guarantee that the sequence is restartable. It assumes the +application knows what it's doing. + +A task may have a finite number of atomic sequences that is defined at +compile time. + +The flavor specifices the particular operation that should be applied to +this restartable atomic sequence. Possible values for flavor can be: + +@table @code +@item TASK_RAS_CONTROL_PURGE_ALL +Remove all registered sequences for this task. + +@item TASK_RAS_CONTROL_PURGE_ONE +Remove the named registered sequence for this task. + +@item TASK_RAS_CONTROL_PURGE_ALL_AND_INSTALL_ONE +Atomically remove all registered sequences and install the named +sequence. + +@item TASK_RAS_CONTROL_INSTALL_ONE +Install this sequence. +@end table + +The function returns @code{KERN_SUCCESS} if the operation has been +performed, @code{KERN_INVALID_ADDRESS} if the @var{start_pc} or +@var{end_pc} values are not a valid address for the requested operation +(for example, it is invalid to purge a sequence that has not been +registered), @code{KERN_RESOURCE_SHORTAGE} if an attempt was made to +install more restartable atomic sequences for a task than can be +supported by the kernel, @code{KERN_INVALID_VALUE} if a bad flavor was +specified, @code{KERN_INVALID_ARGUMENT} if @var{target_task} is not a +task and @code{KERN_FAILURE} if the call is not not supported on this +configuration. +@end deftypefun + + +@node Task Special Ports +@subsection Task Special Ports + +@deftypefun kern_return_t task_get_special_port (@w{task_t @var{task}}, @w{int @var{which_port}}, @w{mach_port_t *@var{special_port}}) +The function @code{task_get_special_port} returns send rights to one of +a set of special ports for the task specified by @var{task}. + +The special ports associated with a task are the kernel port +(@code{TASK_KERNEL_PORT}), the bootstrap port +(@code{TASK_BOOTSTRAP_PORT}) and the exception port +(@code{TASK_EXCEPTION_PORT}). The bootstrap port is a port to which a +task may send a message requesting other system service ports. This +port is not used by the kernel. The task's exception port is the port +to which messages are sent by the kernel when an exception occurs and +the thread causing the exception has no exception port of its own. + +The following macros to call @code{task_get_special_port} for a specific +port are defined in @code{mach/task_special_ports.h}: +@code{task_get_exception_port} and @code{task_get_bootstrap_port}. + +The function returns @code{KERN_SUCCESS} if the port was returned and +@code{KERN_INVALID_ARGUMENT} if @var{task} is not a task or +@var{which_port} is an invalid port selector. +@end deftypefun + +@deftypefun kern_return_t task_get_kernel_port (@w{task_t @var{task}}, @w{mach_port_t *@var{kernel_port}}) +The function @code{task_get_kernel_port} is equivalent to the function +@code{task_get_special_port} with the @var{which_port} argument set to +@code{TASK_KERNEL_PORT}. +@end deftypefun + +@deftypefun kern_return_t task_get_exception_port (@w{task_t @var{task}}, @w{mach_port_t *@var{exception_port}}) +The function @code{task_get_exception_port} is equivalent to the +function @code{task_get_special_port} with the @var{which_port} argument +set to @code{TASK_EXCEPTION_PORT}. +@end deftypefun + +@deftypefun kern_return_t task_get_bootstrap_port (@w{task_t @var{task}}, @w{mach_port_t *@var{bootstrap_port}}) +The function @code{task_get_bootstrap_port} is equivalent to the +function @code{task_get_special_port} with the @var{which_port} argument +set to @code{TASK_BOOTSTRAP_PORT}. +@end deftypefun + +@deftypefun kern_return_t task_set_special_port (@w{task_t @var{task}}, @w{int @var{which_port}}, @w{mach_port_t @var{special_port}}) +The function @code{thread_set_special_port} sets one of a set of special +ports for the task specified by @var{task}. + +The special ports associated with a task are the kernel port +(@code{TASK_KERNEL_PORT}), the bootstrap port +(@code{TASK_BOOTSTRAP_PORT}) and the exception port +(@code{TASK_EXCEPTION_PORT}). The bootstrap port is a port to which a +thread may send a message requesting other system service ports. This +port is not used by the kernel. The task's exception port is the port +to which messages are sent by the kernel when an exception occurs and +the thread causing the exception has no exception port of its own. + +The function returns @code{KERN_SUCCESS} if the port was set and +@code{KERN_INVALID_ARGUMENT} if @var{task} is not a task or +@var{which_port} is an invalid port selector. +@end deftypefun + +@deftypefun kern_return_t task_set_kernel_port (@w{task_t @var{task}}, @w{mach_port_t @var{kernel_port}}) +The function @code{task_set_kernel_port} is equivalent to the function +@code{task_set_special_port} with the @var{which_port} argument set to +@code{TASK_KERNEL_PORT}. +@end deftypefun + +@deftypefun kern_return_t task_set_exception_port (@w{task_t @var{task}}, @w{mach_port_t @var{exception_port}}) +The function @code{task_set_exception_port} is equivalent to the +function @code{task_set_special_port} with the @var{which_port} argument +set to @code{TASK_EXCEPTION_PORT}. +@end deftypefun + +@deftypefun kern_return_t task_set_bootstrap_port (@w{task_t @var{task}}, @w{mach_port_t @var{bootstrap_port}}) +The function @code{task_set_bootstrap_port} is equivalent to the +function @code{task_set_special_port} with the @var{which_port} argument +set to @code{TASK_BOOTSTRAP_PORT}. +@end deftypefun + + +@node Syscall Emulation +@subsection Syscall Emulation + +@deftypefun kern_return_t task_get_emulation_vector (@w{task_t @var{task}}, @w{int *@var{vector_start}}, @w{emulation_vector_t *@var{emulation_vector}}, @w{mach_msg_type_number_t *@var{emulation_vector_count}}) +The function @code{task_get_emulation_vector} gets the user-level +handler entry points for all emulated system calls. +@c XXX Fixme +@end deftypefun + +@deftypefun kern_return_t task_set_emulation_vector (@w{task_t @var{task}}, @w{int @var{vector_start}}, @w{emulation_vector_t @var{emulation_vector}}, @w{mach_msg_type_number_t @var{emulation_vector_count}}) +The function @code{task_set_emulation_vector} establishes user-level +handlers for the specified system calls. Non-emulated system calls are +specified with an entry of @code{EML_ROUTINE_NULL}. System call +emulation handlers are inherited by the childs of @var{task}. +@c XXX Fixme +@end deftypefun + +@deftypefun kern_return_t task_set_emulation (@w{task_t @var{task}}, @w{vm_address_t @var{routine_entry_pt}}, @w{int @var{routine_number}}) +The function @code{task_set_emulation} establishes a user-level handler +for the specified system call. System call emulation handlers are +inherited by the childs of @var{task}. +@c XXX Fixme +@end deftypefun + +@c XXX Fixme datatype emulation_vector_t + + +@node Profiling +@section Profiling + +@deftypefun kern_return_t task_enable_pc_sampling (@w{task_t @var{task}}, @w{int *@var{ticks}}, @w{sampled_pc_flavor_t @var{flavor}}) +@deftypefunx kern_return_t thread_enable_pc_sampling (@w{thread_t @var{thread}}, @w{int *@var{ticks}}, @w{sampled_pc_flavor_t @var{flavor}}) +The function @code{task_enable_pc_sampling} enables PC sampling for +@var{task}, the function @code{thread_enable_pc_sampling} enables PC +sampling for @var{thread}. The kernel's idea of clock granularity is +returned in @var{ticks} in usecs. (this value should not be trusted). The +sampling flavor is specified by @var{flavor}. + +The function returns @code{KERN_SUCCESS} if the operation is completed successfully +and @code{KERN_INVALID_ARGUMENT} if @var{thread} is not a valid thread. +@end deftypefun + +@deftypefun kern_return_t task_disable_pc_sampling (@w{task_t @var{task}}, @w{int *@var{sample_count}}) +@deftypefunx kern_return_t thread_disable_pc_sampling (@w{thread_t @var{thread}}, @w{int *@var{sample_count}}) +The function @code{task_disable_pc_sampling} disables PC sampling for +@var{task}, the function @code{thread_disable_pc_sampling} disables PC +sampling for @var{thread}. The number of sample elements in the kernel +for the thread is returned in @var{sample_count}. + +The function returns @code{KERN_SUCCESS} if the operation is completed successfully +and @code{KERN_INVALID_ARGUMENT} if @var{thread} is not a valid thread. +@end deftypefun + +@deftypefun kern_return_t task_get_sampled_pcs (@w{task_t @var{task}}, @w{sampled_pc_seqno_t *@var{seqno}}, @w{sampled_pc_array_t @var{sampled_pcs}}, @w{mach_msg_type_number_t *@var{sample_count}}) +@deftypefunx kern_return_t thread_get_sampled_pcs (@w{thread_t @var{thread}}, @w{sampled_pc_seqno_t *@var{seqno}}, @w{sampled_pc_array_t @var{sampled_pcs}}, @w{int *@var{sample_count}}) +The function @code{task_get_sampled_pcs} extracts the PC samples for +@var{task}, the function @code{thread_get_sampled_pcs} extracts the PC +samples for @var{thread}. @var{seqno} is the sequence number of the +sampled PCs. This is useful for determining when a collector thread has +missed a sample. The sampled PCs for the thread are returned in +@var{sampled_pcs}. @var{sample_count} contains the number of sample +elements returned. + +The function returns @code{KERN_SUCCESS} if the operation is completed successfully, +@code{KERN_INVALID_ARGUMENT} if @var{thread} is not a valid thread and +@code{KERN_FAILURE} if @var{thread} is not sampled. +@end deftypefun + + +@deftp {Data type} sampled_pc_t +This structure is returned in @var{sampled_pcs} by the +@code{thread_get_sampled_pcs} and @code{task_get_sampled_pcs} functions +and provides pc samples for threads or tasks. It has the following +members: + +@table @code +@item natural_t id +A thread-specific unique identifier. + +@item vm_offset_t pc +A pc value. + +@item sampled_pc_flavor_t sampletype +The type of the sample as per flavor. +@end table +@end deftp + + +@deftp {Data type} sampled_pc_flavor_t +This data type specifies a pc sample flavor, either as argument passed +in @var{flavor} to the @code{thread_enable_pc_sample} and +@code{thread_disable_pc_sample} functions, or as member +@code{sampletype} in the @code{sample_pc_t} data type. The flavor is a +bitwise-or of the possible flavors defined in @file{mach/pc_sample.h}: + +@table @code +@item SAMPLED_PC_PERIODIC +default +@item SAMPLED_PC_VM_ZFILL_FAULTS +zero filled fault +@item SAMPLED_PC_VM_REACTIVATION_FAULTS +reactivation fault +@item SAMPLED_PC_VM_PAGEIN_FAULTS +pagein fault +@item SAMPLED_PC_VM_COW_FAULTS +copy-on-write fault +@item SAMPLED_PC_VM_FAULTS_ANY +any fault +@item SAMPLED_PC_VM_FAULTS +the bitwise-or of @code{SAMPLED_PC_VM_ZFILL_FAULTS}, +@code{SAMPLED_PC_VM_REACTIVATION_FAULTS}, +@code{SAMPLED_PC_VM_PAGEIN_FAULTS} and @code{SAMPLED_PC_VM_COW_FAULTS}. +@end table +@end deftp + +@c XXX sampled_pc_array_t, sampled_pc_seqno_t + + +@node Host Interface +@chapter Host Interface +@cindex host interface + +This section describes the Mach interface to a host executing a Mach +kernel. The interface allows to query statistics about a host and +control its behaviour. + +A host is represented by two ports, a name port @var{host} used to query +information about the host accessible to everyone, and a control port +@var{host_priv} used to manipulate it. For example, you can query the +current time using the name port, but to change the time you need to +send a message to the host control port. + +Everything described in this section is declared in the header file +@file{mach.h}. + +@menu +* Host Ports:: Ports representing a host. +* Host Information:: Retrieval of information about a host. +* Host Time:: Operations on the time as seen by a host. +* Host Reboot:: Rebooting the system. +@end menu + + +@node Host Ports +@section Host Ports +@cindex host ports +@cindex ports representing a host + +@cindex host name port +@deftp {Data type} host_t +This is a @code{mach_port_t} and used to hold the port name of a host +name port (or short: host port). Any task can get a send right to the +name port of the host running the task using the @code{mach_host_self} +system call. The name port can be used query information about the +host, for example the current time. +@end deftp + +@deftypefun host_t mach_host_self () +The @code{mach_host_self} system call returns the calling thread's host +name port. It has an effect equivalent to receiving a send right for +the host port. @code{mach_host_self} returns the name of the send +right. In particular, successive calls will increase the calling task's +user-reference count for the send right. + +As a special exception, the kernel will overrun the user reference count +of the host name port, so that this function can not fail for that +reason. Because of this, the user should not deallocate the port right +if an overrun might have happened. Otherwise the reference count could +drop to zero and the send right be destroyed while the user still +expects to be able to use it. As the kernel does not make use of the +number of extant send rights anyway, this is safe to do (the host port +itself is never destroyed). + +The function returns @code{MACH_PORT_NULL} if a resource shortage +prevented the reception of the send right. + +This function is also available in @file{mach/mach_traps.h}. +@end deftypefun + +@cindex host control port +@deftp {Data type} host_priv_t +This is a @code{mach_port_t} and used to hold the port name of a +privileged host control port. A send right to the host control port is +inserted into the first task at bootstrap (@pxref{Modules}). This is +the only way to get access to the host control port in Mach, so the +initial task has to preserve the send right carefully, moving a copy of +it to other privileged tasks if necessary and denying access to +unprivileged tasks. +@end deftp + + +@node Host Information +@section Host Information + +@deftypefun kern_return_t host_info (@w{host_t @var{host}}, @w{int @var{flavor}}, @w{host_info_t @var{host_info}}, @w{mach_msg_type_number_t *@var{host_info_count}}) +The @code{host_info} function returns various information about +@var{host}. @var{host_info} is an array of integers that is supplied by +the caller. It will be filled with the requested information. +@var{host_info_count} is supplied as the maximum number of integers in +@var{host_info}. On return, it contains the actual number of integers +in @var{host_info}. The maximum number of integers returned by any +flavor is @code{HOST_INFO_MAX}. + +The type of information returned is defined by @var{flavor}, which can +be one of the following: + +@table @code +@item HOST_BASIC_INFO +The function returns basic information about the host, as defined by +@code{host_basic_info_t}. This includes the number of processors, their +type, and the amount of memory installed in the system. The number of +integers returned is @code{HOST_BASIC_INFO_COUNT}. For how to get more +information about the processor, see @ref{Processor Interface}. + +@item HOST_PROCESSOR_SLOTS +The function returns the numbers of the slots with active processors in +them. The number of integers returned can be up to @code{max_cpus}, as +returned by the @code{HOST_BASIC_INFO} flavor of @code{host_info}. + +@item HOST_SCHED_INFO +The function returns information of interest to schedulers as defined by +@code{host_sched_info_t}. The number of integers returned is +@code{HOST_SCHED_INFO_COUNT}. +@end table + +The function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{host} is not a host or @var{flavor} +is not recognized. The function returns @code{MIG_ARRAY_TOO_LARGE} if +the returned info array is too large for @var{host_info}. In this case, +@var{host_info} is filled as much as possible and @var{host_info_count} +is set to the number of elements that would be returned if there were +enough room. +@c BUGS Availability limited. Systems without this call support a +@c host_info call with an incompatible calling sequence. +@end deftypefun + +@deftp {Data type} {struct host_basic_info} +A pointer to this structure is returned in @var{host_info} by the +@code{host_info} function and provides basic information about the host. +You can cast a variable of type @code{host_info_t} to a pointer of this +type if you provided it as the @var{host_info} parameter for the +@code{HOST_BASIC_INFO} flavor of @code{host_info}. It has the following +members: + +@table @code +@item int max_cpus +The maximum number of possible processors for which the kernel is +configured. + +@item int avail_cpus +The number of cpus currently available. + +@item vm_size_t memory_size +The size of physical memory in bytes. + +@item cpu_type_t cpu_type +The type of the master processor. + +@item cpu_subtype_t cpu_subtype +The subtype of the master processor. +@end table + +The type and subtype of the individual processors are also available +by @code{processor_info}, see @ref{Processor Interface}. +@end deftp + +@deftp {Data type} host_basic_info_t +This is a pointer to a @code{struct host_basic_info}. +@end deftp + +@deftp {Data type} {struct host_sched_info} +A pointer to this structure is returned in @var{host_info} by the +@code{host_info} function and provides information of interest to +schedulers. You can cast a variable of type @code{host_info_t} to a +pointer of this type if you provided it as the @var{host_info} parameter +for the @code{HOST_SCHED_INFO} flavor of @code{host_info}. It has the +following members: + +@table @code +@item int min_timeout +The minimum timeout and unit of time in milliseconds. + +@item int min_quantum +The minimum quantum and unit of quantum in milliseconds. +@end table +@end deftp + +@deftp {Data type} host_sched_info_t +This is a pointer to a @code{struct host_sched_info}. +@end deftp + +@deftypefun kern_return_t host_kernel_version (@w{host_t @var{host}}, @w{kernel_version_t *@var{version}}) +The @code{host_kernel_version} function returns the version string +compiled into the kernel executing on @var{host} at the time it was +built in the character string @var{version}. This string describes the +version of the kernel. The constant @code{KERNEL_VERSION_MAX} should be +used to dimension storage for the returned string if the +@code{kernel_version_t} declaration is not used. + +If the version string compiled into the kernel is longer than +@code{KERNEL_VERSION_MAX}, the result is truncated and not necessarily +null-terminated. + +If @var{host} is not a valid send right to a host port, the function +returns @code{KERN_INVALID_ARGUMENT}. If @var{version} points to +inaccessible memory, it returns @code{KERN_INVALID_ADDRESS}, and +@code{KERN_SUCCESS} otherwise. +@end deftypefun + +@deftypefun kern_return_t host_get_boot_info (@w{host_priv_t @var{host_priv}}, @w{kernel_boot_info_t @var{boot_info}}) +The @code{host_get_boot_info} function returns the boot-time information +string supplied by the operator to the kernel executing on +@var{host_priv} in the character string @var{boot_info}. The constant +@code{KERNEL_BOOT_INFO_MAX} should be used to dimension storage for the +returned string if the @code{kernel_boot_info_t} declaration is not +used. + +If the boot-time information string supplied by the operator is longer +than @code{KERNEL_BOOT_INFO_MAX}, the result is truncated and not +necessarily null-terminated. +@end deftypefun + + +@node Host Time +@section Host Time + +@deftp {Data type} time_value_t +This is the representation of a time in Mach. It is a @code{struct +time_value} and consists of the following members: + +@table @code +@item integer_t seconds +The number of seconds. +@item integer_t microseconds +The number of microseconds. +@end table +@end deftp + +The number of microseconds should always be smaller than +@code{TIME_MICROS_MAX} (100000). A time with this property is +@dfn{normalized}. Normalized time values can be manipulated with the +following macros: + +@defmac time_value_add_usec (@w{time_value_t *@var{val}}, @w{integer_t *@var{micros}}) +Add @var{micros} microseconds to @var{val}. If @var{val} is normalized +and @var{micros} smaller than @code{TIME_MICROS_MAX}, @var{val} will be +normalized afterwards. +@end defmac + +@defmac time_value_add (@w{time_value_t *@var{result}}, @w{time_value_t *@var{addend}}) +Add the values in @var{addend} to @var{result}. If both are normalized, +@var{result} will be normalized afterwards. +@end defmac + +A variable of type @code{time_value_t} can either represent a duration +or a fixed point in time. In the latter case, it shall be interpreted as +the number of seconds and microseconds after the epoch 1. Jan 1970. + +@deftypefun kern_return_t host_get_time (@w{host_t @var{host}}, @w{time_value_t *@var{current_time}}) +Get the current time as seen by @var{host}. On success, the time passed +since the epoch is returned in @var{current_time}. +@end deftypefun + +@deftypefun kern_return_t host_set_time (@w{host_priv_t @var{host_priv}}, @w{time_value_t @var{new_time}}) +Set the time of @var{host_priv} to @var{new_time}. +@end deftypefun + +@deftypefun kern_return_t host_adjust_time (@w{host_priv_t @var{host_priv}}, @w{time_value_t @var{new_adjustment}}, @w{time_value_t *@var{old_adjustment}}) +Arrange for the current time as seen by @var{host_priv} to be gradually +changed by the adjustment value @var{new_adjustment}, and return the old +adjustment value in @var{old_adjustment}. +@end deftypefun + +For efficiency, the current time is available through a mapped-time +interface. + +@deftp {Data type} mapped_time_value_t +This structure defines the mapped-time interface. It has the following +members: + +@table @code +@item integer_t seconds +The number of seconds. + +@item integer_t microseconds +The number of microseconds. + +@item integer_t check_seconds +This is a copy of the seconds value, which must be checked to protect +against a race condition when reading out the two time values. +@end table +@end deftp + +Here is an example how to read out the current time using the +mapped-time interface: + +@c XXX Complete the example. +@example +do + @{ + secs = mtime->seconds; + usecs = mtime->microseconds; + @} +while (secs != mtime->check_seconds); +@end example + + +@node Host Reboot +@section Host Reboot + +@deftypefun kern_return_t host_reboot (@w{host_priv_t @var{host_priv}}, @w{int @var{options}}) +Reboot the host specified by @var{host_priv}. The argument +@var{options} specifies the flags. The available flags are defined in +@file{sys/reboot.h}: + +@table @code +@item RB_HALT +Do not reboot, but halt the machine. + +@item RB_DEBUGGER +Do not reboot, but enter kernel debugger from user space. +@end table + +If successful, the function might not return. +@end deftypefun + + +@node Processors and Processor Sets +@chapter Processors and Processor Sets + +This section describes the Mach interface to processor sets and +individual processors. The interface allows to group processors into +sets and control the processors and processor sets. + +A processor is not a central part of the interface. It is mostly of +relevance as a part of a processor set. Threads are always assigned to +processor sets, and all processors in a set are equally involved in +executing all threads assigned to that set. + +The processor set is represented by two ports, a name port +@var{processor_set_name} used to query information about the host +accessible to everyone, and a control port @var{processor_set} used to +manipulate it. + +@menu +* Processor Set Interface:: How to work with processor sets. +* Processor Interface:: How to work with individual processors. +@end menu + + +@node Processor Set Interface +@section Processor Set Interface + +@menu +* Processor Set Ports:: Ports representing a processor set. +* Processor Set Access:: How the processor sets are accessed. +* Processor Set Creation:: How new processor sets are created. +* Processor Set Destruction:: How processor sets are destroyed. +* Tasks and Threads on Sets:: Assigning tasks, threads to processor sets. +* Processor Set Priority:: Specifying the priority of a processor set. +* Processor Set Policy:: Changing the processor set policies. +* Processor Set Info:: Obtaining information about a processor set. +@end menu + + +@node Processor Set Ports +@subsection Processor Set Ports +@cindex processor set ports +@cindex ports representing a processor set + +@cindex processor set name port +@cindex port representing a processor set name +@deftp {Data type} processor_set_name_t +This is a @code{mach_port_t} and used to hold the port name of a +processor set name port that names the processor set. Any task can get +a send right to name port of a processor set. The processor set name +port allows to get information about the processor set. +@end deftp + +@cindex processor set port +@deftp {Data type} processor_set_t +This is a @code{mach_port_t} and used to hold the port name of a +privileged processor set control port that represents the processor set. +Operations on the processor set are implemented as remote procedure +calls to the processor set port. The processor set port allows to +manipulate the processor set. +@end deftp + + +@node Processor Set Access +@subsection Processor Set Access + +@deftypefun kern_return_t host_processor_sets (@w{host_t @var{host}}, @w{processor_set_name_array_t *@var{processor_sets}}, @w{mach_msg_type_number_t *@var{processor_sets_count}}) +The function @code{host_processor_sets} gets send rights to the name +port for each processor set currently assigned to @var{host}. + +@code{host_processor_set_priv} can be used to obtain the control ports +from these if desired. @var{processor_sets} is an array that is +created as a result of this call. The caller may wish to +@code{vm_deallocate} this array when the data is no longer needed. +@var{processor_sets_count} is set to the number of processor sets in the +@var{processor_sets}. + +This function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{host} is not a host. +@end deftypefun + +@deftypefun kern_return_t host_processor_set_priv (@w{host_priv_t @var{host_priv}}, @w{processor_set_name_t @var{set_name}}, @w{processor_set_t *@var{set}}) +The function @code{host_processor_set_priv} allows a privileged +application to obtain the control port @var{set} for an existing +processor set from its name port @var{set_name}. The privileged host +port @var{host_priv} is required. + +This function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{host_priv} is not a valid host +control port. +@end deftypefun + +@deftypefun kern_return_t processor_set_default (@w{host_t @var{host}}, @w{processor_set_name_t *@var{default_set}}) +The function @code{processor_set_default} returns the default processor +set of @var{host} in @var{default_set}. The default processor set is +used by all threads, tasks, and processors that are not explicitly +assigned to other sets. processor_set_default returns a port that can +be used to obtain information about this set (e.g. how many threads are +assigned to it). This port cannot be used to perform operations on that +set. + +This function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_ARGUMENT} if @var{host} is not a host and +@code{KERN_INVALID_ADDRESS} if @var{default_set} points to +inaccessible memory. +@end deftypefun + + +@node Processor Set Creation +@subsection Processor Set Creation + +@deftypefun kern_return_t processor_set_create (@w{host_t @var{host}}, @w{processor_set_t *@var{new_set}}, @w{processor_set_name_t *@var{new_name}}) +The function @code{processor_set_create} creates a new processor set on +@var{host} and returns the two ports associated with it. The port +returned in @var{new_set} is the actual port representing the set. It +is used to perform operations such as assigning processors, tasks, or +threads. The port returned in @var{new_name} identifies the set, and is +used to obtain information about the set. + +This function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_ARGUMENT} if @var{host} is not a host, +@code{KERN_INVALID_ADDRESS} if @var{new_set} or @var{new_name} points to +inaccessible memory and @code{KERN_FAILURE} is the operating system does +not support processor allocation. +@end deftypefun + + +@node Processor Set Destruction +@subsection Processor Set Destruction + +@deftypefun kern_return_t processor_set_destroy (@w{processor_set_t @var{processor_set}}) +The function @code{processor_set_destroy} destroys the specified +processor set. Any assigned processors, tasks, or threads are +reassigned to the default set. The object port for the processor set is +required (not the name port). The default processor set cannot be +destroyed. + +This function returns @code{KERN_SUCCESS} if the set was destroyed, +@code{KERN_FAILURE} if an attempt was made to destroy the default +processor set, or the operating system does not support processor +allocation, and @code{KERN_INVALID_ARGUMENT} if @var{processor_set} is +not a valid processor set control port. +@end deftypefun + + +@node Tasks and Threads on Sets +@subsection Tasks and Threads on Sets + +@deftypefun kern_return_t processor_set_tasks (@w{processor_set_t @var{processor_set}}, @w{task_array_t *@var{task_list}}, @w{mach_msg_type_number_t *@var{task_count}}) +The function @code{processor_set_tasks} gets send rights to the kernel +port for each task currently assigned to @var{processor_set}. + +@var{task_list} is an array that is created as a result of this call. +The caller may wish to @code{vm_deallocate} this array when the data is +no longer needed. @var{task_count} is set to the number of tasks in the +@var{task_list}. + +This function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{processor_set} is not a processor +set. +@end deftypefun + +@deftypefun kern_return_t processor_set_threads (@w{processor_set_t @var{processor_set}}, @w{thread_array_t *@var{thread_list}}, @w{mach_msg_type_number_t *@var{thread_count}}) +The function @code{processor_set_thread} gets send rights to the kernel +port for each thread currently assigned to @var{processor_set}. + +@var{thread_list} is an array that is created as a result of this call. +The caller may wish to @code{vm_deallocate} this array when the data is +no longer needed. @var{thread_count} is set to the number of threads in +the @var{thread_list}. + +This function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{processor_set} is not a processor +set. +@end deftypefun + +@deftypefun kern_return_t task_assign (@w{task_t @var{task}}, @w{processor_set_t @var{processor_set}}, @w{boolean_t @var{assign_threads}}) +The function @code{task_assign} assigns @var{task} the set +@var{processor_set}. This assignment is for the purposes of determining +the initial assignment of newly created threads in task. Any previous +assignment of the task is nullified. Existing threads within the task +are also reassigned if @var{assign_threads} is @code{TRUE}. They are +not affected if it is @code{FALSE}. + +This function returns @code{KERN_SUCCESS} if the assignment has been +performed and @code{KERN_INVALID_ARGUMENT} if @var{task} is not a task, +or @var{processor_set} is not a processor set on the same host as +@var{task}. +@end deftypefun + +@deftypefun kern_return_t task_assign_default (@w{task_t @var{task}}, @w{boolean_t @var{assign_threads}}) +The function @code{task_assign_default} is a variant of +@code{task_assign} that assigns the task to the default processor set on +that task's host. This variant exists because the control port for the +default processor set is privileged and not ususally available to users. + +This function returns @code{KERN_SUCCESS} if the assignment has been +performed and @code{KERN_INVALID_ARGUMENT} if @var{task} is not a task. +@end deftypefun + +@deftypefun kern_return_t task_get_assignment (@w{task_t @var{task}}, @w{processor_set_name_t *@var{assigned_set}}) +The function @code{task_get_assignment} returns the name of the +processor set to which the thread is currently assigned in +@var{assigned_set}. This port can only be used to obtain information +about the processor set. + +This function returns @code{KERN_SUCCESS} if the assignment has been +performed, @code{KERN_INVALID_ADDRESS} if @var{processor_set} points to +inaccessible memory, and @code{KERN_INVALID_ARGUMENT} if @var{task} is +not a task. +@end deftypefun + +@deftypefun kern_return_t thread_assign (@w{thread_t @var{thread}}, @w{processor_set_t @var{processor_set}}) +The function @code{thread_assign} assigns @var{thread} the set +@var{processor_set}. After the assignment is completed, the thread only +executes on processors assigned to the designated processor set. If +there are no such processors, then the thread is unable to execute. Any +previous assignment of the thread is nullified. Unix system call +compatibility code may temporarily force threads to execute on the +master processor. + +This function returns @code{KERN_SUCCESS} if the assignment has been +performed and @code{KERN_INVALID_ARGUMENT} if @var{thread} is not a +thread, or @var{processor_set} is not a processor set on the same host +as @var{thread}. +@end deftypefun + +@deftypefun kern_return_t thread_assign_default (@w{thread_t @var{thread}}) +The function @code{thread_assign_default} is a variant of +@code{thread_assign} that assigns the thread to the default processor +set on that thread's host. This variant exists because the control port +for the default processor set is privileged and not ususally available +to users. + +This function returns @code{KERN_SUCCESS} if the assignment has been +performed and @code{KERN_INVALID_ARGUMENT} if @var{thread} is not a +thread. +@end deftypefun + +@deftypefun kern_return_t thread_get_assignment (@w{thread_t @var{thread}}, @w{processor_set_name_t *@var{assigned_set}}) +The function @code{thread_get_assignment} returns the name of the +processor set to which the thread is currently assigned in +@var{assigned_set}. This port can only be used to obtain information +about the processor set. + +This function returns @code{KERN_SUCCESS} if the assignment has been +performed, @code{KERN_INVALID_ADDRESS} if @var{processor_set} points to +inaccessible memory, and @code{KERN_INVALID_ARGUMENT} if @var{thread} is +not a thread. +@end deftypefun + + +@node Processor Set Priority +@subsection Processor Set Priority + +@deftypefun kern_return_t processor_set_max_priority (@w{processor_set_t @var{processor_set}}, @w{int @var{max_priority}}, @w{boolean_t @var{change_threads}}) +The function @code{processor_set_max_priority} is used to set the +maximum priority for a processor set. The priority of a processor set +is used only for newly created threads (thread's maximum priority is set +to processor set's) and the assignment of threads to the set (thread's +maximum priority is reduced if it exceeds the set's maximum priority, +thread's priority is similarly reduced). +@code{processor_set_max_priority} changes this priority. It also sets +the maximum priority of all threads assigned to the processor set to +this new priority if @var{change_threads} is @code{TRUE}. If this +maximum priority is less than the priorities of any of these threads, +their priorities will also be set to this new value. + +This function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{processor_set} is not a processor +set or @var{priority} is not a valid priority. +@end deftypefun + + +@node Processor Set Policy +@subsection Processor Set Policy + +@deftypefun kern_return_t processor_set_policy_enable (@w{processor_set_t @var{processor_set}}, @w{int @var{policy}}) +@deftypefunx kern_return_t processor_set_policy_disable (@w{processor_set_t @var{processor_set}}, @w{int @var{policy}}, @w{boolean_t @var{change_threads}}) +Processor sets may restrict the scheduling policies to be used for +threads assigned to them. These two calls provide the mechanism for +designating permitted and forbidden policies. The current set of +permitted policies can be obtained from @code{processor_set_info}. +Timesharing may not be forbidden by any processor set. This is a +compromise to reduce the complexity of the assign operation; any thread +whose policy is forbidden by the target processor set has its policy +reset to timesharing. If the @var{change_threads} argument to +@code{processor_set_policy_disable} is true, threads currently assigned +to this processor set and using the newly disabled policy will have +their policy reset to timesharing. + +@file{mach/policy.h} contains the allowed policies; it is included by +@file{mach.h}. Not all policies (e.g. fixed priority) are supported by +all systems. + +This function returns @code{KERN_SUCCESS} if the operation was completed +successfully and @code{KERN_INVALID_ARGUMENT} if @var{processor_set} is +not a processor set or @var{policy} is not a valid policy, or an attempt +was made to disable timesharing. +@end deftypefun + + +@node Processor Set Info +@subsection Processor Set Info + +@deftypefun kern_return_t processor_set_info (@w{processor_set_name_t @var{set_name}}, @w{int @var{flavor}}, @w{host_t *@var{host}}, @w{processor_set_info_t @var{processor_set_info}}, @w{mach_msg_type_number_t *@var{processor_set_info_count}}) +The function @code{processor_set_info} returns the selected information array +for a processor set, as specified by @var{flavor}. + +@var{host} is set to the host on which the processor set resides. This +is the non-privileged host port. + +@var{processor_set_info} is an array of integers that is supplied by the +caller and returned filled with specified information. +@var{processor_set_info_count} is supplied as the maximum number of +integers in @var{processor_set_info}. On return, it contains the actual +number of integers in @var{processor_set_info}. The maximum number of +integers returned by any flavor is @code{PROCESSOR_SET_INFO_MAX}. + +The type of information returned is defined by @var{flavor}, which can +be one of the following: + +@table @code +@item PROCESSOR_SET_BASIC_INFO +The function returns basic information about the processor set, as +defined by @code{processor_set_basic_info_t}. This includes the number +of tasks and threads assigned to the processor set. The number of +integers returned is @code{PROCESSOR_SET_BASIC_INFO_COUNT}. + +@item PROCESSOR_SET_SCHED_INFO +The function returns information about the schduling policy for the +processor set as defined by @code{processor_set_sched_info_t}. The +number of integers returned is @code{PROCESSOR_SET_SCHED_INFO_COUNT}. +@end table + +Some machines may define additional (machine-dependent) flavors. + +The function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{processor_set} is not a processor +set or @var{flavor} is not recognized. The function returns +@code{MIG_ARRAY_TOO_LARGE} if the returned info array is too large for +@var{processor_set_info}. In this case, @var{processor_set_info} is +filled as much as possible and @var{processor_set_info_count} is set to the +number of elements that would have been returned if there were enough +room. +@end deftypefun + +@deftp {Data type} {struct processor_set_basic_info} +This structure is returned in @var{processor_set_info} by the +@code{processor_set_info} function and provides basic information about +the processor set. You can cast a variable of type +@code{processor_set_info_t} to a pointer of this type if you provided it +as the @var{processor_set_info} parameter for the +@code{PROCESSOR_SET_BASIC_INFO} flavor of @code{processor_set_info}. It +has the following members: + +@table @code +@item int processor_count +number of processors + +@item int task_count +number of tasks + +@item int thread_count +number of threads + +@item int load_average +scaled load average + +@item int mach_factor +scaled mach factor +@end table +@end deftp + +@deftp {Data type} processor_set_basic_info_t +This is a pointer to a @code{struct processor_set_basic_info}. +@end deftp + +@deftp {Data type} {struct processor_set_sched_info} +This structure is returned in @var{processor_set_info} by the +@code{processor_set_info} function and provides schedule information +about the processor set. You can cast a variable of type +@code{processor_set_info_t} to a pointer of this type if you provided it +as the @var{processor_set_info} parameter for the +@code{PROCESSOR_SET_SCHED_INFO} flavor of @code{processor_set_info}. It +has the following members: + +@table @code +@item int policies +allowed policies + +@item int max_priority +max priority for new threads +@end table +@end deftp + +@deftp {Data type} processor_set_sched_info_t +This is a pointer to a @code{struct processor_set_sched_info}. +@end deftp + + +@node Processor Interface +@section Processor Interface + +@cindex processor port +@cindex port representing a processor +@deftp {Data type} processor_t +This is a @code{mach_port_t} and used to hold the port name of a +processor port that represents the processor. Operations on the +processor are implemented as remote procedure calls to the processor +port. +@end deftp + +@menu +* Hosted Processors:: Getting a list of all processors on a host. +* Processor Control:: Starting, stopping, controlling processors. +* Processors and Sets:: Combining processors into processor sets. +* Processor Info:: Obtaining information on processors. +@end menu + + +@node Hosted Processors +@subsection Hosted Processors + +@deftypefun kern_return_t host_processors (@w{host_priv_t @var{host_priv}}, @w{processor_array_t *@var{processor_list}}, @w{mach_msg_type_number_t *@var{processor_count}}) +The function @code{host_processors} gets send rights to the processor +port for each processor existing on @var{host_priv}. This is the +privileged port that allows its holder to control a processor. + +@var{processor_list} is an array that is created as a result of this +call. The caller may wish to @code{vm_deallocate} this array when the +data is no longer needed. @var{processor_count} is set to the number of +processors in the @var{processor_list}. + +This function returns @code{KERN_SUCCESS} if the call succeeded, +@code{KERN_INVALID_ARGUMENT} if @var{host_priv} is not a privileged host +port, and @code{KERN_INVALID_ADDRESS} if @var{processor_count} points to +inaccessible memory. +@end deftypefun + + +@node Processor Control +@subsection Processor Control + +@deftypefun kern_return_t processor_start (@w{processor_t @var{processor}}) +@deftypefunx kern_return_t processor_exit (@w{processor_t @var{processor}}) +@deftypefunx kern_return_t processor_control (@w{processor_t @var{processor}}, @w{processor_info_t *@var{cmd}}, @w{mach_msg_type_number_t @var{count}}) +Some multiprocessors may allow privileged software to control +processors. The @code{processor_start}, @code{processor_exit}, and +@code{processor_control} operations implement this. The interpretation +of the command in @var{cmd} is machine dependent. A newly started +processor is assigned to the default processor set. An exited processor +is removed from the processor set to which it was assigned and ceases to +be active. + +@var{count} contains the length of the command @var{cmd} as a number of +ints. + +Availability limited. All of these operations are machine-dependent. +They may do nothing. The ability to restart an exited processor is also +machine-dependent. + +This function returns @code{KERN_SUCCESS} if the operation was +performed, @code{KERN_FAILURE} if the operation was not performed (a +likely reason is that it is not supported on this processor), +@code{KERN_INVALID_ARGUMENT} if @var{processor} is not a processor, and +@code{KERN_INVALID_ADDRESS} if @var{cmd} points to inaccessible memory. +@end deftypefun + +@node Processors and Sets +@subsection Processors and Sets + +@deftypefun kern_return_t processor_assign (@w{processor_t @var{processor}}, @w{processor_set_t @var{processor_set}}, @w{boolean_t @var{wait}}) +The function @code{processor_assign} assigns @var{processor} to the the +set @var{processor_set}. After the assignment is completed, the +processor only executes threads that are assigned to that processor set. +Any previous assignment of the processor is nullified. The master +processor cannot be reassigned. All processors take clock interrupts at +all times. The @var{wait} argument indicates whether the caller should +wait for the assignment to be completed or should return immediately. +Dedicated kernel threads are used to perform processor assignment, so +setting wait to @code{FALSE} allows assignment requests to be queued and +performed faster, especially if the kernel has more than one dedicated +internal thread for processor assignment. Redirection of other device +interrupts away from processors assigned to other than the default +processor set is machine-dependent. Intermediaries that interpose on +ports must be sure to interpose on both ports involved in this call if +they interpose on either. + +This function returns @code{KERN_SUCCESS} if the assignment has been +performed, @code{KERN_INVALID_ARGUMENT} if @var{processor} is not a +processor, or @var{processor_set} is not a processor set on the same +host as @var{processor}. +@end deftypefun + +@deftypefun kern_return_t processor_get_assignment (@w{processor_t @var{processor}}, @w{processor_set_name_t *@var{assigned_set}}) +The function @code{processor_get_assignment} obtains the current +assignment of a processor. The name port of the processor set is +returned in @var{assigned_set}. +@end deftypefun + +@node Processor Info +@subsection Processor Info + +@deftypefun kern_return_t processor_info (@w{processor_t @var{processor}}, @w{int @var{flavor}}, @w{host_t *@var{host}}, @w{processor_info_t @var{processor_info}}, @w{mach_msg_type_number_t *@var{processor_info_count}}) +The function @code{processor_info} returns the selected information array +for a processor, as specified by @var{flavor}. + +@var{host} is set to the host on which the processor set resides. This +is the non-privileged host port. + +@var{processor_info} is an array of integers that is supplied by the +caller and returned filled with specified information. +@var{processor_info_count} is supplied as the maximum number of integers in +@var{processor_info}. On return, it contains the actual number of +integers in @var{processor_info}. The maximum number of integers +returned by any flavor is @code{PROCESSOR_INFO_MAX}. + +The type of information returned is defined by @var{flavor}, which can +be one of the following: + +@table @code +@item PROCESSOR_BASIC_INFO +The function returns basic information about the processor, as defined +by @code{processor_basic_info_t}. This includes the slot number of the +processor. The number of integers returned is +@code{PROCESSOR_BASIC_INFO_COUNT}. +@end table + +Machines which require more configuration information beyond the slot +number are expected to define additional (machine-dependent) flavors. + +The function returns @code{KERN_SUCCESS} if the call succeeded and +@code{KERN_INVALID_ARGUMENT} if @var{processor} is not a processor or +@var{flavor} is not recognized. The function returns +@code{MIG_ARRAY_TOO_LARGE} if the returned info array is too large for +@var{processor_info}. In this case, @var{processor_info} is filled as +much as possible and @var{processor_infoCnt} is set to the number of +elements that would have been returned if there were enough room. +@end deftypefun + +@deftp {Data type} {struct processor_basic_info} +This structure is returned in @var{processor_info} by the +@code{processor_info} function and provides basic information about the +processor. You can cast a variable of type @code{processor_info_t} to a +pointer of this type if you provided it as the @var{processor_info} +parameter for the @code{PROCESSOR_BASIC_INFO} flavor of +@code{processor_info}. It has the following members: + +@table @code +@item cpu_type_t cpu_type +cpu type + +@item cpu_subtype_t cpu_subtype +cpu subtype + +@item boolean_t running +is processor running? + +@item int slot_num +slot number + +@item boolean_t is_master +is this the master processor +@end table +@end deftp + +@deftp {Data type} processor_basic_info_t +This is a pointer to a @code{struct processor_basic_info}. +@end deftp + + +@node Device Interface +@chapter Device Interface + +The GNU Mach microkernel provides a simple device interface that allows +the user space programs to access the underlying hardware devices. Each +device has a unique name, which is a string up to 127 characters long. +To open a device, the device master port has to be supplied. The device +master port is only available through the bootstrap port. Anyone who +has control over the device master port can use all hardware devices. +@c XXX FIXME bootstrap port, bootstrap + +@cindex device port +@cindex port representing a device +@deftp {Data type} device_t +This is a @code{mach_port_t} and used to hold the port name of a +device port that represents the device. Operations on the device are +implemented as remote procedure calls to the device port. Each device +provides a sequence of records. The length of a record is specific to +the device. Data can be transferred ``out-of-line'' or ``in-line'' +(@pxref{Memory}). +@end deftp + +All constants and functions in this chapter are defined in +@file{device/device.h}. + +@menu +* Device Reply Server:: Handling device reply messages. +* Device Open:: Opening hardware devices. +* Device Close:: Closing hardware devices. +* Device Read:: Reading data from the device. +* Device Write:: Writing data to the device. +* Device Map:: Mapping devices into virtual memory. +* Device Status:: Querying and manipulating a device. +* Device Filter:: Filtering packets arriving on a device. +@end menu + + +@node Device Reply Server +@section Device Reply Server + +Beside the usual synchronous interface, an asynchronous interface is +provided. For this, the caller has to receive and handle the reply +messages seperately from the function call. + +@deftypefun boolean_t device_reply_server (@w{msg_header_t *@var{in_msg}}, @w{msg_header_t *@var{out_msg}}) +The function @code{device_reply_server} is produced by the +remote procedure call generator to handle a received message. This +function does all necessary argument handling, and actually calls one of +the following functions: @code{ds_device_open_reply}, +@code{ds_device_read_reply}, @code{ds_device_read_reply_inband}, +@code{ds_device_write_reply} and @code{ds_device_write_reply_inband}. + +The @var{in_msg} argument is the message that has been received from the +kernel. The @var{out_msg} is a reply message, but this is not used for +this server. + +The function returns @code{TRUE} to indicate that the message in +question was applicable to this interface, and that the appropriate +routine was called to interpret the message. It returns @code{FALSE} to +indicate that the message did not apply to this interface, and that no +other action was taken. +@end deftypefun + + +@node Device Open +@section Device Open + +@deftypefun kern_return_t device_open (@w{mach_port_t @var{master_port}}, @w{dev_mode_t @var{mode}}, @w{dev_name_t @var{name}}, @w{device_t *@var{device}}) +The function @code{device_open} opens the device @var{name} and returns +a port to it in @var{device}. The open count for the device is +incremented by one. If the open count was 0, the open handler for the +device is invoked. + +@var{master_port} must hold the master device port. @var{name} +specifies the device to open, and is a string up to 128 characters long. +@var{mode} is the open mode. It is a bitwise-or of the following +constants: + +@table @code +@item D_READ +Request read access for the device. + +@item D_WRITE +Request write access for the device. + +@item D_NODELAY +Do not delay an open. +@c XXX Is this really used at all? Maybe for tape drives? What does it mean? +@end table + +The function returns @code{D_SUCCESS} if the device was successfully +opened, @code{D_INVALID_OPERATION} if @var{master_port} is not the +master device port, @code{D_WOULD_BLOCK} is the device is busy and +@code{D_NOWAIT} was specified in mode, @code{D_ALREADY_OPEN} if the +device is already open in an incompatible mode and +@code{D_NO_SUCH_DEVICE} if @var{name} does not denote a know device. +@end deftypefun + +@deftypefun kern_return_t device_open_request (@w{mach_port_t @var{master_port}}, @w{mach_port_t @var{reply_port}}, @w{dev_mode_t @var{mode}}, @w{dev_name_t @var{name}}) +@deftypefunx kern_return_t ds_device_open_reply (@w{mach_port_t @var{reply_port}}, @w{kern_return_t @var{return}}, @w{device_t *@var{device}}) +This is the asynchronous form of the @code{device_open} function. +@code{device_open_request} performs the open request. The meaning for +the parameters is as in @code{device_open}. Additionally, the caller +has to supply a reply port to which the @code{ds_device_open_reply} +message is sent by the kernel when the open has been performed. The +return value of the open operation is stored in @var{return_code}. + +As neither function receives a reply message, only message transmission +errors apply. If no error occurs, @code{KERN_SUCCESS} is returned. +@end deftypefun + + +@node Device Close +@section Device Close + +@deftypefun kern_return_t device_close (@w{device_t @var{device}}) +The function @code{device_close} decrements the open count of the device +by one. If the open count drops to zero, the close handler for the +device is called. The device to close is specified by its port +@var{device}. + +The function returns @code{D_SUCCESS} if the device was successfully +closed and @code{D_NO_SUCH_DEVICE} if @var{device} does not denote a +device port. +@end deftypefun + + +@node Device Read +@section Device Read + +@deftypefun kern_return_t device_read (@w{device_t @var{device}}, @w{dev_mode_t @var{mode}}, @w{recnum_t @var{recnum}}, @w{int @var{bytes_wanted}}, @w{io_buf_ptr_t *@var{data}}, @w{mach_msg_type_number_t *@var{data_count}}) +The function @code{device_read} reads @var{bytes_wanted} bytes from +@var{device}, and stores them in a buffer allocated with +@code{vm_allocate}, which address is returned in @var{data}. The caller +must deallocated it if it is no longer needed. The number of bytes +actually returned is stored in @var{data_count}. + +If @var{mode} is @code{D_NOWAIT}, the operation does not block. +Otherwise @var{mode} should be 0. @var{recnum} is the record number to +be read, its meaning is device specific. + +The function returns @code{D_SUCCESS} if some data was successfully +read, @code{D_WOULD_BLOCK} if no data is currently available and +@code{D_NOWAIT} is specified, and @code{D_NO_SUCH_DEVICE} if +@var{device} does not denote a device port. +@end deftypefun + +@deftypefun kern_return_t device_read_inband (@w{device_t @var{device}}, @w{dev_mode_t @var{mode}}, @w{recnum_t @var{recnum}}, @w{int @var{bytes_wanted}}, @w{io_buf_ptr_inband_t *@var{data}}, @w{mach_msg_type_number_t *@var{data_count}}) +The @code{device_read_inband} function works as the @code{device_read} +function, except that the data is returned ``in-line'' in the reply IPC +message (@pxref{Memory}). +@end deftypefun + +@deftypefun kern_return_t device_read_request (@w{device_t @var{device}}, @w{mach_port_t @var{reply_port}}, @w{dev_mode_t @var{mode}}, @w{recnum_t @var{recnum}}, @w{int @var{bytes_wanted}}) +@deftypefunx kern_return_t ds_device_read_reply (@w{mach_port_t @var{reply_port}}, @w{kern_return_t @var{return_code}}, @w{io_buf_ptr_t @var{data}}, @w{mach_msg_type_number_t @var{data_count}}) +This is the asynchronous form of the @code{device_read} function. +@code{device_read_request} performs the read request. The meaning for +the parameters is as in @code{device_read}. Additionally, the caller +has to supply a reply port to which the @code{ds_device_read_reply} +message is sent by the kernel when the read has been performed. The +return value of the read operation is stored in @var{return_code}. + +As neither function receives a reply message, only message transmission +errors apply. If no error occurs, @code{KERN_SUCCESS} is returned. +@end deftypefun + +@deftypefun kern_return_t device_read_request_inband (@w{device_t @var{device}}, @w{mach_port_t @var{reply_port}}, @w{dev_mode_t @var{mode}}, @w{recnum_t @var{recnum}}, @w{int @var{bytes_wanted}}) +@deftypefunx kern_return_t ds_device_read_reply_inband (@w{mach_port_t @var{reply_port}}, @w{kern_return_t @var{return_code}}, @w{io_buf_ptr_t @var{data}}, @w{mach_msg_type_number_t @var{data_count}}) +The @code{device_read_request_inband} and +@code{ds_device_read_reply_inband} functions work as the +@code{device_read_request} and @code{ds_device_read_reply} functions, +except that the data is returned ``in-line'' in the reply IPC message +(@pxref{Memory}). +@end deftypefun + + +@node Device Write +@section Device Write + +@deftypefun kern_return_t device_write (@w{device_t @var{device}}, @w{dev_mode_t @var{mode}}, @w{recnum_t @var{recnum}}, @w{io_buf_ptr_t @var{data}}, @w{mach_msg_type_number_t @var{data_count}}, @w{int *@var{bytes_written}}) +The function @code{device_write} writes @var{data_count} bytes from the +buffer @var{data} to @var{device}. The number of bytes actually written +is returned in @var{bytes_written}. + +If @var{mode} is @code{D_NOWAIT}, the function returns without waiting +for I/O completion. Otherwise @var{mode} should be 0. @var{recnum} is +the record number to be written, its meaning is device specific. + +The function returns @code{D_SUCCESS} if some data was successfully +written and @code{D_NO_SUCH_DEVICE} if @var{device} does not denote a +device port or the device is dead or not completely open. +@end deftypefun + +@deftypefun kern_return_t device_write_inband (@w{device_t @var{device}}, @w{dev_mode_t @var{mode}}, @w{recnum_t @var{recnum}}, @w{int @var{bytes_wanted}}, @w{io_buf_ptr_inband_t *@var{data}}, @w{mach_msg_type_number_t *@var{data_count}}) +The @code{device_write_inband} function works as the @code{device_write} +function, except that the data is sent ``in-line'' in the request IPC +message (@pxref{Memory}). +@end deftypefun + +@deftypefun kern_return_t device_write_request (@w{device_t @var{device}}, @w{mach_port_t @var{reply_port}}, @w{dev_mode_t @var{mode}}, @w{recnum_t @var{recnum}}, @w{io_buf_ptr_t @var{data}}, @w{mach_msg_type_number_t @var{data_count}}) +@deftypefunx kern_return_t ds_device_write_reply (@w{mach_port_t @var{reply_port}}, @w{kern_return_t @var{return_code}}, @w{int @var{bytes_written}}) +This is the asynchronous form of the @code{device_write} function. +@code{device_write_request} performs the write request. The meaning for +the parameters is as in @code{device_write}. Additionally, the caller +has to supply a reply port to which the @code{ds_device_write_reply} +message is sent by the kernel when the write has been performed. The +return value of the write operation is stored in @var{return_code}. + +As neither function receives a reply message, only message transmission +errors apply. If no error occurs, @code{KERN_SUCCESS} is returned. +@end deftypefun + +@deftypefun kern_return_t device_write_request_inband (@w{device_t @var{device}}, @w{mach_port_t @var{reply_port}}, @w{dev_mode_t @var{mode}}, @w{recnum_t @var{recnum}}, @w{io_buf_ptr_t @var{data}}, @w{mach_msg_type_number_t @var{data_count}}) +@deftypefunx kern_return_t ds_device_write_reply_inband (@w{mach_port_t @var{reply_port}}, @w{kern_return_t @var{return_code}}, @w{int @var{bytes_written}}) +The @code{device_write_request_inband} and +@code{ds_device_write_reply_inband} functions work as the +@code{device_write_request} and @code{ds_device_write_reply} functions, +except that the data is sent ``in-line'' in the request IPC message +(@pxref{Memory}). +@end deftypefun + + +@node Device Map +@section Device Map + +@deftypefun kern_return_t device_map (@w{device_t @var{device}}, @w{vm_prot_t @var{prot}}, @w{vm_offset_t @var{offset}}, @w{vm_size_t @var{size}}, @w{mach_port_t *@var{pager}}, @w{int @var{unmap}}) +The function @code{device_map} creates a new memory manager for +@var{device} and returns a port to it in @var{pager}. The memory +manager is usable as a memory object in a @code{vm_map} call. The call +is device dependant. + +The protection for the memory object is specified by @var{prot}. The +memory object starts at @var{offset} within the device and extends +@var{size} bytes. @var{unmap} is currently unused. +@c XXX I suppose the caller should set it to 0. + +The function returns @code{D_SUCCESS} if some data was successfully +written and @code{D_NO_SUCH_DEVICE} if @var{device} does not denote a +device port or the device is dead or not completely open. +@end deftypefun + + +@node Device Status +@section Device Status + +@deftypefun kern_return_t device_set_status (@w{device_t @var{device}}, @w{dev_flavor_t @var{flavor}}, @w{dev_status_t @var{status}}, @w{mach_msg_type_number_t @var{status_count}}) +The function @code{device_set_status} sets the status of a device. The +possible values for @var{flavor} and their interpretation is device +specific. + +The function returns @code{D_SUCCESS} if some data was successfully +written and @code{D_NO_SUCH_DEVICE} if @var{device} does not denote a +device port or the device is dead or not completely open. +@end deftypefun + +@deftypefun kern_return_t device_get_status (@w{device_t @var{device}}, @w{dev_flavor_t @var{flavor}}, @w{dev_status_t @var{status}}, @w{mach_msg_type_number_t *@var{status_count}}) +The function @code{device_get_status} gets the status of a device. The +possible values for @var{flavor} and their interpretation is device +specific. + +The function returns @code{D_SUCCESS} if some data was successfully +written and @code{D_NO_SUCH_DEVICE} if @var{device} does not denote a +device port or the device is dead or not completely open. +@end deftypefun + + +@node Device Filter +@section Device Filter + +@deftypefun kern_return_t device_set_filter (@w{device_t @var{device}}, @w{mach_port_t @var{receive_port}}, @w{mach_msg_type_name_t @var{receive_port_type}}, @w{int @var{priority}}, @w{filter_array_t @var{filter}}, @w{mach_msg_type_number_t @var{filter_count}}) +The function @code{device_set_filter} makes it possible to filter out +selected data arriving at the device and forward it to a port. +@var{filter} is a list of filter commands, which are applied to incoming +data to determine if the data should be sent to @var{receive_port}. The +IPC type of the send right is specified by @var{receive_port_right}, it +is either @code{MACH_MSG_TYPE_MAKE_SEND} or +@code{MACH_MSG_TYPE_MOVE_SEND}. The @var{priority} value is used to +order multiple filters. + +There can be up to @code{NET_MAX_FILTER} commands in @var{filter}. The +actual number of commands is passed in @var{filter_count}. For the +purpose of the filter test, an internal stack is provided. After all +commands have been processed, the value on the top of the stack +determines if the data is forwarded or the next filter is tried. + +@c XXX The following description was taken verbatim from the +@c kernel_interface.pdf document. +Each word of the command list specifies a data (push) operation (high +order NETF_NBPO bits) as well as a binary operator (low order NETF_NBPA +bits). The value to be pushed onto the stack is chosen as follows. + +@table @code +@item NETF_PUSHLIT +Use the next short word of the filter as the value. + +@item NETF_PUSHZERO +Use 0 as the value. + +@item NETF_PUSHWORD+N +Use short word N of the ``data'' portion of the message as the value. + +@item NETF_PUSHHDR+N +Use short word N of the ``header'' portion of the message as the value. + +@item NETF_PUSHIND+N +Pops the top long word from the stack and then uses short word N of the +``data'' portion of the message as the value. + +@item NETF_PUSHHDRIND+N +Pops the top long word from the stack and then uses short word N of the +``header'' portion of the message as the value. + +@item NETF_PUSHSTK+N +Use long word N of the stack (where the top of stack is long word 0) as +the value. + +@item NETF_NOPUSH +Don't push a value. +@end table + +The unsigned value so chosen is promoted to a long word before being +pushed. Once a value is pushed (except for the case of +@code{NETF_NOPUSH}), the top two long words of the stack are popped and +a binary operator applied to them (with the old top of stack as the +second operand). The result of the operator is pushed on the stack. +These operators are: + +@table @code +@item NETF_NOP +Don't pop off any values and do no operation. + +@item NETF_EQ +Perform an equal comparison. + +@item NETF_LT +Perform a less than comparison. + +@item NETF_LE +Perform a less than or equal comparison. + +@item NETF_GT +Perform a greater than comparison. + +@item NETF_GE +Perform a greater than or equal comparison. + +@item NETF_AND +Perform a bitise boolean AND operation. + +@item NETF_OR +Perform a bitise boolean inclusive OR operation. + +@item NETF_XOR +Perform a bitise boolean exclusive OR operation. + +@item NETF_NEQ +Perform a not equal comparison. + +@item NETF_LSH +Perform a left shift operation. + +@item NETF_RSH +Perform a right shift operation. + +@item NETF_ADD +Perform an addition. + +@item NETF_SUB +Perform a subtraction. + +@item NETF_COR +Perform an equal comparison. If the comparison is @code{TRUE}, terminate +the filter list. Otherwise, pop the result of the comparison off the +stack. + +@item NETF_CAND +Perform an equal comparison. If the comparison is @code{FALSE}, +terminate the filter list. Otherwise, pop the result of the comparison +off the stack. + +@item NETF_CNOR +Perform a not equal comparison. If the comparison is @code{FALSE}, +terminate the filter list. Otherwise, pop the result of the comparison +off the stack. + +@item NETF_CNAND +Perform a not equal comparison. If the comparison is @code{TRUE}, +terminate the filter list. Otherwise, pop the result of the comparison +off the stack. The scan of the filter list terminates when the filter +list is emptied, or a @code{NETF_C...} operation terminates the list. At +this time, if the final value of the top of the stack is @code{TRUE}, +then the message is accepted for the filter. +@end table + +The function returns @code{D_SUCCESS} if some data was successfully +written, @code{D_INVALID_OPERATION} if @var{receive_port} is not a valid +send right, and @code{D_NO_SUCH_DEVICE} if @var{device} does not denote +a device port or the device is dead or not completely open. +@end deftypefun + + +@node Kernel Debugger +@chapter Kernel Debugger + +The GNU Mach kernel debugger @code{ddb} is a powerful built-in debugger +with a gdb like syntax. It is enabled at compile time using the +@option{--enable-kdb} option. Whenever you want to enter the debugger +while running the kernel, you can press the key combination +@key{Ctrl-Alt-D}. + +@menu +* Operation:: Basic architecture of the kernel debugger. +* Commands:: Available commands in the kernel debugger. +* Variables:: Access of variables from the kernel debugger. +* Expressions:: Usage of expressions in the kernel debugger. +@end menu + + +@node Operation +@section Operation + +The current location is called @dfn{dot}. The dot is displayed with a +hexadecimal format at a prompt. Examine and write commands update dot +to the address of the last line examined or the last location modified, +and set @dfn{next} to the address of the next location to be examined or +changed. Other commands don't change dot, and set next to be the same +as dot. + +The general command syntax is: + +@example +@var{command}[/@var{modifier}] @var{address} [,@var{count}] +@end example + +@kbd{!!} repeats the previous command, and a blank line repeats from the +address next with count 1 and no modifiers. Specifying @var{address} sets +dot to the address. Omitting @var{address} uses dot. A missing @var{count} +is taken to be 1 for printing commands or infinity for stack traces. + +Current @code{ddb} is enhanced to support multi-thread debugging. A +break point can be set only for a specific thread, and the address space +or registers of non current thread can be examined or modified if +supported by machine dependent routines. For example, + +@example +break/t mach_msg_trap $task11.0 +@end example + +sets a break point at @code{mach_msg_trap} for the first thread of task +11 listed by a @code{show all threads} command. + +In the above example, @code{$task11.0} is translated to the +corresponding thread structure's address by variable translation +mechanism described later. If a default target thread is set in a +variable @code{$thread}, the @code{$task11.0} can be omitted. In +general, if @code{t} is specified in a modifier of a command line, a +specified thread or a default target thread is used as a target thread +instead of the current one. The @code{t} modifier in a command line is +not valid in evaluating expressions in a command line. If you want to +get a value indirectly from a specific thread's address space or access +to its registers within an expression, you have to specify a default +target thread in advance, and to use @code{:t} modifier immediately +after the indirect access or the register reference like as follows: + +@example +set $thread $task11.0 +print $eax:t *(0x100):tuh +@end example + +No sign extension and indirection @code{size(long, half word, byte)} can +be specified with @code{u}, @code{l}, @code{h} and @code{b} respectively +for the indirect access. + +Note: Support of non current space/register access and user space break +point depend on the machines. If not supported, attempts of such +operation may provide incorrect information or may cause strange +behavior. Even if supported, the user space access is limited to the +pages resident in the main memory at that time. If a target page is not +in the main memory, an error will be reported. + +@code{ddb} has a feature like a command @code{more} for the output. If +an output line exceeds the number set in the @code{$lines} variable, it +displays @samp{--db_more--} and waits for a response. The valid +responses for it are: + +@table @kbd +@item @key{SPC} +one more page + +@item @key{RET} +one more line + +@item q +abort the current command, and return to the command input mode +@end table + + +@node Commands +@section Commands + +@table @code +@item examine(x) [/@var{modifier}] @var{addr}[,@var{count}] [ @var{thread} ] +Display the addressed locations according to the formats in the +modifier. Multiple modifier formats display multiple locations. If no +format is specified, the last formats specified for this command is +used. Address space other than that of the current thread can be +specified with @code{t} option in the modifier and @var{thread} +parameter. The format characters are + +@table @code +@item b +look at by bytes(8 bits) + +@item h +look at by half words(16 bits) + +@item l +look at by long words(32 bits) + +@item a +print the location being displayed + +@item , +skip one unit producing no output + +@item A +print the location with a line number if possible + +@item x +display in unsigned hex + +@item z +display in signed hex + +@item o +display in unsigned octal + +@item d +display in signed decimal + +@item u +display in unsigned decimal + +@item r +display in current radix, signed + +@item c +display low 8 bits as a character. Non-printing characters are +displayed as an octal escape code (e.g. '\000'). + +@item s +display the null-terminated string at the location. Non-printing +characters are displayed as octal escapes. + +@item m +display in unsigned hex with character dump at the end of each line. +The location is also displayed in hex at the beginning of each line. + +@item i +display as an instruction + +@item I +display as an instruction with possible alternate formats depending on +the machine: + +@table @code +@item vax +don't assume that each external label is a procedure entry mask + +@item i386 +don't round to the next long word boundary + +@item mips +print register contents +@end table +@end table + +@item xf +Examine forward. It executes an examine command with the last specified +parameters to it except that the next address displayed by it is used as +the start address. + +@item xb +Examine backward. It executes an examine command with the last +specified parameters to it except that the last start address subtracted +by the size displayed by it is used as the start address. + +@item print[/axzodurc] @var{addr1} [ @var{addr2} @dots{} ] +Print @var{addr}'s according to the modifier character. Valid formats +are: @code{a} @code{x} @code{z} @code{o} @code{d} @code{u} @code{r} +@code{c}. If no modifier is specified, the last one specified to it is +used. @var{addr} can be a string, and it is printed as it is. For +example, + +@example +print/x "eax = " $eax "\necx = " $ecx "\n" +@end example + +will print like + +@example +eax = xxxxxx +ecx = yyyyyy +@end example + +@item write[/bhlt] @var{addr} [ @var{thread} ] @var{expr1} [ @var{expr2} @dots{} ] +Write the expressions at succeeding locations. The write unit size can +be specified in the modifier with a letter b (byte), h (half word) or +l(long word) respectively. If omitted, long word is assumed. Target +address space can also be specified with @code{t} option in the modifier +and @var{thread} parameter. Warning: since there is no delimiter +between expressions, strange things may happen. It's best to enclose +each expression in parentheses. + +@item set $@var{variable} [=] @var{expr} +Set the named variable or register with the value of @var{expr}. Valid +variable names are described below. + +@item break[/tuTU] @var{addr}[,@var{count}] [ @var{thread1} @dots{} ] +Set a break point at @var{addr}. If count is supplied, continues +(@var{count}-1) times before stopping at the break point. If the break +point is set, a break point number is printed with @samp{#}. This +number can be used in deleting the break point or adding conditions to +it. + +@table @code +@item t +Set a break point only for a specific thread. The thread is specified +by @var{thread} parameter, or default one is used if the parameter is +omitted. + +@item u +Set a break point in user space address. It may be combined with +@code{t} or @code{T} option to specify the non-current target user +space. Without @code{u} option, the address is considered in the kernel +space, and wrong space address is rejected with an error message. This +option can be used only if it is supported by machine dependent +routines. + +@item T +Set a break point only for threads in a specific task. It is like +@code{t} option except that the break point is valid for all threads +which belong to the same task as the specified target thread. + +@item U +Set a break point in shared user space address. It is like @code{u} +option, except that the break point is valid for all threads which share +the same address space even if @code{t} option is specified. @code{t} +option is used only to specify the target shared space. Without +@code{t} option, @code{u} and @code{U} have the same meanings. @code{U} +is useful for setting a user space break point in non-current address +space with @code{t} option such as in an emulation library space. This +option can be used only if it is supported by machine dependent +routines. +@end table + +Warning: if a user text is shadowed by a normal user space debugger, +user space break points may not work correctly. Setting a break point +at the low-level code paths may also cause strange behavior. + +@item delete[/tuTU] @var{addr}|#@var{number} [ @var{thread1} @dots{} ] +Delete the break point. The target break point can be specified by a +break point number with @code{#}, or by @var{addr} like specified in +@code{break} command. + +@item cond #@var{number} [ @var{condition} @var{commands} ] +Set or delete a condition for the break point specified by the +@var{number}. If the @var{condition} and @var{commands} are null, the +condition is deleted. Otherwise the condition is set for it. When the +break point is hit, the @var{condition} is evaluated. The +@var{commands} will be executed if the condition is true and the break +point count set by a break point command becomes zero. @var{commands} +is a list of commands separated by semicolons. Each command in the list +is executed in that order, but if a @code{continue} command is executed, +the command execution stops there, and the stopped thread resumes +execution. If the command execution reaches the end of the list, and it +enters into a command input mode. For example, + +@example +set $work0 0 +break/Tu xxx_start $task7.0 +cond #1 (1) set $work0 1; set $work1 0; cont +break/T vm_fault $task7.0 +cond #2 ($work0) set $work1 ($work1+1); cont +break/Tu xxx_end $task7.0 +cond #3 ($work0) print $work1 " faults\n"; set $work0 0 +cont +@end example + +will print page fault counts from @code{xxx_start} to @code{xxx_end} in +@code{task7}. + +@item step[/p] [,@var{count}] +Single step @var{count} times. If @code{p} option is specified, print +each instruction at each step. Otherwise, only print the last +instruction. + +Warning: depending on machine type, it may not be possible to +single-step through some low-level code paths or user space code. On +machines with software-emulated single-stepping (e.g., pmax), stepping +through code executed by interrupt handlers will probably do the wrong +thing. + +@item continue[/c] +Continue execution until a breakpoint or watchpoint. If @code{/c}, +count instructions while executing. Some machines (e.g., pmax) also +count loads and stores. + +Warning: when counting, the debugger is really silently single-stepping. +This means that single-stepping on low-level code may cause strange +behavior. + +@item until +Stop at the next call or return instruction. + +@item next[/p] +Stop at the matching return instruction. If @code{p} option is +specified, print the call nesting depth and the cumulative instruction +count at each call or return. Otherwise, only print when the matching +return is hit. + +@item match[/p] +A synonym for @code{next}. + +@item trace[/tu] [ @var{frame_addr}|@var{thread} ][,@var{count}] +Stack trace. @code{u} option traces user space; if omitted, only traces +kernel space. If @code{t} option is specified, it shows the stack trace +of the specified thread or a default target thread. Otherwise, it shows +the stack trace of the current thread from the frame address specified +by a parameter or from the current frame. @var{count} is the number of +frames to be traced. If the @var{count} is omitted, all frames are +printed. + +Warning: If the target thread's stack is not in the main memory at that +time, the stack trace will fail. User space stack trace is valid only +if the machine dependent code supports it. + +@item search[/bhl] @var{addr} @var{value} [@var{mask}] [,@var{count}] +Search memory for a value. This command might fail in interesting ways +if it doesn't find the searched-for value. This is because @code{ddb} +doesn't always recover from touching bad memory. The optional count +argument limits the search. + +@item macro @var{name} @var{commands} +Define a debugger macro as @var{name}. @var{commands} is a list of +commands to be associated with the macro. In the expressions of the +command list, a variable @code{$argxx} can be used to get a parameter +passed to the macro. When a macro is called, each argument is evaluated +as an expression, and the value is assigned to each parameter, +@code{$arg1}, @code{$arg2}, @dots{} respectively. 10 @code{$arg} +variables are reserved to each level of macros, and they can be used as +local variables. The nesting of macro can be allowed up to 5 levels. +For example, + +@example +macro xinit set $work0 $arg1 +macro xlist examine/m $work0,4; set $work0 *($work0) +xinit *(xxx_list) +xlist +@enddots{} +@end example + +will print the contents of a list starting from @code{xxx_list} by each +@code{xlist} command. + +@item dmacro @var{name} +Delete the macro named @var{name}. + +@item show all threads[/ul] +Display all tasks and threads information. This version of @code{ddb} +prints more information than previous one. It shows UNIX process +information like @command{ps} for each task. The UNIX process +information may not be shown if it is not supported in the machine, or +the bottom of the stack of the target task is not in the main memory at +that time. It also shows task and thread identification numbers. These +numbers can be used to specify a task or a thread symbolically in +various commands. The numbers are valid only in the same debugger +session. If the execution is resumed again, the numbers may change. +The current thread can be distinguished from others by a @code{#} after +the thread id instead of @code{:}. Without @code{l} option, it only +shows thread id, thread structure address and the status for each +thread. The status consists of 5 letters, R(run), W(wait), S(sus­ +pended), O(swapped out) and N(interruptible), and if corresponding +status bit is off, @code{.} is printed instead. If @code{l} option is +specified, more detail information is printed for each thread. + +@item show task [ @var{addr} ] +Display the information of a task specified by @var{addr}. If +@var{addr} is omitted, current task information is displayed. + +@item show thread [ @var{addr} ] +Display the information of a thread specified by @var{addr}. If +@var{addr} is omitted, current thread information is displayed. + +@item show registers[/tu [ @var{thread} ]] +Display the register set. Target thread can be specified with @code{t} +option and @var{thread} parameter. If @code{u} option is specified, it +displays user registers instead of kernel or currently saved one. + +Warning: The support of @code{t} and @code{u} option depends on the +machine. If not supported, incorrect information will be displayed. + +@item show map @var{addr} +Prints the @code{vm_map} at @var{addr}. + +@item show object @var{addr} +Prints the @code{vm_object} at @var{addr}. + +@item show page @var{addr} +Prints the @code{vm_page} structure at @var{addr}. + +@item show port @var{addr} +Prints the @code{ipc_port} structure at @var{addr}. + +@item show ipc_port[/t [ @var{thread} ]] +Prints all @code{ipc_port} structure's addresses the target thread has. +The target thread is a current thread or that specified by a parameter. + +@item show macro [ @var{name} ] +Show the definitions of macros. If @var{name} is specified, only the +definition of it is displayed. Otherwise, definitions of all macros are +displayed. + +@item show watches +Displays all watchpoints. + +@item watch[/T] @var{addr},@var{size} [ @var{task} ] +Set a watchpoint for a region. Execution stops when an attempt to +modify the region occurs. The @var{size} argument defaults to 4. +Without @code{T} option, @var{addr} is assumed to be a kernel address. +If you want to set a watch point in user space, specify @code{T} and +@var{task} parameter where the address belongs to. If the @var{task} +parameter is omitted, a task of the default target thread or a current +task is assumed. If you specify a wrong space address, the request is +rejected with an error message. + +Warning: Attempts to watch wired kernel memory may cause unrecoverable +error in some systems such as i386. Watchpoints on user addresses work +best. +@end table + + +@node Variables +@section Variables + +The debugger accesses registers and variables as $@var{name}. Register +names are as in the @code{show registers} command. Some variables are +suffixed with numbers, and may have some modifier following a colon +immediately after the variable name. For example, register variables +can have @code{u} and @code{t} modifier to indicate user register and +that of a default target thread instead of that of the current thread +(e.g. @code{$eax:tu}). + +Built-in variables currently supported are: + +@table @code +@item task@var{xx}[.@var{yy}] +Task or thread structure address. @var{xx} and @var{yy} are task and +thread identification numbers printed by a @code{show all threads} +command respectively. This variable is read only. + +@item thread +The default target thread. The value is used when @code{t} option is +specified without explicit thread structure address parameter in command +lines or expression evaluation. + +@item radix +Input and output radix + +@item maxoff +Addresses are printed as @var{symbol}+@var{offset} unless offset is greater than +maxoff. + +@item maxwidth +The width of the displayed line. + +@item lines +The number of lines. It is used by @code{more} feature. + +@item tabstops +Tab stop width. + +@item arg@var{xx} +Parameters passed to a macro. @var{xx} can be 1 to 10. + +@item work@var{xx} +Work variable. @var{xx} can be 0 to 31. +@end table + + +@node Expressions +@section Expressions + +Almost all expression operators in C are supported except @code{~}, +@code{^}, and unary @code{&}. Special rules in @code{ddb} are: + +@table @code +@item @var{identifier} +name of a symbol. It is translated to the address(or value) of it. +@code{.} and @code{:} can be used in the identifier. If supported by +an object format dependent routine, +[@var{file_name}:]@var{func}[:@var{line_number}] +[@var{file_name}:]@var{variable}, and +@var{file_name}[:@var{line_number}] can be accepted as a symbol. The +symbol may be prefixed with @code{@var{symbol_table_name}::} like +@code{emulator::mach_msg_trap} to specify other than kernel symbols. + +@item @var{number} +radix is determined by the first two letters: +@table @code +@item 0x +hex +@item 0o +octal +@item 0t +decimal +@end table + +otherwise, follow current radix. + +@item . +dot + +@item + +next + +@item .. +address of the start of the last line examined. Unlike dot or next, +this is only changed by @code{examine} or @code{write} command. + +@item ´ +last address explicitly specified. + +@item $@var{variable} +register name or variable. It is translated to the value of it. It may +be followed by a @code{:} and modifiers as described above. + +@item a +multiple of right hand side. + +@item *@var{expr} +indirection. It may be followed by a @code{:} and modifiers as +described above. +@end table + + +@include gpl.texi + + +@node Documentation License +@appendix Documentation License + +This manual is copyrighted and licensed under the GNU Free Documentation +license. + +Parts of this manual are derived from the Mach manual packages +originally provided by Carnegie Mellon University. + +@menu +* Free Documentation License:: The GNU Free Documentation License. +* CMU License:: The CMU license applies to the original Mach + kernel and its documentation. +@end menu + +@lowersections +@include fdl.texi +@raisesections + +@node CMU License +@appendixsec CMU License + +@quotation +@display +Mach Operating System +Copyright @copyright{} 1991,1990,1989 Carnegie Mellon University +All Rights Reserved. +@end display + +Permission to use, copy, modify and distribute this software and its +documentation is hereby granted, provided that both the copyright +notice and this permission notice appear in all copies of the +software, derivative works or modified versions, and any portions +thereof, and that both notices appear in supporting documentation. + +@sc{carnegie mellon allows free use of this software in its ``as is'' +condition. carnegie mellon disclaims any liability of any kind for +any damages whatsoever resulting from the use of this software.} + +Carnegie Mellon requests users of this software to return to + +@display + Software Distribution Coordinator + School of Computer Science + Carnegie Mellon University + Pittsburgh PA 15213-3890 +@end display + +@noindent +or @email{Software.Distribution@@CS.CMU.EDU} any improvements or +extensions that they make and grant Carnegie Mellon the rights to +redistribute these changes. +@end quotation + +@node Concept Index +@unnumbered Concept Index + +@printindex cp + + +@node Function and Data Index +@unnumbered Function and Data Index + +@printindex fn + + +@summarycontents +@contents +@bye diff -brNpu gnumach-1.2/gensym.awk gnumach-1.3/gensym.awk --- gnumach-1.2/gensym.awk Mon Jun 21 11:58:12 1999 +++ gnumach-1.3/gensym.awk Mon May 27 11:17:01 2002 @@ -34,7 +34,7 @@ BEGIN { # Take an arbitrarily complex C symbol or expression and constantize it. /^expr/ { - print "__asm (\""; + print "__asm (\"\\n\\"; if ($3 == "") printf "* %s mAgIc%%0\" : : \"i\" (%s));\n", $2, $2; else @@ -43,7 +43,7 @@ BEGIN { # Output a symbol defining the size of a C structure. /^size/ { - print "__asm (\""; + print "__asm (\"\\n\\"; if ($4 == "") printf "* %s_SIZE mAgIc%%0\" : : \"i\" (sizeof(struct %s)));\n", toupper($3), $2; @@ -54,7 +54,7 @@ BEGIN { # Output a symbol defining the byte offset of an element of a C structure. /^offset/ { - print "__asm (\""; + print "__asm (\"\\n\\"; if ($5 == "") { printf "* %s_%s mAgIc%%0\" : : \"i\" (&((struct %s*)0)->%s));\n", @@ -75,4 +75,3 @@ BEGIN { END { print "}" } - diff -brNpu gnumach-1.2/i386/Files gnumach-1.3/i386/Files --- gnumach-1.2/i386/Files Mon Jun 21 11:59:00 1999 +++ gnumach-1.3/i386/Files Mon May 27 11:17:01 2002 @@ -212,19 +212,12 @@ i386/imps/cpus.h i386/imps/imps.c i386/imps/impsasm.sym i386/include/Makefile.in -i386/include/mach/proc_ops.h -i386/include/mach/setjmp.h i386/include/mach/i386/asm.h -i386/include/mach/i386/bios.h i386/include/mach/i386/boolean.h -i386/include/mach/i386/code16.h i386/include/mach/i386/cthreads.h -i386/include/mach/i386/debug_reg.h i386/include/mach/i386/disk.h -i386/include/mach/i386/dpmi.h i386/include/mach/i386/eflags.h i386/include/mach/i386/exception.h -i386/include/mach/i386/far_ptr.h i386/include/mach/i386/fp_reg.h i386/include/mach/i386/ioccom.h i386/include/mach/i386/kern_return.h @@ -232,23 +225,14 @@ i386/include/mach/i386/mach_i386.defs i386/include/mach/i386/mach_i386_types.h i386/include/mach/i386/machine_types.defs i386/include/mach/i386/multiboot.h -i386/include/mach/i386/paging.h -i386/include/mach/i386/pio.h -i386/include/mach/i386/pmode.h -i386/include/mach/i386/proc_reg.h i386/include/mach/i386/rpc.h -i386/include/mach/i386/seg.h i386/include/mach/i386/syscall_sw.h i386/include/mach/i386/thread_status.h -i386/include/mach/i386/time_stamp.h i386/include/mach/i386/trap.h -i386/include/mach/i386/tss.h -i386/include/mach/i386/vcpi.h i386/include/mach/i386/vm_param.h i386/include/mach/i386/vm_types.h i386/include/mach/i386/exec/elf.h i386/include/mach/sa/stdarg.h -i386/include/mach/sa/sys/varargs.h i386/intel/pmap.c i386/intel/pmap.h i386/intel/read_fault.c diff -brNpu gnumach-1.2/i386/Makefile.in gnumach-1.3/i386/Makefile.in --- gnumach-1.2/i386/Makefile.in Mon Jun 21 11:59:00 1999 +++ gnumach-1.3/i386/Makefile.in Mon May 27 11:17:01 2002 @@ -29,8 +29,9 @@ sysdep.o: linux/linux.o $(srcdir)/config rm -f $@ $(LD) -r -o $@ linux/linux.o -linux/linux.o: linux +linux/linux.o: FORCE cd linux && $(MAKE) all +FORCE: clean: rm -f sysdep.o diff -brNpu gnumach-1.2/i386/Makefrag gnumach-1.3/i386/Makefrag --- gnumach-1.2/i386/Makefrag Mon Jun 21 11:59:38 1999 +++ gnumach-1.3/i386/Makefrag Mon May 27 11:17:05 2002 @@ -65,8 +65,9 @@ endif # those filenames. objfiles += i386/sysdep.o -i386/sysdep.o: $(systype) +i386/sysdep.o: FORCE cd i386 && $(MAKE) all +FORCE: clean: i386-clean i386-clean: @@ -123,13 +124,13 @@ i386-install-kernel: # We have our own version of this file installed-headers := $(filter-out mach/proc_ops.h,$(installed-headers)) -i386-installed-headers= mach/proc_ops.h \ - $(addprefix mach/i386/,asm.h bios.h boolean.h code16.h \ - debug_reg.h disk.h dpmi.h eflags.h exception.h far_ptr.h \ +i386-installed-headers= \ + $(addprefix mach/i386/,asm.h boolean.h \ + disk.h eflags.h exception.h \ fp_reg.h ioccom.h kern_return.h mach_i386.defs \ - mach_i386_types.h machine_types.defs multiboot.h paging.h \ - pio.h pmode.h proc_reg.h rpc.h seg.h syscall_sw.h \ - thread_status.h time_stamp.h trap.h tss.h vcpi.h vm_param.h \ + mach_i386_types.h machine_types.defs multiboot.h \ + rpc.h syscall_sw.h \ + thread_status.h trap.h vm_param.h \ vm_types.h) diff -brNpu gnumach-1.2/i386/README-Drivers gnumach-1.3/i386/README-Drivers --- gnumach-1.2/i386/README-Drivers Mon Jun 21 11:59:00 1999 +++ gnumach-1.3/i386/README-Drivers Mon May 27 11:17:01 2002 @@ -158,14 +158,12 @@ DTC3180/3280 NCR53C8XX --enable-ncr53c8xx scsi/ncr53c8xx.c - -Tekram DC-390W/U/F - --enable-dc390w scsi/tmsscsiw.c + --enable-dc390w --enable-dc390u --enable-dc390f Tekram DC-390(T) - --enable-dc390t scsi/tmsscsim.c + --enable-dc390t scsi/tmscsim.c --enable-dc390 IOMEGA Parallel Port ZIP drive diff -brNpu gnumach-1.2/i386/bogus/fpe.h gnumach-1.3/i386/bogus/fpe.h --- gnumach-1.2/i386/bogus/fpe.h Mon Jun 21 11:59:01 1999 +++ gnumach-1.3/i386/bogus/fpe.h Mon May 27 11:17:02 2002 @@ -1 +1 @@ -#define FPE 1 +#define FPE 0 diff -brNpu gnumach-1.2/i386/i386/ast_check.c gnumach-1.3/i386/i386/ast_check.c --- gnumach-1.2/i386/i386/ast_check.c Mon Jun 21 11:59:07 1999 +++ gnumach-1.3/i386/i386/ast_check.c Mon May 27 11:17:02 2002 @@ -44,7 +44,7 @@ init_ast_check(processor) { #ifdef lint processor++; -#endif lint +#endif /* lint */ } /* @@ -55,7 +55,7 @@ cause_ast_check(processor) { #ifdef lint processor++; -#endif lint +#endif /* lint */ } #endif /* NCPUS > 1 */ diff -brNpu gnumach-1.2/i386/i386/cswitch.S gnumach-1.3/i386/i386/cswitch.S --- gnumach-1.2/i386/i386/cswitch.S Mon Jun 21 11:59:07 1999 +++ gnumach-1.3/i386/i386/cswitch.S Mon May 27 11:17:02 2002 @@ -138,5 +138,4 @@ ENTRY(switch_to_shutdown_context) call *%ebx /* call routine to run */ hlt /* (should never return) */ -#endif NCPUS > 1 - +#endif /* NCPUS > 1 */ diff -brNpu gnumach-1.2/i386/i386/db_disasm.c gnumach-1.3/i386/i386/db_disasm.c --- gnumach-1.2/i386/i386/db_disasm.c Mon Jun 21 11:59:07 1999 +++ gnumach-1.3/i386/i386/db_disasm.c Mon May 27 11:17:02 2002 @@ -1420,4 +1420,4 @@ db_disasm( return loc; } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/i386/i386/db_interface.c gnumach-1.3/i386/i386/db_interface.c --- gnumach-1.2/i386/i386/db_interface.c Mon Jun 21 11:59:08 1999 +++ gnumach-1.3/i386/i386/db_interface.c Mon May 27 11:17:02 2002 @@ -555,4 +555,4 @@ db_task_name( db_printf(" "); } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/i386/i386/db_trace.c gnumach-1.3/i386/i386/db_trace.c --- gnumach-1.2/i386/i386/db_trace.c Mon Jun 21 11:59:08 1999 +++ gnumach-1.3/i386/i386/db_trace.c Mon May 27 11:17:02 2002 @@ -672,4 +672,4 @@ void db_all_cprocs( #endif /* CTHREADS_SUPPORT */ -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/i386/i386/debug.h gnumach-1.3/i386/i386/debug.h --- gnumach-1.2/i386/i386/debug.h Mon Jun 21 11:59:08 1999 +++ gnumach-1.3/i386/i386/debug.h Mon May 27 11:17:02 2002 @@ -51,7 +51,7 @@ void debug_trace_reset(void); Also clears the trace buffer. */ void debug_trace_dump(void); -#else ASSEMBLER +#else /* ASSEMBLER */ #define DEBUG_TRACE \ pushl $__LINE__ ;\ @@ -62,11 +62,11 @@ void debug_trace_dump(void); 9: .ascii __FILE__"\0" ;\ .text -#endif ASSEMBLER +#endif /* ASSEMBLER */ -#endif DEBUG +#endif /* DEBUG */ /* XXX #include_next "debug.h" */ -#endif _I386_DEBUG_ +#endif /* _I386_DEBUG_ */ diff -brNpu gnumach-1.2/i386/i386/debug_i386.c gnumach-1.3/i386/i386/debug_i386.c --- gnumach-1.2/i386/i386/debug_i386.c Mon Jun 21 11:59:08 1999 +++ gnumach-1.3/i386/i386/debug_i386.c Mon May 27 11:17:02 2002 @@ -143,5 +143,4 @@ syscall_trace_print(int syscallvec, ...) return syscallvec; } -#endif DEBUG - +#endif /* DEBUG */ diff -brNpu gnumach-1.2/i386/i386/debug_trace.S gnumach-1.3/i386/i386/debug_trace.S --- gnumach-1.2/i386/i386/debug_trace.S Mon Jun 21 11:59:08 1999 +++ gnumach-1.3/i386/i386/debug_trace.S Mon May 27 11:17:02 2002 @@ -48,7 +48,7 @@ ENTRY(_debug_trace) popf ret -#endif DEBUG +#endif /* DEBUG */ /* XXX gas bug? need at least one symbol... */ foo: diff -brNpu gnumach-1.2/i386/i386/eflags.h gnumach-1.3/i386/i386/eflags.h --- gnumach-1.2/i386/i386/eflags.h Mon Jun 21 11:59:09 1999 +++ gnumach-1.3/i386/i386/eflags.h Mon May 27 11:17:02 2002 @@ -32,4 +32,4 @@ #define EFL_USER_SET (EFL_IF) #define EFL_USER_CLEAR (EFL_IOPL|EFL_NT|EFL_RF) -#endif _KERNEL_I386_EFLAGS_H_ +#endif /* _KERNEL_I386_EFLAGS_H_ */ diff -brNpu gnumach-1.2/i386/i386/gdt.h gnumach-1.3/i386/i386/gdt.h --- gnumach-1.2/i386/i386/gdt.h Mon Jun 21 11:59:11 1999 +++ gnumach-1.3/i386/i386/gdt.h Mon May 27 11:17:02 2002 @@ -69,4 +69,4 @@ extern struct real_descriptor gdt[GDTSZ] #define fill_gdt_descriptor(segment, base, limit, access, sizebits) \ fill_descriptor(&gdt[segment/8], base, limit, access, sizebits) -#endif _I386_GDT_ +#endif /* _I386_GDT_ */ diff -brNpu gnumach-1.2/i386/i386/hardclock.c gnumach-1.3/i386/i386/hardclock.c --- gnumach-1.2/i386/i386/hardclock.c Mon Jun 21 11:59:11 1999 +++ gnumach-1.3/i386/i386/hardclock.c Mon May 27 11:17:02 2002 @@ -46,7 +46,7 @@ #ifdef PS2 #include #include -#endif PS2 +#endif /* PS2 */ extern void clock_interrupt(); extern char return_to_iret[]; diff -brNpu gnumach-1.2/i386/i386/i386asm.sym gnumach-1.3/i386/i386/i386asm.sym --- gnumach-1.2/i386/i386/i386asm.sym Mon Jun 21 11:59:11 1999 +++ gnumach-1.3/i386/i386/i386asm.sym Mon May 27 11:17:02 2002 @@ -120,12 +120,12 @@ expr (VM_MIN_KERNEL_ADDRESS>>PDESHIFT)*s #if MACH_KDB expr RB_KDB -#endif MACH_KDB +#endif /* MACH_KDB */ #if NCPUS > 1 offset mp_desc_table mp gdt offset mp_desc_table mp idt -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ expr INTSTACK_SIZE #if !STAT_TIME @@ -136,4 +136,3 @@ expr TIMER_HIGH_UNIT offset thread th system_timer offset thread th user_timer #endif - diff -brNpu gnumach-1.2/i386/i386/idt-gen.h gnumach-1.3/i386/i386/idt-gen.h --- gnumach-1.2/i386/i386/idt-gen.h Mon Jun 21 11:59:11 1999 +++ gnumach-1.3/i386/i386/idt-gen.h Mon May 27 11:17:02 2002 @@ -44,4 +44,4 @@ extern struct real_gate idt[IDTSZ]; #define fill_idt_gate(int_num, entry, selector, access, dword_count) \ fill_gate(&idt[int_num], entry, selector, access, dword_count) -#endif _I386_IDT_ +#endif /* _I386_IDT_ */ diff -brNpu gnumach-1.2/i386/i386/ipl.h gnumach-1.3/i386/i386/ipl.h --- gnumach-1.2/i386/i386/ipl.h Mon Jun 21 11:59:13 1999 +++ gnumach-1.3/i386/i386/ipl.h Mon May 27 11:17:02 2002 @@ -73,5 +73,5 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT extern int (*ivect[])(); extern int iunit[]; extern int intpri[]; -#endif ASSEMBLER -#endif KERNEL +#endif /* ASSEMBLER */ +#endif /* KERNEL */ diff -brNpu gnumach-1.2/i386/i386/ktss.h gnumach-1.3/i386/i386/ktss.h --- gnumach-1.2/i386/i386/ktss.h Mon Jun 21 11:59:13 1999 +++ gnumach-1.3/i386/i386/ktss.h Mon May 27 11:17:02 2002 @@ -27,4 +27,4 @@ extern struct i386_tss ktss; -#endif _I386_KTSS_ +#endif /* _I386_KTSS_ */ diff -brNpu gnumach-1.2/i386/i386/kttd_interface.c gnumach-1.3/i386/i386/kttd_interface.c --- gnumach-1.2/i386/i386/kttd_interface.c Mon Jun 21 11:59:14 1999 +++ gnumach-1.3/i386/i386/kttd_interface.c Mon May 27 11:17:03 2002 @@ -212,7 +212,7 @@ void kttd_machine_setregs(struct i386_gd printf("ss 0x%x:0x%x, ", kttd_regs.ss, ttd_state->ss); kttd_regs.ss = ttd_state->ss; } -#endif 0 +#endif /* 0 */ } @@ -574,4 +574,4 @@ kttd_netentry(int_regs) (void) splx(s); } -#endif MACH_TTD +#endif /* MACH_TTD */ diff -brNpu gnumach-1.2/i386/i386/ldt.c gnumach-1.3/i386/i386/ldt.c --- gnumach-1.2/i386/i386/ldt.c Mon Jun 21 11:59:14 1999 +++ gnumach-1.3/i386/i386/ldt.c Mon May 27 11:17:03 2002 @@ -51,14 +51,15 @@ ldt_init() (vm_offset_t)&syscall, KERNEL_CS, ACC_PL_U|ACC_CALL_GATE, 0); fill_ldt_descriptor(USER_CS, - VM_MIN_ADDRESS, VM_MAX_ADDRESS-VM_MIN_ADDRESS, + VM_MIN_ADDRESS, + VM_MAX_ADDRESS-VM_MIN_ADDRESS-4096, /* XXX LINEAR_... */ ACC_PL_U|ACC_CODE_R, SZ_32); fill_ldt_descriptor(USER_DS, - VM_MIN_ADDRESS, VM_MAX_ADDRESS-VM_MIN_ADDRESS, + VM_MIN_ADDRESS, + VM_MAX_ADDRESS-VM_MIN_ADDRESS-4096, ACC_PL_U|ACC_DATA_W, SZ_32); /* Activate the LDT. */ lldt(KERNEL_LDT); } - diff -brNpu gnumach-1.2/i386/i386/ldt.h gnumach-1.3/i386/i386/ldt.h --- gnumach-1.2/i386/i386/ldt.h Mon Jun 21 11:59:15 1999 +++ gnumach-1.3/i386/i386/ldt.h Mon May 27 11:17:03 2002 @@ -61,6 +61,6 @@ extern struct real_descriptor ldt[LDTSZ] fill_gate((struct real_gate*)&ldt[selector/8], \ offset, dest_selector, access, word_count) -#endif !ASSEMBLER +#endif /* !ASSEMBLER */ -#endif _I386_LDT_ +#endif /* _I386_LDT_ */ diff -brNpu gnumach-1.2/i386/i386/lock.h gnumach-1.3/i386/i386/lock.h --- gnumach-1.2/i386/i386/lock.h Mon Jun 21 11:59:16 1999 +++ gnumach-1.3/i386/i386/lock.h Mon May 27 11:17:03 2002 @@ -121,7 +121,7 @@ extern void simple_lock_pause(); -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ #include_next "lock.h" diff -brNpu gnumach-1.2/i386/i386/locore.S gnumach-1.3/i386/i386/locore.S --- gnumach-1.2/i386/i386/locore.S Mon Jun 21 11:59:16 1999 +++ gnumach-1.3/i386/i386/locore.S Mon May 27 11:17:03 2002 @@ -867,7 +867,7 @@ kdb_from_iret_i: /* on interrupt stack addl $8,%esp iret -#endif MACH_KDB +#endif /* MACH_KDB */ #if MACH_TTD /* @@ -1071,7 +1071,7 @@ mach_call_call: /* will return with syscallofs still (or again) in eax */ addl $4,%esp 0: -#endif DEBUG +#endif /* DEBUG */ call *EXT(mach_trap_table)+4(%eax) /* call procedure */ @@ -1480,7 +1480,7 @@ ENTRY(outb) outb %al,%dx /* send it out */ #ifdef iPSC386 mull %ecx /* Delay a little to make H/W happy */ -#endif iPSC386 +#endif /* iPSC386 */ ret /* @@ -1498,7 +1498,7 @@ ENTRY(inb) pushl %eax mull %ecx popl %eax -#endif iPSC386 +#endif /* iPSC386 */ ret /* @@ -1707,13 +1707,13 @@ ENTRY(dr3) movzbl B_ARG1, %eax andb $3, %al - addb $0x10, %ecx + addb $0x10, %cl shll %cl, %eax orl %eax, %edx movzbl B_ARG2, %eax andb $3, %al - addb $0x2, %ecx + addb $0x2, %cl shll %cl, %eax orl %eax, %edx @@ -1735,15 +1735,6 @@ ENTRY(dr_addr) .text /* - * Waste 10 microseconds. - */ -ENTRY(tenmicrosec) - movl EXT(microdata),%ecx /* cycle count for 10 microsecond loop */ -tenmicroloop: - loop tenmicroloop - ret - -/* * cpu_shutdown() * Force reboot */ @@ -1768,4 +1759,3 @@ Entry(cpu_shutdown) .data .globl EXT(ktss) .comm EXT(ktss),0x68+65536/8+1 - diff -brNpu gnumach-1.2/i386/i386/mp_desc.h gnumach-1.3/i386/i386/mp_desc.h --- gnumach-1.2/i386/i386/mp_desc.h Mon Jun 21 11:59:17 1999 +++ gnumach-1.3/i386/i386/mp_desc.h Mon May 27 11:17:03 2002 @@ -79,6 +79,6 @@ extern struct real_descriptor *mp_gdt[NC extern struct mp_desc_table * mp_desc_init(/* int */); -#endif MULTIPROCESSOR +#endif /* MULTIPROCESSOR */ #endif /* _I386_MP_DESC_H_ */ diff -brNpu gnumach-1.2/i386/i386/pic.c gnumach-1.3/i386/i386/pic.c --- gnumach-1.2/i386/i386/pic.c Mon Jun 21 11:59:18 1999 +++ gnumach-1.3/i386/i386/pic.c Mon May 27 11:17:03 2002 @@ -154,11 +154,11 @@ picinit() #ifdef AT386 PICM_ICW3 = ( SLAVE_ON_IR2 ); PICS_ICW3 = ( I_AM_SLAVE_2 ); -#endif AT386 +#endif /* AT386 */ #ifdef iPSC386 PICM_ICW3 = ( SLAVE_ON_IR7 ); PICS_ICW3 = ( I_AM_SLAVE_7 ); -#endif iPSC386 +#endif /* iPSC386 */ #ifdef iPSC386 /* Use Buffered mode for iPSC386 */ @@ -166,12 +166,12 @@ picinit() NRML_EOI_MOD | I8086_EMM_MOD); PICS_ICW4 = (SNF_MODE_DIS | BUFFERD_MODE | I_AM_A_SLAVE | NRML_EOI_MOD | I8086_EMM_MOD); -#else iPSC386 +#else /* iPSC386 */ PICM_ICW4 = (SNF_MODE_DIS | NONBUFD_MODE | NRML_EOI_MOD | I8086_EMM_MOD); PICS_ICW4 = (SNF_MODE_DIS | NONBUFD_MODE | NRML_EOI_MOD | I8086_EMM_MOD); -#endif iPSC386 +#endif /* iPSC386 */ PICM_OCW1 = (curr_pic_mask & 0x00FF); PICS_OCW1 = ((curr_pic_mask & 0xFF00)>>8); @@ -238,7 +238,7 @@ picinit() #endif /* defined(AT386) || defined(PS2) */ #ifdef iPSC386 #define SLAVEMASK (0xFFFF ^ SLAVE_ON_IR7) -#endif iPSC386 +#endif /* iPSC386 */ #define SLAVEACTV 0xFF00 diff -brNpu gnumach-1.2/i386/i386/pic.h gnumach-1.3/i386/i386/pic.h --- gnumach-1.2/i386/i386/pic.h Mon Jun 21 11:59:18 1999 +++ gnumach-1.3/i386/i386/pic.h Mon May 27 11:17:03 2002 @@ -73,7 +73,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #define OFF_ICW 0x00 #define OFF_OCW 0x02 #define SIZE_PIC 0x04 -#endif iPSC386 +#endif /* iPSC386 */ #define PIC_MASTER_ICW (ADDR_PIC_BASE + OFF_ICW) #define PIC_MASTER_OCW (ADDR_PIC_BASE + OFF_OCW) @@ -112,7 +112,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #ifdef iPSC386 #define PICM_VECTBASE 0x40 #define PICS_VECTBASE PICM_VECTBASE + 0x08 -#endif iPSC386 +#endif /* iPSC386 */ /* ** ICW3 @@ -147,7 +147,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #if iPSC386 #define I_AM_A_SLAVE 0x00 #define I_AM_A_MASTR 0x04 -#endif iPSC386 +#endif /* iPSC386 */ #define AUTO_EOI_MOD 0x02 #define NRML_EOI_MOD 0x00 #define I8086_EMM_MOD 0x01 @@ -194,4 +194,4 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #define READ_IR_ONRD 0x00 #define READ_IS_ONRD 0x01 -#endif _I386_PIC_H_ +#endif /* _I386_PIC_H_ */ diff -brNpu gnumach-1.2/i386/i386/pio.h gnumach-1.3/i386/i386/pio.h --- gnumach-1.2/i386/i386/pio.h Mon Jun 21 11:59:18 1999 +++ gnumach-1.3/i386/i386/pio.h Mon May 27 11:17:03 2002 @@ -29,7 +29,7 @@ #ifndef __GNUC__ #error You do not stand a chance. This file is gcc only. -#endif __GNUC__ +#endif /* __GNUC__ */ #define inl(y) \ ({ unsigned long _tmp__; \ diff -brNpu gnumach-1.2/i386/i386/pit.c gnumach-1.3/i386/i386/pit.c --- gnumach-1.2/i386/i386/pit.c Mon Jun 21 11:59:18 1999 +++ gnumach-1.3/i386/i386/pit.c Mon May 27 11:17:03 2002 @@ -63,15 +63,6 @@ int pitctr2_port = PITCTR2_PORT; /* For int pit0_mode = PIT_C0|PIT_SQUAREMODE|PIT_READMODE ; -unsigned int delaycount; /* loop count in trying to delay for - * 1 millisecond - */ -unsigned long microdata=50; /* loop count for 10 microsecond wait. - MUST be initialized for those who - insist on calling "tenmicrosec" - it before the clock has been - initialized. - */ unsigned int clknumb = CLKNUM; /* interrupt interval for timer 0 */ #ifdef PS2 @@ -93,8 +84,6 @@ clkstart() intpri[0] = SPLHI; form_pic_mask(); - findspeed(); - microfind(); s = sploff(); /* disable interrupts */ #ifdef PS2 @@ -116,39 +105,6 @@ clkstart() #define COUNT 10000 /* should be a multiple of 1000! */ -findspeed() -{ - unsigned int flags; - unsigned char byte; - unsigned int leftover; - int i; - int j; - int s; - - s = sploff(); /* disable interrupts */ - /* Put counter in count down mode */ -#define PIT_COUNTDOWN PIT_READMODE|PIT_NDIVMODE - outb(pitctl_port, PIT_COUNTDOWN); - /* output a count of -1 to counter 0 */ - outb(pitctr0_port, 0xff); - outb(pitctr0_port, 0xff); - delaycount = COUNT; - spinwait(1); - /* Read the value left in the counter */ - byte = inb(pitctr0_port); /* least siginifcant */ - leftover = inb(pitctr0_port); /* most significant */ - leftover = (leftover<<8) + byte ; - /* Formula for delaycount is : - * (loopcount * timer clock speed)/ (counter ticks * 1000) - * 1000 is for figuring out milliseconds - */ - /* we arrange calculation so that it doesn't overflow */ - delaycount = ((COUNT/1000) * CLKNUM) / (0xffff-leftover); - /* printf("findspeed: delaycount=%d (tics=%d)\n", - delaycount, (0xffff-leftover));*/ - splon(s); /* restore interrupt state */ -} - #ifdef PS2 abios_clock_start() @@ -190,47 +146,3 @@ ackrtclock() } } #endif /* PS2 */ - - -spinwait(millis) - int millis; /* number of milliseconds to delay */ -{ - int i, j; - - for (i=0;ioffset_high = (offset >> 16) & 0xffff; } -#endif !ASSEMBLER +#endif /* !ASSEMBLER */ #endif /* _I386_SEG_H_ */ diff -brNpu gnumach-1.2/i386/i386/thread.h gnumach-1.3/i386/i386/thread.h --- gnumach-1.2/i386/i386/thread.h Mon Jun 21 11:59:19 1999 +++ gnumach-1.3/i386/i386/thread.h Mon May 27 11:17:03 2002 @@ -195,4 +195,4 @@ typedef struct pcb { /* #include_next "thread.h" */ -#endif _I386_THREAD_H_ +#endif /* _I386_THREAD_H_ */ diff -brNpu gnumach-1.2/i386/i386/trap.c gnumach-1.3/i386/i386/trap.c --- gnumach-1.2/i386/i386/trap.c Mon Jun 21 11:59:20 1999 +++ gnumach-1.3/i386/i386/trap.c Mon May 27 11:17:03 2002 @@ -77,12 +77,12 @@ thread_kdb_return() /*NOTREACHED*/ } } -#endif MACH_KDB +#endif /* MACH_KDB */ #if MACH_TTD extern boolean_t kttd_enabled; boolean_t debug_all_traps_with_kttd = TRUE; -#endif MACH_TTD +#endif /* MACH_TTD */ void user_page_fault_continue(kr) @@ -100,7 +100,7 @@ user_page_fault_continue(kr) (vm_offset_t)regs->cr2, regs)) kdb_trap(T_WATCHPOINT, 0, regs); -#endif MACH_KDB +#endif /* MACH_KDB */ thread_exception_return(); /*NOTREACHED*/ } @@ -111,7 +111,7 @@ user_page_fault_continue(kr) thread_exception_return(); /*NOTREACHED*/ } -#endif MACH_KDB +#endif /* MACH_KDB */ i386_exception(EXC_BAD_ACCESS, kr, regs->cr2); /*NOTREACHED*/ @@ -181,7 +181,7 @@ void kernel_trap(regs) vm_map_t map; kern_return_t result; register thread_t thread; - extern char start[], etext[]; + extern char _start[], etext[]; type = regs->trapno; code = regs->err; @@ -231,7 +231,7 @@ dump_ss(regs); printf("now %08x\n", subcode); #endif if (trunc_page(subcode) == 0 - || (subcode >= (int)start + || (subcode >= (int)_start && subcode < (int)etext)) { printf("Kernel page fault at address 0x%x, " "eip = 0x%x\n", @@ -271,7 +271,7 @@ dump_ss(regs); kdb_trap(T_WATCHPOINT, 0, regs); } else -#endif MACH_KDB +#endif /* MACH_KDB */ if ((code & T_PF_WRITE) == 0 && result == KERN_PROTECTION_FAILURE) { @@ -348,7 +348,7 @@ dump_ss(regs); #if MACH_KDB if (kdb_trap(type, code, regs)) return; -#endif MACH_KDB +#endif /* MACH_KDB */ splhigh(); printf("kernel trap, type %d, code = %x\n", type, code); @@ -554,7 +554,7 @@ printf("user trap %d error %d sub %08x\n #if MACH_KDB if (kdb_trap(type, regs->err, regs)) return 0; -#endif MACH_KDB +#endif /* MACH_KDB */ splhigh(); printf("user trap, type %d, code = %x\n", type, regs->err); @@ -571,7 +571,7 @@ printf("user trap %d error %d sub %08x\n if (debug_all_traps_with_kdb && kdb_trap(type, regs->err, regs)) return 0; -#endif MACH_KDB +#endif /* MACH_KDB */ i386_exception(exc, code, subcode); /*NOTREACHED*/ @@ -1138,4 +1138,3 @@ interrupted_pc(t) return iss->eip; } #endif /* MACH_PCSAMPLE > 0*/ - diff -brNpu gnumach-1.2/i386/i386/trap.h gnumach-1.3/i386/i386/trap.h --- gnumach-1.2/i386/i386/trap.h Mon Jun 21 11:59:20 1999 +++ gnumach-1.3/i386/i386/trap.h Mon May 27 11:17:03 2002 @@ -33,6 +33,6 @@ char *trap_name(unsigned int trapnum); -#endif !ASSEMBLER +#endif /* !ASSEMBLER */ -#endif _I386_TRAP_H_ +#endif /* _I386_TRAP_H_ */ diff -brNpu gnumach-1.2/i386/i386/user_ldt.c gnumach-1.3/i386/i386/user_ldt.c --- gnumach-1.2/i386/i386/user_ldt.c Mon Jun 21 11:59:20 1999 +++ gnumach-1.3/i386/i386/user_ldt.c Mon May 27 11:17:03 2002 @@ -37,6 +37,7 @@ #include #include #include "ldt.h" +#include "vm_param.h" char acc_type[8][3] = { /* code stack data */ @@ -100,9 +101,10 @@ i386_set_ldt(thread, first_selector, des unsigned int count; boolean_t desc_list_inline; { - user_ldt_t new_ldt, old_ldt, cur_ldt; + user_ldt_t new_ldt, old_ldt, temp; struct real_descriptor *dp; int i; + int min_selector = 0; pcb_t pcb; vm_size_t ldt_size_needed; int first_desc = sel_idx(first_selector); @@ -110,7 +112,9 @@ i386_set_ldt(thread, first_selector, des if (thread == THREAD_NULL) return KERN_INVALID_ARGUMENT; - if (first_desc < 0 || first_desc > 8191) + if (thread == current_thread()) + min_selector = LDTSZ; + if (first_desc < min_selector || first_desc > 8191) return KERN_INVALID_ARGUMENT; if (first_desc + count >= 8192) return KERN_INVALID_ARGUMENT; @@ -172,19 +176,18 @@ i386_set_ldt(thread, first_selector, des } } ldt_size_needed = sizeof(struct real_descriptor) - * (first_desc + count - 1); + * (first_desc + count); pcb = thread->pcb; - old_ldt = 0; /* the one to throw away */ - new_ldt = 0; /* the one to allocate */ + new_ldt = 0; Retry: simple_lock(&pcb->lock); - cur_ldt = pcb->ims.ldt; - if (cur_ldt == 0 || - cur_ldt->desc.limit_low + 1 < ldt_size_needed) + old_ldt = pcb->ims.ldt; + if (old_ldt == 0 || + old_ldt->desc.limit_low + 1 < ldt_size_needed) { /* - * No current LDT, or not big enough + * No old LDT, or not big enough */ if (new_ldt == 0) { simple_unlock(&pcb->lock); @@ -199,7 +202,7 @@ i386_set_ldt(thread, first_selector, des { vm_offset_t ldt_base; - ldt_base = (vm_offset_t) &new_ldt->ldt[0]; + ldt_base = kvtolin(&new_ldt->ldt[0]); new_ldt->desc.limit_low = ldt_size_needed - 1; new_ldt->desc.limit_high = 0; @@ -214,40 +217,48 @@ i386_set_ldt(thread, first_selector, des } /* - * Have new LDT. Copy descriptors from current to new. + * Have new LDT. If there was a an old ldt, copy descriptors + * from old to new. Otherwise copy the default ldt. */ - if (cur_ldt) - bcopy((char *) &cur_ldt->ldt[0], - (char *) &new_ldt->ldt[0], - cur_ldt->desc.limit_low + 1); - - old_ldt = cur_ldt; /* discard old LDT */ - cur_ldt = new_ldt; /* use new LDT from now on */ - new_ldt = 0; /* keep new LDT */ + if (old_ldt) { + bcopy((char *)&old_ldt->ldt[0], + (char *)&new_ldt->ldt[0], + old_ldt->desc.limit_low + 1); + } + else if (thread == current_thread()) { + struct real_descriptor template = {0, 0, 0, ACC_P, 0, 0 ,0}; - pcb->ims.ldt = cur_ldt; /* set LDT for thread */ + for (dp = &new_ldt->ldt[0], i = 0; i < first_desc; i++, dp++) { + if (i < LDTSZ) + *dp = *(struct real_descriptor *) &ldt[i]; + else + *dp = template; + } } - /* - * Install new descriptors. - */ - bcopy((char *) desc_list, - (char *) &cur_ldt->ldt[first_desc], - count * sizeof(struct real_descriptor)); + temp = old_ldt; + old_ldt = new_ldt; /* use new LDT from now on */ + new_ldt = temp; /* discard old LDT */ - simple_unlock(&pcb->lock); + pcb->ims.ldt = old_ldt; /* set LDT for thread */ /* - * Discard old LDT if it was replaced + * If we are modifying the LDT for the current thread, + * make sure it is properly set. */ - if (old_ldt) - kfree((vm_offset_t)old_ldt, - old_ldt->desc.limit_low + 1 - + sizeof(struct real_descriptor)); + if (thread == current_thread()) + switch_ktss(pcb); + } /* - * Discard new LDT if it was not used + * Install new descriptors. */ + bcopy((char *)desc_list, + (char *)&old_ldt->ldt[first_desc], + count * sizeof(struct real_descriptor)); + + simple_unlock(&pcb->lock); + if (new_ldt) kfree((vm_offset_t)new_ldt, new_ldt->desc.limit_low + 1 @@ -344,7 +355,7 @@ i386_get_ldt(thread, first_selector, sel /* * copy out the descriptors */ - bcopy((char *)&user_ldt[first_desc], + bcopy((char *)&user_ldt->ldt[first_desc], (char *)*desc_list, ldt_size); *count = ldt_count; @@ -372,7 +383,8 @@ i386_get_ldt(thread, first_selector, sel /* * Make memory into copyin form - this unwires it. */ - (void) vm_map_copyin(ipc_kernel_map, addr, size_used, TRUE, &memory); + (void) vm_map_copyin(ipc_kernel_map, addr, size_used, + TRUE, &memory); *desc_list = (struct real_descriptor *)memory; } diff -brNpu gnumach-1.2/i386/i386/vm_param.h gnumach-1.3/i386/i386/vm_param.h --- gnumach-1.2/i386/i386/vm_param.h Mon Jun 21 11:59:20 1999 +++ gnumach-1.3/i386/i386/vm_param.h Mon May 27 11:17:03 2002 @@ -61,4 +61,4 @@ extern vm_offset_t phys_mem_va; #define kvtolin(a) ((vm_offset_t)(a) + LINEAR_MIN_KERNEL_ADDRESS) #define lintokv(a) ((vm_offset_t)(a) - LINEAR_MIN_KERNEL_ADDRESS) -#endif _I386_KERNEL_I386_VM_PARAM_ +#endif /* _I386_KERNEL_I386_VM_PARAM_ */ diff -brNpu gnumach-1.2/i386/i386/vm_tuning.h gnumach-1.3/i386/i386/vm_tuning.h --- gnumach-1.2/i386/i386/vm_tuning.h Mon Jun 21 11:59:20 1999 +++ gnumach-1.3/i386/i386/vm_tuning.h Mon May 27 11:17:03 2002 @@ -32,4 +32,4 @@ #ifndef _I386_VM_TUNING_H_ #define _I386_VM_TUNING_H_ -#endif _I386_VM_TUNING_H_ +#endif /* _I386_VM_TUNING_H_ */ diff -brNpu gnumach-1.2/i386/i386at/autoconf.c gnumach-1.3/i386/i386at/autoconf.c --- gnumach-1.2/i386/i386at/autoconf.c Mon Jun 21 11:59:21 1999 +++ gnumach-1.3/i386/i386at/autoconf.c Mon May 27 11:17:03 2002 @@ -81,7 +81,7 @@ extern int pc586intr(); #if NNE > 0 extern struct bus_driver nedriver; extern int neintr(); -#endif NNE +#endif /* NNE */ #include #if NNS8390 > 0 @@ -331,7 +331,7 @@ struct bus_device bus_device_init[] = { '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 5}, {&nedriver, "ne", 1, neintr, 0x300,0x4000,0xd0000, '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 10}, -#endif NNE > 0 +#endif /* NNE > 0 */ #if NNS8390 > 0 /* "wd" and "el" */ diff -brNpu gnumach-1.2/i386/i386at/blit.c gnumach-1.3/i386/i386at/blit.c --- gnumach-1.2/i386/i386at/blit.c Mon Jun 21 11:59:21 1999 +++ gnumach-1.3/i386/i386at/blit.c Mon May 27 11:17:03 2002 @@ -81,14 +81,14 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #ifdef MACH_KERNEL #include #include -#else MACH_KERNEL +#else /* MACH_KERNEL */ #include #include #include #include #include #include -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ #include #include #include @@ -556,9 +556,9 @@ int length; /* num bytes to map */ vm_offset_t vmaddr; #ifdef MACH_KERNEL vm_offset_t io_map(); -#else MACH_KERNEL +#else /* MACH_KERNEL */ vm_offset_t pmap_map_bd(); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ if (physaddr != (caddr_t)trunc_page(physaddr)) panic("Blit card not on page boundary"); @@ -566,11 +566,11 @@ int length; /* num bytes to map */ #ifdef MACH_KERNEL vmaddr = io_map((vm_offset_t)physaddr, length); if (vmaddr == 0) -#else MACH_KERNEL +#else /* MACH_KERNEL */ if (kmem_alloc_pageable(kernel_map, &vmaddr, round_page(BLIT_MAPPED_SIZE)) != KERN_SUCCESS) -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ panic("can't alloc VM for Blit card"); (void)pmap_map_bd(vmaddr, (vm_offset_t)physaddr, @@ -894,7 +894,7 @@ io_return_t blit_get_stat(dev, flavor, d } return (D_SUCCESS); } -#else MACH_KERNEL +#else /* MACH_KERNEL */ /*ARGSUSED*/ int blitioctl(dev, cmd, data, flag) @@ -916,7 +916,7 @@ blitioctl(dev, cmd, data, flag) return(err); } -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ /* * clear_blit: clear blit's screen. diff -brNpu gnumach-1.2/i386/i386at/com.c gnumach-1.3/i386/i386at/com.c --- gnumach-1.2/i386/i386at/com.c Mon Jun 21 11:59:21 1999 +++ gnumach-1.3/i386/i386at/com.c Mon May 27 11:17:03 2002 @@ -85,7 +85,7 @@ u_short divisorreg[] = { 857, 768, 576, 384, 192, /* 134.5, 150, 200, 300, 600*/ 96, 64, 48, /* 1200, 1800, 2000, 2400 */ 24, 12, /* 3600, 4800, 7200, 9600 */ - 6, 3, 2}; /* 19200, 38400, 56000 */ + 6, 3, 2, 1}; /* 19200, 38400, 56000,115200 */ /* diff -brNpu gnumach-1.2/i386/i386at/conf.c gnumach-1.3/i386/i386at/conf.c --- gnumach-1.2/i386/i386at/conf.c Mon Jun 21 11:59:21 1999 +++ gnumach-1.3/i386/i386at/conf.c Mon May 27 11:17:03 2002 @@ -47,7 +47,7 @@ extern int pchdopen(),pchdread(),pc #define pchdname "pchd" #endif -#endif NHD > 0 +#endif /* NHD > 0 */ #include #if NAHA > 0 @@ -66,20 +66,20 @@ int cd_open(), cd_close(), cd_read(), cd extern int fdopen(), fdclose(), fdread(), fdwrite(); extern int fdgetstat(), fdsetstat(), fddevinfo(); #define fdname "fd" -#endif NFD > 0 +#endif /* NFD > 0 */ #include #if NWT > 0 extern int wtopen(), wtread(), wtwrite(), wtclose(); #define wtname "wt" -#endif NWT > 0 +#endif /* NWT > 0 */ #include #if NPC586 > 0 extern int pc586open(), pc586output(), pc586getstat(), pc586setstat(), pc586setinput(); #define pc586name "pc" -#endif NPC586 > 0 +#endif /* NPC586 > 0 */ #include #if NNE > 0 @@ -88,7 +88,7 @@ extern int neopen(), neoutput(), ne extern int nefoutput(); #endif /* FIPC */ #define nename "ne" -#endif NNE > 0 +#endif /* NNE > 0 */ #include #if NNS8390 > 0 @@ -97,7 +97,7 @@ extern int ns8390output(), ns8390getstat ns8390setinput(); #define ns8390wdname "wd" #define ns8390elname "el" -#endif NNS8390 > 0 +#endif /* NNS8390 > 0 */ #include #if NAT3C501 > 0 @@ -105,21 +105,21 @@ extern int at3c501open(), at3c501output( at3c501getstat(), at3c501setstat(), at3c501setinput(); #define at3c501name "et" -#endif NAT3C501 > 0 +#endif /* NAT3C501 > 0 */ #include #if NUL > 0 extern int ulopen(), uloutput(), ulgetstat(), ulsetstat(), ulsetinput(); #define ulname "ul" -#endif NUL > 0 +#endif /* NUL > 0 */ #include #if NWD > 0 extern int wdopen(), wdoutput(), wdgetstat(), wdsetstat(), wdsetinput(); #define wdname "wd" -#endif NWD > 0 +#endif /* NWD > 0 */ #include #if NHPP > 0 @@ -133,14 +133,14 @@ extern int hppopen(), hppoutput(), hp extern int paropen(), paroutput(), pargetstat(), parsetstat(), parsetinput(); #define parname "par" -#endif NPAR > 0 +#endif /* NPAR > 0 */ #include #if NDE6C > 0 extern int de6copen(), de6coutput(), de6cgetstat(), de6csetstat(), de6csetinput(); #define de6cname "de" -#endif NDE6C > 0 +#endif /* NDE6C > 0 */ extern int kdopen(), kdclose(), kdread(), kdwrite(); extern int kdgetstat(), kdsetstat(), kdportdeath(); @@ -152,14 +152,14 @@ extern vm_offset_t kdmmap(); extern int comopen(), comclose(), comread(), comwrite(); extern int comgetstat(), comsetstat(), comportdeath(); #define comname "com" -#endif NCOM > 0 +#endif /* NCOM > 0 */ #include #if NLPR > 0 extern int lpropen(), lprclose(), lprread(), lprwrite(); extern int lprgetstat(), lprsetstat(), lprportdeath(); #define lprname "lpr" -#endif NLPR > 0 +#endif /* NLPR > 0 */ #include #if NBLIT > 0 @@ -219,7 +219,7 @@ struct dev_ops dev_name_list[] = hdwrite, hdgetstat, hdsetstat, nomap, nodev, nulldev, nulldev, 1024, hddevinfo }, -#endif NHD > 0 +#endif /* NHD > 0 */ #if NAHA > 0 { rzname, rz_open, rz_close, rz_read, @@ -249,14 +249,14 @@ struct dev_ops dev_name_list[] = fdwrite, fdgetstat, fdsetstat, nomap, nodev, nulldev, nulldev, 64, fddevinfo }, -#endif NFD > 0 +#endif /* NFD > 0 */ #if NWT > 0 { wtname, wtopen, wtclose, wtread, wtwrite, nulldev, nulldev, nomap, nodev, nulldev, nulldev, 0, nodev }, -#endif NWT > 0 +#endif /* NWT > 0 */ #if NPC586 > 0 { pc586name, pc586open, nulldev, nulldev, @@ -331,7 +331,7 @@ struct dev_ops dev_name_list[] = #endif #endif /* ! LINUX_DEV */ -#ifdef MACH_COM +#if NCOM > 0 { comname, comopen, comclose, comread, comwrite, comgetstat, comsetstat, nomap, nodev, nulldev, comportdeath, 0, @@ -373,7 +373,7 @@ struct dev_ops dev_name_list[] = pchdwrite, pchdgetstat, pchdsetstat, nomap, nodev, nulldev, nulldev, 16, hddevinfo }, -#endif NHD > 0 +#endif /* NHD > 0 */ #endif #if 0 @@ -382,8 +382,8 @@ struct dev_ops dev_name_list[] = hdwrite, hdgetstat, hdsetstat, nomap, nodev, nulldev, nulldev, 16, hddevinfo }, -#endif NHD > 0 -#endif 0 /* Kevin doesn't know why this was here. */ +#endif /* NHD > 0 */ +#endif /* Kevin doesn't know why this was here. */ #ifdef MACH_KMSG { kmsgname, kmsgopen, kmsgclose, kmsgread, diff -brNpu gnumach-1.2/i386/i386at/fd.c gnumach-1.3/i386/i386at/fd.c --- gnumach-1.2/i386/i386at/fd.c Mon Jun 21 11:59:22 1999 +++ gnumach-1.3/i386/i386at/fd.c Mon May 27 11:17:03 2002 @@ -57,12 +57,12 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #include #include #include -#else MACH_KERNEL +#else /* MACH_KERNEL */ #include #include #include #include -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ #include #include #include @@ -135,7 +135,7 @@ int m765verify[MAXUNIT] = {1,1,1,1}; /* /* 0 == not verify mode */ #ifdef MACH_KERNEL extern struct buf *geteblk(); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ #define trfrate(uip, type) outb(VFOREG(uip->addr),(((type)&RATEMASK)>>6)) #define rbskrate(uip, type) trfrate(uip,(type)&RAPID?RPSEEK:NMSEEK) @@ -305,10 +305,10 @@ off_t offset; /* not used */ spl_t s; #ifdef MACH_KERNEL -#else MACH_KERNEL +#else /* MACH_KERNEL */ if ((dev == rootdev) || (dev == swapdev)) /* never close these */ return(0); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ /* Clear the bit. * If last close of drive insure drtab queue is empty before returning. @@ -321,9 +321,9 @@ off_t offset; /* not used */ splx(s); #ifdef MACH_KERNEL return(0); -#else MACH_KERNEL +#else /* MACH_KERNEL */ close(0); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ } /***************************************************************************** * @@ -595,9 +595,9 @@ struct uio *uio; #ifdef MACH_KERNEL /* no need for page-size restriction */ return (block_io(fdstrategy, minphys, uio)); -#else MACH_KERNEL +#else /* MACH_KERNEL */ return(physio(fdstrategy,&fdrbuf[UNIT(dev)],dev,B_READ,fdminphys,uio)); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ } /***************************************************************************** * @@ -615,9 +615,9 @@ struct uio *uio; #ifdef MACH_KERNEL /* no need for page-size restriction */ return (block_io(fdstrategy, minphys, uio)); -#else MACH_KERNEL +#else /* MACH_KERNEL */ return(physio(fdstrategy,&fdrbuf[UNIT(dev)],dev,B_WRITE,fdminphys,uio)); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ } /***************************************************************************** * @@ -720,7 +720,7 @@ char *info; return(result); } -#else MACH_KERNEL +#else /* MACH_KERNEL */ /***************************************************************************** * * TITLE: fdioctl @@ -751,7 +751,7 @@ int flag; /* not used */ } return(EINVAL); } -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ /**************************************************************************** * * set fd parameters @@ -1588,9 +1588,9 @@ struct unit_info *uip; (B_READ|B_VERIFY))?TOUT:ITOUT; #ifdef MACH_KERNEL timeout(fdintr,uip->dev->ctlr,cnt0); -#else MACH_KERNEL +#else /* MACH_KERNEL */ cmdp->c_timeid = timeout(fdintr,uip->dev->ctlr,cnt0); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ } return(rtn); } @@ -1655,9 +1655,9 @@ struct unit_info *uip; cmdp->c_stsflag |= MTROFF; #ifdef MACH_KERNEL timeout(mtr_off,uip,MTRSTOP); -#else MACH_KERNEL +#else /* MACH_KERNEL */ cmdp->c_mtrid = timeout(mtr_off,uip,MTRSTOP); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ } /***************************************************************************** * diff -brNpu gnumach-1.2/i386/i386at/i386at_ds_routines.c gnumach-1.3/i386/i386at/i386at_ds_routines.c --- gnumach-1.2/i386/i386at/i386at_ds_routines.c Mon Jun 21 11:59:22 1999 +++ gnumach-1.3/i386/i386at/i386at_ds_routines.c Mon May 27 11:17:03 2002 @@ -273,6 +273,8 @@ device_reference (device_t dev) void device_deallocate (device_t dev) { + if (dev == DEVICE_NULL) + return; if (dev->emul_ops->dealloc) (*dev->emul_ops->dealloc) (dev->emul_data); } diff -brNpu gnumach-1.2/i386/i386at/idt.h gnumach-1.3/i386/i386at/idt.h --- gnumach-1.2/i386/i386at/idt.h Mon Jun 21 11:59:22 1999 +++ gnumach-1.3/i386/i386at/idt.h Mon May 27 11:17:03 2002 @@ -34,4 +34,4 @@ #include "idt-gen.h" -#endif _I386AT_IDT_ +#endif /* _I386AT_IDT_ */ diff -brNpu gnumach-1.2/i386/i386at/immc.c gnumach-1.3/i386/i386at/immc.c --- gnumach-1.2/i386/i386at/immc.c Mon Jun 21 11:59:24 1999 +++ gnumach-1.3/i386/i386at/immc.c Mon May 27 11:17:03 2002 @@ -73,5 +73,4 @@ int immc_cnmaygetc(void) return -1; } -#endif ENABLE_IMMEDIATE_CONSOLE - +#endif /* ENABLE_IMMEDIATE_CONSOLE */ diff -brNpu gnumach-1.2/i386/i386at/kd.c gnumach-1.3/i386/i386at/kd.c --- gnumach-1.2/i386/i386at/kd.c Mon Jun 21 11:59:24 1999 +++ gnumach-1.3/i386/i386at/kd.c Mon May 27 11:17:03 2002 @@ -160,6 +160,8 @@ csrpos_t kd_curpos = 0; /* set indirectl short kd_lines = 25; short kd_cols = 80; char kd_attr = KA_NORMAL; /* current attribute */ +char kd_color = KA_NORMAL; +char kd_attrflags = 0; /* Not reverse, underline, blink */ /* * kd_state shows the state of the modifier keys (ctrl, caps lock, @@ -208,7 +210,7 @@ boolean_t kd_initialized = FALSE; /* dr boolean_t kd_extended = FALSE; /* Array for processing escape sequences. */ -#define K_MAXESC 16 +#define K_MAXESC 32 u_char esc_seq[K_MAXESC]; u_char *esc_spt = (u_char *)0; @@ -785,7 +787,7 @@ int regs; tp = &kd_tty; #ifdef old while ((inb(K_STATUS) & K_OBUF_FUL) == 0); /* this should never loop */ -#else old +#else /* old */ { /* * Allow for keyboards that raise interrupt before @@ -807,7 +809,7 @@ int regs; while ((inb(K_STATUS) & K_OBUF_FUL) == 0) if (!safety--) break; /* XXX */ } -#endif old +#endif /* old */ /* * We may have seen a mouse event. */ @@ -822,8 +824,7 @@ int regs; } scancode = inb(K_RDWR); - if (scancode == K_EXTEND) { - if (kb_mode != KB_EVENT) + if (scancode == K_EXTEND && kb_mode != KB_EVENT) { kd_extended = TRUE; goto done; } else if (scancode == K_RESEND) { @@ -967,7 +968,7 @@ boolean_t up; break; #ifndef ORC case (K_CLCKSC): -#endif ORC +#endif /* ORC */ case (K_CTLSC): if (up) state &= ~KS_CTLED; @@ -980,7 +981,7 @@ boolean_t up; if (!up) state ^= KS_CLKED; break; -#endif ORC +#endif /* ORC */ case (K_NLCKSC): if (!up) state ^= KS_NLKED; @@ -1056,7 +1057,7 @@ int *regs; } return(TRUE); break; -#endif MACH_KDB +#endif /* MACH_KDB */ case K_DELSC: /* ctl-alt-del */ /* if rebootflag is on, reboot the system */ if (rebootflag) @@ -1200,6 +1201,8 @@ kdinit() esc_spt = esc_seq; kd_attr = KA_NORMAL; + kd_attrflags = 0; + kd_color = KA_NORMAL; /* * board specific initialization: set up globals and kd_dxxx * pointers, and synch displayed cursor with logical cursor. @@ -1471,6 +1474,37 @@ kd_parseesc() } +/* kd_update_kd_attr: + * + * Updates kd_attr according to kd_attrflags and kd_color. + * This code has its origin from console.c and selection.h in + * linux 2.2 drivers/char/. + * Modified for GNU Mach by Marcus Brinkmann. + */ + +#define reverse_video_char(a) (((a) & 0x88) | ((((a) >> 4) | ((a) << 4)) & 0x77)) +void +kd_update_kd_attr(void) +{ + kd_attr = kd_color; + if (kd_attrflags & KAX_UNDERLINE) + kd_attr = (kd_attr & 0xf0) | KAX_COL_UNDERLINE; + else if (kd_attrflags & KAX_DIM) + kd_attr = (kd_attr & 0xf0) | KAX_COL_DIM; + if (kd_attrflags & KAX_REVERSE) + kd_attr = reverse_video_char(kd_attr); + if (kd_attrflags & KAX_BLINK) + kd_attr ^= 0x80; + if (kd_attrflags & KAX_BOLD) + kd_attr ^= 0x08; +} + +/* color_table added by Julio Merino to take proper color order. + * I get this code from Linux 2.2 source code in file: + * linux/drivers/char/console.c + */ +unsigned char color_table[] = { 0, 4, 2, 6, 1, 5, 3, 7, + 8,12,10,14, 9,13,11,15 }; /* * kd_parserest: * @@ -1487,130 +1521,172 @@ kd_parseesc() kd_parserest(cp) u_char *cp; { - int number; + int number[16], npar = 0, i; csrpos_t newpos; - cp += kd_atoi(cp, &number); + for(i=0;i<=15;i++) + number[i] = DEFAULT; + + do { + cp += kd_atoi(cp, &number[npar]); + } while (*cp == ';' && ++npar <= 15 && cp++); + switch(*cp) { case 'm': - switch(number) { + for (i=0;i<=npar;i++) + switch(number[i]) { case DEFAULT: case 0: - kd_attr = KA_NORMAL; + kd_attrflags = 0; + kd_color = KA_NORMAL; + break; + case 1: + kd_attrflags |= KAX_BOLD; + kd_attrflags &= ~KAX_DIM; + break; + case 2: + kd_attrflags |= KAX_DIM; + kd_attrflags &= ~KAX_BOLD; + break; + case 4: + kd_attrflags |= KAX_UNDERLINE; + break; + case 5: + kd_attrflags |= KAX_BLINK; break; case 7: - kd_attr = KA_REVERSE; + kd_attrflags |= KAX_REVERSE; + break; + case 8: + kd_attrflags |= KAX_INVISIBLE; + break; + case 21: + case 22: + kd_attrflags &= ~(KAX_BOLD | KAX_DIM); + break; + case 24: + kd_attrflags &= ~KAX_UNDERLINE; + break; + case 25: + kd_attrflags &= ~KAX_BLINK; + break; + case 27: + kd_attrflags &= ~KAX_REVERSE; + break; + case 38: + kd_attrflags |= KAX_UNDERLINE; + kd_color = (kd_color & 0xf0) | (KA_NORMAL & 0x0f); + break; + case 39: + kd_attrflags &= ~KAX_UNDERLINE; + kd_color = (kd_color & 0xf0) | (KA_NORMAL & 0x0f); break; default: - kd_attr = KA_NORMAL; + if (number[i] >= 30 && number[i] <= 37) { + /* foreground color */ + kd_color = (kd_color & 0xf0) | color_table[(number[i] - 30)]; + } else if (number[i] >= 40 && number[i] <= 47) { + /* background color */ + kd_color = (kd_color & 0x0f) | (color_table[(number[i] - 40)] << 4); + } break; } + kd_update_kd_attr(); esc_spt = esc_seq; break; case '@': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_insch(1); else - kd_insch(number); - esc_spt = esc_seq; - break; - case 'H': - kd_home(); + kd_insch(number[0]); esc_spt = esc_seq; break; case 'A': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_up(); else - while (number--) + while (number[0]--) kd_up(); esc_spt = esc_seq; break; case 'B': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_down(); else - while (number--) + while (number[0]--) kd_down(); esc_spt = esc_seq; break; case 'C': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_right(); else - while (number--) + while (number[0]--) kd_right(); esc_spt = esc_seq; break; case 'D': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_left(); else - while (number--) + while (number[0]--) kd_left(); esc_spt = esc_seq; break; case 'E': kd_cr(); - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_down(); else - while (number--) + while (number[0]--) kd_down(); esc_spt = esc_seq; break; case 'F': kd_cr(); - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_up(); else - while (number--) + while (number[0]--) kd_up(); esc_spt = esc_seq; break; case 'G': - if (number == DEFAULT) - number = 0; + if (number[0] == DEFAULT) + number[0] = 0; else - if (number > 0) - --number; /* because number is from 1 */ - kd_setpos(BEG_OF_LINE(kd_curpos) + number * ONE_SPACE); - esc_spt = esc_seq; - break; - case ';': - ++cp; - if (*cp == '\0') - break; /* not ready yet */ - if (number == DEFAULT) - number = 0; - else - if (number > 0) - --number; /* numbered from 1 */ - newpos = (number * ONE_LINE); /* setup row */ - cp += kd_atoi(cp, &number); - if (*cp == '\0') - break; /* not ready yet */ - if (number == DEFAULT) - number = 0; - else if (number > 0) - number--; - newpos += (number * ONE_SPACE); /* setup column */ + if (number[0] > 0) + --number[0]; /* because number[0] is from 1 */ + kd_setpos(BEG_OF_LINE(kd_curpos) + number[0] * ONE_SPACE); + esc_spt = esc_seq; + break; + case 'f': + case 'H': + if (number[0] == DEFAULT && number[1] == DEFAULT) + { + kd_home(); + esc_spt = esc_seq; + break; + } + if (number[0] == DEFAULT) + number[0] = 0; + else if (number[0] > 0) + --number[0]; /* numbered from 1 */ + newpos = (number[0] * ONE_LINE); /* setup row */ + if (number[1] == DEFAULT) + number[1] = 0; + else if (number[1] > 0) + number[1]--; + newpos += (number[1] * ONE_SPACE); /* setup column */ if (newpos < 0) newpos = 0; /* upper left */ if (newpos > ONE_PAGE) - newpos = (ONE_PAGE - ONE_SPACE); - /* lower right */ - if (*cp == '\0') - break; /* not ready yet */ - if (*cp == 'H') { + newpos = (ONE_PAGE - ONE_SPACE); /* lower right */ kd_setpos(newpos); - esc_spt = esc_seq; /* done, reset */ - } - else esc_spt = esc_seq; break; /* done or not ready */ case 'J': - switch(number) { + switch(number[0]) { case DEFAULT: case 0: kd_cltobcur(); /* clears from current @@ -1631,7 +1707,7 @@ u_char *cp; esc_spt = esc_seq; /* reset it */ break; case 'K': - switch(number) { + switch(number[0]) { case DEFAULT: case 0: kd_cltoecur(); /* clears from current @@ -1653,47 +1729,47 @@ u_char *cp; esc_spt = esc_seq; break; case 'L': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_insln(1); else - kd_insln(number); + kd_insln(number[0]); esc_spt = esc_seq; break; case 'M': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_delln(1); else - kd_delln(number); + kd_delln(number[0]); esc_spt = esc_seq; break; case 'P': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_delch(1); else - kd_delch(number); + kd_delch(number[0]); esc_spt = esc_seq; break; case 'S': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_scrollup(); else - while (number--) + while (number[0]--) kd_scrollup(); esc_spt = esc_seq; break; case 'T': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_scrolldn(); else - while (number--) + while (number[0]--) kd_scrolldn(); esc_spt = esc_seq; break; case 'X': - if (number == DEFAULT) + if (number[0] == DEFAULT) kd_erase(1); else - kd_erase(number); + kd_erase(number[0]); esc_spt = esc_seq; break; case '\0': diff -brNpu gnumach-1.2/i386/i386at/kd.h gnumach-1.3/i386/i386at/kd.h --- gnumach-1.2/i386/i386at/kd.h Mon Jun 21 11:59:24 1999 +++ gnumach-1.3/i386/i386at/kd.h Mon May 27 11:17:03 2002 @@ -212,6 +212,16 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #define KA_NORMAL 0x07 #define KA_REVERSE 0x70 +#define KAX_REVERSE 0x01 +#define KAX_UNDERLINE 0x02 +#define KAX_BLINK 0x04 +#define KAX_BOLD 0x08 +#define KAX_DIM 0x10 +#define KAX_INVISIBLE 0x20 + +#define KAX_COL_UNDERLINE 0x0f /* bright white */ +#define KAX_COL_DIM 0x08 /* gray */ + /* * For an EGA-like display, each character takes two bytes, one for the * actual character, followed by one for its attributes. diff -brNpu gnumach-1.2/i386/i386at/kd_event.c gnumach-1.3/i386/i386at/kd_event.c --- gnumach-1.2/i386/i386at/kd_event.c Mon Jun 21 11:59:25 1999 +++ gnumach-1.3/i386/i386at/kd_event.c Mon May 27 11:17:03 2002 @@ -59,7 +59,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #ifdef MACH_KERNEL #include #include -#else MACH_KERNEL +#else /* MACH_KERNEL */ #include #include #include @@ -68,7 +68,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #include #include #include -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ #include #include #include @@ -87,7 +87,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT kd_event_queue kbd_queue; /* queue of keyboard events */ #ifdef MACH_KERNEL queue_head_t kbd_read_queue = { &kbd_read_queue, &kbd_read_queue }; -#else MACH_KERNEL +#else /* MACH_KERNEL */ struct proc *kbd_sel = 0; /* selecting process, if any */ short kbdpgrp = 0; /* process group leader when dev is open */ @@ -95,14 +95,14 @@ int kbdflag = 0; #define KBD_COLL 1 /* select collision */ #define KBD_ASYNC 2 /* user wants asynch notification */ #define KBD_NBIO 4 /* user wants non-blocking I/O */ -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ void kbd_enqueue(); #ifdef MACH_KERNEL io_return_t X_kdb_enter_init(); io_return_t X_kdb_exit_init(); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ static boolean_t initialized = FALSE; @@ -136,13 +136,13 @@ kbdopen(dev, flags) kbdinit(); #ifdef MACH_KERNEL -#else MACH_KERNEL +#else /* MACH_KERNEL */ if (flags & FWRITE) return(ENODEV); if (kbdpgrp == 0) kbdpgrp = u.u_procp->p_pgrp; -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ return(0); } @@ -161,11 +161,11 @@ kbdclose(dev, flags) kb_mode = KB_ASCII; #ifdef MACH_KERNEL -#else MACH_KERNEL +#else /* MACH_KERNEL */ kbdpgrp = 0; kbdflag = 0; kbd_sel = 0; -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ kdq_reset(&kbd_queue); splx(s); } @@ -220,7 +220,7 @@ io_return_t kbdsetstat(dev, flavor, data return (D_SUCCESS); } -#else MACH_KERNEL +#else /* MACH_KERNEL */ /* * kbdioctl - handling for asynch & non-blocking I/O. */ @@ -295,7 +295,7 @@ kbdselect(dev, rw) splx(s); return(0); } -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ /* @@ -374,7 +374,7 @@ boolean_t kbd_read_done(ior) return (TRUE); } -#else MACH_KERNEL +#else /* MACH_KERNEL */ /*ARGSUSED*/ kbdread(dev, uio) dev_t dev; @@ -411,7 +411,7 @@ done: splx(s); return(err); } -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ /* @@ -451,7 +451,7 @@ kbd_enqueue(ev) while ((ior = (io_req_t)dequeue_head(&kbd_read_queue)) != 0) iodone(ior); } -#else MACH_KERNEL +#else /* MACH_KERNEL */ if (kbd_sel) { selwakeup(kbd_sel, kbdflag & KBD_COLL); kbd_sel = 0; @@ -460,7 +460,7 @@ kbd_enqueue(ev) if (kbdflag & KBD_ASYNC) gsignal(kbdpgrp, SIGIO); wakeup((caddr_t)&kbd_queue); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ } u_int X_kdb_enter_str[512], X_kdb_exit_str[512]; @@ -544,7 +544,7 @@ X_kdb_exit_init(data, count) X_kdb_exit_len = count; return D_SUCCESS; } -#else MACH_KERNEL +#else /* MACH_KERNEL */ X_kdb_enter_init(kp) struct X_kdb *kp; { @@ -566,4 +566,4 @@ struct X_kdb *kp; X_kdb_exit_len = kp->size>>2; } -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ diff -brNpu gnumach-1.2/i386/i386at/kd_mouse.c gnumach-1.3/i386/i386at/kd_mouse.c --- gnumach-1.2/i386/i386at/kd_mouse.c Mon Jun 21 11:59:25 1999 +++ gnumach-1.3/i386/i386at/kd_mouse.c Mon May 27 11:17:03 2002 @@ -69,7 +69,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #ifdef MACH_KERNEL #include #include -#else MACH_KERNEL +#else /* MACH_KERNEL */ #include #include #include @@ -78,7 +78,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT #include #include #include -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ #include #include #include @@ -94,18 +94,18 @@ kd_event_queue mouse_queue; /* queue of boolean_t mouse_in_use = FALSE; #ifdef MACH_KERNEL queue_head_t mouse_read_queue = { &mouse_read_queue, &mouse_read_queue }; -#else MACH_KERNEL +#else /* MACH_KERNEL */ struct proc *mouse_sel = 0; /* selecting process, if any */ short mousepgrp = 0; /* process group leader when dev is open */ -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ #ifdef MACH_KERNEL -#else MACH_KERNEL +#else /* MACH_KERNEL */ int mouseflag = 0; #define MOUSE_COLL 1 /* select collision */ #define MOUSE_ASYNC 2 /* user wants asynch notification */ #define MOUSE_NBIO 4 /* user wants non-blocking I/O */ -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ /* * The state of the 3 buttons is encoded in the low-order 3 bits (both @@ -168,19 +168,19 @@ mouseopen(dev, flags) int flags; { #ifdef MACH_KERNEL -#else MACH_KERNEL +#else /* MACH_KERNEL */ if (flags & FWRITE) return(ENODEV); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ if (mouse_in_use) return(EBUSY); mouse_in_use = TRUE; /* locking? */ kdq_reset(&mouse_queue); lastbuttons = MOUSE_ALL_UP; #ifdef MACH_KERNEL -#else MACH_KERNEL +#else /* MACH_KERNEL */ mousepgrp = u.u_procp->p_pgrp; -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ switch (mouse_type = ((minor(dev) & 0xf8) >> 3)) { case MICROSOFT_MOUSE7: @@ -277,11 +277,11 @@ mouseclose(dev, flags) kdq_reset(&mouse_queue); /* paranoia */ mouse_in_use = FALSE; #ifdef MACH_KERNEL -#else MACH_KERNEL +#else /* MACH_KERNEL */ mousepgrp = 0; mouseflag = 0; mouse_sel = 0; -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ } /*ARGSUSED*/ @@ -334,7 +334,7 @@ io_return_t mousegetstat(dev, flavor, da return D_SUCCESS; } -#else MACH_KERNEL +#else /* MACH_KERNEL */ /* * mouseioctl - handling for asynch & non-blocking I/O. */ @@ -395,7 +395,7 @@ mouseselect(dev, rw) splx(s); return(0); } -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ /* * mouseread - dequeue and return any queued events. @@ -472,7 +472,7 @@ boolean_t mouse_read_done(ior) return (TRUE); } -#else MACH_KERNEL +#else /* MACH_KERNEL */ /*ARGSUSED*/ mouseread(dev, uio) dev_t dev; @@ -509,7 +509,7 @@ done: splx(s); return(err); } -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ /* @@ -752,9 +752,9 @@ int kd_mouse_read(void) #ifdef MACH_KERNEL assert_wait((event_t) &mouse_char, FALSE); thread_block((void (*)()) 0); -#else MACH_KERNEL +#else /* MACH_KERNEL */ sleep(&mouse_char, PZERO); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ } ch = mouse_char; @@ -910,7 +910,7 @@ mouse_enqueue(ev) while ((ior = (io_req_t)dequeue_head(&mouse_read_queue)) != 0) iodone(ior); } -#else MACH_KERNEL +#else /* MACH_KERNEL */ if (mouse_sel) { selwakeup(mouse_sel, mouseflag & MOUSE_COLL); mouse_sel = 0; @@ -919,5 +919,5 @@ mouse_enqueue(ev) if (mouseflag & MOUSE_ASYNC) gsignal(mousepgrp, SIGIO); wakeup((caddr_t)&mouse_queue); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ } diff -brNpu gnumach-1.2/i386/i386at/model_dep.c gnumach-1.3/i386/i386at/model_dep.c --- gnumach-1.2/i386/i386at/model_dep.c Mon Jun 21 11:59:25 1999 +++ gnumach-1.3/i386/i386at/model_dep.c Mon May 27 11:17:04 2002 @@ -42,6 +42,8 @@ #include "vm_param.h" #include +#include +#include #include #include #include @@ -65,7 +67,8 @@ vm_offset_t phys_last_addr; /* Virtual address of physical memory, for the kvtophys/phystokv macros. */ vm_offset_t phys_mem_va; -struct multiboot_info *boot_info; +/* A copy of the multiboot info structure passed by the boot loader. */ +struct multiboot_info boot_info; /* Command line supplied to kernel. */ char *kernel_cmdline = ""; @@ -84,13 +87,13 @@ static vm_size_t avail_remaining; if zero, only use physical memory in the low 16MB of addresses. Only SCSI still has DMA problems. */ #ifdef LINUX_DEV -int use_all_mem = 1; +#define use_all_mem 1 #else #include "nscsi.h" #if NSCSI > 0 -int use_all_mem = 0; +#define use_all_mem 0 #else -int use_all_mem = 1; +#define use_all_mem 1 #endif #endif @@ -98,6 +101,9 @@ extern char version[]; extern void setup_main(); +void halt_all_cpu (boolean_t reboot) __attribute__ ((noreturn)); +void halt_cpu (void) __attribute__ ((noreturn)); + void inittodr(); /* forward */ int rebootflag = 0; /* exported to kdintr */ @@ -152,10 +158,17 @@ void machine_init() pmap_unmap_page_zero(); } +/* Conserve power on processor CPU. */ +void machine_idle (int cpu) +{ + assert (cpu == cpu_number ()); + asm volatile ("hlt" : : : "memory"); +} + /* * Halt a cpu. */ -halt_cpu() +void halt_cpu(void) { asm volatile("cli"); while(1); @@ -164,7 +177,7 @@ halt_cpu() /* * Halt the system or reboot. */ -halt_all_cpus(reboot) +void halt_all_cpus(reboot) boolean_t reboot; { if (reboot) { @@ -200,9 +213,9 @@ mem_size_init() XX make it a constant. */ phys_first_addr = 0; - phys_last_addr = 0x100000 + (boot_info->mem_upper * 0x400); + phys_last_addr = 0x100000 + (boot_info.mem_upper * 0x400); avail_remaining - = phys_last_addr - (0x100000 - (boot_info->mem_lower * 0x400) + = phys_last_addr - (0x100000 - (boot_info.mem_lower * 0x400) - 0x1000); printf("AT386 boot: physical memory from 0x%x to 0x%x\n", @@ -292,7 +305,7 @@ i386at_init() void c_boot_entry(vm_offset_t bi) { /* Stash the boot_image_info pointer. */ - boot_info = (struct multiboot_info*)phystokv(bi); + boot_info = *(struct multiboot_info*)phystokv(bi); /* XXX we currently assume phys_mem_va is always 0 here - if it isn't, we must tweak the pointers in the boot_info. */ @@ -304,8 +317,8 @@ void c_boot_entry(vm_offset_t bi) printf("\n"); /* Find the kernel command line, if there is one. */ - if (boot_info->flags & MULTIBOOT_CMDLINE) - kernel_cmdline = (char*)phystokv(boot_info->cmdline); + if (boot_info.flags & MULTIBOOT_CMDLINE) + kernel_cmdline = (char*)phystokv(boot_info.cmdline); #if MACH_KDB /* @@ -313,21 +326,21 @@ void c_boot_entry(vm_offset_t bi) * We need to do this before i386at_init() * so that the symbol table's memory won't be stomped on. */ - if ((boot_info->flags & MULTIBOOT_AOUT_SYMS) - && boot_info->syms.a.addr) + if ((boot_info.flags & MULTIBOOT_AOUT_SYMS) + && boot_info.syms.a.addr) { vm_size_t symtab_size, strtab_size; - kern_sym_start = (vm_offset_t)phystokv(boot_info->syms.a.addr); - symtab_size = (vm_offset_t)phystokv(boot_info->syms.a.tabsize); - strtab_size = (vm_offset_t)phystokv(boot_info->syms.a.strsize); + kern_sym_start = (vm_offset_t)phystokv(boot_info.syms.a.addr); + symtab_size = (vm_offset_t)phystokv(boot_info.syms.a.tabsize); + strtab_size = (vm_offset_t)phystokv(boot_info.syms.a.strsize); kern_sym_end = kern_sym_start + 4 + symtab_size + strtab_size; printf("kernel symbol table at %08x-%08x (%d,%d)\n", kern_sym_start, kern_sym_end, symtab_size, strtab_size); } -#endif MACH_KDB +#endif /* MACH_KDB */ /* * Do basic VM initialization @@ -353,7 +366,7 @@ void c_boot_entry(vm_offset_t bi) cninit(); /* need console for debugger */ Debugger(); } -#endif MACH_KDB +#endif /* MACH_KDB */ machine_slot[0].is_cpu = TRUE; machine_slot[0].running = TRUE; @@ -399,7 +412,7 @@ timemmap(dev,off,prot) #ifdef lint dev++; off++; -#endif lint +#endif /* lint */ if (prot & VM_PROT_WRITE) return (-1); @@ -440,26 +453,25 @@ unsigned int pmap_free_pages() } /* Always returns page-aligned regions. */ -boolean_t +static boolean_t init_alloc_aligned(vm_size_t size, vm_offset_t *addrp) { vm_offset_t addr; extern char start[], end[]; int i; + static int wrapped = 0; /* Memory regions to skip. */ - vm_offset_t boot_info_start_pa = kvtophys(boot_info); - vm_offset_t boot_info_end_pa = boot_info_start_pa + sizeof(*boot_info); - vm_offset_t cmdline_start_pa = boot_info->flags & MULTIBOOT_CMDLINE - ? boot_info->cmdline : 0; + vm_offset_t cmdline_start_pa = boot_info.flags & MULTIBOOT_CMDLINE + ? boot_info.cmdline : 0; vm_offset_t cmdline_end_pa = cmdline_start_pa ? cmdline_start_pa+strlen((char*)phystokv(cmdline_start_pa))+1 : 0; - vm_offset_t mods_start_pa = boot_info->flags & MULTIBOOT_MODS - ? boot_info->mods_addr : 0; + vm_offset_t mods_start_pa = boot_info.flags & MULTIBOOT_MODS + ? boot_info.mods_addr : 0; vm_offset_t mods_end_pa = mods_start_pa ? mods_start_pa - + boot_info->mods_count * sizeof(struct multiboot_module) + + boot_info.mods_count * sizeof(struct multiboot_module) : 0; retry: @@ -467,8 +479,25 @@ init_alloc_aligned(vm_size_t size, vm_of /* Page-align the start address. */ avail_next = round_page(avail_next); + /* Start with memory above 16MB, reserving the low memory for later. */ + if (use_all_mem && !wrapped && phys_last_addr > 16 * 1024*1024) + { + if (avail_next < 16 * 1024*1024) + avail_next = 16 * 1024*1024; + else if (avail_next == phys_last_addr) + { + /* We have used all the memory above 16MB, so now start on + the low memory. This will wind up at the end of the list + of free pages, so it should not have been allocated to any + other use in early initialization before the Linux driver + glue initialization needs to allocate low memory. */ + avail_next = 0x1000; + wrapped = 1; + } + } + /* Check if we have reached the end of memory. */ - if (avail_next == phys_last_addr) + if (avail_next == (wrapped ? 16 * 1024*1024 : phys_last_addr)) return FALSE; /* Tentatively assign the current location to the caller. */ @@ -479,7 +508,7 @@ init_alloc_aligned(vm_size_t size, vm_of avail_next += size; /* Skip past the I/O and ROM area. */ - if ((avail_next > (boot_info->mem_lower * 0x400)) && (addr < 0x100000)) + if ((avail_next > (boot_info.mem_lower * 0x400)) && (addr < 0x100000)) { avail_next = 0x100000; goto retry; @@ -491,18 +520,13 @@ init_alloc_aligned(vm_size_t size, vm_of } /* Skip our own kernel code, data, and bss. */ - if ((avail_next >= (vm_offset_t)start) && (addr < (vm_offset_t)end)) + if ((avail_next > (vm_offset_t)start) && (addr < (vm_offset_t)end)) { avail_next = (vm_offset_t)end; goto retry; } /* Skip any areas occupied by valuable boot_info data. */ - if ((avail_next > boot_info_start_pa) && (addr < boot_info_end_pa)) - { - avail_next = boot_info_end_pa; - goto retry; - } if ((avail_next > cmdline_start_pa) && (addr < cmdline_end_pa)) { avail_next = cmdline_end_pa; @@ -518,11 +542,11 @@ init_alloc_aligned(vm_size_t size, vm_of avail_next = kern_sym_end; goto retry; } - if (boot_info->flags & MULTIBOOT_MODS) + if (boot_info.flags & MULTIBOOT_MODS) { struct multiboot_module *m = (struct multiboot_module *) - phystokv(boot_info->mods_addr); - for (i = 0; i < boot_info->mods_count; i++) + phystokv(boot_info.mods_addr); + for (i = 0; i < boot_info.mods_count; i++) { if ((avail_next > m[i].mod_start) && (addr < m[i].mod_end)) @@ -563,7 +587,7 @@ boolean_t pmap_valid_page(x) { /* XXX is this OK? What does it matter for? */ return (((phys_first_addr <= x) && (x < phys_last_addr)) && - !(((boot_info->mem_lower * 1024) <= x) && (x < 1024*1024))); + !(((boot_info.mem_lower * 1024) <= x) && (x < 1024*1024))); } #ifndef NBBY diff -brNpu gnumach-1.2/i386/i386at/rtc.c gnumach-1.3/i386/i386at/rtc.c --- gnumach-1.2/i386/i386at/rtc.c Mon Jun 21 11:59:26 1999 +++ gnumach-1.3/i386/i386at/rtc.c Mon May 27 11:17:04 2002 @@ -136,9 +136,9 @@ readtodc(tp) #ifdef MACH_KERNEL ospl = splclock(); -#else MACH_KERNEL +#else /* MACH_KERNEL */ ospl = spl5(); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ if (rtcget(&rtclk)) { splx(ospl); return(-1); @@ -166,11 +166,11 @@ readtodc(tp) n += days * 3600 * 24; #ifdef MACH_KERNEL -#else MACH_KERNEL +#else /* MACH_KERNEL */ n += tz.tz_minuteswest * 60; if (tz.tz_dsttime) n -= 3600; -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ *tp = n; @@ -186,9 +186,9 @@ writetodc() #ifdef MACH_KERNEL ospl = splclock(); -#else MACH_KERNEL +#else /* MACH_KERNEL */ ospl = spl5(); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ if (rtcget(&rtclk)) { splx(ospl); return(-1); @@ -197,11 +197,11 @@ writetodc() #ifdef MACH_KERNEL diff = 0; -#else MACH_KERNEL +#else /* MACH_KERNEL */ diff = tz.tz_minuteswest * 60; if (tz.tz_dsttime) diff -= 3600; -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ n = (time.tv_sec - diff) % (3600 * 24); /* hrs+mins+secs */ rtclk.rtc_sec = dectohexdec(n%60); n /= 60; @@ -227,9 +227,9 @@ writetodc() #ifdef MACH_KERNEL ospl = splclock(); -#else MACH_KERNEL +#else /* MACH_KERNEL */ ospl = spl5(); -#endif MACH_KERNEL +#endif /* MACH_KERNEL */ rtcput(&rtclk); splx(ospl); diff -brNpu gnumach-1.2/i386/include/mach/i386/asm.h gnumach-1.3/i386/include/mach/i386/asm.h --- gnumach-1.2/i386/include/mach/i386/asm.h Mon Jun 21 11:59:27 1999 +++ gnumach-1.3/i386/include/mach/i386/asm.h Mon May 27 11:17:04 2002 @@ -65,7 +65,7 @@ #define gLB(n) n ## : #define LBb(x,n) n ## b #define LBf(x,n) n ## f -#else __STDC__ +#else /* __STDC__ */ #error XXX elf #define EXT(x) _/**/x #define LEXT(x) _/**/x/**/: @@ -73,7 +73,7 @@ #define gLB(n) n/**/: #define LBb(x,n) n/**/b #define LBf(x,n) n/**/f -#endif __STDC__ +#endif /* __STDC__ */ #define SVC .byte 0x9a; .long 0; .word 0x7 #define String .ascii @@ -101,14 +101,14 @@ #define ASENTRY(x) .globl x; .p2align TEXT_ALIGN; gLB(x) ; \ pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; -#else GPROF +#else /* GPROF */ #define MCOUNT #define ENTRY(x) .globl EXT(x); .p2align TEXT_ALIGN; LEXT(x) #define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \ .p2align TEXT_ALIGN; LEXT(x) LEXT(y) #define ASENTRY(x) .globl x; .p2align TEXT_ALIGN; gLB(x) -#endif GPROF +#endif /* GPROF */ #define Entry(x) .globl EXT(x); .p2align TEXT_ALIGN; LEXT(x) #define DATA(x) .globl EXT(x); .p2align DATA_ALIGN; LEXT(x) diff -brNpu gnumach-1.2/i386/include/mach/i386/bios.h gnumach-1.3/i386/include/mach/i386/bios.h --- gnumach-1.2/i386/include/mach/i386/bios.h Mon Jun 21 11:59:27 1999 +++ gnumach-1.3/i386/include/mach/i386/bios.h Wed Dec 31 16:00:00 1969 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Computer Systems Laboratory at the University of Utah (CSL). - * All rights reserved. - * - * Permission to use, copy, modify and distribute this software is hereby - * granted provided that (1) source code retains these copyright, permission, - * and disclaimer notices, and (2) redistributions including binaries - * reproduce the notices in supporting documentation, and (3) all advertising - * materials mentioning features or use of this software display the following - * acknowledgement: ``This product includes software developed by the - * Computer Systems Laboratory at the University of Utah.'' - * - * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSL requests users of this software to return to csl-dist@cs.utah.edu any - * improvements that they make and grant CSL redistribution rights. - * - * Author: Bryan Ford, University of Utah CSL - */ - -#ifndef _MACH_MACHINE_BIOS_ -#define _MACH_MACHINE_BIOS_ - -/* - * To make a call to a 16-bit BIOS entrypoint, - * fill in one of these structures and call bios_call(). - */ -struct bios_call_params -{ - union - { - struct - { - unsigned short ax; - unsigned short bx; - unsigned short cx; - unsigned short dx; - } w; - struct - { - unsigned char al; - unsigned char ah; - unsigned char bl; - unsigned char bh; - unsigned char cl; - unsigned char ch; - unsigned char dl; - unsigned char dh; - } b; - } u; - unsigned short si; - unsigned short di; - unsigned short bp; - unsigned short ds; - unsigned short es; - unsigned short flags; -}; - -void bios_call(unsigned char int_num, struct bios_call_params *bcp); - -#endif _MACH_MACHINE_BIOS_ diff -brNpu gnumach-1.2/i386/include/mach/i386/code16.h gnumach-1.3/i386/include/mach/i386/code16.h --- gnumach-1.2/i386/include/mach/i386/code16.h Mon Jun 21 11:59:28 1999 +++ gnumach-1.3/i386/include/mach/i386/code16.h Wed Dec 31 16:00:00 1969 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Center for Software Science (CSS). All rights reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSS requests users of this software to return to css-dist@cs.utah.edu any - * improvements that they make and grant CSS redistribution rights. - * - * Author: Bryan Ford, University of Utah CSS - */ -#ifndef _MACH_I386_CODE16_H_ -#define _MACH_I386_CODE16_H_ - -/* Switch GAS into 16-bit mode. */ -#define CODE16 asm(".code16"); - -/* Switch back to 32-bit mode. */ -#define CODE32 asm(".code32"); - -#endif _MACH_I386_CODE16_H_ diff -brNpu gnumach-1.2/i386/include/mach/i386/debug_reg.h gnumach-1.3/i386/include/mach/i386/debug_reg.h --- gnumach-1.2/i386/include/mach/i386/debug_reg.h Mon Jun 21 11:59:28 1999 +++ gnumach-1.3/i386/include/mach/i386/debug_reg.h Wed Dec 31 16:00:00 1969 @@ -1,196 +0,0 @@ -/* - * Copyright (c) 1995 The University of Utah and - * the Computer Systems Laboratory at the University of Utah (CSL). - * All rights reserved. - * - * Permission to use, copy, modify and distribute this software is hereby - * granted provided that (1) source code retains these copyright, permission, - * and disclaimer notices, and (2) redistributions including binaries - * reproduce the notices in supporting documentation, and (3) all advertising - * materials mentioning features or use of this software display the following - * acknowledgement: ``This product includes software developed by the - * Computer Systems Laboratory at the University of Utah.'' - * - * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSL requests users of this software to return to csl-dist@cs.utah.edu any - * improvements that they make and grant CSL redistribution rights. - * - * Author: Bryan Ford, University of Utah CSL - */ -#ifndef _MACH_I386_DEBUG_REG_H_ -#define _MACH_I386_DEBUG_REG_H_ - -/* Bits in DR7 - debug control register */ -#define DR7_LEN3 0xc0000000 -#define DR7_RW3 0x30000000 -#define DR7_LEN2 0x0c000000 -#define DR7_RW2 0x03000000 -#define DR7_LEN1 0x00c00000 -#define DR7_RW1 0x00300000 -#define DR7_LEN0 0x000c0000 -#define DR7_RW0 0x00030000 -#define DR7_GD 0x00002000 -#define DR7_GE 0x00000200 -#define DR7_LE 0x00000100 -#define DR7_G3 0x00000080 -#define DR7_L3 0x00000040 -#define DR7_G2 0x00000020 -#define DR7_L2 0x00000010 -#define DR7_G1 0x00000008 -#define DR7_L1 0x00000004 -#define DR7_G0 0x00000002 -#define DR7_L0 0x00000001 - -/* Shift values for multibit fields in DR7 */ -#define DR7_LEN3_SHIFT 30 -#define DR7_RW3_SHIFT 28 -#define DR7_LEN2_SHIFT 26 -#define DR7_RW2_SHIFT 24 -#define DR7_LEN1_SHIFT 22 -#define DR7_RW1_SHIFT 20 -#define DR7_LEN0_SHIFT 18 -#define DR7_RW0_SHIFT 16 - -/* Values for LEN fields in DR7 */ -#define DR7_LEN_1 0 -#define DR7_LEN_2 1 -#define DR7_LEN_4 3 - -/* Values for RW fields in DR7 */ -#define DR7_RW_INST 0 /* Break on instruction execution */ -#define DR7_RW_WRITE 1 /* Break on data writes */ -#define DR7_RW_IO 2 /* Break on I/O reads and writes (Pentium only) */ -#define DR7_RW_DATA 3 /* Break on data reads and writes */ - - -/* Bits in DR6 - debug status register */ -#define DR6_BT 0x00008000 -#define DR6_BS 0x00004000 -#define DR6_BD 0x00002000 -#define DR6_B3 0x00000008 -#define DR6_B2 0x00000004 -#define DR6_B1 0x00000002 -#define DR6_B0 0x00000001 - - -#include - -/* Functions to set debug registers. */ - -MACH_INLINE unsigned get_dr0() -{ - unsigned val; - asm volatile("movl %%dr0,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr1() -{ - unsigned val; - asm volatile("movl %%dr1,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr2() -{ - unsigned val; - asm volatile("movl %%dr2,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr3() -{ - unsigned val; - asm volatile("movl %%dr3,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr6() -{ - unsigned val; - asm volatile("movl %%dr6,%0" : "=r" (val)); - return val; -} - -MACH_INLINE unsigned get_dr7() -{ - unsigned val; - asm volatile("movl %%dr7,%0" : "=r" (val)); - return val; -} - -MACH_INLINE void set_dr0(unsigned val) -{ - asm volatile("movl %0,%%dr0" : : "r" (val)); -} - - -/* Functions to read debug registers. */ - -MACH_INLINE void set_dr1(unsigned val) -{ - asm volatile("movl %0,%%dr1" : : "r" (val)); -} - -MACH_INLINE void set_dr2(unsigned val) -{ - asm volatile("movl %0,%%dr2" : : "r" (val)); -} - -MACH_INLINE void set_dr3(unsigned val) -{ - asm volatile("movl %0,%%dr3" : : "r" (val)); -} - -MACH_INLINE void set_dr6(unsigned val) -{ - asm volatile("movl %0,%%dr6" : : "r" (val)); -} - -MACH_INLINE void set_dr7(unsigned val) -{ - asm volatile("movl %0,%%dr7" : : "r" (val)); -} - - -/* Functions to set global breakpoints. */ - -MACH_INLINE void set_b0(unsigned addr, unsigned len, unsigned rw) -{ - set_dr0(addr); - addr = ((get_dr7() & ~(DR7_LEN0 | DR7_RW0)) - | (len << DR7_LEN0_SHIFT) | (rw << DR7_RW0_SHIFT) - | DR7_GE | DR7_G0); - set_dr7(addr); -} - -MACH_INLINE void set_b1(unsigned addr, unsigned len, unsigned rw) -{ - set_dr1(addr); - set_dr7((get_dr7() & ~(DR7_LEN1 | DR7_RW1)) - | (len << DR7_LEN1_SHIFT) | (rw << DR7_RW1_SHIFT) - | DR7_GE | DR7_G1); -} - -MACH_INLINE void set_b2(unsigned addr, unsigned len, unsigned rw) -{ - set_dr2(addr); - set_dr7((get_dr7() & ~(DR7_LEN2 | DR7_RW2)) - | (len << DR7_LEN2_SHIFT) | (rw << DR7_RW2_SHIFT) - | DR7_GE | DR7_G2); -} - -MACH_INLINE void set_b3(unsigned addr, unsigned len, unsigned rw) -{ - set_dr3(addr); - set_dr7((get_dr7() & ~(DR7_LEN3 | DR7_RW3)) - | (len << DR7_LEN3_SHIFT) | (rw << DR7_RW3_SHIFT) - | DR7_GE | DR7_G3); -} - - - -#endif /* _MACH_I386_DEBUG_REG_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/dpmi.h gnumach-1.3/i386/include/mach/i386/dpmi.h --- gnumach-1.2/i386/include/mach/i386/dpmi.h Mon Jun 21 11:59:28 1999 +++ gnumach-1.3/i386/include/mach/i386/dpmi.h Wed Dec 31 16:00:00 1969 @@ -1,537 +0,0 @@ -/* - * Copyright (c) 1996-1994 The University of Utah and - * the Computer Systems Laboratory at the University of Utah (CSL). - * All rights reserved. - * - * Permission to use, copy, modify and distribute this software is hereby - * granted provided that (1) source code retains these copyright, permission, - * and disclaimer notices, and (2) redistributions including binaries - * reproduce the notices in supporting documentation, and (3) all advertising - * materials mentioning features or use of this software display the following - * acknowledgement: ``This product includes software developed by the - * Computer Systems Laboratory at the University of Utah.'' - * - * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSL requests users of this software to return to csl-dist@cs.utah.edu any - * improvements that they make and grant CSL redistribution rights. - * - * Author: Bryan Ford, University of Utah CSL - */ -#ifndef _FLUX_KERNEL_I386_DOS_I16_DPMI_H_ -#define _FLUX_KERNEL_I386_DOS_I16_DPMI_H_ - -#include -#include - -typedef unsigned short dpmi_error_t; - -#define DPMI_UNSUPPORTED_FUNCTION 0x8001 -#define DPMI_OBJECT_WRONG_STATE 0x8002 -#define DPMI_SYSTEM_INTEGRITY 0x8003 -#define DPMI_DEADLOCK 0x8004 -#define DPMI_SERIALIZATION_CANCELLED 0x8005 -#define DPMI_OUT_OF_RESOURCES 0x8010 -#define DPMI_DESCRIPTOR_UNAVAILABLE 0x8011 -#define DPMI_LINEAR_MEMORY_UNAVAILABLE 0x8012 -#define DPMI_PHYSICAL_MEMORY_UNAVAILABLE 0x8013 -#define DPMI_BACKING_STORE_UNAVAILABLE 0x8014 -#define DPMI_CALLBACK_UNAVAILABLE 0x8015 -#define DPMI_HANDLE_UNAVAILABLE 0x8016 -#define DPMI_MAX_LOCK_COUNT_EXCEEDED 0x8017 -#define DPMI_ALREADY_SERIALIZED_EXCLUSIVELY 0x8018 -#define DPMI_ALREADY_SERIALIZED_SHARED 0x8019 -#define DPMI_INVALID_VALUE 0x8021 -#define DPMI_INVALID_SELECTOR 0x8022 -#define DPMI_INVALID_HANDLE 0x8023 -#define DPMI_INVALID_CALLBACK 0x8024 -#define DPMI_INVALID_LINEAR_ADDRESS 0x8025 -#define DPMI_NOT_SUPPORTED_BY_HARDWARE 0x8026 - -struct real_call_data; /*XXX*/ - -MACH_INLINE dpmi_error_t dpmi_switch_to_pmode( - struct far_pointer_16 *pmode_entry_vector, - unsigned short host_data_seg) -{ - dpmi_error_t err; - - asm volatile(" - movw %3,%%es - lcallw %2 - jc 1f - xorw %%ax,%%ax - 1: pushw %%ds - popw %%es - " : "=a" (err) - : "a" (1), - "m" (*pmode_entry_vector), - "rm" (host_data_seg)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_allocate_descriptors( - unsigned short count, - unsigned short *out_selector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - movw %%ax,%1 - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=rm" (*out_selector) - : "a" (0x0000), - "c" (count)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_segment_base( - unsigned short selector, - unsigned long *out_base) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - shll $16,%ecx - movw %dx,%cx - 1: - " : "=a" (err), - "=c" (*out_base) - : "a" (0x0006), - "b" (selector) - : "edx"); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_segment_base( - unsigned short selector, - unsigned long base) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0007), - "b" (selector), - "c" (base >> 16), - "d" (base)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_segment_limit( - unsigned short selector, - unsigned limit) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0008), - "b" (selector), - "c" (limit >> 16), - "d" (limit)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_create_code_segment_alias( - unsigned short code_selector, - unsigned short *out_data_selector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - movw %%ax,%1 - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=rm" (*out_data_selector) - : "a" (0x000a), - "b" (code_selector)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_descriptor( - unsigned short selector, - struct i386_descriptor *out_descriptor) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x000b), - "b" (selector), - "D" (out_descriptor)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_descriptor( - unsigned short selector, - struct i386_descriptor *descriptor) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x000c), - "b" (selector), - "D" (descriptor)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_allocate_specific_descriptor( - unsigned short selector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x000d), - "b" (selector)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_exception_handler( - unsigned char trapno, - struct far_pointer_32 *out_vector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=c" (out_vector->seg), - "=d" (out_vector->ofs) - : "a" (0x0202), - "b" (trapno)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_exception_handler( - unsigned char trapno, - struct far_pointer_32 *vector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0203), - "b" (trapno), - "c" (vector->seg), - "d" (vector->ofs)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_interrupt_handler( - unsigned char intvec, - struct far_pointer_32 *out_vector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=c" (out_vector->seg), - "=d" (out_vector->ofs) - : "a" (0x0204), - "b" (intvec)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_set_interrupt_handler( - unsigned char intvec, - struct far_pointer_32 *vector) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0205), - "b" (intvec), - "c" (vector->seg), - "d" (vector->ofs)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_simulate_real_mode_interrupt( - unsigned char intnum, - struct real_call_data *call_data) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0300), - "b" ((unsigned short)intnum), - "c" (0), - "D" (call_data)); - - return err; -} - -struct dpmi_version_status -{ - unsigned char minor_version; - unsigned char major_version; - unsigned short flags; - unsigned char slave_pic_base; - unsigned char master_pic_base; - unsigned char processor_type; -}; - -MACH_INLINE void dpmi_get_version(struct dpmi_version_status *status) -{ - asm volatile(" - int $0x31 - " : "=a" (*((short*)&status->minor_version)), - "=b" (status->flags), - "=c" (status->processor_type), - "=d" (*((short*)&status->slave_pic_base)) - : "a" (0x0400)); -} - -MACH_INLINE dpmi_error_t dpmi_allocate_memory( - unsigned size, - unsigned *out_linear_addr, - unsigned *out_mem_handle) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - shll $16,%%ebx - movw %%cx,%%bx - shll $16,%%esi - movw %%di,%%si - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=b" (*out_linear_addr), - "=S" (*out_mem_handle) - : "a" (0x0501), - "b" (size >> 16), - "c" (size) - : "ebx", "ecx", "esi", "edi"); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_free_memory( - unsigned mem_handle) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0502), - "S" (mem_handle >> 16), - "D" (mem_handle)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_allocate_linear_memory( - unsigned linear_addr, - unsigned size, - unsigned flags, - unsigned *out_linear_addr, - unsigned *out_mem_handle) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=b" (*out_linear_addr), - "=S" (*out_mem_handle) - : "a" (0x0504), - "b" (linear_addr), - "c" (size), - "d" (flags)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_resize_linear_memory( - unsigned handle, - unsigned new_size, - unsigned flags, - unsigned short *update_selector_array, - unsigned update_selector_count, - unsigned *out_new_linear_addr) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=b" (*out_new_linear_addr) - : "a" (0x0505), - "b" (update_selector_array), - "c" (new_size), - "d" (flags), - "S" (handle), - "D" (update_selector_count)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_map_conventional_memory( - unsigned handle, - vm_offset_t offset, - vm_offset_t low_addr, - vm_size_t page_count) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0509), - "S" (handle), - "b" (offset), - "c" (page_count), - "d" (low_addr)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_lock_linear_region( - vm_offset_t start_la, - vm_size_t size) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0600), - "b" (start_la >> 16), - "c" (start_la), - "S" (size >> 16), - "D" (size)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_unlock_linear_region( - vm_offset_t start_la, - vm_size_t size) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - xorw %%ax,%%ax - 1: - " : "=a" (err) - : "a" (0x0601), - "b" (start_la >> 16), - "c" (start_la), - "S" (size >> 16), - "D" (size)); - - return err; -} - -MACH_INLINE dpmi_error_t dpmi_get_page_size( - unsigned *out_page_size) -{ - dpmi_error_t err; - - asm volatile(" - int $0x31 - jc 1f - shll $16,%%ebx - movw %%cx,%%bx - xorw %%ax,%%ax - 1: - " : "=a" (err), - "=b" (*out_page_size) - : "a" (0x0604) - : "ecx"); - - return err; -} - - -#endif /* _FLUX_KERNEL_I386_DOS_I16_DPMI_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/eflags.h gnumach-1.3/i386/include/mach/i386/eflags.h --- gnumach-1.2/i386/include/mach/i386/eflags.h Mon Jun 21 11:59:28 1999 +++ gnumach-1.3/i386/include/mach/i386/eflags.h Mon May 27 11:17:04 2002 @@ -46,4 +46,4 @@ #define EFL_RF 0x00010000 /* resume without tracing */ #define EFL_VM 0x00020000 /* virtual 8086 mode */ -#endif _MACH_I386_EFLAGS_H_ +#endif /* _MACH_I386_EFLAGS_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/far_ptr.h gnumach-1.3/i386/include/mach/i386/far_ptr.h --- gnumach-1.2/i386/include/mach/i386/far_ptr.h Mon Jun 21 11:59:28 1999 +++ gnumach-1.3/i386/include/mach/i386/far_ptr.h Wed Dec 31 16:00:00 1969 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Center for Software Science (CSS). All rights reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSS requests users of this software to return to css-dist@cs.utah.edu any - * improvements that they make and grant CSS redistribution rights. - * - * Author: Bryan Ford, University of Utah CSS - */ -#ifndef _MACH_I386_FAR_PTR_H_ -#define _MACH_I386_FAR_PTR_H_ - -struct far_pointer_16 -{ - unsigned short ofs; - unsigned short seg; -}; - -struct far_pointer_32 -{ - unsigned long ofs; - unsigned short seg; -}; - -#endif /* _MACH_I386_FAR_PTR_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/mach_i386.defs gnumach-1.3/i386/include/mach/i386/mach_i386.defs --- gnumach-1.2/i386/include/mach/i386/mach_i386.defs Mon Jun 21 11:59:30 1999 +++ gnumach-1.3/i386/include/mach/i386/mach_i386.defs Mon May 27 11:17:04 2002 @@ -30,7 +30,7 @@ subsystem #if KERNEL_SERVER KernelServer -#endif KERNEL_SERVER +#endif /* KERNEL_SERVER */ mach_i386 3800; #include diff -brNpu gnumach-1.2/i386/include/mach/i386/multiboot.h gnumach-1.3/i386/include/mach/i386/multiboot.h --- gnumach-1.2/i386/include/mach/i386/multiboot.h Mon Jun 21 11:59:30 1999 +++ gnumach-1.3/i386/include/mach/i386/multiboot.h Mon May 27 11:17:04 2002 @@ -179,4 +179,4 @@ struct AddrRangeDesc #define MB_ARD_MEMORY 1 -#endif _MACH_I386_MULTIBOOT_H_ +#endif /* _MACH_I386_MULTIBOOT_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/paging.h gnumach-1.3/i386/include/mach/i386/paging.h --- gnumach-1.2/i386/include/mach/i386/paging.h Mon Jun 21 11:59:30 1999 +++ gnumach-1.3/i386/include/mach/i386/paging.h Wed Dec 31 16:00:00 1969 @@ -1,134 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * Definitions relating to i386 page directories and page tables. - */ -#ifndef _MACH_I386_PAGING_H_ -#define _MACH_I386_PAGING_H_ - - -#define INTEL_OFFMASK 0xfff /* offset within page */ -#define PDESHIFT 22 /* page descriptor shift */ -#define PDEMASK 0x3ff /* mask for page descriptor index */ -#define PTESHIFT 12 /* page table shift */ -#define PTEMASK 0x3ff /* mask for page table index */ - -/* - * Convert linear offset to page descriptor/page table index - */ -#define lin2pdenum(a) (((a) >> PDESHIFT) & PDEMASK) -#define lin2ptenum(a) (((a) >> PTESHIFT) & PTEMASK) - -/* - * Convert page descriptor/page table index to linear address - */ -#define pdenum2lin(a) ((vm_offset_t)(a) << PDESHIFT) -#define ptenum2lin(a) ((vm_offset_t)(a) << PTESHIFT) - -/* - * Number of ptes/pdes in a page table/directory. - */ -#define NPTES (i386_ptob(1)/sizeof(pt_entry_t)) -#define NPDES (i386_ptob(1)/sizeof(pt_entry_t)) - -/* - * Hardware pte bit definitions (to be used directly on the ptes - * without using the bit fields). - */ -#define INTEL_PTE_VALID 0x00000001 -#define INTEL_PTE_WRITE 0x00000002 -#define INTEL_PTE_USER 0x00000004 -#define INTEL_PTE_WTHRU 0x00000008 -#define INTEL_PTE_NCACHE 0x00000010 -#define INTEL_PTE_REF 0x00000020 -#define INTEL_PTE_MOD 0x00000040 -#define INTEL_PTE_AVAIL 0x00000e00 -#define INTEL_PTE_PFN 0xfffff000 - -/* - * Macros to translate between page table entry values - * and physical addresses. - */ -#define pa_to_pte(a) ((a) & INTEL_PTE_PFN) -#define pte_to_pa(p) ((p) & INTEL_PTE_PFN) -#define pte_increment_pa(p) ((p) += INTEL_OFFMASK+1) - - -#ifndef ASSEMBLER - -#include -#include -#include - -/* - * i386/i486/i860 Page Table Entry - */ -typedef unsigned int pt_entry_t; -#define PT_ENTRY_NULL ((pt_entry_t *) 0) - - -/* - * Load page directory 'pdir' and turn paging on. - * Assumes that 'pdir' equivalently maps the physical memory - * that contains the currently executing code, - * the currently loaded GDT and IDT, etc. - */ -MACH_INLINE void i386_paging_enable(vm_offset_t pdir) -{ - /* Load the page directory. */ - set_cr3(pdir); - - /* Turn on paging. */ - asm volatile(" - movl %0,%%cr0 - jmp 1f - 1: - " : : "r" (get_cr0() | CR0_PG)); -} - -/* - * Turn paging off. - * Assumes that the currently loaded page directory - * equivalently maps the physical memory - * that contains the currently executing code, - * the currently loaded GDT and IDT, etc. - */ -MACH_INLINE void i386_paging_disable(void) -{ - /* Turn paging off. */ - asm volatile(" - movl %0,%%cr0 - jmp 1f - 1: - " : : "r" (get_cr0() & ~CR0_PG)); - - /* Flush the TLB. */ - set_cr3(0); -} - -#endif /* !ASSEMBLER */ - -#endif _MACH_I386_PAGING_H_ diff -brNpu gnumach-1.2/i386/include/mach/i386/pio.h gnumach-1.3/i386/include/mach/i386/pio.h --- gnumach-1.2/i386/include/mach/i386/pio.h Mon Jun 21 11:59:30 1999 +++ gnumach-1.3/i386/include/mach/i386/pio.h Wed Dec 31 16:00:00 1969 @@ -1,70 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -#ifndef _MACH_I386_PIO_H_ -#define _MACH_I386_PIO_H_ - -#ifdef __GNUC__ - -#define inl(port) \ -({ unsigned long _tmp__; \ - asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(port))); \ - _tmp__; }) - -#define inw(port) \ -({ unsigned short _tmp__; \ - asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(port))); \ - _tmp__; }) - -#define inb(port) \ -({ unsigned char _tmp__; \ - asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(port))); \ - _tmp__; }) - - -#define outl(port, val) \ -({ asm volatile("outl %0, %1" : : "a" (val) , "d" ((unsigned short)(port))); }) - - -#define outw(port, val) \ -({asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(val)) , "d" ((unsigned short)(port))); }) - - -#define outb(port, val) \ -({ asm volatile("outb %0, %1" : : "a" ((unsigned char)(val)) , "d" ((unsigned short)(port))); }) - - -/* Inline code works just as well for 16-bit code as for 32-bit. */ -#define i16_inl(port) inl(port) -#define i16_inw(port) inw(port) -#define i16_inb(port) inb(port) -#define i16_outl(port, val) outl(port, val) -#define i16_outw(port, val) outw(port, val) -#define i16_outb(port, val) outb(port, val) - -#endif __GNUC__ - -#endif /* _MACH_I386_PIO_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/pmode.h gnumach-1.3/i386/include/mach/i386/pmode.h --- gnumach-1.2/i386/include/mach/i386/pmode.h Mon Jun 21 11:59:30 1999 +++ gnumach-1.3/i386/include/mach/i386/pmode.h Wed Dec 31 16:00:00 1969 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Center for Software Science (CSS). All rights reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSS requests users of this software to return to css-dist@cs.utah.edu any - * improvements that they make and grant CSS redistribution rights. - * - * Author: Bryan Ford, University of Utah CSS - */ -#ifndef _MACH_I386_PMODE_H_ -#define _MACH_I386_PMODE_H_ - -#include -#include -#include - - - -/* Enter protected mode on i386 machines. - Assumes: - * Running in real mode. - * Interrupts are turned off. - * A20 is enabled (if on a PC). - * A suitable GDT is already loaded. - - You must supply a 16-bit code segment - equivalent to the real-mode code segment currently in use. - - You must reload all segment registers except CS - immediately after invoking this macro. -*/ -#define i16_enter_pmode(prot_cs) \ -MACRO_BEGIN \ - /* Switch to protected mode. */ \ - asm volatile(" - movl %0,%%cr0 - ljmp %1,$1f - 1: - " : : "r" (i16_get_cr0() | CR0_PE), "i" (KERNEL_16_CS)); \ -MACRO_END - - - -/* Leave protected mode and return to real mode. - Assumes: - * Running in protected mode - * Interrupts are turned off. - * Paging is turned off. - * All currently loaded segment registers - contain 16-bit segments with limits of 0xffff. - - You must supply a real-mode code segment - equivalent to the protected-mode code segment currently in use. - - You must reload all segment registers except CS - immediately after invoking this function. -*/ -MACH_INLINE i16_leave_pmode(int real_cs) -{ - /* Switch back to real mode. - Note: switching to the real-mode code segment - _must_ be done with an _immediate_ far jump, - not an indirect far jump. At least on my Am386DX/40, - an indirect far jump leaves the code segment read-only. */ - { - extern unsigned short real_jmp[]; - - real_jmp[3] = real_cs; - asm volatile(" - movl %0,%%cr0 - jmp 1f - 1: - real_jmp: - _real_jmp: - ljmp $0,$1f - 1: - " : : "r" (i16_get_cr0() & ~CR0_PE)); - } -} - - - -#endif _MACH_I386_PMODE_H_ diff -brNpu gnumach-1.2/i386/include/mach/i386/proc_reg.h gnumach-1.3/i386/include/mach/i386/proc_reg.h --- gnumach-1.2/i386/include/mach/i386/proc_reg.h Mon Jun 21 11:59:30 1999 +++ gnumach-1.3/i386/include/mach/i386/proc_reg.h Wed Dec 31 16:00:00 1969 @@ -1,340 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * Processor registers for i386 and i486. - */ -#ifndef _MACH_I386_PROC_REG_H_ -#define _MACH_I386_PROC_REG_H_ - -/* - * CR0 - */ -#define CR0_PG 0x80000000 /* enable paging */ -#define CR0_CD 0x40000000 /* i486: cache disable */ -#define CR0_NW 0x20000000 /* i486: no write-through */ -#define CR0_AM 0x00040000 /* i486: alignment check mask */ -#define CR0_WP 0x00010000 /* i486: write-protect kernel access */ -#define CR0_NE 0x00000020 /* i486: handle numeric exceptions */ -#define CR0_ET 0x00000010 /* extension type is 80387 */ - /* (not official) */ -#define CR0_TS 0x00000008 /* task switch */ -#define CR0_EM 0x00000004 /* emulate coprocessor */ -#define CR0_MP 0x00000002 /* monitor coprocessor */ -#define CR0_PE 0x00000001 /* enable protected mode */ - -#ifndef ASSEMBLER -#ifdef __GNUC__ - -#include - - -/* Some processors, notably my Am386DX/40, - seem to have some rather subtle pipeline- or timing-related bugs - which case really weird things to happen with pushf's and popf's - that come too close together... */ - -MACH_INLINE unsigned get_eflags() -{ - unsigned eflags; - asm volatile(" - jmp 1f - 1: jmp 1f - 1: jmp 1f - 1: pushf - jmp 1f - 1: jmp 1f - 1: jmp 1f - 1: popl %0" : "=r" (eflags)); - return eflags; -} - -MACH_INLINE void set_eflags(unsigned eflags) -{ - asm volatile(" - pushl %0 - jmp 1f - 1: jmp 1f - 1: jmp 1f - 1: popf - jmp 1f - 1: jmp 1f - 1: jmp 1f - 1: " : : "r" (eflags)); -} - -MACH_INLINE void cli() { asm volatile("cli"); } -MACH_INLINE void sti() { asm volatile("sti"); } -MACH_INLINE void cld() { asm volatile("cld"); } -MACH_INLINE void std() { asm volatile("std"); } -MACH_INLINE void clts() { asm volatile("clts"); } - -MACH_INLINE unsigned short get_cs() -{ - unsigned short cs; - asm volatile("movw %%cs,%w0" : "=r" (cs)); - return cs; -} - -MACH_INLINE unsigned short get_ds() -{ - unsigned short ds; - asm volatile("movw %%ds,%w0" : "=r" (ds)); - return ds; -} -MACH_INLINE void set_ds(unsigned short ds) -{ - asm volatile("movw %w0,%%ds" : : "r" (ds)); -} - -MACH_INLINE unsigned short get_es() -{ - unsigned short es; - asm volatile("movw %%es,%w0" : "=r" (es)); - return es; -} -MACH_INLINE void set_es(unsigned short es) -{ - asm volatile("movw %w0,%%es" : : "r" (es)); -} - -MACH_INLINE unsigned short get_fs() -{ - unsigned short fs; - asm volatile("movw %%fs,%w0" : "=r" (fs)); - return fs; -} -MACH_INLINE void set_fs(unsigned short fs) -{ - asm volatile("movw %w0,%%fs" : : "r" (fs)); -} - -MACH_INLINE unsigned short get_gs() -{ - unsigned short gs; - asm volatile("movw %%gs,%w0" : "=r" (gs)); - return gs; -} -MACH_INLINE void set_gs(unsigned short gs) -{ - asm volatile("movw %w0,%%gs" : : "r" (gs)); -} - -MACH_INLINE unsigned short get_ss() -{ - unsigned short ss; - asm volatile("movw %%ss,%w0" : "=r" (ss)); - return ss; -} -MACH_INLINE void set_ss(unsigned short ss) -{ - asm volatile("movw %w0,%%ss" : : "r" (ss)); -} - -#define get_eax() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%eax, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_ebx() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%ebx, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_ecx() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%ecx, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_edx() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%edx, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_esi() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%esi, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_edi() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%edi, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_ebp() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%ebp, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_esp() \ - ({ \ - register unsigned int _temp__; \ - asm("movl %%esp, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_eflags() \ - ({ \ - register unsigned int _temp__; \ - asm volatile("pushf; popl %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_cr0() \ - ({ \ - register unsigned int _temp__; \ - asm volatile("mov %%cr0, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define set_cr0(value) \ - ({ \ - register unsigned int _temp__ = (value); \ - asm volatile("mov %0, %%cr0" : : "r" (_temp__)); \ - }) - -MACH_INLINE unsigned short get_msw() -{ - unsigned short msw; - asm volatile("smsw %0" : "=r" (msw)); - return msw; -} - -#define get_cr2() \ - ({ \ - register unsigned int _temp__; \ - asm("mov %%cr2, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define get_cr3() \ - ({ \ - register unsigned int _temp__; \ - asm("mov %%cr3, %0" : "=r" (_temp__)); \ - _temp__; \ - }) - -#define set_cr3(value) \ - ({ \ - register unsigned int _temp__ = (value); \ - asm volatile("mov %0, %%cr3" : : "r" (_temp__)); \ - }) - -#define set_ts() \ - set_cr0(get_cr0() | CR0_TS) - -#define clear_ts() \ - asm volatile("clts") - -#define get_tr() \ - ({ \ - unsigned short _seg__; \ - asm volatile("str %0" : "=rm" (_seg__) ); \ - _seg__; \ - }) - -#define set_tr(seg) \ - asm volatile("ltr %0" : : "rm" ((unsigned short)(seg)) ) - -#define set_gdt(pseudo_desc) \ - ({ \ - asm volatile("lgdt %0" : : "m" ((pseudo_desc)->limit)); \ - }) - -#define set_idt(pseudo_desc) \ - ({ \ - asm volatile("lidt %0" : : "m" ((pseudo_desc)->limit)); \ - }) - -#define get_ldt() \ - ({ \ - unsigned short _seg__; \ - asm volatile("sldt %0" : "=rm" (_seg__) ); \ - _seg__; \ - }) - -#define set_ldt(seg) \ - asm volatile("lldt %0" : : "rm" ((unsigned short)(seg)) ) - -/* This doesn't set a processor register, - but it's often used immediately after setting one, - to flush the instruction queue. */ -#define flush_instr_queue() \ - asm volatile(" - jmp 0f - 0: - ") - -/* Inline functions work fine for 16-bit code as well. */ -#ifdef CODE16 -#define i16_get_eflags get_eflags -#define i16_set_eflags set_eflags -#define i16_cli cli -#define i16_sti sti -#define i16_cld cld -#define i16_std std -#define i16_clts clts -#define i16_get_cs get_cs -#define i16_set_cs set_cs -#define i16_get_ds get_ds -#define i16_set_ds set_ds -#define i16_get_es get_es -#define i16_set_es set_es -#define i16_get_fs get_fs -#define i16_set_fs set_fs -#define i16_get_gs get_gs -#define i16_set_gs set_gs -#define i16_get_ss get_ss -#define i16_set_ss set_ss -#define i16_get_cr0 get_cr0 -#define i16_set_cr0 set_cr0 -#define i16_get_cr3 get_cr3 -#define i16_set_cr3 set_cr3 -#define i16_get_msw get_msw -#define i16_set_gdt set_gdt -#define i16_set_idt set_idt -#define i16_set_ldt set_ldt -#define i16_set_tr set_tr -#define i16_flush_instr_queue flush_instr_queue -#endif - -#endif /* __GNUC__ */ -#endif /* ASSEMBLER */ - -#endif /* _MACH_I386_PROC_REG_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/seg.h gnumach-1.3/i386/include/mach/i386/seg.h --- gnumach-1.2/i386/include/mach/i386/seg.h Mon Jun 21 11:59:30 1999 +++ gnumach-1.3/i386/include/mach/i386/seg.h Wed Dec 31 16:00:00 1969 @@ -1,190 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990 Carnegie Mellon University - * Copyright (c) 1991 IBM Corporation - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation, - * and that the name IBM not be used in advertising or publicity - * pertaining to distribution of the software without specific, written - * prior permission. - * - * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -#ifndef _MACH_I386_SEG_H_ -#define _MACH_I386_SEG_H_ - - -/* - * i386 segmentation. - */ - -#ifndef ASSEMBLER - -/* - * Real segment descriptor. - */ -struct i386_descriptor { - unsigned int limit_low:16, /* limit 0..15 */ - base_low:16, /* base 0..15 */ - base_med:8, /* base 16..23 */ - access:8, /* access byte */ - limit_high:4, /* limit 16..19 */ - granularity:4, /* granularity */ - base_high:8; /* base 24..31 */ -}; - -struct i386_gate { - unsigned int offset_low:16, /* offset 0..15 */ - selector:16, - word_count:8, - access:8, - offset_high:16; /* offset 16..31 */ -}; - -#endif !ASSEMBLER - -#define SZ_32 0x4 /* 32-bit segment */ -#define SZ_16 0x0 /* 16-bit segment */ -#define SZ_G 0x8 /* 4K limit field */ - -#define ACC_A 0x01 /* accessed */ -#define ACC_TYPE 0x1e /* type field: */ - -#define ACC_TYPE_SYSTEM 0x00 /* system descriptors: */ - -#define ACC_LDT 0x02 /* LDT */ -#define ACC_CALL_GATE_16 0x04 /* 16-bit call gate */ -#define ACC_TASK_GATE 0x05 /* task gate */ -#define ACC_TSS 0x09 /* task segment */ -#define ACC_CALL_GATE 0x0c /* call gate */ -#define ACC_INTR_GATE 0x0e /* interrupt gate */ -#define ACC_TRAP_GATE 0x0f /* trap gate */ - -#define ACC_TSS_BUSY 0x02 /* task busy */ - -#define ACC_TYPE_USER 0x10 /* user descriptors */ - -#define ACC_DATA 0x10 /* data */ -#define ACC_DATA_W 0x12 /* data, writable */ -#define ACC_DATA_E 0x14 /* data, expand-down */ -#define ACC_DATA_EW 0x16 /* data, expand-down, - writable */ -#define ACC_CODE 0x18 /* code */ -#define ACC_CODE_R 0x1a /* code, readable */ -#define ACC_CODE_C 0x1c /* code, conforming */ -#define ACC_CODE_CR 0x1e /* code, conforming, - readable */ -#define ACC_PL 0x60 /* access rights: */ -#define ACC_PL_K 0x00 /* kernel access only */ -#define ACC_PL_U 0x60 /* user access */ -#define ACC_P 0x80 /* segment present */ - -/* - * Components of a selector - */ -#define SEL_LDT 0x04 /* local selector */ -#define SEL_PL 0x03 /* privilege level: */ -#define SEL_PL_K 0x00 /* kernel selector */ -#define SEL_PL_U 0x03 /* user selector */ - -/* - * Convert selector to descriptor table index. - */ -#define sel_idx(sel) ((sel)>>3) - - -#ifndef ASSEMBLER - -#include - - -/* Format of a "pseudo-descriptor", used for loading the IDT and GDT. */ -struct pseudo_descriptor -{ - short pad; - unsigned short limit; - unsigned long linear_base; -}; - - -/* Fill a segment descriptor. */ -MACH_INLINE void -fill_descriptor(struct i386_descriptor *desc, unsigned base, unsigned limit, - unsigned char access, unsigned char sizebits) -{ - if (limit > 0xfffff) - { - limit >>= 12; - sizebits |= SZ_G; - } - desc->limit_low = limit & 0xffff; - desc->base_low = base & 0xffff; - desc->base_med = (base >> 16) & 0xff; - desc->access = access | ACC_P; - desc->limit_high = limit >> 16; - desc->granularity = sizebits; - desc->base_high = base >> 24; -} - -/* Set the base address in a segment descriptor. */ -MACH_INLINE void -fill_descriptor_base(struct i386_descriptor *desc, unsigned base) -{ - desc->base_low = base & 0xffff; - desc->base_med = (base >> 16) & 0xff; - desc->base_high = base >> 24; -} - -/* Set the limit in a segment descriptor. */ -MACH_INLINE void -fill_descriptor_limit(struct i386_descriptor *desc, unsigned limit) -{ - if (limit > 0xfffff) - { - limit >>= 12; - desc->granularity |= SZ_G; - } - else - desc->granularity &= ~SZ_G; - desc->limit_low = limit & 0xffff; - desc->limit_high = limit >> 16; -} - -/* Fill a gate with particular values. */ -MACH_INLINE void -fill_gate(struct i386_gate *gate, unsigned offset, unsigned short selector, - unsigned char access, unsigned char word_count) -{ - gate->offset_low = offset & 0xffff; - gate->selector = selector; - gate->word_count = word_count; - gate->access = access | ACC_P; - gate->offset_high = (offset >> 16) & 0xffff; -} - -#ifdef CODE16 -#define i16_fill_descriptor fill_descriptor -#define i16_fill_gate fill_gate -#endif - -#endif !ASSEMBLER - -#endif /* _MACH_I386_SEG_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/time_stamp.h gnumach-1.3/i386/include/mach/i386/time_stamp.h --- gnumach-1.2/i386/include/mach/i386/time_stamp.h Mon Jun 21 11:59:31 1999 +++ gnumach-1.3/i386/include/mach/i386/time_stamp.h Wed Dec 31 16:00:00 1969 @@ -1,29 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * The I386 timestamp implementation uses the default, so we don't - * need to do anything here. - */ diff -brNpu gnumach-1.2/i386/include/mach/i386/trap.h gnumach-1.3/i386/include/mach/i386/trap.h --- gnumach-1.2/i386/include/mach/i386/trap.h Mon Jun 21 11:59:31 1999 +++ gnumach-1.3/i386/include/mach/i386/trap.h Mon May 27 11:17:04 2002 @@ -57,4 +57,4 @@ #define T_PF_USER 0x4 /* from user state */ -#endif _MACH_I386_TRAP_H_ +#endif /* _MACH_I386_TRAP_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/tss.h gnumach-1.3/i386/include/mach/i386/tss.h --- gnumach-1.2/i386/include/mach/i386/tss.h Mon Jun 21 11:59:31 1999 +++ gnumach-1.3/i386/include/mach/i386/tss.h Wed Dec 31 16:00:00 1969 @@ -1,67 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -#ifndef _MACH_I386_TSS_H_ -#define _MACH_I386_TSS_H_ - -/* - * i386 Task State Segment - */ -struct i386_tss { - int back_link; /* segment number of previous task, - if nested */ - int esp0; /* initial stack pointer ... */ - int ss0; /* and segment for ring 0 */ - int esp1; /* initial stack pointer ... */ - int ss1; /* and segment for ring 1 */ - int esp2; /* initial stack pointer ... */ - int ss2; /* and segment for ring 2 */ - int cr3; /* CR3 - page table directory - physical address */ - int eip; - int eflags; - int eax; - int ecx; - int edx; - int ebx; - int esp; /* current stack pointer */ - int ebp; - int esi; - int edi; - int es; - int cs; - int ss; /* current stack segment */ - int ds; - int fs; - int gs; - int ldt; /* local descriptor table segment */ - unsigned short trace_trap; /* trap on switch to this task */ - unsigned short io_bit_map_offset; - /* offset to start of IO permission - bit map */ -}; - -#endif /* _MACH_I386_TSS_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/vcpi.h gnumach-1.3/i386/include/mach/i386/vcpi.h --- gnumach-1.2/i386/include/mach/i386/vcpi.h Mon Jun 21 11:59:31 1999 +++ gnumach-1.3/i386/include/mach/i386/vcpi.h Wed Dec 31 16:00:00 1969 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1996-1994 The University of Utah and - * the Computer Systems Laboratory at the University of Utah (CSL). - * All rights reserved. - * - * Permission to use, copy, modify and distribute this software is hereby - * granted provided that (1) source code retains these copyright, permission, - * and disclaimer notices, and (2) redistributions including binaries - * reproduce the notices in supporting documentation, and (3) all advertising - * materials mentioning features or use of this software display the following - * acknowledgement: ``This product includes software developed by the - * Computer Systems Laboratory at the University of Utah.'' - * - * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSL requests users of this software to return to csl-dist@cs.utah.edu any - * improvements that they make and grant CSL redistribution rights. - * - * Author: Bryan Ford, University of Utah CSL - */ -#ifndef _FLUX_INCLUDE_FLUX_I386_VCPI_H_ -#define _FLUX_INCLUDE_FLUX_I386_VCPI_H_ - -struct vcpi_switch_data -{ - vm_offset_t phys_pdir; - vm_offset_t lin_gdt; - vm_offset_t lin_idt; - unsigned short ldt_sel; - unsigned short tss_sel; - unsigned long entry_eip; - unsigned short entry_cs; -}; - -#endif /* _FLUX_INCLUDE_FLUX_I386_VCPI_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/i386/vm_types.h gnumach-1.3/i386/include/mach/i386/vm_types.h --- gnumach-1.2/i386/include/mach/i386/vm_types.h Mon Jun 21 11:59:31 1999 +++ gnumach-1.3/i386/include/mach/i386/vm_types.h Mon May 27 11:17:04 2002 @@ -35,7 +35,7 @@ #define _MACHINE_VM_TYPES_H_ 1 #ifdef ASSEMBLER -#else ASSEMBLER +#else /* ASSEMBLER */ /* * A natural_t is the type for the native @@ -105,4 +105,3 @@ typedef double float64_t; #define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32 #endif /* _MACHINE_VM_TYPES_H_ */ - diff -brNpu gnumach-1.2/i386/include/mach/proc_ops.h gnumach-1.3/i386/include/mach/proc_ops.h --- gnumach-1.2/i386/include/mach/proc_ops.h Mon Jun 21 11:59:27 1999 +++ gnumach-1.3/i386/include/mach/proc_ops.h Wed Dec 31 16:00:00 1969 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Center for Software Science (CSS). All rights reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSS requests users of this software to return to css-dist@cs.utah.edu any - * improvements that they make and grant CSS redistribution rights. - * - * Author: Bryan Ford, University of Utah CSS - */ -#ifndef _MACH_I386_PROC_OPS_H_ -#define _MACH_I386_PROC_OPS_H_ - -#include -#include - -/* Returns the bit number of the most-significant set bit in `val', - e.g. 0 for 1, 1 for 2-3, 2 for 4-7, etc. - If `val' is 0 (i.e. no bits are set), the behavior is undefined. */ -MACH_INLINE int find_msb_set(natural_t val) -{ - int msb; - - asm(" - bsr %0,%0 - " : "=r" (msb) : "0" (val)); - - return msb; -} - -#endif _MACH_I386_PROC_OPS_H_ diff -brNpu gnumach-1.2/i386/include/mach/sa/stdarg.h gnumach-1.3/i386/include/mach/sa/stdarg.h --- gnumach-1.2/i386/include/mach/sa/stdarg.h Mon Jun 21 11:59:31 1999 +++ gnumach-1.3/i386/include/mach/sa/stdarg.h Mon May 27 11:17:04 2002 @@ -43,4 +43,4 @@ typedef char *va_list; ((pvar) += __va_size(type), \ *((type *)((pvar) - __va_size(type)))) -#endif _MACH_SA_STDARG_H_ +#endif /* _MACH_SA_STDARG_H_ */ diff -brNpu gnumach-1.2/i386/include/mach/sa/sys/varargs.h gnumach-1.3/i386/include/mach/sa/sys/varargs.h --- gnumach-1.2/i386/include/mach/sa/sys/varargs.h Mon Jun 21 11:59:32 1999 +++ gnumach-1.3/i386/include/mach/sa/sys/varargs.h Wed Dec 31 16:00:00 1969 @@ -1,41 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1993 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon rights - * to redistribute these changes. - */ -/* - * varargs support for i386 - */ -#ifndef _MACH_SYS_VARARGS_H_ -#define _MACH_SYS_VARARGS_H_ - -#define va_dcl int va_alist; -typedef char * va_list; - -#define va_start(pvar) (pvar) = (va_list)&va_alist -#define va_end(pvar) -#define va_arg(pvar,type) ( \ - (pvar) += ((sizeof(type)+3) & ~0x3), \ - *((type *)((pvar) - ((sizeof(type)+3) & ~0x3))) ) - -#endif _MACH_SYS_VARARGS_H_ diff -brNpu gnumach-1.2/i386/include/mach/setjmp.h gnumach-1.3/i386/include/mach/setjmp.h --- gnumach-1.2/i386/include/mach/setjmp.h Mon Jun 21 11:59:27 1999 +++ gnumach-1.3/i386/include/mach/setjmp.h Wed Dec 31 16:00:00 1969 @@ -1,58 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1993 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ -/* - * Setjmp/longjmp buffer for i386. - */ -#ifndef _MACH_SETJMP_H_PROCESSED_ -#define _MACH_SETJMP_H_PROCESSED_ 1 - -/* XXX prefix these with mach_ so they don't interfere with higher layers? - This stuff is included by cthreads.h. */ - -/* XXX The original definition of jmp_buf[] causes problems using - * libthreads when linked against NetBSD and FreeBSD's libc because - * it's too small. When cthreads calls _setjmp, it gets the libc - * version which saves more state than it's expecting and overwrites - * important cthread data. =( This definition is big enough for all - * known systems so far (Linux's is 6, FreeBSD's is 9 and NetBSD's is - * 10). This file really shouldn't even be here, since we should be - * using libc's setjmp.h. - */ -#if 0 -#define _JBLEN 6 -#else -#define _JBLEN 10 -#endif - -typedef int jmp_buf[_JBLEN]; /* ebx, esi, edi, ebp, esp, eip */ - - -extern int setjmp (jmp_buf); -extern void longjmp (jmp_buf, int); -extern int _setjmp (jmp_buf); -extern void _longjmp (jmp_buf, int); - -#endif /* _MACH_SETJMP_H_PROCESSED_ */ diff -brNpu gnumach-1.2/i386/intel/pmap.c gnumach-1.3/i386/intel/pmap.c --- gnumach-1.2/i386/intel/pmap.c Mon Jun 21 11:59:32 1999 +++ gnumach-1.3/i386/intel/pmap.c Mon May 27 11:17:04 2002 @@ -83,12 +83,12 @@ #ifdef ORC #define OLIVETTICACHE 1 -#endif ORC +#endif /* ORC */ #ifndef OLIVETTICACHE #define WRITE_PTE(pte_p, pte_entry) *(pte_p) = (pte_entry); #define WRITE_PTE_FAST(pte_p, pte_entry) *(pte_p) = (pte_entry); -#else OLIVETTICACHE +#else /* OLIVETTICACHE */ #error might not work anymore /* This gross kludgery is needed for Olivetti XP7 & XP9 boxes to get @@ -125,7 +125,7 @@ pt_entry_t *pte_p, pte_entry; #define WRITE_PTE_FAST(pte_p, pte_entry)*pte_p = pte_entry; -#endif OLIVETTICACHE +#endif /* OLIVETTICACHE */ /* * Private data structures. @@ -349,7 +349,7 @@ lock_data_t pmap_system_lock; } \ } -#else NCPUS > 1 +#else /* NCPUS > 1 */ #define SPLVM(spl) #define SPLX(spl) @@ -370,7 +370,7 @@ lock_data_t pmap_system_lock; } \ } -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ #define MAX_TBIS_SIZE 32 /* > this -> TBIA */ /* XXX */ @@ -380,11 +380,11 @@ lock_data_t pmap_system_lock; flush(); \ flush_tlb(); \ } -#else i860 +#else /* i860 */ #define INVALIDATE_TLB(s, e) { \ flush_tlb(); \ } -#endif i860 +#endif /* i860 */ #if NCPUS > 1 @@ -415,7 +415,7 @@ typedef struct pmap_update_list *pmap_up struct pmap_update_list cpu_update_list[NCPUS]; -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ /* * Other useful macros. @@ -450,7 +450,7 @@ pt_entry_t *kernel_page_dir; void pmap_remove_range(); /* forward */ #if NCPUS > 1 void signal_cpus(); /* forward */ -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ #if i860 /* @@ -520,7 +520,7 @@ void ptep_check(ptep) panic("pte count"); } } -#endif DEBUG_PTE_PAGE +#endif /* DEBUG_PTE_PAGE */ /* * Map memory at initialization. The physical addresses being @@ -614,7 +614,7 @@ void pmap_bootstrap() #if NCPUS > 1 lock_init(&pmap_system_lock, FALSE); /* NOT a sleep lock */ -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ simple_lock_init(&kernel_pmap->lock); @@ -676,9 +676,9 @@ void pmap_bootstrap() } else { - extern char start[], etext[]; + extern char _start[], etext[]; - if ((va >= (vm_offset_t)start) + if ((va >= (vm_offset_t)_start) && (va + INTEL_PGBYTES <= (vm_offset_t)etext)) { WRITE_PTE_FAST(pte, pa_to_pte(va) @@ -852,7 +852,7 @@ void pmap_init() simple_lock_init(&up->lock); up->count = 0; } -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ /* * Indicate that the PMAP module is now fully initialized. @@ -915,7 +915,7 @@ pmap_page_table_page_alloc() /* * Allocate a VM page for the level 2 page table entries. */ - while ((m = vm_page_grab()) == VM_PAGE_NULL) + while ((m = vm_page_grab(FALSE)) == VM_PAGE_NULL) VM_PAGE_WAIT((void (*)()) 0); /* @@ -1126,7 +1126,7 @@ void pmap_remove_range(pmap, va, spte, e #if DEBUG_PTE_PAGE if (pmap != kernel_pmap) ptep_check(get_pte_page(spte)); -#endif DEBUG_PTE_PAGE +#endif /* DEBUG_PTE_PAGE */ num_removed = 0; num_unwired = 0; @@ -1730,7 +1730,7 @@ Retry: e = e->next; } } -#endif DEBUG +#endif /* DEBUG */ /* * Add new pv_entry after header. @@ -1888,9 +1888,9 @@ void pmap_copy(dst_pmap, src_pmap, dst_a { #ifdef lint dst_pmap++; src_pmap++; dst_addr++; len++; src_addr++; -#endif lint +#endif /* lint */ } -#endif 0 +#endif /* 0 */ /* * Routine: pmap_collect @@ -2014,7 +2014,7 @@ void pmap_activate(my_pmap, th, my_cpu) { PMAP_ACTIVATE(my_pmap, th, my_cpu); } -#endif 0 +#endif /* 0 */ /* * Routine: pmap_deactivate @@ -2031,10 +2031,10 @@ void pmap_deactivate(pmap, th, which_cpu { #ifdef lint pmap++; th++; which_cpu++; -#endif lint +#endif /* lint */ PMAP_DEACTIVATE(pmap, th, which_cpu); } -#endif 0 +#endif /* 0 */ /* * Routine: pmap_kernel @@ -2046,7 +2046,7 @@ pmap_t pmap_kernel() { return (kernel_pmap); } -#endif 0 +#endif /* 0 */ /* * pmap_zero_page zeros the specified (machine independent) page. @@ -2065,7 +2065,7 @@ pmap_zero_page(phys) while (i--) zero_phys(phys++); } -#endif 0 +#endif /* 0 */ /* * pmap_copy_page copies the specified (machine independent) page. @@ -2087,7 +2087,7 @@ pmap_copy_page(src, dst) dst += INTEL_PGBYTES; } } -#endif 0 +#endif /* 0 */ /* * Routine: pmap_pageable @@ -2111,7 +2111,7 @@ pmap_pageable(pmap, start, end, pageable { #ifdef lint pmap++; start++; end++; pageable++; -#endif lint +#endif /* lint */ } /* @@ -2528,7 +2528,7 @@ void pmap_update_interrupt() splx(s); } -#else NCPUS > 1 +#else /* NCPUS > 1 */ /* * Dummy routine to satisfy external reference. */ @@ -2536,7 +2536,7 @@ void pmap_update_interrupt() { /* should never be called. */ } -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ #if i860 /* akp */ void set_dirbase(dirbase) @@ -2546,7 +2546,7 @@ void set_dirbase(dirbase) /*flush_tlb();*/ flush_and_ctxsw(dirbase); } -#endif i860 +#endif /* i860 */ #ifdef i386 /* Unmap page 0 to trap NULL references. */ diff -brNpu gnumach-1.2/i386/intel/pmap.h gnumach-1.3/i386/intel/pmap.h --- gnumach-1.2/i386/intel/pmap.h Mon Jun 21 11:59:32 1999 +++ gnumach-1.3/i386/intel/pmap.h Mon May 27 11:17:04 2002 @@ -57,7 +57,7 @@ #define trunc_intel_to_vm(x) trunc_i386_to_vm(x) #define round_intel_to_vm(x) round_i386_to_vm(x) #define vm_to_intel(x) vm_to_i386(x) -#endif i386 +#endif /* i386 */ #if i860 #define INTEL_PGBYTES I860_PGBYTES #define INTEL_PGSHIFT I860_PGSHIFT @@ -68,7 +68,7 @@ #define trunc_intel_to_vm(x) trunc_i860_to_vm(x) #define round_intel_to_vm(x) round_i860_to_vm(x) #define vm_to_intel(x) vm_to_i860(x) -#endif i860 +#endif /* i860 */ /* * i386/i486/i860 Page Table Entry @@ -77,7 +77,7 @@ typedef unsigned int pt_entry_t; #define PT_ENTRY_NULL ((pt_entry_t *) 0) -#endif ASSEMBLER +#endif /* ASSEMBLER */ #define INTEL_OFFMASK 0xfff /* offset within page */ #define PDESHIFT 22 /* page descriptor shift */ @@ -130,13 +130,13 @@ typedef unsigned int pt_entry_t; |INTEL_PTE_REF \ |INTEL_PTE_MOD \ ) -#else NOCACHE +#else /* NOCACHE */ #define INTEL_PTE_VALID (INTEL_PTE_valid \ |INTEL_PTE_REF \ |INTEL_PTE_MOD \ ) -#endif NOCACHE -#endif i860 +#endif /* NOCACHE */ +#endif /* i860 */ #define pa_to_pte(a) ((a) & INTEL_PTE_PFN) #define pte_to_pa(p) ((p) & INTEL_PTE_PFN) @@ -199,7 +199,7 @@ void process_pmap_updates(); void pmap_update_interrupt(); extern pmap_t kernel_pmap; -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ /* * Machine dependent routines that are used only for i386/i486/i860. @@ -355,7 +355,7 @@ pt_entry_t *pmap_pte(pmap_t pmap, vm_off splx(s); \ } -#else NCPUS > 1 +#else /* NCPUS > 1 */ /* * With only one CPU, we just have to indicate whether the pmap is @@ -384,7 +384,7 @@ pt_entry_t *pmap_pte(pmap_t pmap, vm_off (pmap)->cpus_using = FALSE; \ } -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ #define PMAP_CONTEXT(pmap, thread) @@ -396,6 +396,6 @@ pt_entry_t *pmap_pte(pmap_t pmap, vm_off #define pmap_attribute(pmap,addr,size,attr,value) \ (KERN_INVALID_ADDRESS) -#endif ASSEMBLER +#endif /* ASSEMBLER */ -#endif _PMAP_MACHINE_ +#endif /* _PMAP_MACHINE_ */ diff -brNpu gnumach-1.2/i386/linux/Drivers.in gnumach-1.3/i386/linux/Drivers.in --- gnumach-1.2/i386/linux/Drivers.in Mon Jun 21 11:58:58 1999 +++ gnumach-1.3/i386/linux/Drivers.in Mon May 27 11:17:01 2002 @@ -88,8 +88,9 @@ AC_DRIVER_ALIAS(t128f, t128) AC_DRIVER_ALIAS(t228, t128) AC_DRIVER_ALIAS(am79c974, am53c974) AC_DRIVER_ALIAS(dtc3180, dtc3280) -AC_DRIVER_ALIAS(dc390u, dc390w) -AC_DRIVER_ALIAS(dc390f, dc390w) +AC_DRIVER_ALIAS(dc390w, ncr53c8xx) +AC_DRIVER_ALIAS(dc390u, ncr53c8xx) +AC_DRIVER_ALIAS(dc390f, ncr53c8xx) AC_DRIVER_ALIAS(dc390, dc390t) AC_DRIVER_ALIAS(epic100, epic) @@ -142,7 +143,6 @@ linux_DRIVER(eata, SCSI_EATA, eata, scsi linux_DRIVER(am53c974, SCSI_AM53C974, AM53C974, scsi) linux_DRIVER(dtc3280, SCSI_DTC3280, dtc, scsi) linux_DRIVER(ncr53c8xx, SCSI_NCR53C8XX, ncr53c8xx, scsi) -linux_DRIVER(dc390w, SCSI_DC390W, tmscsiw, scsi) linux_DRIVER(dc390t, SCSI_DC390T, tmscsim, scsi) linux_DRIVER(ppa, SCSI_PPA, ppa, scsi) linux_DRIVER(qlogicfas, SCSI_QLOGIC_FAS, qlogicfas, scsi) diff -brNpu gnumach-1.2/i386/linux/Makefile.in gnumach-1.3/i386/linux/Makefile.in --- gnumach-1.2/i386/linux/Makefile.in Mon Jun 21 11:58:58 1999 +++ gnumach-1.3/i386/linux/Makefile.in Mon May 27 11:17:01 2002 @@ -31,7 +31,7 @@ CFLAGS = @CFLAGS@ # Files for driver support. -linux-c-files = version.c softirq.c dma.c resource.c printk.c \ +linux-c-files = version.c softirq.c delay.c dma.c resource.c printk.c \ bios32.c irq.c ctype.c vsprintf.c main.c misc.c sched.c \ kmem.c block.c setup.c @@ -39,6 +39,7 @@ linux-c-files = version.c softirq.c dma. vpath %.c $(linuxsrcdir)/dev/kernel vpath %.c $(linuxsrcdir)/dev/init vpath %.c $(linuxsrcdir)/dev/arch/$(systype)/kernel +vpath %.c $(linuxsrcdir)/dev/arch/$(systype)/lib vpath %.c $(linuxsrcdir)/dev/glue vpath %.c $(linuxsrcdir)/dev/lib @@ -46,11 +47,12 @@ vpath %.c $(linuxsrcdir)/dev/lib vpath %.c $(linuxsrcdir)/src/kernel vpath %.c $(linuxsrcdir)/src/init vpath %.c $(linuxsrcdir)/src/arch/$(systype)/kernel +vpath %.c $(linuxsrcdir)/src/arch/$(systype)/lib vpath %.c $(linuxsrcdir)/src/lib # XXX: Assembly source files must be treated separately... Uggg... -linux-asm-files = delay.S semaphore.S +linux-asm-files = semaphore.S vpath %.S $(linuxsrcdir)/dev/arch/$(systype)/lib vpath %.S $(linuxsrcdir)/src/arch/$(systype)/lib @@ -81,7 +83,7 @@ linux-scsi-files = 53c78xx.c AM53C974.c eata_dma.c eata_pio.c fdomain.c g_NCR5380.c gdth.c hosts.c in2000.c \ ncr53c8xx.c pas16.c ppa.c qlogicfas.c qlogicisp.c scsi.c scsi_ioctl.c \ scsi_proc.c scsicam.c sd.c sd_ioctl.c seagate.c sr.c sr_ioctl.c \ - t128.c tmscsim.c tmscsiw.c u14-34f.c ultrastor.c wd7000.c + t128.c tmscsim.c u14-34f.c ultrastor.c wd7000.c vpath %.c $(linuxsrcdir)/dev/drivers/scsi vpath %.c $(linuxsrcdir)/src/drivers/scsi @@ -205,3 +207,28 @@ mostlyclean: distclean maintainer-clean: mostlyclean rm -f $(srcdir)/configure + + + +# +# Dependency generation +# + +# Include dependency files +ifneq ($(no_deps),t) + +# For each .o file we need a .d file. +-include $(subst .o,.d,$(filter %.o,$(linux-objs))) /dev/null + +endif + +# Generic rule for $(CC) based compilation for making dependencies +define make-deps +set -e; $(CC) $(CFLAGS) $(CPPFLAGS) -M -MG $< | \ + sed > $@.new -e 's/$*\.o:/$*.o $@:/' +mv -f $@.new $@ +endef + +%.d: %.c $(before-compile); $(make-deps) +%.d: %.S $(before-compile); $(make-deps) + diff -brNpu gnumach-1.2/i386/linux/configure gnumach-1.3/i386/linux/configure --- gnumach-1.2/i386/linux/configure Mon Jun 21 11:58:59 1999 +++ gnumach-1.3/i386/linux/configure Mon May 27 11:17:01 2002 @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12 +# Generated automatically using autoconf version 2.13.1 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -377,8 +377,6 @@ ac_help="$ac_help " ac_help="$ac_help " -ac_help="$ac_help -" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -417,6 +415,7 @@ mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 @@ -700,7 +699,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12" + echo "configure generated by autoconf version 2.13.1" exit 0 ;; -with-* | --with-*) @@ -860,7 +859,7 @@ done if test -r "$cache_file"; then echo "loading cache $cache_file" - . $cache_file + test -f "$cache_file" && . $cache_file else echo "creating cache $cache_file" > $cache_file @@ -870,9 +869,11 @@ ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross +ac_exeext= +ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -911,8 +912,6 @@ fi - - ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -923,41 +922,59 @@ for ac_dir in $srcdir $srcdir/.. $srcdir ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. -# Make sure we can run config.sub. -if $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:943: checking host system type" >&5 +echo "configure:941: checking host system type" >&5 +if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then -host_alias=$host -case "$host_alias" in -NONE) +# Make sure we can run config.sub. + if $ac_config_sub sun4 >/dev/null 2>&1; then : + else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } + fi + + ac_cv_host_alias=$host + case "$ac_cv_host_alias" in + NONE) case $nonopt in NONE) - if host_alias=`$ac_config_guess`; then : + if ac_cv_host_alias=`$ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; - *) host_alias=$nonopt ;; + *) ac_cv_host_alias=$nonopt ;; esac ;; -esac + esac + + ac_cv_host=`$ac_config_sub $ac_cv_host_alias` + ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` + ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +else + echo $ac_n "(cached) $ac_c" 1>&6 +fi + +echo "$ac_t""$ac_cv_host" 1>&6 + +host=$ac_cv_host +host_alias=$ac_cv_host_alias +host_cpu=$ac_cv_host_cpu +host_vendor=$ac_cv_host_vendor +host_os=$ac_cv_host_os + + -host=`$ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 case "$host_cpu" in @@ -1009,23 +1026,45 @@ i[3456]86) systype=i386 ;; esac + echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1014: checking build system type" >&5 +echo "configure:1032: checking build system type" >&5 +if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then -build_alias=$build -case "$build_alias" in -NONE) +# Make sure we can run config.sub. + if $ac_config_sub sun4 >/dev/null 2>&1; then : + else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } + fi + + ac_cv_build_alias=$build + case "$ac_cv_build_alias" in + NONE) case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; + NONE) + ac_cv_build_alias=$host_alias ;; + + *) ac_cv_build_alias=$nonopt ;; esac ;; -esac + esac + + ac_cv_build=`$ac_config_sub $ac_cv_build_alias` + ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` + ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +else + echo $ac_n "(cached) $ac_c" 1>&6 +fi + +echo "$ac_t""$ac_cv_build" 1>&6 + +build=$ac_cv_build +build_alias=$ac_cv_build_alias +build_cpu=$ac_cv_build_cpu +build_vendor=$ac_cv_build_vendor +build_os=$ac_cv_build_os + + -build=`$ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 if test $host != $build; then ac_tool_prefix=${host_alias}- @@ -1036,15 +1075,16 @@ fi # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1040: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +echo "configure:1079: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="${ac_tool_prefix}gcc" @@ -1067,15 +1107,16 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1071: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +echo "configure:1111: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -1096,16 +1137,17 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1100: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +echo "configure:1141: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -1144,21 +1186,23 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1148: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1190: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext < conftest.$ac_ext << EOF + +#line 1201 "configure" #include "confdefs.h" + main(){return(0);} EOF -if { (eval echo configure:1162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1172,6 +1216,12 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then @@ -1182,14 +1232,14 @@ else cross_linkable=yes fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1186: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1236: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1192: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then +echo "configure:1242: checking whether we are using GNU C" >&5 +if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1251: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1231,15 +1281,16 @@ fi # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. set dummy ${ac_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1235: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then +echo "configure:1285: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_prog_LD+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$LD"; then ac_cv_prog_LD="$LD" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_LD="${ac_tool_prefix}ld" @@ -1632,11 +1683,20 @@ if test "${enable_dtc3180+set}" = set; t fi +# Checking for alias dc390w +# Check whether --enable-dc390w or --disable-dc390w was given. +if test "${enable_dc390w+set}" = set; then + enableval="$enable_dc390w" + enable_ncr53c8xx="$enable_dc390w" + +fi + + # Checking for alias dc390u # Check whether --enable-dc390u or --disable-dc390u was given. if test "${enable_dc390u+set}" = set; then enableval="$enable_dc390u" - enable_dc390w="$enable_dc390u" + enable_ncr53c8xx="$enable_dc390u" fi @@ -1645,7 +1705,7 @@ fi # Check whether --enable-dc390f or --disable-dc390f was given. if test "${enable_dc390f+set}" = set; then enableval="$enable_dc390f" - enable_dc390w="$enable_dc390f" + enable_ncr53c8xx="$enable_dc390f" fi @@ -1689,7 +1749,8 @@ driver_class_net_files="auto_irq.o net.o # Check whether --enable-floppy or --disable-floppy was given. if test "${enable_floppy+set}" = set; then enableval="$enable_floppy" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_BLK_DEV_FD 1 EOF @@ -1702,6 +1763,7 @@ EOF device_drivers="$device_drivers $driver_class__files" fi +fi fi @@ -1710,7 +1772,8 @@ fi # Check whether --enable-ide or --disable-ide was given. if test "${enable_ide+set}" = set; then enableval="$enable_ide" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_BLK_DEV_IDE 1 EOF @@ -1723,6 +1786,7 @@ EOF device_drivers="$device_drivers $driver_class__files" fi +fi fi @@ -1743,7 +1807,8 @@ fi # Check whether --enable-advansys or --disable-advansys was given. if test "${enable_advansys+set}" = set; then enableval="$enable_advansys" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_ADVANSYS 1 EOF @@ -1756,6 +1821,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -1773,7 +1839,8 @@ fi # Check whether --enable-buslogic or --disable-buslogic was given. if test "${enable_buslogic+set}" = set; then enableval="$enable_buslogic" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_BUSLOGIC 1 EOF @@ -1786,6 +1853,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -1803,7 +1871,8 @@ fi # Check whether --enable-u1434f or --disable-u1434f was given. if test "${enable_u1434f+set}" = set; then enableval="$enable_u1434f" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_U14_34F 1 EOF @@ -1816,6 +1885,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -1833,7 +1903,8 @@ fi # Check whether --enable-ultrastor or --disable-ultrastor was given. if test "${enable_ultrastor+set}" = set; then enableval="$enable_ultrastor" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_ULTRASTOR 1 EOF @@ -1846,6 +1917,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -1863,7 +1935,8 @@ fi # Check whether --enable-aha152x or --disable-aha152x was given. if test "${enable_aha152x+set}" = set; then enableval="$enable_aha152x" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_AHA152X 1 EOF @@ -1876,6 +1949,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -1893,7 +1967,8 @@ fi # Check whether --enable-aha1542 or --disable-aha1542 was given. if test "${enable_aha1542+set}" = set; then enableval="$enable_aha1542" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_AHA1542 1 EOF @@ -1906,6 +1981,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -1923,7 +1999,8 @@ fi # Check whether --enable-aha1740 or --disable-aha1740 was given. if test "${enable_aha1740+set}" = set; then enableval="$enable_aha1740" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_AHA1740 1 EOF @@ -1936,6 +2013,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -1953,7 +2031,8 @@ fi # Check whether --enable-aic7xxx or --disable-aic7xxx was given. if test "${enable_aic7xxx+set}" = set; then enableval="$enable_aic7xxx" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_AIC7XXX 1 EOF @@ -1966,6 +2045,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -1983,7 +2063,8 @@ fi # Check whether --enable-futuredomain or --disable-futuredomain was given. if test "${enable_futuredomain+set}" = set; then enableval="$enable_futuredomain" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_FUTURE_DOMAIN 1 EOF @@ -1996,6 +2077,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2013,7 +2095,8 @@ fi # Check whether --enable-in2000 or --disable-in2000 was given. if test "${enable_in2000+set}" = set; then enableval="$enable_in2000" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_IN2000 1 EOF @@ -2026,6 +2109,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2043,7 +2127,8 @@ fi # Check whether --enable-ncr5380 or --disable-ncr5380 was given. if test "${enable_ncr5380+set}" = set; then enableval="$enable_ncr5380" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_GENERIC_NCR5380 1 EOF @@ -2056,6 +2141,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2073,7 +2159,8 @@ fi # Check whether --enable-ncr53c406a or --disable-ncr53c406a was given. if test "${enable_ncr53c406a+set}" = set; then enableval="$enable_ncr53c406a" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_NCR53C406A 1 EOF @@ -2086,6 +2173,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2103,7 +2191,8 @@ fi # Check whether --enable-pas16 or --disable-pas16 was given. if test "${enable_pas16+set}" = set; then enableval="$enable_pas16" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_PASS16 1 EOF @@ -2116,6 +2205,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2133,7 +2223,8 @@ fi # Check whether --enable-seagate or --disable-seagate was given. if test "${enable_seagate+set}" = set; then enableval="$enable_seagate" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_SEAGATE 1 EOF @@ -2146,6 +2237,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2163,7 +2255,8 @@ fi # Check whether --enable-t128 or --disable-t128 was given. if test "${enable_t128+set}" = set; then enableval="$enable_t128" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_T128 1 EOF @@ -2176,6 +2269,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2193,7 +2287,8 @@ fi # Check whether --enable-ncr53c7xx or --disable-ncr53c7xx was given. if test "${enable_ncr53c7xx+set}" = set; then enableval="$enable_ncr53c7xx" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_NCR53C7xx 1 EOF @@ -2206,6 +2301,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2223,7 +2319,8 @@ fi # Check whether --enable-eatadma or --disable-eatadma was given. if test "${enable_eatadma+set}" = set; then enableval="$enable_eatadma" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_EATA_DMA 1 EOF @@ -2236,6 +2333,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2253,7 +2351,8 @@ fi # Check whether --enable-eatapio or --disable-eatapio was given. if test "${enable_eatapio+set}" = set; then enableval="$enable_eatapio" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_EATA_PIO 1 EOF @@ -2266,6 +2365,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2283,7 +2383,8 @@ fi # Check whether --enable-wd7000 or --disable-wd7000 was given. if test "${enable_wd7000+set}" = set; then enableval="$enable_wd7000" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_7000FASST 1 EOF @@ -2296,6 +2397,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2313,7 +2415,8 @@ fi # Check whether --enable-eata or --disable-eata was given. if test "${enable_eata+set}" = set; then enableval="$enable_eata" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_EATA 1 EOF @@ -2326,6 +2429,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2343,7 +2447,8 @@ fi # Check whether --enable-am53c974 or --disable-am53c974 was given. if test "${enable_am53c974+set}" = set; then enableval="$enable_am53c974" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_AM53C974 1 EOF @@ -2356,6 +2461,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2373,7 +2479,8 @@ fi # Check whether --enable-dtc3280 or --disable-dtc3280 was given. if test "${enable_dtc3280+set}" = set; then enableval="$enable_dtc3280" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_DTC3280 1 EOF @@ -2386,6 +2493,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2403,7 +2511,8 @@ fi # Check whether --enable-ncr53c8xx or --disable-ncr53c8xx was given. if test "${enable_ncr53c8xx+set}" = set; then enableval="$enable_ncr53c8xx" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_NCR53C8XX 1 EOF @@ -2416,35 +2525,6 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi - -fi - - -# Checking for alias tmscsiw -# Check whether --enable-tmscsiw or --disable-tmscsiw was given. -if test "${enable_tmscsiw+set}" = set; then - enableval="$enable_tmscsiw" - enable_dc390w="$enable_tmscsiw" - -fi - - -# Checking for device driver option dc390w -# Check whether --enable-dc390w or --disable-dc390w was given. -if test "${enable_dc390w+set}" = set; then - enableval="$enable_dc390w" - cat >> confdefs.h <<\EOF -#define CONFIG_SCSI_DC390W 1 -EOF - -device_drivers="$device_drivers tmscsiw.o" -if test "${driver_class_scsi_selected+set}" != set; then - driver_class_scsi_selected=yes - cat >> confdefs.h <> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_DC390T 1 EOF @@ -2476,6 +2557,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2493,7 +2575,8 @@ fi # Check whether --enable-ppa or --disable-ppa was given. if test "${enable_ppa+set}" = set; then enableval="$enable_ppa" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_PPA 1 EOF @@ -2506,6 +2589,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2523,7 +2607,8 @@ fi # Check whether --enable-qlogicfas or --disable-qlogicfas was given. if test "${enable_qlogicfas+set}" = set; then enableval="$enable_qlogicfas" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_QLOGIC_FAS 1 EOF @@ -2536,6 +2621,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2553,7 +2639,8 @@ fi # Check whether --enable-qlogicisp or --disable-qlogicisp was given. if test "${enable_qlogicisp+set}" = set; then enableval="$enable_qlogicisp" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_QLOGIC_ISP 1 EOF @@ -2566,6 +2653,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2583,7 +2671,8 @@ fi # Check whether --enable-gdth or --disable-gdth was given. if test "${enable_gdth+set}" = set; then enableval="$enable_gdth" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SCSI_GDTH 1 EOF @@ -2596,6 +2685,7 @@ EOF device_drivers="$device_drivers $driver_class_scsi_files" fi +fi fi @@ -2621,7 +2711,8 @@ fi # Check whether --enable-ne2000 or --disable-ne2000 was given. if test "${enable_ne2000+set}" = set; then enableval="$enable_ne2000" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_NE2000 1 EOF @@ -2634,6 +2725,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2642,7 +2734,8 @@ fi # Check whether --enable-el2 or --disable-el2 was given. if test "${enable_el2+set}" = set; then enableval="$enable_el2" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_EL2 1 EOF @@ -2655,6 +2748,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2672,7 +2766,8 @@ fi # Check whether --enable-el3 or --disable-el3 was given. if test "${enable_el3+set}" = set; then enableval="$enable_el3" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_EL3 1 EOF @@ -2685,6 +2780,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2693,7 +2789,8 @@ fi # Check whether --enable-wd80x3 or --disable-wd80x3 was given. if test "${enable_wd80x3+set}" = set; then enableval="$enable_wd80x3" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_WD80x3 1 EOF @@ -2706,6 +2803,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2723,7 +2821,8 @@ fi # Check whether --enable-el1 or --disable-el1 was given. if test "${enable_el1+set}" = set; then enableval="$enable_el1" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_EL1 1 EOF @@ -2736,6 +2835,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2744,7 +2844,8 @@ fi # Check whether --enable-ul or --disable-ul was given. if test "${enable_ul+set}" = set; then enableval="$enable_ul" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_ULTRA 1 EOF @@ -2757,6 +2858,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2765,7 +2867,8 @@ fi # Check whether --enable-ul32 or --disable-ul32 was given. if test "${enable_ul32+set}" = set; then enableval="$enable_ul32" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_ULTRA32 1 EOF @@ -2778,6 +2881,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2786,7 +2890,8 @@ fi # Check whether --enable-hplanplus or --disable-hplanplus was given. if test "${enable_hplanplus+set}" = set; then enableval="$enable_hplanplus" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_HPLAN_PLUS 1 EOF @@ -2799,6 +2904,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2807,7 +2913,8 @@ fi # Check whether --enable-hplan or --disable-hplan was given. if test "${enable_hplan+set}" = set; then enableval="$enable_hplan" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_HPLAN 1 EOF @@ -2820,6 +2927,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2837,7 +2945,8 @@ fi # Check whether --enable-vortex or --disable-vortex was given. if test "${enable_vortex+set}" = set; then enableval="$enable_vortex" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_VORTEX 1 EOF @@ -2850,6 +2959,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2867,7 +2977,8 @@ fi # Check whether --enable-seeq8005 or --disable-seeq8005 was given. if test "${enable_seeq8005+set}" = set; then enableval="$enable_seeq8005" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SEEQ8005 1 EOF @@ -2880,6 +2991,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2897,7 +3009,8 @@ fi # Check whether --enable-hp100 or --disable-hp100 was given. if test "${enable_hp100+set}" = set; then enableval="$enable_hp100" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_HP100 1 EOF @@ -2910,6 +3023,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2918,7 +3032,8 @@ fi # Check whether --enable-ac3200 or --disable-ac3200 was given. if test "${enable_ac3200+set}" = set; then enableval="$enable_ac3200" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_AC3200 1 EOF @@ -2931,6 +3046,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2939,7 +3055,8 @@ fi # Check whether --enable-e2100 or --disable-e2100 was given. if test "${enable_e2100+set}" = set; then enableval="$enable_e2100" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_E2100 1 EOF @@ -2952,6 +3069,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2969,7 +3087,8 @@ fi # Check whether --enable-at1700 or --disable-at1700 was given. if test "${enable_at1700+set}" = set; then enableval="$enable_at1700" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_AT1700 1 EOF @@ -2982,6 +3101,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -2999,7 +3119,8 @@ fi # Check whether --enable-eth16i or --disable-eth16i was given. if test "${enable_eth16i+set}" = set; then enableval="$enable_eth16i" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_ETH16I 1 EOF @@ -3012,6 +3133,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3029,7 +3151,8 @@ fi # Check whether --enable-znet or --disable-znet was given. if test "${enable_znet+set}" = set; then enableval="$enable_znet" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_ZNET 1 EOF @@ -3042,6 +3165,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3059,7 +3183,8 @@ fi # Check whether --enable-eexpress or --disable-eexpress was given. if test "${enable_eexpress+set}" = set; then enableval="$enable_eexpress" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_EEXPRESS 1 EOF @@ -3072,6 +3197,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3089,7 +3215,8 @@ fi # Check whether --enable-eexpresspro or --disable-eexpresspro was given. if test "${enable_eexpresspro+set}" = set; then enableval="$enable_eexpresspro" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_EEXPRESS_PRO 1 EOF @@ -3102,6 +3229,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3119,7 +3247,8 @@ fi # Check whether --enable-eexpresspro100 or --disable-eexpresspro100 was given. if test "${enable_eexpresspro100+set}" = set; then enableval="$enable_eexpresspro100" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_EEXPRESS_PRO100B 1 EOF @@ -3132,6 +3261,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3149,7 +3279,8 @@ fi # Check whether --enable-depca or --disable-depca was given. if test "${enable_depca+set}" = set; then enableval="$enable_depca" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_DEPCA 1 EOF @@ -3162,6 +3293,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3179,7 +3311,8 @@ fi # Check whether --enable-ewrk3 or --disable-ewrk3 was given. if test "${enable_ewrk3+set}" = set; then enableval="$enable_ewrk3" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_EWRK3 1 EOF @@ -3192,6 +3325,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3209,7 +3343,8 @@ fi # Check whether --enable-de4x5 or --disable-de4x5 was given. if test "${enable_de4x5+set}" = set; then enableval="$enable_de4x5" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_DE4X5 1 EOF @@ -3222,6 +3357,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3239,7 +3375,8 @@ fi # Check whether --enable-apricot or --disable-apricot was given. if test "${enable_apricot+set}" = set; then enableval="$enable_apricot" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_APRICOT 1 EOF @@ -3252,6 +3389,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3269,7 +3407,8 @@ fi # Check whether --enable-wavelan or --disable-wavelan was given. if test "${enable_wavelan+set}" = set; then enableval="$enable_wavelan" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_WAVELAN 1 EOF @@ -3282,6 +3421,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3299,7 +3439,8 @@ fi # Check whether --enable-el16 or --disable-el16 was given. if test "${enable_el16+set}" = set; then enableval="$enable_el16" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_EL16 1 EOF @@ -3312,6 +3453,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3329,7 +3471,8 @@ fi # Check whether --enable-elplus or --disable-elplus was given. if test "${enable_elplus+set}" = set; then enableval="$enable_elplus" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_ELPLUS 1 EOF @@ -3342,6 +3485,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3359,7 +3503,8 @@ fi # Check whether --enable-de600 or --disable-de600 was given. if test "${enable_de600+set}" = set; then enableval="$enable_de600" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_DE600 1 EOF @@ -3372,6 +3517,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3389,7 +3535,8 @@ fi # Check whether --enable-de620 or --disable-de620 was given. if test "${enable_de620+set}" = set; then enableval="$enable_de620" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_DE620 1 EOF @@ -3402,6 +3549,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3419,7 +3567,8 @@ fi # Check whether --enable-skg16 or --disable-skg16 was given. if test "${enable_skg16+set}" = set; then enableval="$enable_skg16" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_SK_G16 1 EOF @@ -3432,6 +3581,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3449,7 +3599,8 @@ fi # Check whether --enable-ni52 or --disable-ni52 was given. if test "${enable_ni52+set}" = set; then enableval="$enable_ni52" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_NI52 1 EOF @@ -3462,6 +3613,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3479,7 +3631,8 @@ fi # Check whether --enable-ni65 or --disable-ni65 was given. if test "${enable_ni65+set}" = set; then enableval="$enable_ni65" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_NI65 1 EOF @@ -3492,6 +3645,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3509,7 +3663,8 @@ fi # Check whether --enable-atp or --disable-atp was given. if test "${enable_atp+set}" = set; then enableval="$enable_atp" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_ATP 1 EOF @@ -3522,6 +3677,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3539,7 +3695,8 @@ fi # Check whether --enable-lance or --disable-lance was given. if test "${enable_lance+set}" = set; then enableval="$enable_lance" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_LANCE 1 EOF @@ -3552,6 +3709,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3569,7 +3727,8 @@ fi # Check whether --enable-elcp or --disable-elcp was given. if test "${enable_elcp+set}" = set; then enableval="$enable_elcp" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_DEC_ELCP 1 EOF @@ -3582,6 +3741,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3599,7 +3759,8 @@ fi # Check whether --enable-fmv18x or --disable-fmv18x was given. if test "${enable_fmv18x+set}" = set; then enableval="$enable_fmv18x" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_FMV18X 1 EOF @@ -3612,6 +3773,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3629,7 +3791,8 @@ fi # Check whether --enable-3c515 or --disable-3c515 was given. if test "${enable_3c515+set}" = set; then enableval="$enable_3c515" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_3C515 1 EOF @@ -3642,6 +3805,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3659,7 +3823,8 @@ fi # Check whether --enable-pcnet32 or --disable-pcnet32 was given. if test "${enable_pcnet32+set}" = set; then enableval="$enable_pcnet32" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_PCNET32 1 EOF @@ -3672,6 +3837,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3680,7 +3846,8 @@ fi # Check whether --enable-ne2kpci or --disable-ne2kpci was given. if test "${enable_ne2kpci+set}" = set; then enableval="$enable_ne2kpci" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_NE2K_PCI 1 EOF @@ -3693,6 +3860,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3710,7 +3878,8 @@ fi # Check whether --enable-yellowfin or --disable-yellowfin was given. if test "${enable_yellowfin+set}" = set; then enableval="$enable_yellowfin" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_YELLOWFIN 1 EOF @@ -3723,6 +3892,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3740,7 +3910,8 @@ fi # Check whether --enable-rtl8139 or --disable-rtl8139 was given. if test "${enable_rtl8139+set}" = set; then enableval="$enable_rtl8139" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_RTL8139 1 EOF @@ -3753,6 +3924,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3770,7 +3942,8 @@ fi # Check whether --enable-epic or --disable-epic was given. if test "${enable_epic+set}" = set; then enableval="$enable_epic" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_EPIC 1 EOF @@ -3783,6 +3956,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3800,7 +3974,8 @@ fi # Check whether --enable-tlan or --disable-tlan was given. if test "${enable_tlan+set}" = set; then enableval="$enable_tlan" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_TLAN 1 EOF @@ -3813,6 +3988,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3830,7 +4006,8 @@ fi # Check whether --enable-viarhine or --disable-viarhine was given. if test "${enable_viarhine+set}" = set; then enableval="$enable_viarhine" - cat >> confdefs.h <<\EOF + if test "x$enableval" != xno; then +cat >> confdefs.h <<\EOF #define CONFIG_VIA_RHINE 1 EOF @@ -3843,6 +4020,7 @@ EOF device_drivers="$device_drivers $driver_class_net_files" fi +fi fi @@ -3869,7 +4047,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1` in + case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -3936,7 +4114,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12" + echo "$CONFIG_STATUS generated by autoconf version 2.13.1" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -3955,9 +4133,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub +s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -4072,7 +4252,7 @@ for ac_file in .. $CONFIG_FILES; do if t rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in - *Makefile*) ac_comsub="1i\\ + *[Mm]akefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac @@ -4203,5 +4383,5 @@ exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1 diff -brNpu gnumach-1.2/i386/linux/dev/include/linux/autoconf.h gnumach-1.3/i386/linux/dev/include/linux/autoconf.h --- gnumach-1.2/i386/linux/dev/include/linux/autoconf.h Mon Jun 21 11:58:58 1999 +++ gnumach-1.3/i386/linux/dev/include/linux/autoconf.h Mon May 27 11:17:01 2002 @@ -238,8 +238,11 @@ #define CONFIG_AFFS_FS 1 #undef CONFIG_AMIGA_PARTITION #define CONFIG_UFS_FS 1 -#define CONFIG_BSD_DISKLABEL 1 -#define CONFIG_SMD_DISKLABEL 1 + +/* We want Linux's partitioning code to do only the DOS partition table, + since the Mach glue code does BSD disklabels for us. */ +#undef CONFIG_BSD_DISKLABEL +#undef CONFIG_SMD_DISKLABEL /* * Character devices diff -brNpu gnumach-1.2/i386/linux/device-drivers.h.in gnumach-1.3/i386/linux/device-drivers.h.in --- gnumach-1.2/i386/linux/device-drivers.h.in Mon Jun 21 11:59:00 1999 +++ gnumach-1.3/i386/linux/device-drivers.h.in Mon May 27 11:17:01 2002 @@ -33,7 +33,6 @@ #undef CONFIG_SCSI_AM53C974 #undef CONFIG_SCSI_DTC3280 #undef CONFIG_SCSI_NCR53C8XX -#undef CONFIG_SCSI_DC390W #undef CONFIG_SCSI_DC390T #undef CONFIG_SCSI_PPA #undef CONFIG_SCSI_QLOGIC_FAS diff -brNpu gnumach-1.2/include/alloca.h gnumach-1.3/include/alloca.h --- gnumach-1.2/include/alloca.h Mon Jun 21 11:58:57 1999 +++ gnumach-1.3/include/alloca.h Mon May 27 11:17:01 2002 @@ -22,4 +22,4 @@ #define alloca(size) __builtin_alloca(size) -#endif _MACH_ALLOCA_H_ +#endif /* _MACH_ALLOCA_H_ */ diff -brNpu gnumach-1.2/include/device/device_reply.defs gnumach-1.3/include/device/device_reply.defs --- gnumach-1.2/include/device/device_reply.defs Mon Jun 21 11:58:55 1999 +++ gnumach-1.3/include/device/device_reply.defs Mon May 27 11:17:01 2002 @@ -51,7 +51,7 @@ userprefix ds_; #if SEQNOS serverprefix seqnos_; serverdemux seqnos_device_reply_server; -#endif SEQNOS +#endif /* SEQNOS */ type reply_port_t = polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE ctype: mach_port_t; @@ -60,7 +60,7 @@ simpleroutine device_open_reply( reply_port : reply_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ in return_code : kern_return_t; in device_port : mach_port_make_send_t ); @@ -71,7 +71,7 @@ simpleroutine device_write_reply( reply_port : reply_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ in return_code : kern_return_t; in bytes_written : int ); @@ -80,7 +80,7 @@ simpleroutine device_write_reply_inband( reply_port : reply_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ in return_code : kern_return_t; in bytes_written : int ); @@ -89,7 +89,7 @@ simpleroutine device_read_reply( reply_port : reply_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ in return_code : kern_return_t; in data : io_buf_ptr_t, dealloc ); @@ -98,7 +98,7 @@ simpleroutine device_read_reply_inband( reply_port : reply_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ in return_code : kern_return_t; in data : io_buf_ptr_inband_t ); diff -brNpu gnumach-1.2/include/device/device_types.defs gnumach-1.3/include/device/device_types.defs --- gnumach-1.2/include/device/device_types.defs Mon Jun 21 11:58:55 1999 +++ gnumach-1.3/include/device/device_types.defs Mon May 27 11:17:01 2002 @@ -61,4 +61,4 @@ type device_t = mach_port_t import ; import ; -#endif _DEVICE_DEVICE_TYPES_DEFS_ +#endif /* _DEVICE_DEVICE_TYPES_DEFS_ */ diff -brNpu gnumach-1.2/include/device/device_types.h gnumach-1.3/include/device/device_types.h --- gnumach-1.2/include/device/device_types.h Mon Jun 21 11:58:55 1999 +++ gnumach-1.3/include/device/device_types.h Mon May 27 11:17:01 2002 @@ -110,6 +110,11 @@ typedef int dev_status_data_t[DEV_STATU # define DEV_GET_SIZE_DEVICE_SIZE 0 /* 0 if unknown */ # define DEV_GET_SIZE_RECORD_SIZE 1 /* 1 if sequential */ #define DEV_GET_SIZE_COUNT 2 +/* size a device in record numbers, not bytes */ +#define DEV_GET_RECORDS 1 +# define DEV_GET_RECORDS_DEVICE_RECORDS 0 /* 0 if unknown */ +# define DEV_GET_RECORDS_RECORD_SIZE 1 /* 1 if sequential */ +#define DEV_GET_RECORDS_COUNT 2 /* * Device error codes @@ -130,4 +135,4 @@ typedef int io_return_t; #define D_NO_MEMORY 2508 /* memory allocation failure */ #define D_READ_ONLY 2509 /* device cannot be written to */ -#endif DEVICE_TYPES_H +#endif /* DEVICE_TYPES_H */ diff -brNpu gnumach-1.2/include/device/disk_status.h gnumach-1.3/include/device/disk_status.h --- gnumach-1.2/include/device/disk_status.h Mon Jun 21 11:58:55 1999 +++ gnumach-1.3/include/device/disk_status.h Mon May 27 11:17:01 2002 @@ -168,7 +168,7 @@ struct disklabel { int bugfix; #endif }; -#else LOCORE +#else /* LOCORE */ /* * offsets for asm boot files. */ @@ -179,7 +179,7 @@ struct disklabel { .set d_secpercyl,56 .set d_secperunit,60 .set d_end_,276 /* size of disk label */ -#endif LOCORE +#endif /* LOCORE */ /* d_type values: */ #define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ @@ -301,6 +301,6 @@ struct format_op { #define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */ -#endif LOCORE +#endif /* LOCORE */ #endif /* _DISK_STATUS_H_ */ diff -brNpu gnumach-1.2/include/device/net_status.h gnumach-1.3/include/device/net_status.h --- gnumach-1.2/include/device/net_status.h Mon Jun 21 11:58:55 1999 +++ gnumach-1.3/include/device/net_status.h Mon May 27 11:17:01 2002 @@ -184,4 +184,4 @@ typedef struct net_rcv_msg *net_rcv_msg -#endif _DEVICE_NET_STATUS_H_ +#endif /* _DEVICE_NET_STATUS_H_ */ diff -brNpu gnumach-1.2/include/device/tty_status.h gnumach-1.3/include/device/tty_status.h --- gnumach-1.2/include/device/tty_status.h Mon Jun 21 11:58:56 1999 +++ gnumach-1.3/include/device/tty_status.h Mon May 27 11:17:01 2002 @@ -61,8 +61,10 @@ struct tty_status { #define EXTB 15 #define B19200 EXTA #define B38400 EXTB +#define B57600 16 +#define B115200 17 -#define NSPEEDS 16 +#define NSPEEDS 18 /* * Flags diff -brNpu gnumach-1.2/include/mach/mach.defs gnumach-1.3/include/mach/mach.defs --- gnumach-1.2/include/mach/mach.defs Mon Jun 21 11:58:51 1999 +++ gnumach-1.3/include/mach/mach.defs Mon May 27 11:17:01 2002 @@ -164,13 +164,13 @@ skip; /* old thread_mutate */ */ #ifdef EMULATOR skip; /* the emulator redefines vm_allocate using vm_map */ -#else EMULATOR +#else /* EMULATOR */ routine vm_allocate( target_task : vm_task_t; inout address : vm_address_t; size : vm_size_t; anywhere : boolean_t); -#endif EMULATOR +#endif /* EMULATOR */ skip; /* old vm_allocate_with_pager */ @@ -764,7 +764,7 @@ routine port_extract_receive( his_name : port_name_t; out his_port : port_all_t); -#else MACH_IPC_COMPAT +#else /* MACH_IPC_COMPAT */ skip; /* old port_names */ skip; /* old port_type */ @@ -783,7 +783,7 @@ skip; /* old port_extract_send */ skip; /* old port_insert_receive */ skip; /* old port_extract_receive */ -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ /* * Map a user-defined memory object into the virtual address @@ -829,7 +829,7 @@ routine htg_vm_map( cur_protection : vm_prot_t; max_protection : vm_prot_t; inheritance : vm_inherit_t); -#else EMULATOR +#else /* EMULATOR */ routine vm_map( target_task : vm_task_t; inout address : vm_address_t; @@ -842,7 +842,7 @@ routine vm_map( cur_protection : vm_prot_t; max_protection : vm_prot_t; inheritance : vm_inherit_t); -#endif EMULATOR +#endif /* EMULATOR */ /* * Indicate that a range of the specified memory object cannot @@ -933,11 +933,11 @@ routine port_set_backup( ctype: mach_port_t; out previous : port_t); -#else MACH_IPC_COMPAT +#else /* MACH_IPC_COMPAT */ skip; /* old port_set_backup */ -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ /* * Set/Get special properties of memory associated diff -brNpu gnumach-1.2/include/mach/memory_object.defs gnumach-1.3/include/mach/memory_object.defs --- gnumach-1.2/include/mach/memory_object.defs Mon Jun 21 11:58:51 1999 +++ gnumach-1.3/include/mach/memory_object.defs Mon May 27 11:17:01 2002 @@ -33,18 +33,18 @@ subsystem #if KERNEL_USER KernelUser -#endif KERNEL_USER +#endif /* KERNEL_USER */ #if KERNEL_SERVER KernelServer -#endif KERNEL_SERVER +#endif /* KERNEL_SERVER */ memory_object 2200; #ifdef KERNEL #include #if NORMA_VM userprefix k_; -#endif NORMA_VM -#endif KERNEL +#endif /* NORMA_VM */ +#endif /* KERNEL */ #include #include @@ -52,7 +52,7 @@ userprefix k_; #if SEQNOS serverprefix seqnos_; serverdemux seqnos_memory_object_server; -#endif SEQNOS +#endif /* SEQNOS */ /* * Initialize the specified memory object, providing @@ -69,7 +69,7 @@ simpleroutine memory_object_init( memory_object : memory_object_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; @@ -95,14 +95,14 @@ simpleroutine memory_object_terminate( ctype: mach_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control : memory_object_control_t = MACH_MSG_TYPE_MOVE_RECEIVE ctype: mach_port_t #if KERNEL_USER /* for compatibility with Mach 2.5 kernels */ , dealloc -#endif KERNEL_USER +#endif /* KERNEL_USER */ ; memory_object_name : memory_object_name_t = MACH_MSG_TYPE_MOVE_RECEIVE @@ -110,7 +110,7 @@ simpleroutine memory_object_terminate( #if KERNEL_USER /* for compatibility with Mach 2.5 kernels */ , dealloc -#endif KERNEL_USER +#endif /* KERNEL_USER */ ); /* @@ -143,7 +143,7 @@ simpleroutine memory_object_copy( old_memory_object : memory_object_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ old_memory_control : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; @@ -155,7 +155,7 @@ simpleroutine memory_object_copy( #if KERNEL_USER /* for compatibility with Mach 2.5 kernels */ , dealloc -#endif KERNEL_USER +#endif /* KERNEL_USER */ ); /* @@ -169,7 +169,7 @@ simpleroutine memory_object_data_request memory_object : memory_object_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; @@ -188,7 +188,7 @@ simpleroutine memory_object_data_unlock( memory_object : memory_object_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; @@ -210,7 +210,7 @@ simpleroutine memory_object_data_write( memory_object : memory_object_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; @@ -231,7 +231,7 @@ simpleroutine memory_object_lock_complet ctype: mach_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; @@ -262,7 +262,7 @@ simpleroutine memory_object_supply_compl ctype: mach_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; @@ -286,7 +286,7 @@ simpleroutine memory_object_data_retur memory_object : memory_object_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; @@ -308,6 +308,6 @@ simpleroutine memory_object_change_compl ctype: mach_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ may_cache : boolean_t; copy_strategy : memory_object_copy_strategy_t); diff -brNpu gnumach-1.2/include/mach/memory_object_default.defs gnumach-1.3/include/mach/memory_object_default.defs --- gnumach-1.2/include/mach/memory_object_default.defs Mon Jun 21 11:58:51 1999 +++ gnumach-1.3/include/mach/memory_object_default.defs Mon May 27 11:17:01 2002 @@ -34,15 +34,15 @@ subsystem #if KERNEL_USER KernelUser -#endif KERNEL_USER +#endif /* KERNEL_USER */ memory_object_default 2250; #ifdef MACH_KERNEL #include #if NORMA_VM userprefix k_; -#endif NORMA_VM -#endif MACH_KERNEL +#endif /* NORMA_VM */ +#endif /* MACH_KERNEL */ #include #include @@ -50,7 +50,7 @@ userprefix k_; #if SEQNOS serverprefix seqnos_; serverdemux seqnos_memory_object_default_server; -#endif SEQNOS +#endif /* SEQNOS */ /* * Pass on responsibility for the new kernel-created memory @@ -65,14 +65,14 @@ simpleroutine memory_object_create( ctype: mach_port_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ new_memory_object : memory_object_t = MACH_MSG_TYPE_MOVE_RECEIVE ctype: mach_port_t #if KERNEL_USER /* for compatibility with Mach 2.5 kernels */ , dealloc -#endif KERNEL_USER +#endif /* KERNEL_USER */ ; new_object_size : vm_size_t; new_control_port : memory_object_control_t = @@ -93,7 +93,7 @@ simpleroutine memory_object_data_initial memory_object : memory_object_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control_port : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; @@ -110,12 +110,12 @@ simpleroutine memory_object_data_termina memory_object : memory_object_t; #if SEQNOS msgseqno seqno : mach_port_seqno_t; -#endif SEQNOS +#endif /* SEQNOS */ memory_control_port : memory_object_control_t = MACH_MSG_TYPE_MAKE_SEND ctype: mach_port_t; offset : vm_offset_t; size : vm_size_t); -#else 0 +#else /* 0 */ skip; /* memory_object_data_terminate */ -#endif 0 +#endif /* 0 */ diff -brNpu gnumach-1.2/include/mach/proc_ops.h gnumach-1.3/include/mach/proc_ops.h --- gnumach-1.2/include/mach/proc_ops.h Mon Jun 21 11:58:53 1999 +++ gnumach-1.3/include/mach/proc_ops.h Wed Dec 31 16:00:00 1969 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1994 The University of Utah and - * the Center for Software Science (CSS). All rights reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS - * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF - * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * CSS requests users of this software to return to css-dist@cs.utah.edu any - * improvements that they make and grant CSS redistribution rights. - * - * Author: Bryan Ford, University of Utah CSS - */ -/* - * Simple operations that don't exist as primitives in C, - * but which processors often implement directly. - * This file contains default, "dumb" implementations; - * machine-independent code can override these with smarter implementations. - */ -#ifndef _MACH_PROC_OPS_H_ -#define _MACH_PROC_OPS_H_ - -#include -#include - -/* Returns the bit number of the most-significant set bit in `val', - e.g. 0 for 1, 1 for 2-3, 2 for 4-7, etc. - If `val' is 0 (i.e. no bits are set), the behavior is undefined. */ -MACH_INLINE int find_msb_set(natural_t val) -{ - int msb; - for (msb = sizeof(val)*8-1; (val & ((natural_t)1 << msb)) == 0; msb--); - return msb; -} - -/* Returns the bit number of the least-significant set bit in `val'. - If `val' is 0 (i.e. no bits are set), the behavior is undefined. */ -MACH_INLINE int find_lsb_set(natural_t val) -{ - int lsb; - for (lsb = 0; (val & ((natural_t)1 << lsb)) == 0; lsb++); - return lsb; -} - -#endif _MACH_PROC_OPS_H_ diff -brNpu gnumach-1.2/include/mach/std_types.defs gnumach-1.3/include/mach/std_types.defs --- gnumach-1.2/include/mach/std_types.defs Mon Jun 21 11:58:51 1999 +++ gnumach-1.3/include/mach/std_types.defs Mon May 27 11:17:01 2002 @@ -124,8 +124,8 @@ type port_rcv_t = MACH_MSG_TYPE_MOVE_REC type port_array_t = ^array[] of port_t ctype: mach_port_array_t; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ import ; -#endif _MACH_STD_TYPES_DEFS_ +#endif /* _MACH_STD_TYPES_DEFS_ */ diff -brNpu gnumach-1.2/include/mach_debug/hash_info.h gnumach-1.3/include/mach_debug/hash_info.h --- gnumach-1.2/include/mach_debug/hash_info.h Mon Jun 21 11:58:56 1999 +++ gnumach-1.3/include/mach_debug/hash_info.h Mon May 27 11:17:01 2002 @@ -38,4 +38,4 @@ typedef struct hash_info_bucket { typedef hash_info_bucket_t *hash_info_bucket_array_t; -#endif _MACH_DEBUG_HASH_INFO_H_ +#endif /* _MACH_DEBUG_HASH_INFO_H_ */ diff -brNpu gnumach-1.2/include/mach_debug/ipc_info.h gnumach-1.3/include/mach_debug/ipc_info.h --- gnumach-1.2/include/mach_debug/ipc_info.h Mon Jun 21 11:58:56 1999 +++ gnumach-1.3/include/mach_debug/ipc_info.h Mon May 27 11:17:01 2002 @@ -97,4 +97,4 @@ typedef ipc_info_tree_name_t *ipc_info_t #define IPC_INFO_TYPE_XMM_PAGER 11 #define IPC_INFO_TYPE_PAGING_NAME 12 -#endif _MACH_DEBUG_IPC_INFO_H_ +#endif /* _MACH_DEBUG_IPC_INFO_H_ */ diff -brNpu gnumach-1.2/include/mach_debug/mach_debug.defs gnumach-1.3/include/mach_debug/mach_debug.defs --- gnumach-1.2/include/mach_debug/mach_debug.defs Mon Jun 21 11:58:56 1999 +++ gnumach-1.3/include/mach_debug/mach_debug.defs Mon May 27 11:17:01 2002 @@ -36,7 +36,7 @@ subsystem #if KERNEL_SERVER KernelServer -#endif KERNEL_SERVER +#endif /* KERNEL_SERVER */ mach_debug 3000; #include @@ -115,13 +115,13 @@ routine mach_port_dnrequest_info( out total : unsigned; /* total size of table */ out used : unsigned); /* amount used */ -#else !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG +#else /* !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG */ skip; /* mach_port_get_srights */ skip; /* host_ipc_hash_info */ skip; /* host_ipc_marequest_info */ skip; /* mach_port_space_info */ skip; /* mach_port_dnrequest_info */ -#endif !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG +#endif /* !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG */ skip; /* mach_vm_region_info */ skip; /* vm_mapped_pages_info */ @@ -164,9 +164,9 @@ routine host_virtual_physical_table_info out info : hash_info_bucket_array_t, CountInOut, Dealloc); -#else !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG +#else /* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */ skip; /* host_virtual_physical_table_info */ -#endif !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG +#endif /* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */ #if !defined(MACH_KDB) || MACH_KDB /* @@ -181,9 +181,9 @@ routine host_load_symbol_table( name : symtab_name_t; symtab : pointer_t); -#else !defined(MACH_KDB) || MACH_KDB +#else /* !defined(MACH_KDB) || MACH_KDB */ skip; /* host_load_symbol_table */ -#endif !defined(MACH_KDB) || MACH_KDB +#endif /* !defined(MACH_KDB) || MACH_KDB */ #if !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG @@ -198,9 +198,9 @@ routine mach_port_kernel_object( out object_type : unsigned; out object_addr : vm_offset_t); -#else !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG +#else /* !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG */ skip; /* mach_port_kernel_object */ -#endif !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG +#endif /* !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG */ #if !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG @@ -234,8 +234,8 @@ routine mach_vm_object_pages( out pages : vm_page_info_array_t, CountInOut, Dealloc); -#else !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG +#else /* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */ skip; /* mach_vm_region_info */ skip; /* mach_vm_object_info */ skip; /* mach_vm_object_pages */ -#endif !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG +#endif /* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */ diff -brNpu gnumach-1.2/include/mach_debug/mach_debug_types.defs gnumach-1.3/include/mach_debug/mach_debug_types.defs --- gnumach-1.2/include/mach_debug/mach_debug_types.defs Mon Jun 21 11:58:56 1999 +++ gnumach-1.3/include/mach_debug/mach_debug_types.defs Mon May 27 11:17:01 2002 @@ -62,4 +62,4 @@ type symtab_name_t = (MACH_MSG_TYPE_STRI import ; -#endif _MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_ +#endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_ */ diff -brNpu gnumach-1.2/include/mach_debug/mach_debug_types.h gnumach-1.3/include/mach_debug/mach_debug_types.h --- gnumach-1.2/include/mach_debug/mach_debug_types.h Mon Jun 21 11:58:56 1999 +++ gnumach-1.3/include/mach_debug/mach_debug_types.h Mon May 27 11:17:01 2002 @@ -37,4 +37,4 @@ typedef char symtab_name_t[32]; -#endif _MACH_DEBUG_MACH_DEBUG_TYPES_H_ +#endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_H_ */ diff -brNpu gnumach-1.2/include/mach_debug/vm_info.h gnumach-1.3/include/mach_debug/vm_info.h --- gnumach-1.2/include/mach_debug/vm_info.h Mon Jun 21 11:58:57 1999 +++ gnumach-1.3/include/mach_debug/vm_info.h Mon May 27 11:17:01 2002 @@ -129,4 +129,4 @@ typedef struct vm_page_info { typedef vm_page_info_t *vm_page_info_array_t; -#endif _MACH_DEBUG_VM_INFO_H_ +#endif /* _MACH_DEBUG_VM_INFO_H_ */ diff -brNpu gnumach-1.2/include/mach_debug/zone_info.h gnumach-1.3/include/mach_debug/zone_info.h --- gnumach-1.2/include/mach_debug/zone_info.h Mon Jun 21 11:58:57 1999 +++ gnumach-1.3/include/mach_debug/zone_info.h Mon May 27 11:17:01 2002 @@ -58,4 +58,4 @@ typedef struct zone_info { typedef zone_info_t *zone_info_array_t; -#endif _MACH_DEBUG_ZONE_INFO_H_ +#endif /* _MACH_DEBUG_ZONE_INFO_H_ */ diff -brNpu gnumach-1.2/include/sys/ioctl.h gnumach-1.3/include/sys/ioctl.h --- gnumach-1.2/include/sys/ioctl.h Mon Jun 21 11:58:58 1999 +++ gnumach-1.3/include/sys/ioctl.h Mon May 27 11:17:01 2002 @@ -49,4 +49,4 @@ #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) #define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) -#endif _MACH_SYS_IOCTL_H_ +#endif /* _MACH_SYS_IOCTL_H_ */ diff -brNpu gnumach-1.2/include/sys/time.h gnumach-1.3/include/sys/time.h --- gnumach-1.2/include/sys/time.h Mon Jun 21 11:58:58 1999 +++ gnumach-1.3/include/sys/time.h Mon May 27 11:17:01 2002 @@ -50,4 +50,4 @@ extern time_value_t time; (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 -#endif _MACH_SA_SYS_TIME_H_ +#endif /* _MACH_SA_SYS_TIME_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_entry.h gnumach-1.3/ipc/ipc_entry.h --- gnumach-1.2/ipc/ipc_entry.h Mon Jun 21 11:58:27 1999 +++ gnumach-1.3/ipc/ipc_entry.h Mon May 27 11:17:01 2002 @@ -155,4 +155,4 @@ ipc_entry_dealloc(/* ipc_space_t space, extern kern_return_t ipc_entry_grow_table(/* ipc_space_t space */); -#endif _IPC_IPC_ENTRY_H_ +#endif /* _IPC_IPC_ENTRY_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_hash.h gnumach-1.3/ipc/ipc_hash.h --- gnumach-1.2/ipc/ipc_hash.h Mon Jun 21 11:58:27 1999 +++ gnumach-1.3/ipc/ipc_hash.h Mon May 27 11:17:01 2002 @@ -47,7 +47,7 @@ ipc_hash_init(); extern unsigned int ipc_hash_info(/* hash_info_bucket_t *, unsigned int */); -#endif MACH_IPC_DEBUG +#endif /* MACH_IPC_DEBUG */ extern boolean_t ipc_hash_lookup(/* ipc_space_t space, ipc_object_t obj, @@ -91,4 +91,4 @@ extern void ipc_hash_local_delete(/* ipc_space_t space, ipc_object_t obj, mach_port_index_t index, ipc_entry_t entry */); -#endif _IPC_IPC_HASH_H_ +#endif /* _IPC_IPC_HASH_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_init.c gnumach-1.3/ipc/ipc_init.c --- gnumach-1.2/ipc/ipc_init.c Mon Jun 21 11:58:25 1999 +++ gnumach-1.3/ipc/ipc_init.c Mon May 27 11:17:01 2002 @@ -111,7 +111,7 @@ ipc_bootstrap(void) #if NORMA_IPC kr = ipc_space_create_special(&ipc_space_remote); assert(kr == KERN_SUCCESS); -#endif NORMA_IPC +#endif /* NORMA_IPC */ /* initialize modules with hidden data structures */ diff -brNpu gnumach-1.2/ipc/ipc_kmsg.c gnumach-1.3/ipc/ipc_kmsg.c --- gnumach-1.2/ipc/ipc_kmsg.c Mon Jun 21 11:58:25 1999 +++ gnumach-1.3/ipc/ipc_kmsg.c Mon May 27 11:17:01 2002 @@ -473,7 +473,7 @@ ipc_kmsg_free(kmsg) /* return it to the norma ipc code */ norma_kmsg_put(kmsg); break; -#endif NORMA_IPC +#endif /* NORMA_IPC */ case IKM_SIZE_NETWORK: /* return it to the network code */ @@ -1251,9 +1251,9 @@ ipc_kmsg_copyin_header(msg, space, notif reply_soright = IP_NULL; goto skip_reply_checks; } -#else MACH_IPC_COMPAT +#else /* MACH_IPC_COMPAT */ assert(kr == KERN_SUCCESS); -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ if ((saved_reply != IP_NULL) && (reply_port == IO_DEAD)) { ipc_port_t dest = (ipc_port_t) dest_port; @@ -1321,7 +1321,7 @@ ipc_kmsg_copyin_header(msg, space, notif * and the port died on us. In this case, the copyin * code already deallocated reply_entry. */ -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ if (IE_BITS_TYPE(dest_entry->ie_bits) == MACH_PORT_TYPE_NONE) ipc_entry_dealloc(space, dest_name, dest_entry); @@ -1398,7 +1398,7 @@ ipc_kmsg_copyin_body(kmsg, space, map) use_page_lists = TRUE; steal_pages = TRUE; } -#endif NORMA_IPC +#endif /* NORMA_IPC */ saddr = (vm_offset_t) (&kmsg->ikm_header + 1); eaddr = (vm_offset_t) &kmsg->ikm_header + kmsg->ikm_header.msgh_size; @@ -2746,7 +2746,7 @@ ipc_kmsg_copyout_to_kernel(kmsg, space) kmsg->ikm_header.msgh_local_port = dest_name; kmsg->ikm_header.msgh_remote_port = reply_name; } -#endif NORMA_IPC || NORMA_VM +#endif /* NORMA_IPC || NORMA_VM */ #if MACH_IPC_COMPAT @@ -2829,7 +2829,7 @@ ipc_kmsg_copyin_compat(kmsg, space, map) use_page_lists = TRUE; steal_pages = TRUE; } -#endif NORMA_IPC +#endif /* NORMA_IPC */ saddr = (vm_offset_t) (&kmsg->ikm_header + 1); eaddr = (vm_offset_t) &kmsg->ikm_header + kmsg->ikm_header.msgh_size; @@ -3211,7 +3211,7 @@ ipc_kmsg_copyout_compat(kmsg, space, map return MACH_MSG_SUCCESS; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ #include #if MACH_KDB @@ -3313,9 +3313,9 @@ ipc_kmsg_print(kmsg) db_printf(",page=0x%x,copy=0x%x\n", kmsg->ikm_page, kmsg->ikm_copy); -#else NORMA_IPC +#else /* NORMA_IPC */ db_printf("\n"); -#endif NORMA_IPC +#endif /* NORMA_IPC */ ipc_msg_print(&kmsg->ikm_header); } @@ -3481,4 +3481,4 @@ ipc_msg_print(msgh) } } } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ipc/ipc_kmsg.h gnumach-1.3/ipc/ipc_kmsg.h --- gnumach-1.2/ipc/ipc_kmsg.h Mon Jun 21 11:58:27 1999 +++ gnumach-1.3/ipc/ipc_kmsg.h Mon May 27 11:17:01 2002 @@ -48,7 +48,7 @@ #if NORMA_IPC #include #include -#endif NORMA_IPC +#endif /* NORMA_IPC */ /* * This structure is only the header for a kmsg buffer; @@ -70,7 +70,7 @@ typedef struct ipc_kmsg { vm_page_t ikm_page; vm_map_copy_t ikm_copy; unsigned long ikm_source_node; -#endif NORMA_IPC +#endif /* NORMA_IPC */ mach_msg_header_t ikm_header; } *ipc_kmsg_t; @@ -287,5 +287,5 @@ ipc_kmsg_copyin_compat(/* ipc_kmsg_t, ip extern mach_msg_return_t ipc_kmsg_copyout_compat(/* ipc_kmsg_t, ipc_space_t, vm_map_t */); -#endif MACH_IPC_COMPAT -#endif _IPC_IPC_KMSG_H_ +#endif /* MACH_IPC_COMPAT */ +#endif /* _IPC_IPC_KMSG_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_marequest.c gnumach-1.3/ipc/ipc_marequest.c --- gnumach-1.2/ipc/ipc_marequest.c Mon Jun 21 11:58:25 1999 +++ gnumach-1.3/ipc/ipc_marequest.c Mon May 27 11:17:01 2002 @@ -189,7 +189,7 @@ ipc_marequest_create(space, port, notify #if !MACH_IPC_COMPAT assert(notify != MACH_PORT_NULL); -#endif !MACH_IPC_COMPAT +#endif /* !MACH_IPC_COMPAT */ marequest = imar_alloc(); if (marequest == IMAR_NULL) @@ -229,7 +229,7 @@ ipc_marequest_create(space, port, notify if (notify == MACH_PORT_NULL) soright = IP_NULL; else -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ if ((soright = ipc_port_lookup_notify(space, notify)) == IP_NULL) { is_write_unlock(space); @@ -256,7 +256,7 @@ ipc_marequest_create(space, port, notify if (notify == MACH_PORT_NULL) soright = IP_NULL; else -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ if ((soright = ipc_port_lookup_notify(space, notify)) == IP_NULL) { is_write_unlock(space); @@ -373,7 +373,7 @@ ipc_marequest_destroy(marequest) ipc_port_t soright; #if MACH_IPC_COMPAT ipc_port_t sright = IP_NULL; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ is_write_lock(space); @@ -411,7 +411,7 @@ ipc_marequest_destroy(marequest) #if MACH_IPC_COMPAT if (soright == IP_NULL) sright = ipc_space_make_notify(space); -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ } else name = MACH_PORT_NULL; } @@ -431,7 +431,7 @@ ipc_marequest_destroy(marequest) return; } assert(sright == IP_NULL); -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ assert(soright != IP_NULL); ipc_notify_msg_accepted(soright, name); @@ -482,4 +482,4 @@ ipc_marequest_info(maxp, info, count) return ipc_marequest_size; } -#endif MACH_IPC_DEBUG +#endif /* MACH_IPC_DEBUG */ diff -brNpu gnumach-1.2/ipc/ipc_marequest.h gnumach-1.3/ipc/ipc_marequest.h --- gnumach-1.2/ipc/ipc_marequest.h Mon Jun 21 11:58:28 1999 +++ gnumach-1.3/ipc/ipc_marequest.h Mon May 27 11:17:01 2002 @@ -79,7 +79,7 @@ ipc_marequest_init(); extern unsigned int ipc_marequest_info(/* unsigned int *, hash_info_bucket_t *, unsigned int */); -#endif MACH_IPC_DEBUG +#endif /* MACH_IPC_DEBUG */ extern mach_msg_return_t ipc_marequest_create(/* ipc_space_t space, mach_port_t name, @@ -95,4 +95,4 @@ ipc_marequest_rename(/* ipc_space_t spac extern void ipc_marequest_destroy(/* ipc_marequest_t marequest */); -#endif _IPC_IPC_MAREQUEST_H_ +#endif /* _IPC_IPC_MAREQUEST_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_mqueue.c gnumach-1.3/ipc/ipc_mqueue.c --- gnumach-1.2/ipc/ipc_mqueue.c Mon Jun 21 11:58:25 1999 +++ gnumach-1.3/ipc/ipc_mqueue.c Mon May 27 11:17:01 2002 @@ -59,7 +59,7 @@ extern ipc_kmsg_t norma_ipc_handoff_msg; extern mach_msg_size_t norma_ipc_handoff_max_size; extern mach_msg_size_t norma_ipc_handoff_msg_size; extern ipc_kmsg_t norma_ipc_kmsg_accept(); -#endif NORMA_IPC +#endif /* NORMA_IPC */ /* * Routine: ipc_mqueue_init @@ -220,7 +220,7 @@ ipc_mqueue_send(kmsg, option, time_out) ip_unlock(port); return mr; } -#endif NORMA_IPC +#endif /* NORMA_IPC */ for (;;) { ipc_thread_t self; @@ -245,7 +245,7 @@ ipc_mqueue_send(kmsg, option, time_out) #if NORMA_IPC /* XXX until ipc_kmsg_destroy is fixed... */ norma_ipc_finish_receiving(&kmsg); -#endif NORMA_IPC +#endif /* NORMA_IPC */ ipc_kmsg_destroy(kmsg); return MACH_MSG_SUCCESS; } @@ -332,7 +332,7 @@ ipc_mqueue_send(kmsg, option, time_out) #if NORMA_IPC /* XXX until ipc_kmsg_destroy is fixed... */ norma_ipc_finish_receiving(&kmsg); -#endif NORMA_IPC +#endif /* NORMA_IPC */ ipc_kmsg_destroy(kmsg); return MACH_MSG_SUCCESS; } @@ -379,7 +379,7 @@ ipc_mqueue_send(kmsg, option, time_out) } norma_ipc_handoff_msg_size = kmsg->ikm_header.msgh_size; } -#endif NORMA_IPC +#endif /* NORMA_IPC */ for (;;) { receiver = ipc_thread_queue_first(receivers); if (receiver == ITH_NULL) { @@ -595,7 +595,7 @@ ipc_mqueue_receive( return MACH_RCV_TOO_LARGE; } } -#endif NORMA_IPC +#endif /* NORMA_IPC */ if (kmsg != IKM_NULL) { /* check space requirements */ @@ -747,7 +747,7 @@ ipc_mqueue_receive( #if NORMA_IPC norma_ipc_finish_receiving(&kmsg); -#endif NORMA_IPC +#endif /* NORMA_IPC */ *kmsgp = kmsg; *seqnop = seqno; return MACH_MSG_SUCCESS; diff -brNpu gnumach-1.2/ipc/ipc_mqueue.h gnumach-1.3/ipc/ipc_mqueue.h --- gnumach-1.2/ipc/ipc_mqueue.h Mon Jun 21 11:58:28 1999 +++ gnumach-1.3/ipc/ipc_mqueue.h Mon May 27 11:17:01 2002 @@ -95,7 +95,7 @@ MACRO_BEGIN \ assert(mr == MACH_MSG_SUCCESS); \ MACRO_END -#else MACH_ASSERT +#else /* MACH_ASSERT */ #define ipc_mqueue_send_always(kmsg) \ MACRO_BEGIN \ diff -brNpu gnumach-1.2/ipc/ipc_notify.c gnumach-1.3/ipc/ipc_notify.c --- gnumach-1.2/ipc/ipc_notify.c Mon Jun 21 11:58:26 1999 +++ gnumach-1.3/ipc/ipc_notify.c Mon May 27 11:17:01 2002 @@ -61,9 +61,9 @@ mach_dead_name_notification_t ipc_notif */ #define NOTIFY_MSGH_SEQNO MSG_TYPE_EMERGENCY -#else MACH_IPC_COMPAT +#else /* MACH_IPC_COMPAT */ #define NOTIFY_MSGH_SEQNO 0 -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ /* * Routine: ipc_notify_init_port_deleted @@ -388,7 +388,7 @@ ipc_notify_no_senders(port, mscount) norma_ipc_notify_no_senders(ip_nsproxy(port)); return; } -#endif NORMA_IPC +#endif /* NORMA_IPC */ kmsg = ikm_alloc(sizeof *n); if (kmsg == IKM_NULL) { printf("dropped no-senders (0x%08x, %u)\n", port, mscount); @@ -590,4 +590,4 @@ ipc_notify_port_destroyed_compat(port, r ipc_mqueue_send_always(kmsg); } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ diff -brNpu gnumach-1.2/ipc/ipc_notify.h gnumach-1.3/ipc/ipc_notify.h --- gnumach-1.2/ipc/ipc_notify.h Mon Jun 21 11:58:28 1999 +++ gnumach-1.3/ipc/ipc_notify.h Mon May 27 11:17:01 2002 @@ -68,5 +68,5 @@ ipc_notify_msg_accepted_compat(/* ipc_po extern void ipc_notify_port_destroyed_compat(/* ipc_port_t, ipc_port_t */); -#endif MACH_IPC_COMPAT -#endif _IPC_IPC_NOTIFY_H_ +#endif /* MACH_IPC_COMPAT */ +#endif /* _IPC_IPC_NOTIFY_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_object.c gnumach-1.3/ipc/ipc_object.c --- gnumach-1.2/ipc/ipc_object.c Mon Jun 21 11:58:26 1999 +++ gnumach-1.3/ipc/ipc_object.c Mon May 27 11:17:01 2002 @@ -247,7 +247,6 @@ ipc_object_alloc( bzero((char *)pset, sizeof(*pset)); } - *namep = (mach_port_t)object; kr = ipc_entry_alloc(space, namep, &entry); if (kr != KERN_SUCCESS) { io_free(otype, object); @@ -373,7 +372,7 @@ ipc_object_copyin_type( case MSG_TYPE_PORT_ALL: return MACH_MSG_TYPE_PORT_RECEIVE; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ default: #if MACH_ASSERT @@ -727,7 +726,7 @@ ipc_object_copyout_multiname(space, obje *namep = name; return kr; } -#endif 0 +#endif /* 0 */ /* * Routine: ipc_object_copyout_name @@ -1279,7 +1278,7 @@ ipc_object_copyout_name_compat(space, ob return kr; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ #include diff -brNpu gnumach-1.2/ipc/ipc_object.h gnumach-1.3/ipc/ipc_object.h --- gnumach-1.2/ipc/ipc_object.h Mon Jun 21 11:58:28 1999 +++ gnumach-1.3/ipc/ipc_object.h Mon May 27 11:17:01 2002 @@ -184,9 +184,9 @@ extern kern_return_t ipc_object_copyout_name_compat(/* ipc_space_t, ipc_object_t, mach_msg_type_name_t, mach_port_t */); -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ extern void ipc_object_print(/* ipc_object_t */); -#endif _IPC_IPC_OBJECT_H_ +#endif /* _IPC_IPC_OBJECT_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_port.c gnumach-1.3/ipc/ipc_port.c --- gnumach-1.2/ipc/ipc_port.c Mon Jun 21 11:58:26 1999 +++ gnumach-1.3/ipc/ipc_port.c Mon May 27 11:17:01 2002 @@ -51,7 +51,7 @@ #include #if NORMA_IPC #include -#endif NORMA_IPC +#endif /* NORMA_IPC */ @@ -508,7 +508,7 @@ ipc_port_init( port->ip_norma_spare2 = 0L; port->ip_norma_spare3 = 0L; port->ip_norma_spare4 = 0L; -#endif NORMA_IPC +#endif /* NORMA_IPC */ ipc_mqueue_init(&port->ip_messages); ipc_thread_queue_init(&port->ip_blocked); @@ -637,7 +637,7 @@ ipc_port_delete_compat(port, space, name is_release(space); } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ /* * Routine: ipc_port_destroy @@ -702,7 +702,7 @@ ipc_port_destroy( ipc_port_release_send(sright); } } else -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ if (!ipc_port_check_circularity(port, pdrequest)) { /* consumes our refs for port and pdrequest */ @@ -730,7 +730,7 @@ ipc_port_destroy( * destroy any NORMA_IPC state associated with port */ norma_ipc_port_destroy(port); -#endif NORMA_IPC +#endif /* NORMA_IPC */ /* * rouse all blocked senders @@ -804,7 +804,7 @@ ipc_port_destroy( ipr_space(soright), name); continue; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ ipc_notify_dead_name(soright, name); } @@ -1247,7 +1247,7 @@ ipc_port_alloc_special(space) int ret = (int) ipc_port_alloc_special; #endif extern int input_msgh_id; -#endif NORMA_IPC +#endif /* NORMA_IPC */ ipc_port_t port; port = (ipc_port_t) io_alloc(IOT_PORT); @@ -1274,7 +1274,7 @@ ipc_port_alloc_special(space) #if NORMA_IPC port->ip_norma_spare1 = ret; port->ip_norma_spare2 = input_msgh_id; -#endif NORMA_IPC +#endif /* NORMA_IPC */ return port; } @@ -1472,7 +1472,7 @@ ipc_port_copyout_receiver(port, space) return name; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ #include @@ -1537,9 +1537,9 @@ ipc_port_print(port) printf(", norma_spare2=0x%x", port->ip_norma_spare2); printf(", norma_spare3=0x%x", port->ip_norma_spare3); printf(", norma_spare4=0x%x\n", port->ip_norma_spare4); -#endif NORMA_IPC +#endif /* NORMA_IPC */ indent -=2; } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ipc/ipc_port.h gnumach-1.3/ipc/ipc_port.h --- gnumach-1.2/ipc/ipc_port.h Mon Jun 21 11:58:28 1999 +++ gnumach-1.3/ipc/ipc_port.h Mon May 27 11:17:01 2002 @@ -116,7 +116,7 @@ struct ipc_port { long ip_norma_spare2; long ip_norma_spare3; long ip_norma_spare4; -#endif NORMA_IPC +#endif /* NORMA_IPC */ }; #define ip_object ip_target.ipt_object @@ -191,7 +191,7 @@ typedef struct ipc_port_request { #define ipr_spacep(soright) ((unsigned int)(soright) & 1) #define ipr_space(soright) ((ipc_space_t)((unsigned int)(soright) &~ 1)) #define ipr_spacem(space) ((ipc_port_t)((unsigned int)(space) | 1)) -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ /* * Taking the ipc_port_multiple lock grants the privilege @@ -381,7 +381,7 @@ ipc_port_copyout_send_compat(/* ipc_port extern mach_port_t ipc_port_copyout_receiver(/* ipc_port_t, ipc_space_t */); -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ extern void ipc_port_print(/* ipc_port_t */); @@ -402,6 +402,6 @@ ipc_port_print(/* ipc_port_t */); #define ip_nsproxy(nsrequest) ((ipc_port_t)((unsigned int)(nsrequest) &~ 1)) #define ip_nsproxym(proxy) ((ipc_port_t)((unsigned int)(proxy) | 1)) -#endif NORMA_IPC +#endif /* NORMA_IPC */ -#endif _IPC_IPC_PORT_H_ +#endif /* _IPC_IPC_PORT_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_pset.c gnumach-1.3/ipc/ipc_pset.c --- gnumach-1.2/ipc/ipc_pset.c Mon Jun 21 11:58:26 1999 +++ gnumach-1.3/ipc/ipc_pset.c Mon May 27 11:17:01 2002 @@ -346,4 +346,4 @@ ipc_pset_print( indent -=2; } -#endif MACH_KDB +#endif /* MACH_KDB */ diff -brNpu gnumach-1.2/ipc/ipc_pset.h gnumach-1.3/ipc/ipc_pset.h --- gnumach-1.2/ipc/ipc_pset.h Mon Jun 21 11:58:28 1999 +++ gnumach-1.3/ipc/ipc_pset.h Mon May 27 11:17:01 2002 @@ -92,4 +92,4 @@ ipc_pset_destroy(/* ipc_pset_t */); extern void ipc_pset_print(/* ipc_pset_t */); -#endif _IPC_IPC_PSET_H_ +#endif /* _IPC_IPC_PSET_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_right.c gnumach-1.3/ipc/ipc_right.c --- gnumach-1.2/ipc/ipc_right.c Mon Jun 21 11:58:26 1999 +++ gnumach-1.3/ipc/ipc_right.c Mon May 27 11:17:01 2002 @@ -221,7 +221,7 @@ ipc_right_dnrequest( previous = IP_NULL; } else -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ previous = ipc_right_dncancel_macro( space, port, name, entry); @@ -263,7 +263,7 @@ ipc_right_dnrequest( entry->ie_request = request; #if MACH_IPC_COMPAT entry->ie_bits = bits &~ IE_BITS_COMPAT; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ is_write_unlock(space); break; } @@ -273,7 +273,7 @@ ipc_right_dnrequest( is_write_unlock(space); return KERN_INVALID_NAME; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ bits = entry->ie_bits; assert(bits & MACH_PORT_TYPE_DEAD_NAME); @@ -346,7 +346,7 @@ ipc_right_dncancel( is_release(space); dnrequest = IP_NULL; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ return dnrequest; } @@ -419,7 +419,7 @@ ipc_right_inuse(space, name, entry) return FALSE; } } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ is_write_unlock(space); return TRUE; @@ -498,7 +498,7 @@ ipc_right_check(space, port, name, entry return TRUE; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ /* convert entry to dead name */ @@ -727,7 +727,7 @@ ipc_right_destroy( #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) return KERN_INVALID_NAME; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ break; } @@ -843,7 +843,7 @@ ipc_right_dealloc(space, name, entry) #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) goto invalid_name; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ bits = entry->ie_bits; assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME); @@ -882,7 +882,7 @@ ipc_right_dealloc(space, name, entry) #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) goto invalid_name; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ bits = entry->ie_bits; assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME); @@ -976,7 +976,7 @@ ipc_right_dealloc(space, name, entry) invalid_name: is_write_unlock(space); return KERN_INVALID_NAME; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ } /* @@ -1086,7 +1086,7 @@ ipc_right_delta(space, name, entry, righ entry->ie_object = IO_NULL; ipc_entry_dealloc(space, name, entry); } else -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ if (bits & MACH_PORT_TYPE_SEND) { assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_SEND_RECEIVE); @@ -1152,7 +1152,7 @@ ipc_right_delta(space, name, entry, righ #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) goto invalid_name; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ assert(!(entry->ie_bits & MACH_PORT_TYPE_SEND_ONCE)); goto invalid_right; @@ -1198,7 +1198,7 @@ ipc_right_delta(space, name, entry, righ #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) goto invalid_name; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ bits = entry->ie_bits; } else if ((bits & MACH_PORT_TYPE_DEAD_NAME) == 0) @@ -1250,7 +1250,7 @@ ipc_right_delta(space, name, entry, righ #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) goto invalid_name; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ assert((entry->ie_bits & MACH_PORT_TYPE_SEND) == 0); goto invalid_right; @@ -1337,7 +1337,7 @@ ipc_right_delta(space, name, entry, righ invalid_name: is_write_unlock(space); return KERN_INVALID_NAME; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ } /* @@ -1372,7 +1372,7 @@ ipc_right_info( is_write_unlock(space); return KERN_INVALID_NAME; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ bits = entry->ie_bits; assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME); @@ -1387,7 +1387,7 @@ ipc_right_info( if (bits & IE_BITS_COMPAT) type |= MACH_PORT_TYPE_COMPAT; else -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ if (request != 0) type |= MACH_PORT_TYPE_DNREQUEST; if (bits & IE_BITS_MAREQUEST) @@ -1449,7 +1449,7 @@ ipc_right_copyin_check( #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) return FALSE; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ break; } @@ -1631,7 +1631,7 @@ ipc_right_copyin( #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) goto invalid_name; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ bits = entry->ie_bits; goto copy_dead; @@ -1678,7 +1678,7 @@ ipc_right_copyin( #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) goto invalid_name; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ bits = entry->ie_bits; goto move_dead; @@ -1754,7 +1754,7 @@ ipc_right_copyin( #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) goto invalid_name; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ bits = entry->ie_bits; goto move_dead; @@ -1834,7 +1834,7 @@ ipc_right_copyin( #if MACH_IPC_COMPAT invalid_name: return KERN_INVALID_NAME; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ } /* @@ -1963,7 +1963,7 @@ ipc_right_copyin_two( #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) goto invalid_name; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ goto invalid_right; } @@ -2017,7 +2017,7 @@ ipc_right_copyin_two( #if MACH_IPC_COMPAT invalid_name: return KERN_INVALID_NAME; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ } /* @@ -2258,7 +2258,7 @@ ipc_right_rename( is_write_unlock(space); return KERN_INVALID_NAME; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ bits = oentry->ie_bits; assert(IE_BITS_TYPE(bits) == MACH_PORT_TYPE_DEAD_NAME); @@ -2759,4 +2759,4 @@ ipc_right_copyin_header(space, name, ent return KERN_INVALID_NAME; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ diff -brNpu gnumach-1.2/ipc/ipc_right.h gnumach-1.3/ipc/ipc_right.h --- gnumach-1.2/ipc/ipc_right.h Mon Jun 21 11:58:28 1999 +++ gnumach-1.3/ipc/ipc_right.h Mon May 27 11:17:01 2002 @@ -120,5 +120,5 @@ extern kern_return_t ipc_right_copyin_header(/* ipc_space_t, mach_port_t, ipc_entry_t, ipc_object_t *, mach_msg_type_name_t * */); -#endif MACH_IPC_COMPAT -#endif _IPC_IPC_RIGHT_H_ +#endif /* MACH_IPC_COMPAT */ +#endif /* _IPC_IPC_RIGHT_H_ */ diff -brNpu gnumach-1.2/ipc/ipc_space.c gnumach-1.3/ipc/ipc_space.c --- gnumach-1.2/ipc/ipc_space.c Mon Jun 21 11:58:26 1999 +++ gnumach-1.3/ipc/ipc_space.c Mon May 27 11:17:01 2002 @@ -61,7 +61,7 @@ ipc_space_t ipc_space_kernel; ipc_space_t ipc_space_reply; #if NORMA_IPC ipc_space_t ipc_space_remote; -#endif NORMA_IPC +#endif /* NORMA_IPC */ /* * Routine: ipc_space_reference @@ -178,7 +178,7 @@ ipc_space_create( ip_unlock(port); space->is_notify = port; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ *spacep = space; return KERN_SUCCESS; @@ -305,7 +305,7 @@ ipc_space_destroy( #if MACH_IPC_COMPAT if (IP_VALID(space->is_notify)) ipc_port_release_send(space->is_notify); -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ /* * Because the space is now dead, diff -brNpu gnumach-1.2/ipc/ipc_space.h gnumach-1.3/ipc/ipc_space.h --- gnumach-1.2/ipc/ipc_space.h Mon Jun 21 11:58:28 1999 +++ gnumach-1.3/ipc/ipc_space.h Mon May 27 11:17:01 2002 @@ -82,7 +82,7 @@ struct ipc_space { #if MACH_IPC_COMPAT struct ipc_port *is_notify; /* notification port */ -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ }; #define IS_NULL ((ipc_space_t) 0) @@ -96,7 +96,7 @@ extern struct ipc_space *ipc_space_kerne extern struct ipc_space *ipc_space_reply; #if NORMA_IPC extern struct ipc_space *ipc_space_remote; -#endif NORMA_IPC +#endif /* NORMA_IPC */ #define is_ref_lock_init(is) simple_lock_init(&(is)->is_ref_lock_data) @@ -160,5 +160,5 @@ void ipc_space_destroy(struct ipc_space #define ipc_space_make_notify(space) \ ipc_port_copy_send(space->is_notify) -#endif MACH_IPC_COMPAT -#endif _IPC_IPC_SPACE_H_ +#endif /* MACH_IPC_COMPAT */ +#endif /* _IPC_IPC_SPACE_H_ */ diff -brNpu gnumach-1.2/ipc/mach_debug.c gnumach-1.3/ipc/mach_debug.c --- gnumach-1.2/ipc/mach_debug.c Mon Jun 21 11:58:27 1999 +++ gnumach-1.3/ipc/mach_debug.c Mon May 27 11:17:01 2002 @@ -383,9 +383,9 @@ mach_port_space_info( iin->iin_collision = (bits & IE_BITS_COLLISION) ? TRUE : FALSE; #if MACH_IPC_COMPAT iin->iin_compat = (bits & IE_BITS_COMPAT) ? TRUE : FALSE; -#else MACH_IPC_COMPAT +#else /* MACH_IPC_COMPAT */ iin->iin_compat = FALSE; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ iin->iin_marequest = (bits & IE_BITS_MAREQUEST) ? TRUE : FALSE; iin->iin_type = IE_BITS_TYPE(bits); iin->iin_urefs = IE_BITS_UREFS(bits); @@ -408,9 +408,9 @@ mach_port_space_info( iin->iin_collision = (bits & IE_BITS_COLLISION) ? TRUE : FALSE; #if MACH_IPC_COMPAT iin->iin_compat = (bits & IE_BITS_COMPAT) ? TRUE : FALSE; -#else MACH_IPC_COMPAT +#else /* MACH_IPC_COMPAT */ iin->iin_compat = FALSE; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ iin->iin_marequest = (bits & IE_BITS_MAREQUEST) ? TRUE : FALSE; iin->iin_type = IE_BITS_TYPE(bits); iin->iin_urefs = IE_BITS_UREFS(bits); diff -brNpu gnumach-1.2/ipc/mach_msg.c gnumach-1.3/ipc/mach_msg.c --- gnumach-1.2/ipc/mach_msg.c Mon Jun 21 11:58:26 1999 +++ gnumach-1.3/ipc/mach_msg.c Mon May 27 11:17:01 2002 @@ -641,7 +641,7 @@ mach_msg_trap(msg, option, send_size, rc ip_unlock(reply_port); goto norma_send; } -#endif NORMA_IPC +#endif /* NORMA_IPC */ if (dest_port->ip_msgcount >= dest_port->ip_qlimit) goto abort_request_send_receive; @@ -760,7 +760,7 @@ mach_msg_trap(msg, option, send_size, rc ip_unlock(dest_port); goto norma_send; } -#endif NORMA_IPC +#endif /* NORMA_IPC */ /* optimized ipc_entry_lookup/ipc_mqueue_copyin */ @@ -861,7 +861,7 @@ mach_msg_trap(msg, option, send_size, rc assert(dest_port->ip_receiver != ipc_space_kernel); #if NORMA_IPC assert(! IP_NORMA_IS_PROXY(dest_port)); -#endif NORMA_IPC +#endif /* NORMA_IPC */ assert((dest_port->ip_msgcount < dest_port->ip_qlimit) || (MACH_MSGH_BITS_REMOTE(kmsg->ikm_header.msgh_bits) == MACH_MSG_TYPE_PORT_SEND_ONCE)); @@ -1343,7 +1343,7 @@ mach_msg_trap(msg, option, send_size, rc if (ip_active(dest_port) && #if NORMA_IPC (! IP_NORMA_IS_PROXY(dest_port)) && -#endif NORMA_IPC +#endif /* NORMA_IPC */ ((dest_port->ip_msgcount < dest_port->ip_qlimit) || (MACH_MSGH_BITS_REMOTE(kmsg->ikm_header.msgh_bits) == MACH_MSG_TYPE_PORT_SEND_ONCE))) @@ -1400,7 +1400,7 @@ mach_msg_trap(msg, option, send_size, rc } goto slow_get_rcv_port; -#endif NORMA_IPC +#endif /* NORMA_IPC */ kernel_send: /* @@ -2276,4 +2276,4 @@ msg_receive_continue() } #endif /* CONTINUATIONS */ -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ diff -brNpu gnumach-1.2/ipc/mach_msg.h gnumach-1.3/ipc/mach_msg.h --- gnumach-1.2/ipc/mach_msg.h Mon Jun 21 11:58:27 1999 +++ gnumach-1.3/ipc/mach_msg.h Mon May 27 11:17:01 2002 @@ -64,5 +64,5 @@ mach_msg_interrupt(/* thread_t */); extern void msg_receive_continue(); -#endif MACH_IPC_COMPAT -#endif _IPC_MACH_MSG_H_ +#endif /* MACH_IPC_COMPAT */ +#endif /* _IPC_MACH_MSG_H_ */ diff -brNpu gnumach-1.2/ipc/mach_port.c gnumach-1.3/ipc/mach_port.c --- gnumach-1.2/ipc/mach_port.c Mon Jun 21 11:58:27 1999 +++ gnumach-1.3/ipc/mach_port.c Mon May 27 11:17:01 2002 @@ -105,7 +105,7 @@ mach_port_names_helper( #if MACH_IPC_COMPAT if (bits & IE_BITS_COMPAT) return; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ /* pretend this is a dead-name entry */ @@ -122,7 +122,7 @@ mach_port_names_helper( if (bits & IE_BITS_COMPAT) type |= MACH_PORT_TYPE_COMPAT; else -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ if (request != 0) type |= MACH_PORT_TYPE_DNREQUEST; if (bits & IE_BITS_MAREQUEST) @@ -1239,7 +1239,7 @@ mach_port_request_notification( ipc_port_release_send(ip_pdsend(previous)); previous = IP_NULL; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ *previousp = previous; break; @@ -2502,4 +2502,4 @@ port_extract_receive(space, name, portp) return kr; } -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ diff -brNpu gnumach-1.2/kern/act.c gnumach-1.3/kern/act.c --- gnumach-1.2/kern/act.c Mon Jun 21 11:58:29 1999 +++ gnumach-1.3/kern/act.c Mon May 27 11:17:01 2002 @@ -934,7 +934,7 @@ act_get_special_port(Act *act, int which case THREAD_REPLY_PORT: whichp = &act->reply_port; break; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ case THREAD_KERNEL_PORT: whichp = &act->self_port; @@ -994,7 +994,7 @@ act_set_special_port(Act *act, int which case THREAD_REPLY_PORT: whichp = &act->reply_port; break; -#endif MACH_IPC_COMPAT +#endif /* MACH_IPC_COMPAT */ case THREAD_KERNEL_PORT: whichp = &act->self_port; diff -brNpu gnumach-1.2/kern/assert.h gnumach-1.3/kern/assert.h --- gnumach-1.2/kern/assert.h Mon Jun 21 11:58:37 1999 +++ gnumach-1.3/kern/assert.h Mon May 27 11:17:01 2002 @@ -46,13 +46,13 @@ MACRO_END #ifdef lint #define assert_static(x) -#else lint +#else /* lint */ #define assert_static(x) assert(x) -#endif lint +#endif /* lint */ -#else MACH_ASSERT +#else /* MACH_ASSERT */ #define assert(ex) #define assert_static(ex) -#endif MACH_ASSERT +#endif /* MACH_ASSERT */ -#endif _KERN_ASSERT_H_ +#endif /* _KERN_ASSERT_H_ */ diff -brNpu gnumach-1.2/kern/ast.c gnumach-1.3/kern/ast.c --- gnumach-1.2/kern/ast.c Mon Jun 21 11:58:29 1999 +++ gnumach-1.3/kern/ast.c Mon May 27 11:17:01 2002 @@ -52,7 +52,7 @@ #if MACH_FIXPRI #include -#endif MACH_FIXPRI +#endif /* MACH_FIXPRI */ volatile ast_t need_ast[NCPUS]; @@ -65,7 +65,7 @@ ast_init() for (i=0; i 1 +#endif /* NCPUS > 1 */ case PROCESSOR_RUNNING: @@ -194,7 +194,7 @@ ast_check() } } else { -#endif MACH_FIXPRI +#endif /* MACH_FIXPRI */ rq = &(myprocessor->processor_set->runq); if (!(myprocessor->first_quantum) && (rq->count > 0)) { register queue_t q; @@ -230,7 +230,7 @@ ast_check() } #if MACH_FIXPRI } -#endif MACH_FIXPRI +#endif /* MACH_FIXPRI */ break; default: diff -brNpu gnumach-1.2/kern/ast.h gnumach-1.3/kern/ast.h --- gnumach-1.2/kern/ast.h Mon Jun 21 11:58:37 1999 +++ gnumach-1.3/kern/ast.h Mon May 27 11:17:01 2002 @@ -78,12 +78,12 @@ extern volatile ast_t need_ast[NCPUS]; /* * machine/ast.h is responsible for defining aston and astoff. */ -#else MACHINE_AST +#else /* MACHINE_AST */ #define aston(mycpu) #define astoff(mycpu) -#endif MACHINE_AST +#endif /* MACHINE_AST */ extern void ast_taken(); @@ -129,4 +129,4 @@ MACRO_END * be followed by ast_propagate(). */ -#endif _KERN_AST_H_ +#endif /* _KERN_AST_H_ */ diff -brNpu gnumach-1.2/kern/boot_script.c gnumach-1.3/kern/boot_script.c --- gnumach-1.2/kern/boot_script.c Wed Dec 31 16:00:00 1969 +++ gnumach-1.3/kern/boot_script.c Mon May 27 11:17:01 2002 @@ -0,0 +1,788 @@ +/* Boot script parser for Mach. */ + +/* Written by Shantanu Goel (goel@cs.columbia.edu). */ + +#include +#if !KERNEL || OSKIT_MACH +#include +#endif +#include "boot_script.h" + + +/* This structure describes a symbol. */ +struct sym +{ + /* Symbol name. */ + const char *name; + + /* Type of value returned by function. */ + int type; + + /* Symbol value. */ + int val; + + /* For function symbols; type of value returned by function. */ + int ret_type; + + /* For function symbols; if set, execute function at the time + of command execution, not during parsing. A function with + this field set must also have `no_arg' set. Also, the function's + `val' argument will always be NULL. */ + int run_on_exec; +}; + +/* Additional values symbols can take. + These are only used internally. */ +#define VAL_SYM 10 /* symbol table entry */ +#define VAL_FUNC 11 /* function pointer */ + +/* This structure describes an argument. */ +struct arg +{ + /* Argument text copied verbatim. 0 if none. */ + char *text; + + /* Type of value assigned. 0 if none. */ + int type; + + /* Argument value. */ + int val; +}; + +/* List of commands. */ +static struct cmd **cmds = 0; + +/* Amount allocated for `cmds'. */ +static int cmds_alloc = 0; + +/* Next available slot in `cmds'. */ +static int cmds_index = 0; + +/* Symbol table. */ +static struct sym **symtab = 0; + +/* Amount allocated for `symtab'. */ +static int symtab_alloc = 0; + +/* Next available slot in `symtab'. */ +static int symtab_index = 0; + +/* Create a task and suspend it. */ +static int +create_task (struct cmd *cmd, int *val) +{ + int err = boot_script_task_create (cmd); + *val = (int) cmd->task; + return err; +} + +/* Resume a task. */ +static int +resume_task (struct cmd *cmd, int *val) +{ + return boot_script_task_resume (cmd); +} + +/* Resume a task when the user hits return. */ +static int +prompt_resume_task (struct cmd *cmd, int *val) +{ + return boot_script_prompt_task_resume (cmd); +} + +/* List of builtin symbols. */ +static struct sym builtin_symbols[] = +{ + { "task-create", VAL_FUNC, (int) create_task, VAL_TASK, 0 }, + { "task-resume", VAL_FUNC, (int) resume_task, VAL_NONE, 1 }, + { "prompt-task-resume", VAL_FUNC, (int) prompt_resume_task, VAL_NONE, 1 }, +}; +#define NUM_BUILTIN (sizeof (builtin_symbols) / sizeof (builtin_symbols[0])) + +/* Free CMD and all storage associated with it. + If ABORTING is set, terminate the task associated with CMD, + otherwise just deallocate the send right. */ +static void +free_cmd (struct cmd *cmd, int aborting) +{ + if (cmd->task) + boot_script_free_task (cmd->task, aborting); + if (cmd->args) + { + int i; + for (i = 0; i < cmd->args_index; i++) + boot_script_free (cmd->args[i], sizeof *cmd->args[i]); + boot_script_free (cmd->args, sizeof cmd->args[0] * cmd->args_alloc); + } + if (cmd->exec_funcs) + boot_script_free (cmd->exec_funcs, + sizeof cmd->exec_funcs[0] * cmd->exec_funcs_alloc); + boot_script_free (cmd, sizeof *cmd); +} + +/* Free all storage allocated by the parser. + If ABORTING is set, terminate all tasks. */ +static void +cleanup (int aborting) +{ + int i; + + for (i = 0; i < cmds_index; i++) + free_cmd (cmds[i], aborting); + boot_script_free (cmds, sizeof cmds[0] * cmds_alloc); + cmds = 0; + cmds_index = cmds_alloc = 0; + + for (i = 0; i < symtab_index; i++) + boot_script_free (symtab[i], sizeof *symtab[i]); + boot_script_free (symtab, sizeof symtab[0] * symtab_alloc); + symtab = 0; + symtab_index = symtab_alloc = 0; +} + +/* Add PTR to the list of pointers PTR_LIST, which + currently has ALLOC amount of space allocated to it, and + whose next available slot is INDEX. If more space + needs to to allocated, INCR is the amount by which + to increase it. Return 0 on success, non-zero otherwise. */ +static int +add_list (void *ptr, void ***ptr_list, int *alloc, int *index, int incr) +{ + if (*index == *alloc) + { + void **p; + + *alloc += incr; + p = boot_script_malloc (*alloc * sizeof (void *)); + if (! p) + { + *alloc -= incr; + return 1; + } + if (*ptr_list) + { + memcpy (p, *ptr_list, *index * sizeof (void *)); + boot_script_free (*ptr_list, (*alloc - incr) * sizeof (void *)); + } + *ptr_list = p; + } + *(*ptr_list + *index) = ptr; + *index += 1; + return 0; +} + +/* Create an argument with TEXT, value type TYPE, and value VAL. + Add the argument to the argument list of CMD. */ +static struct arg * +add_arg (struct cmd *cmd, char *text, int type, int val) +{ + struct arg *arg; + + arg = boot_script_malloc (sizeof (struct arg)); + if (arg) + { + arg->text = text; + arg->type = type; + arg->val = val; + if (add_list (arg, (void ***) &cmd->args, + &cmd->args_alloc, &cmd->args_index, 5)) + { + boot_script_free (arg, sizeof *arg); + return 0; + } + } + return arg; +} + +/* Search for the symbol NAME in the symbol table. */ +static struct sym * +sym_lookup (const char *name) +{ + int i; + + for (i = 0; i < symtab_index; i++) + if (! strcmp (name, symtab[i]->name)) + return symtab[i]; + return 0; +} + +/* Create an entry for symbol NAME in the symbol table. */ +static struct sym * +sym_enter (const char *name) +{ + struct sym *sym; + + sym = boot_script_malloc (sizeof (struct sym)); + if (sym) + { + memset (sym, 0, sizeof (struct sym)); + sym->name = name; + if (add_list (sym, (void ***) &symtab, &symtab_alloc, &symtab_index, 20)) + { + boot_script_free (sym, sizeof *sym); + return 0; + } + } + return sym; +} + +/* Parse the command line CMDLINE. */ +int +boot_script_parse_line (void *hook, char *cmdline) +{ + char *p, *q; + int error; + struct cmd *cmd; + struct arg *arg; + + /* Extract command name. Ignore line if it lacks a command. */ + for (p = cmdline; *p == ' ' || *p == '\t'; p++) + ; + if (*p == '#') + /* Ignore comment line. */ + return 0; + +#if 0 + if (*p && *p != ' ' && *p != '\t' && *p != '\n') + { + printf ("(bootstrap): %s\n", cmdline); + } +#endif + + for (q = p; *q && *q != ' ' && *q != '\t' && *q != '\n'; q++) + ; + if (p == q) + return 0; + + *q = '\0'; + + /* Allocate a command structure. */ + cmd = boot_script_malloc (sizeof (struct cmd)); + if (! cmd) + return BOOT_SCRIPT_NOMEM; + memset (cmd, 0, sizeof (struct cmd)); + cmd->hook = hook; + cmd->path = p; + p = q + 1; + + for (arg = 0;;) + { + if (! arg) + { + /* Skip whitespace. */ + while (*p == ' ' || *p == '\t') + p++; + + /* End of command line. */ + if (! *p || *p == '\n') + { + /* Add command to list. */ + if (add_list (cmd, (void ***) &cmds, + &cmds_alloc, &cmds_index, 10)) + { + error = BOOT_SCRIPT_NOMEM; + goto bad; + } + return 0; + } + } + + /* Look for a symbol. */ + if (arg || (*p == '$' && (*(p + 1) == '{' || *(p + 1) == '('))) + { + char end_char = (*(p + 1) == '{') ? '}' : ')'; + struct sym *sym = 0; + + for (p += 2;;) + { + char c; + int i, val, type; + struct sym *s; + + /* Parse symbol name. */ + for (q = p; *q && *q != '\n' && *q != end_char && *q != '='; q++) + ; + if (p == q || ! *q || *q == '\n' + || (end_char == '}' && *q != '}')) + { + error = BOOT_SCRIPT_SYNTAX_ERROR; + goto bad; + } + c = *q; + *q = '\0'; + + /* See if this is a builtin symbol. */ + for (i = 0; i < NUM_BUILTIN; i++) + if (! strcmp (p, builtin_symbols[i].name)) + break; + + if (i < NUM_BUILTIN) + s = &builtin_symbols[i]; + else + { + /* Look up symbol in symbol table. + If no entry exists, create one. */ + s = sym_lookup (p); + if (! s) + { + s = sym_enter (p); + if (! s) + { + error = BOOT_SCRIPT_NOMEM; + goto bad; + } + } + } + + /* Only values are allowed in ${...} constructs. */ + if (end_char == '}' && s->type == VAL_FUNC) + return BOOT_SCRIPT_INVALID_SYM; + + /* Check that assignment is valid. */ + if (c == '=' && s->type == VAL_FUNC) + { + error = BOOT_SCRIPT_INVALID_ASG; + goto bad; + } + + /* For function symbols, execute the function. */ + if (s->type == VAL_FUNC) + { + if (! s->run_on_exec) + { + (error + = ((*((int (*) (struct cmd *, int *)) s->val)) + (cmd, &val))); + if (error) + goto bad; + type = s->ret_type; + } + else + { + if (add_list (s, (void ***) &cmd->exec_funcs, + &cmd->exec_funcs_alloc, + &cmd->exec_funcs_index, 5)) + { + error = BOOT_SCRIPT_NOMEM; + goto bad; + } + type = VAL_NONE; + goto out; + } + } + else if (s->type == VAL_NONE) + { + type = VAL_SYM; + val = (int) s; + } + else + { + type = s->type; + val = s->val; + } + + if (sym) + { + sym->type = type; + sym->val = val; + } + else if (arg) + { + arg->type = type; + arg->val = val; + } + + out: + p = q + 1; + if (c == end_char) + { + /* Create an argument if necessary. + We create an argument if the symbol appears + in the expression by itself. + + NOTE: This is temporary till the boot filesystem + servers support arguments. When that happens, + symbol values will only be printed if they're + associated with an argument. */ + if (! arg && end_char == '}') + { + if (! add_arg (cmd, 0, type, val)) + { + error = BOOT_SCRIPT_NOMEM; + goto bad; + } + } + arg = 0; + break; + } + if (s->type != VAL_FUNC) + sym = s; + } + } + else + { + char c; + + /* Command argument; just copy the text. */ + for (q = p;; q++) + { + if (! *q || *q == ' ' || *q == '\t' || *q == '\n') + break; + if (*q == '$' && *(q + 1) == '{') + break; + } + c = *q; + *q = '\0'; + + /* Add argument to list. */ + arg = add_arg (cmd, p, VAL_NONE, 0); + if (! arg) + { + error = BOOT_SCRIPT_NOMEM; + goto bad; + } + if (c == '$') + p = q; + else + { + if (c) + p = q + 1; + else + p = q; + arg = 0; + } + } + } + + + bad: + free_cmd (cmd, 1); + cleanup (1); + return error; +} + +/* Ensure that the command line buffer can accommodate LEN bytes of space. */ +#define CHECK_CMDLINE_LEN(len) \ +{ \ + if (cmdline_alloc - cmdline_index < len) \ + { \ + char *ptr; \ + int alloc, i; \ + alloc = cmdline_alloc + len - (cmdline_alloc - cmdline_index) + 100; \ + ptr = boot_script_malloc (alloc); \ + if (! ptr) \ + { \ + error = BOOT_SCRIPT_NOMEM; \ + goto done; \ + } \ + memcpy (ptr, cmdline, cmdline_index); \ + for (i = 0; i < argc; ++i) \ + argv[i] = ptr + (argv[i] - cmdline); \ + boot_script_free (cmdline, cmdline_alloc); \ + cmdline = ptr; \ + cmdline_alloc = alloc; \ + } \ +} + +/* Execute commands previously parsed. */ +int +boot_script_exec () +{ + int cmd_index; + + for (cmd_index = 0; cmd_index < cmds_index; cmd_index++) + { + char **argv, *cmdline; + int i, argc, cmdline_alloc; + int cmdline_index, error, arg_index; + struct cmd *cmd = cmds[cmd_index]; + + /* Skip command if it doesn't have an associated task. */ + if (cmd->task == 0) + continue; + + /* Allocate a command line and copy command name. */ + cmdline_index = strlen (cmd->path) + 1; + cmdline_alloc = cmdline_index + 100; + cmdline = boot_script_malloc (cmdline_alloc); + if (! cmdline) + { + cleanup (1); + return BOOT_SCRIPT_NOMEM; + } + memcpy (cmdline, cmd->path, cmdline_index); + + /* Allocate argument vector. */ + argv = boot_script_malloc (sizeof (char *) * (cmd->args_index + 2)); + if (! argv) + { + boot_script_free (cmdline, cmdline_alloc); + cleanup (1); + return BOOT_SCRIPT_NOMEM; + } + argv[0] = cmdline; + argc = 1; + + /* Build arguments. */ + for (arg_index = 0; arg_index < cmd->args_index; arg_index++) + { + struct arg *arg = cmd->args[arg_index]; + + /* Copy argument text. */ + if (arg->text) + { + int len = strlen (arg->text); + + if (arg->type == VAL_NONE) + len++; + CHECK_CMDLINE_LEN (len); + memcpy (cmdline + cmdline_index, arg->text, len); + argv[argc++] = &cmdline[cmdline_index]; + cmdline_index += len; + } + + /* Add value of any symbol associated with this argument. */ + if (arg->type != VAL_NONE) + { + char *p, buf[50]; + int len; + mach_port_t name; + + if (arg->type == VAL_SYM) + { + struct sym *sym = (struct sym *) arg->val; + + /* Resolve symbol value. */ + while (sym->type == VAL_SYM) + sym = (struct sym *) sym->val; + if (sym->type == VAL_NONE) + { + error = BOOT_SCRIPT_UNDEF_SYM; + goto done; + } + arg->type = sym->type; + arg->val = sym->val; + } + + /* Print argument value. */ + switch (arg->type) + { + case VAL_STR: + p = (char *) arg->val; + len = strlen (p); + break; + + case VAL_TASK: + case VAL_PORT: + if (arg->type == VAL_TASK) + /* Insert send right to task port. */ + error = boot_script_insert_task_port + (cmd, (task_t) arg->val, &name); + else + /* Insert send right. */ + error = boot_script_insert_right (cmd, + (mach_port_t) arg->val, + &name); + if (error) + goto done; + + i = name; + p = buf + sizeof (buf); + len = 0; + do + { + *--p = i % 10 + '0'; + len++; + } + while (i /= 10); + break; + + default: + error = BOOT_SCRIPT_BAD_TYPE; + goto done; + } + len++; + CHECK_CMDLINE_LEN (len); + memcpy (cmdline + cmdline_index, p, len - 1); + *(cmdline + cmdline_index + len - 1) = '\0'; + if (! arg->text) + argv[argc++] = &cmdline[cmdline_index]; + cmdline_index += len; + } + } + + /* Terminate argument vector. */ + argv[argc] = 0; + + /* Execute the command. */ + if (boot_script_exec_cmd (cmd->hook, cmd->task, cmd->path, + argc, argv, cmdline, cmdline_index)) + { + error = BOOT_SCRIPT_EXEC_ERROR; + goto done; + } + + error = 0; + + done: + boot_script_free (cmdline, cmdline_alloc); + boot_script_free (argv, sizeof (char *) * (cmd->args_index + 2)); + if (error) + { + cleanup (1); + return error; + } + } + + for (cmd_index = 0; cmd_index < cmds_index; cmd_index++) + { + int i; + struct cmd *cmd = cmds[cmd_index]; + + /* Execute functions that want to be run on exec. */ + for (i = 0; i < cmd->exec_funcs_index; i++) + { + struct sym *sym = cmd->exec_funcs[i]; + int error = ((*((int (*) (struct cmd *, int *)) sym->val)) + (cmd, 0)); + if (error) + { + cleanup (1); + return error; + } + } + } + + cleanup (0); + return 0; +} + +/* Create an entry for the variable NAME with TYPE and value VAL, + in the symbol table. */ +int +boot_script_set_variable (const char *name, int type, int val) +{ + struct sym *sym = sym_enter (name); + + if (sym) + { + sym->type = type; + sym->val = val; + } + return sym ? 0 : 1; +} + + +/* Define the function NAME, which will return type RET_TYPE. */ +int +boot_script_define_function (const char *name, int ret_type, + int (*func) (const struct cmd *cmd, int *val)) +{ + struct sym *sym = sym_enter (name); + + if (sym) + { + sym->type = VAL_FUNC; + sym->val = (int) func; + sym->ret_type = ret_type; + sym->run_on_exec = ret_type == VAL_NONE; + } + return sym ? 0 : 1; +} + + +/* Return a string describing ERR. */ +char * +boot_script_error_string (int err) +{ + switch (err) + { + case BOOT_SCRIPT_NOMEM: + return "no memory"; + + case BOOT_SCRIPT_SYNTAX_ERROR: + return "syntax error"; + + case BOOT_SCRIPT_INVALID_ASG: + return "invalid variable in assignment"; + + case BOOT_SCRIPT_MACH_ERROR: + return "mach error"; + + case BOOT_SCRIPT_UNDEF_SYM: + return "undefined symbol"; + + case BOOT_SCRIPT_EXEC_ERROR: + return "exec error"; + + case BOOT_SCRIPT_INVALID_SYM: + return "invalid variable in expression"; + + case BOOT_SCRIPT_BAD_TYPE: + return "invalid value type"; + } + return 0; +} + +#ifdef BOOT_SCRIPT_TEST +#include + +int +boot_script_exec_cmd (void *hook, + mach_port_t task, char *path, int argc, + char **argv, char *strings, int stringlen) +{ + int i; + + printf ("port = %d: ", (int) task); + for (i = 0; i < argc; i++) + printf ("%s ", argv[i]); + printf ("\n"); + return 0; +} + +void +main (int argc, char **argv) +{ + char buf[500], *p; + int len; + FILE *fp; + mach_port_t host_port, device_port; + + if (argc < 2) + { + fprintf (stderr, "Usage: %s