Commit graph

420 commits

Author SHA1 Message Date
David van Moolenbroek f11f597777 Make message type ranges in com.h (eventually) unique 2009-10-01 10:33:01 +00:00
David van Moolenbroek b423d7b477 Merge of David's ptrace branch. Summary:
o Support for ptrace T_ATTACH/T_DETACH and T_SYSCALL
o PM signal handling logic should now work properly, even with debuggers
  being present
o Asynchronous PM/VFS protocol, full IPC support for senda(), and
  AMF_NOREPLY senda() flag

DETAILS

Process stop and delay call handling of PM:
o Added sys_runctl() kernel call with sys_stop() and sys_resume()
  aliases, for PM to stop and resume a process
o Added exception for sending/syscall-traced processes to sys_runctl(),
  and matching SIGKREADY pseudo-signal to PM
o Fixed PM signal logic to deal with requests from a process after
  stopping it (so-called "delay calls"), using the SIGKREADY facility
o Fixed various PM panics due to race conditions with delay calls versus
  VFS calls
o Removed special PRIO_STOP priority value
o Added SYS_LOCK RTS kernel flag, to stop an individual process from
  running while modifying its process structure

Signal and debugger handling in PM:
o Fixed debugger signals being dropped if a second signal arrives when
  the debugger has not retrieved the first one
o Fixed debugger signals being sent to the debugger more than once
o Fixed debugger signals unpausing process in VFS; removed PM_UNPAUSE_TR
  protocol message
o Detached debugger signals from general signal logic and from being
  blocked on VFS calls, meaning that even VFS can now be traced
o Fixed debugger being unable to receive more than one pending signal in
  one process stop
o Fixed signal delivery being delayed needlessly when multiple signals
  are pending
o Fixed wait test for tracer, which was returning for children that were
  not waited for
o Removed second parallel pending call from PM to VFS for any process
o Fixed process becoming runnable between exec() and debugger trap
o Added support for notifying the debugger before the parent when a
  debugged child exits
o Fixed debugger death causing child to remain stopped forever
o Fixed consistently incorrect use of _NSIG

Extensions to ptrace():
o Added T_ATTACH and T_DETACH ptrace request, to attach and detach a
  debugger to and from a process
o Added T_SYSCALL ptrace request, to trace system calls
o Added T_SETOPT ptrace request, to set trace options
o Added TO_TRACEFORK trace option, to attach automatically to children
  of a traced process
o Added TO_ALTEXEC trace option, to send SIGSTOP instead of SIGTRAP upon
  a successful exec() of the tracee
o Extended T_GETUSER ptrace support to allow retrieving a process's priv
  structure
o Removed T_STOP ptrace request again, as it does not help implementing
  debuggers properly
o Added MINIX3-specific ptrace test (test42)
o Added proper manual page for ptrace(2)

Asynchronous PM/VFS interface:
o Fixed asynchronous messages not being checked when receive() is called
  with an endpoint other than ANY
o Added AMF_NOREPLY senda() flag, preventing such messages from
  satisfying the receive part of a sendrec()
o Added asynsend3() that takes optional flags; asynsend() is now a
  #define passing in 0 as third parameter
o Made PM/VFS protocol asynchronous; reintroduced tell_fs()
o Made PM_BASE request/reply number range unique
o Hacked in a horrible temporary workaround into RS to deal with newly
  revealed RS-PM-VFS race condition triangle until VFS is asynchronous

System signal handling:
o Fixed shutdown logic of device drivers; removed old SIGKSTOP signal
o Removed is-superuser check from PM's do_procstat() (aka getsigset())
o Added sigset macros to allow system processes to deal with the full
  signal set, rather than just the POSIX subset

Miscellaneous PM fixes:
o Split do_getset into do_get and do_set, merging common code and making
  structure clearer
o Fixed setpriority() being able to put to sleep processes using an
  invalid parameter, or revive zombie processes
o Made find_proc() global; removed obsolete proc_from_pid()
o Cleanup here and there

Also included:
o Fixed false-positive boot order kernel warning
o Removed last traces of old NOTIFY_FROM code

THINGS OF POSSIBLE INTEREST

o It should now be possible to run PM at any priority, even lower than
  user processes
o No assumptions are made about communication speed between PM and VFS,
  although communication must be FIFO
o A debugger will now receive incoming debuggee signals at kill time
  only; the process may not yet be fully stopped
o A first step has been made towards making the SYSTEM task preemptible
2009-09-30 09:57:22 +00:00
Tomas Hruby 40b1d58077 Mostly a revert of r5306. com.h defines MAX_NR_TASKS value which replaces
NR_TASKS in the endpoint macros. MAX_NR_TASKS defines the maximal number of
kernel tasks. It is unlikely that we will ever need this many tasks as the goal
is not to have such a difference in the future. For now it makes possible to
remove the limiting NR_TASKS from the endpoint code.
2009-09-29 20:13:41 +00:00
Tomas Hruby 256610f1d5 Macros in endpoint.h need to know about endpoint_t 2009-09-28 16:25:47 +00:00
Ben Gras 0d7b967413 give sys_fork() a real endpoint_t * arg 2009-09-23 10:48:57 +00:00
Erik van der Kouwe 789c8a6ee4 Fixed compilation errors in ps.c and rs/manager.c. The former was fixed by disabling code using no-longer-existant flags and the latter by removing the spurious parameter i from sys_privctl 2009-09-23 08:46:17 +00:00
Tomas Hruby f53377ed67 Removed the broken PROC_EVENT and SYN_ALARM from VFS 2009-09-22 22:11:20 +00:00
Tomas Hruby c0a1fd1292 Removed NR_TASKS from macros manipulating endpoint_t
- the magic numbers ANY, NONE and SELF are kept for the compatibility with the
  current userspace. It is OK as long as NR_PROCS is greater so they don't
  colide with other endpoints

- the 32 bit endpoint_t value is split in half, lower 16 bits for process slot
  number and upper half for generation number

- transition to a structured endpoint_t in the future possible
2009-09-22 21:45:26 +00:00
Tomas Hruby b900311656 endpoint_t in syslib
- headers use the endpoint_t in syslib.h and the implmentation was using int
  instead. Both uses endpoint_t now

- every variable named like proc, proc_nr or proc_nr_e of type endpoint_t has
  name proc_ep now

- endpoint_t defined as u32_t not int
2009-09-22 21:42:02 +00:00
Ben Gras 32fa22fc2d RS_LOOKUP feature for libc functions that want to access servers.
let ipc talk to all USER processes and vice versa.

pm sig wrapper notify has to be called from two files.

actually install include files.
2009-09-21 15:25:15 +00:00
Ben Gras 8a54d267f0 - VM_KERN_NOPAGEZERO feature is gone
- sys_getbiosbuffer feature is gone (from kernel; available from vm)
- bump version number because munmap() calls that newly compiled binaries
  will do trigger an ugly (but harmless) error message in older VM's
- some new VM calls and flags, the new IPC calls
- some new CR0 register bits
- added files for shared memory
2009-09-21 14:23:10 +00:00
David van Moolenbroek c72487dc9f remove unused NEW_KSIG definition 2009-09-07 22:12:50 +00:00
David van Moolenbroek 8ef6c9b063 cleanup: sys_irqrmpolicy does not need IRQ vector 2009-09-06 14:24:44 +00:00
David van Moolenbroek 9b417d616f remove unused IRQ_ENDPT definition 2009-09-06 14:14:03 +00:00
David van Moolenbroek 979bcfc195 - sys_privctl: don't mix message types
- sys_privctl: remove CTL_MM_PRIV (third parameter)
- remove obsolete sys_svrctl.c library file
2009-09-06 12:37:13 +00:00
Thomas Veerman b47483433c Added a hack to start binaries from the boot image only. In particular, setting
bin_img=1 in the boot monitor will make sure that during the boot procedure the
mfs binary that is part of the boot image is the only binary that is used to
mount partitions. This is useful when for some reason the mfs binary on disk 
malfunctions, rendering Minix unable to boot. By setting bin_img=1, the binary
on disk is ignored and the binary in the boot image is used instead.

- 'service' now accepts an additional flag -r. -r implies -c. -r instructs RS
  to first look in memory if the binary has already been copied to memory and
  execute that version, instead of loading the binary from disk. For example,
  the first time a MFS is being started it is copied (-c) to memory and
  executed from there. The second time MFS is being started this way, RS will
  look in memory for a previously copied MFS binary and reuse it if it exists.
- The mount and newroot commands now accept an additional flag -i, which
  instructs them to set the MS_REUSE flag in the mount flags.
- The mount system call now supports the MS_REUSE flag and invokes 'service'
  with the -r flag when MS_REUSE is set.
- /etc/rc and the rc script that's included in the boot image check for the
  existence of the bin_img flag in the boot monitor, and invoke mount and 
  newroot with the -i flag accordingly.
2009-08-18 11:36:01 +00:00
David van Moolenbroek 47a2bfeddd small errno.h corrections 2009-08-18 09:26:51 +00:00
Tomas Hruby bd2dd15cc6 Missing defines preventing recursive includesion in some include/sys/*.h files 2009-08-17 14:34:14 +00:00
Erik van der Kouwe d1b4c5be5b Removed obsolete declarations in include/ipc.h 2009-08-16 15:12:07 +00:00
David van Moolenbroek 5a13b2eda8 nanosleep(3), and sleep(3) rewrite, by Erik van der Kouwe 2009-08-15 22:14:48 +00:00
David van Moolenbroek 323f0abdd6 Support for setitimer(ITIMER_VIRTUAL/ITIMER_PROF). New test (41) for setitimer. 2009-08-15 21:37:26 +00:00
David van Moolenbroek d82e260a90 Support for setitimer(ITIMER_REAL). 2009-08-15 16:09:32 +00:00
Tomas Hruby 88f7b63019 u64_t for human beings - the high and low parts are named hi and lo, lib/sysutil/profile.c updated accordingly 2009-08-13 15:47:49 +00:00
Thomas Veerman c2ffe723d1 - Moved (u)mount prototypes from unistd.h to sys/mount.h.
- Prepared mount system call to accept multiple mount flags
   instead of just read_only (however, it remains backwards
   compatible).
 - Updated the man mount(2) to reflect new header file usage. 
 - Updated badblocks, newroot, mount, and umount commands to use the
   new header file.
2009-08-12 19:57:37 +00:00
David van Moolenbroek 1a9e07b0e5 PM: fix ptrace(T_EXIT) 'exit_proc: not idle' race condition. 2009-07-11 13:22:56 +00:00
David van Moolenbroek 66d1f1260c remove last traces of FSDEVMAP svrctl 2009-06-13 13:09:14 +00:00
Arun Thomas dac531addf Support for VMWare Workstation 6.x
VMWare Workstation 6.x would previously die when running MINIX 3 with an
IOSPACE assertion and several error messages about multiply registered
I/O ports. The assertion is triggered when we probe for BAR sizes in
record_bar(). The solution: The PCI driver now disables I/O and mem
access before probing for BAR sizes.

Bumped up NR_PCIDEV and NR_PCIBUS, since Workstation 6.x virtualizes
more PCI buses and devices.
2009-05-27 23:35:34 +00:00
Ben Gras fe39483dc9 4MB mask 2009-05-18 15:56:13 +00:00
Ben Gras bdab3c4cfb Library call for cpu features; make kernel and vm use this to query cpu
features (specifically: 4MB pages and TLB global bit).  Only enable
these features in CR4 if available. 4MB pages to be used in the near
future.
2009-05-15 17:07:36 +00:00
David van Moolenbroek fe8c612aa4 support in 'mount' for specifying file system type and options 2009-05-13 15:39:44 +00:00
Ben Gras dd56aa321f to let tty run with its own page table (instead of with the kernel identity
map table), make it map in video memory.

sadly, this breaks tty in non-paged mode.

happily, this simplifies the code by throwing out the messing
around with segments, and throws out vidcopy.s.
2009-05-12 12:43:18 +00:00
Ben Gras ebe050dbe2 large page size constant. 2009-05-12 09:23:27 +00:00
David van Moolenbroek 9a01c828c8 VFS-FS error codes: better safe than sorry 2009-05-11 11:30:04 +00:00
David van Moolenbroek 0ac1aaccca Limited support for nested FS->VFS requests during VFS->FS call.
- Changed VFS-FS protocol to only store OK or negative error code in
  m_type field of reply messages.
- Changed VFS to treat nonzero positive replies from FS as requests.
- Added backwards compatibility to VFS and MFS.
No protection of global data structures is provided in VFS, so many
VFS calls cannot be made safely by FS servers during many FS calls.
Use with caution (or, preferably, not at all).
2009-05-11 10:02:28 +00:00
Ben Gras 3b3e3b36c2 some more vm bits. 2009-04-23 15:21:03 +00:00
Arun Thomas e9e1ae1cfc Move queue.h to include/sys so that it can be used elsewhere. Pull in
FreeBSD's r179210 queue.h.
2009-04-22 20:02:39 +00:00
Ben Gras 9647fbc94e moved type and constants for random data to include file;
added consistency check in random; added source of randomness
internal to random using timing; only retrieve random bins that are full.
2009-04-02 15:24:44 +00:00
Arun Thomas 9e7837f63c Tweak 64-bit integer type declarations; Fixes GCC sysutil build
breakage.
2009-03-30 17:07:39 +00:00
Ben Gras e5079dfc02 multiple ram disks; also make release process use this
so temporary partitions aren't needed any more.
2009-03-19 13:48:19 +00:00
Arun Thomas 347fa61675 Increase ARG_MAX 2009-03-17 07:38:35 +00:00
Arun Thomas 7ce582c783 Define 64 bit integer types when compiling with GCC 2009-03-06 16:56:46 +00:00
Ben Gras 59e972f074 let drivers allocate memory at 64k physical boundary. 2009-02-12 12:26:08 +00:00
Ben Gras c628f24bc2 moved stacktrace to sysctl, as vmctl is very privileged so can't
be used outside VM. IS code cleanup. added stacktrace feature to IS.
2009-01-27 12:54:33 +00:00
Ben Gras 3cc092ff06 . new kernel call sysctl for generic unprivileged system operations;
now used for printing diagnostic messages through the kernel message
   buffer. this lets processes print diagnostics without sending messages
   to tty and log directly, simplifying the message protocol a lot and
   reducing difficulties with deadlocks and other situations in which
   diagnostics are blackholed (e.g. grants don't work). this makes
   DIAGNOSTICS(_S), ASYN_DIAGNOSTICS and DIAG_REPL obsolete, although tty
   and log still accept the codes for 'old' binaries. This also simplifies
   diagnostics in several servers and drivers - only tty needs its own
   kputc() now.
 . simplifications in vfs, and some effort to get the vnode references
   right (consistent) even during shutdown. m_mounted_on is now NULL
   for root filesystems (!) (the original and new root), a less awkward
   special case than 'm_mounted_on == m_root_node'. root now has exactly
   one reference, to root, if no files are open, just like all other
   filesystems. m_driver_e is unused.
2009-01-26 17:43:59 +00:00
Ben Gras 723a756c14 reduce kernel buffer size. 2009-01-20 13:57:24 +00:00
Ben Gras 6a267baeb8 simplification suggested by Mark Farnsworth 2009-01-15 14:42:40 +00:00
Ben Gras b450c33377 sometime this will be a new release. 2009-01-14 08:38:37 +00:00
Ben Gras b82588848d cprofile always on; data type and definitions to include file 2009-01-09 21:40:29 +00:00
Ben Gras 128a0508c0 timing measurement code out of kernel and into library
(so other components can use it too)
2009-01-09 16:15:15 +00:00
Ben Gras b740ff055f if serial output is enabled in the boot monitor, on the first serial line,
enable serial debug output in the kernel too.
2008-12-19 13:21:42 +00:00
Ben Gras f0000078c3 make kernel leave a page-sized gap in its code and data to not be
mapped in if so configured.
2008-12-18 14:30:55 +00:00
Ben Gras 710f44c4b8 added code for debugging pagefaults 2008-12-16 14:33:53 +00:00
Ben Gras 4be5b6f437 2008-12-16 14:32:56 +00:00
Ben Gras a306c63e0b 2008-12-15 15:16:26 +00:00
Ben Gras 0cd26cd1c0 DEV_BOOT is obsolete. 2008-12-11 16:50:01 +00:00
Ben Gras 6009642110 for compatability with older images. 2008-12-11 15:50:33 +00:00
Ben Gras dd9e9c74cd vm map request - ioctl to /dev/video 2008-12-11 14:11:59 +00:00
Ben Gras 3f30c3a0ee add va_copy() 2008-12-11 14:10:56 +00:00
Ben Gras 9bbee4f1ce 2008-12-11 14:10:37 +00:00
Ben Gras e75e231abc VMCTL_INCSP to increase process stack pointer.
(Used to change the virtual address of the stack before a process has
started executing.)
2008-12-11 14:10:17 +00:00
Ben Gras 682b9a872e . ser_putc() goes to library
. another cmd for getinfo - obtaining current HZ value
2008-12-11 14:09:38 +00:00
Ben Gras ef5b6f8cdf . HZ no longer constant, but settable at boot time; default is DEFAULT_HZ (60)
. some kernel flags to <minix/const.h>
2008-12-11 14:08:53 +00:00
Ben Gras 9b33056d2b make allocmem accept and return values in bytes, ramdisk expects this. 2008-11-19 15:40:17 +00:00
Ben Gras c078ec0331 Basic VM and other minor improvements.
Not complete, probably not fully debugged or optimized.
2008-11-19 12:26:10 +00:00
Ben Gras 39aa2e6489 A glob() implementation. 2008-04-08 13:14:33 +00:00
Philip Homburg 60c1131b94 SYS_MAPDMAx -> SYS_MAPDMA, added IOMMU_MAP 2008-02-25 14:39:19 +00:00
Philip Homburg 07c258a9c7 Added adddma/deldma/getdma. 2008-02-21 15:58:55 +00:00
Philip Homburg e674f1a54f Added ERESTART. 2008-02-21 15:58:26 +00:00
Philip Homburg 3b3fc8a9c4 Added O_REOPEN. 2008-02-21 15:58:06 +00:00
Philip Homburg 82cb46af0a Changes for asynchronous interface to character specials.
Removed DEV_SEL_WATCH. Added SYS_MAPDMAx. New message type (DIAG_REPL) for
replies to DIAGNOSTICS(_S).
2008-02-21 15:57:35 +00:00
Philip Homburg 698df384c3 Extra calls to PM for I/O MMUs. 2008-02-21 15:51:27 +00:00
Philip Homburg cb2b7ada63 Nonblocking send. 2008-02-21 15:50:09 +00:00
Philip Homburg fc4593fb42 List of service/driver names that are allowed as IPC endpoints for a new
driver/service.
2008-02-21 15:49:44 +00:00
Philip Homburg 124a128736 Defines for AMD I/O MMU 2008-02-21 15:47:11 +00:00
Ben Gras 50fa859819 A rint() implementation. 2007-12-14 11:59:54 +00:00
Ben Gras 3f2230eee5 add M_SQRT1_2 (1/sqrt(2)) 2007-12-11 10:59:02 +00:00
Ben Gras c67a56708e es1370 driver and updated es1371 and framework by Pieter Hijma. 2007-11-23 11:40:33 +00:00
Ben Gras 0d2d8c6db2 audio drivers. (not updated for trunk.)
sb16: port of isa sb16 driver to user-space. Port by Peter Boonstoppel.
es1371: By Laurens Bronwasser.
2007-11-23 11:30:50 +00:00
Philip Homburg b74b3315a3 Added PF_UNIX and PF_INET to make porting easier. 2007-09-17 11:35:44 +00:00
Philip Homburg 9c3f85d14f Better interface for sys_times. 2007-08-16 13:16:26 +00:00
Philip Homburg 4d2f56daf6 Added prototype for mapdriver5 (from RS to VFS, report the name of a driver
instead of its endpoint).
2007-08-07 11:59:02 +00:00
Philip Homburg 6b0db0d181 Many changes to the VFS/FS interface. 2007-08-07 11:58:03 +00:00
Philip Homburg d9166df3f7 Added FS_READY (from vfsif.h), and MAPDRIVER (from RS to VFS) 2007-08-07 11:57:33 +00:00
Philip Homburg 23fd914307 New message type 9: 5 longs, 3 shorts, and 2 chars. 2007-08-07 11:56:28 +00:00
Philip Homburg 498728bdbe New call SYS_STIME, restructured fields for SYS_TIMES, removed PM_STIME,
added VFS_BASE.
2007-08-07 11:55:28 +00:00
Philip Homburg fc0d7995e9 Some parts of dmap can be private (to vfs) 2007-08-07 11:53:41 +00:00
Philip Homburg bf6620d285 Added prototypes for sys_stime and getuptime2 (tell the kernel about the
boot time and return the boot time together with the uptime)
2007-08-07 11:52:15 +00:00
Philip Homburg 2a58d1dc58 Constants for symlink loops 2007-08-07 11:43:49 +00:00
Ben Gras 03446f5554 micro_delay in sysutil, used in ti1225, dp8390, fxp and
orinoco now. Uses a combination of tickdelay (where possible) and
calibrated busywait (where necessary).
2007-07-31 15:01:49 +00:00
Ben Gras b00f287449 Restore user-owned bits from PSW after a signal handler, instead of
copying complete PSW after signal handler.

This fixes a psw corruption bug reported by Jens de Smit <jst260@few.vu.nl>.
2007-05-08 15:43:00 +00:00
Philip Homburg 69ca935251 getpeuid implementation. Get the uid of a process (by endpoint) 2007-04-27 12:21:06 +00:00
Philip Homburg 35c3f52d99 Renamed BUSC_PCI_ACL to BUSC_PCI_SET_ACL, added BUSC_PCI_DEL_ACL.
Added DL_STAT_REPLY and GET_PRIVID.
2007-04-23 12:01:47 +00:00
Philip Homburg 555bc29a0c sys_getprivid macro to get the ID of a process' privilege structure.
Prototype for pci_del_acl.
2007-04-23 12:00:46 +00:00
Philip Homburg 36c764be1c Asynchronous send. 2007-04-23 11:59:19 +00:00
Philip Homburg a17ff08fb9 Prototype for cpf_reload. 2007-04-23 11:58:41 +00:00
Ben Gras 691b09f232 This will become 3.1.3 2007-04-12 14:31:16 +00:00
Ben Gras 056ac0a0d3 replace library time handling functions
mktime, tzset, asctime, ctime, gmtime, localtime, strftime
with zoneinfo implementations in src/commands/zoneinfo, referenced
from src/lib/stdtime/Makefile.in.
2007-03-30 15:36:49 +00:00
Ben Gras 6d50591226 . let kernel use read_tsc() from sysutil library
. read_tsc() in sysutil library saves edx and eax now
 . added read_tsc_64() by Antonio Mancina to load tsc into
   a 64-bit data type directly
 . deleted read_tsc.h in favour of a prototype in <minix/syslib.h>
2007-03-08 15:39:14 +00:00
Ben Gras 3b08825d85 . service tells you which device it couldn't stat
. bigger rs and ramdisk for drivers
. sanity check for pv_set macro for oversized arguments
2007-02-23 18:22:46 +00:00
Ben Gras 168d766f32 . pci driver now returns devices, even when they have been pci_reserve()d
. pci_reserve() returns an error on devices that have already been reserved,
  instead of panic()ing; the pci_reserve() library call still panics,
  pci_reserve_ok() returns an int.
. this allows at_wini to use the instance value as intended, as all devices
  are seen, even reserved ones
. only devices actually used by at_wini are pci_reserve()d
. pci doesn't release devices based on argv[0], as at_wini both have the
  same name and multiple instances won't work together properly
2007-02-20 17:09:19 +00:00