Commit graph

57 commits

Author SHA1 Message Date
Lionel Sambuc 398af818df Message types for VFS readsuper
Change-Id: I7aea85d9842459ea454420bb1687d9b8eb597914
2014-07-28 17:05:25 +02:00
Lionel Sambuc 20211dd1b0 Remove unused generic message m6
Change-Id: Ie99dca9b75325b3c4890718f8ac7aa49a8973798
2014-07-28 17:05:25 +02:00
Lionel Sambuc 97bbdc69df Introduce message types mess_u{8,16,32,64}
Those messages offer a simple array of the given type. This should allow
for fast and simple prototyping.

When a protocol is fixed, then proper message types should be defined.

Change-Id: I4e98eeb0493924f3015862a51d14d894315e2bc2
2014-07-28 17:05:25 +02:00
Ben Gras 978082bb0d 64-bit REQ_SEEK_POS
Change-Id: I2e51a188b171af0f0a02349e4eccbe78e7cc2e0c
2014-07-28 17:05:10 +02:00
Ben Gras 3c7f4e462e 64-bit bdev position
Change-Id: I149693624610e04af0c5e4437b5efa484a33467d
2014-07-28 17:05:10 +02:00
Lionel Sambuc b33edbfe7a Removing VFS_UTIMENS_* field macros.
Change-Id: I3be1acfbb77b6e229d784d8dbc3ceec1b26abf90
2014-03-03 20:47:00 +01:00
Lionel Sambuc 94c9376df5 Removing SYS_SIG_* field macros.
Change-Id: Ib4f1b48268d4539ae6d4502ad647ecb73ea87f79
2014-03-03 20:47:00 +01:00
Lionel Sambuc 301f5f87f0 Renamed m_vm_vfs to m_vm_vfs_mmap.
Stay coherent with the naming scheme of the messages.

Change-Id: Icc0e13a88ec29263502166c0e6eec81cdb974663
2014-03-03 20:47:00 +01:00
Lionel Sambuc e69e14895d Removing NOTIFY_* field macros.
Change-Id: Idc8604dac9630ee2343476b906b45a115a89994e
2014-03-03 20:47:00 +01:00
Lionel Sambuc 175d3e7eae Changing the message union to anonymous.
This allows us to write things like this:
  message m;
  m.m_notify.interrupts = new_value;

or
  message *mp;
  mp->m_notify.interrupts = new_value;

The shorthands macro have been adapted for the new scheme, and will be
kept as long as we have generic messages being used.

Change-Id: Icfd02b5f126892b1d5d2cebe8c8fb02b180000f7
2014-03-03 20:46:47 +01:00
Lionel Sambuc 4a0199d66d PM_TIME_SEC into 64bit
Change-Id: I609ee8cac7aae8af2c0c0381710433a5df0caebd
2014-03-03 20:45:28 +01:00
Lionel Sambuc 55d9e9954b Extending time_t to 64bits.
Change-Id: Ia96b8bfba19cb8179a0237a7d2122d415c24d73f
2014-03-03 20:45:28 +01:00
Ben Gras 88be7bd333 Use netbsd <sys/mman.h>
Change-Id: I80e9cffc80140383a6faf692248573c64d282b4a
2014-03-03 20:37:27 +01:00
Lionel Sambuc 37598dccf1 Aligning dev_t to 64bits.
Change-Id: I630f72f8530dd4aaf05c35ca23683ae12c9f8328
2014-03-02 12:28:32 +01:00
Lionel Sambuc 5ae60510dc Add a compile-time check for IPC messages size
This patch adds compile-time check for each message type to ensure the
size is within the IPC assumptions.

This will allow messages specific to a protocol to use from now on the
proper types for each fields, while preventing from any unsuspected
side effect when updating type definitions.

Change-Id: Iad64f81a6b6726321fbc492ac37ceeaaa57aa6cd
2014-03-02 12:28:31 +01:00
Ben Gras 8ccb12bb5a use netbsd <sys/signal.h> and sigset_t
. create signals-related struct message type to store sigset_t
	  directly
	. create notify-specific message types, so the generic NOTIFY_ARG
	  doesn't exist anymore
	. various related test expansions, improvements, fixes
	. add a few error-checks to sigismember() calls
	. rename kernel call specific signals fields to SYS_*

Change-Id: I53c18999b5eaf0cfa0cb25f5330bee9e7ad2b478
2014-03-02 12:28:31 +01:00
Ben Gras 25719b5d92 bigger message
Change-Id: Ie770140c55799bdc3bb8f0ad6994d59938155a1a
2014-03-02 12:28:31 +01:00
Lionel Sambuc c3fc9df84a Adding ipc_ prefix to ipc primitives
* Also change _orig to _intr for clarity
 * Cleaned up {IPC,KER}VEC
 * Renamed _minix_kernel_info_struct to get_minix_kerninfo
 * Merged _senda.S into _ipc.S
 * Moved into separate files get_minix_kerninfo and _do_kernel_call
 * Adapted do_kernel_call to follow same _ convention as ipc functions
 * Drop patches in libc/net/send.c and libc/include/namespace.h

Change-Id: If4ea21ecb65435170d7d87de6c826328e84c18d0
2014-03-01 09:05:01 +01:00
Lionel Sambuc cfd3379bb1 Removing CSU patches
* Removed startup code patches in lib/csu regarding kernel to userland
   ABI.

 * Aligned stack layout on NetBSD stack layout.

 * Generate valid stack pointers instead of offsets by taking into account
   _minix_kerninfo->kinfo->user_sp.

 * Refactored stack generation, by moving part of execve in two
   functions {minix_stack_params(), minix_stack_fill()} and using them
   in execve(), rs and vm.

 * Changed load offset of rtld (ld.so) to:
      execi.args.stack_high - execi.args.stack_size - 0xa00000
   which is 10MB below the main executable stack.

Change-Id: I839daf3de43321cded44105634102d419cb36cec
2014-02-18 11:25:02 +01:00
David van Moolenbroek 5d04b92e06 Set M3_STRING to M3_LONG_STRING (ABI break)
Change-Id: Id48bbd4ba3000acf8a891445b4c890b1b42bd72f
2014-02-18 11:25:02 +01:00
David van Moolenbroek 7113bcb896 Redo mount(2)/umount(2) ABI
- pass in file system type through mount(2), and return this type in
  statvfs structures as generated by [f]statvfs(2);
- align mount flags field with NetBSD's, splitting out service flags
  which are not to be passed to VFS;
- remove limitation of mount ABI to 16-byte labels, so that labels
  can be made larger in the future;
- introduce new m11 message union type for mount(2) as side effect.

Change-Id: I88b7710e297e00a5e4582ada5243d3d5c2801fd9
2014-02-18 11:25:01 +01:00
Ben Gras 9e43052b21 inline sendnb should not call send vector
. also vfs has to reply to a vm call - so use asynsend for that

Change-Id: I30ac1e591191dea5c99e25b03151a4415d1151b0
2013-06-12 07:04:53 +00:00
Ben Gras 4f3b015903 fix some warnings
Change-Id: I1f3fa582d8e3ddb3c981784dddb13e740102f4f3
2013-05-31 20:57:39 +00:00
Ben Gras 49eb1f4806 vm: new secondary cache code
Primary purpose of change: to support the mmap implementation, VM must
know both (a) about some block metadata for FS cache blocks, i.e.
inode numbers and inode offsets where applicable; and (b) know about
*all* cache blocks, i.e.  also of the FS primary caches and not just
the blocks that spill into the secondary one. This changes the
interface and VM data structures.

This change is only for the interface (libminixfs) and VM data
structures; the filesystem code is unmodified, so although the
secondary cache will be used as normal, blocks will not be annotated
with inode information until the FS is modified to provide this
information. Until it is modified, mmap of files will fail gracefully
on such filesystems.

This is indicated to VFS/VM by returning ENOSYS for REQ_PEEK.

Change-Id: I1d2df6c485e6c5e89eb28d9055076cc02629594e
2013-04-24 10:18:16 +00:00
Lionel Sambuc f640210005 Removing obsolete _NBSD_LIBC define
Change-Id: Ia6ce84ccdf36cf6f64540b990baaa7d85c53533d
2013-02-26 09:44:24 +00:00
Tomas Hruby 10f30159a9 struct minix_ipcvecs - pretty-print
- the _ptr suffix is not needed anymore :-)
2012-11-15 16:52:00 +01:00
Tomas Hruby dedb53fb10 ipc.h - IPC defined as functions again
- CHOOSETRAP define makes impossible to use some common words
  like send, receive and notify in any other context, for
  instance as members or structures

- any reasonable compiler inlines the static inline functions so
  no extra function call overhead is introduced by this change

- this gets us back to the situation before the SYSCALL/SYSENTER
  change. It is not perfect, but it used to work and still does.
2012-11-15 16:51:59 +01:00
Ben Gras 2d72cbec41 SYSENTER/SYSCALL support
. add cpufeature detection of both
	. use it for both ipc and kernelcall traps, using a register
	  for call number
	. SYSENTER/SYSCALL does not save any context, therefore userland
	  has to save it
	. to accomodate multiple kernel entry/exit types, the entry
	  type is recorded in the process struct. hitherto all types
	  were interrupt (soft int, exception, hard int); now SYSENTER/SYSCALL
	  is new, with the difference that context is not fully restored
	  from proc struct when running the process again. this can't be
	  done as some information is missing.
	. complication: cases in which the kernel has to fully change
	  process context (i.e. sigreturn). in that case the exit type
	  is changed from SYSENTER/SYSEXIT to soft-int (i.e. iret) and
	  context is fully restored from the proc struct. this does mean
	  the PC and SP must change, as the sysenter/sysexit userland code
	  will otherwise try to restore its own context. this is true in the
	  sigreturn case.
	. override all usage by setting libc_ipc=1
2012-09-24 15:53:43 +02:00
Ben Gras b6ea15115c kernel: facility for user-visible memory
. map all objects named usermapped_*.o with globally visible
	  pages; usermapped_glo_*.o with the VM 'global' bit on, i.e.
	  permanently in tlb (very scarce resource!)
	. added kinfo, machine, kmessages and loadinfo for a start
	. modified log, tty to make use of the shared messages struct
2012-07-28 20:57:38 +00:00
Ben Gras 08f8084a21 align messages
Has a small but measurable performance improvement.
2012-06-29 16:13:54 +02:00
Ben Gras 204ae72525 retire _ANSI and <minix/ansi.h> 2012-03-25 21:58:27 +02:00
Ben Gras 6a73e85ad1 retire _PROTOTYPE
. only good for obsolete K&R support
	. also remove a stray ansi.h and the proto cmd
2012-03-25 16:17:10 +02:00
Ben Gras 2fe8fb192f Full switch to clang/ELF. Drop ack. Simplify.
There is important information about booting non-ack images in
docs/UPDATING. ack/aout-format images can't be built any more, and
booting clang/ELF-format ones is a little different. Updating to the
new boot monitor is recommended.

Changes in this commit:

	. drop boot monitor -> allowing dropping ack support
	. facility to copy ELF boot files to /boot so that old boot monitor
	  can still boot fairly easily, see UPDATING
	. no more ack-format libraries -> single-case libraries
	. some cleanup of OBJECT_FMT, COMPILER_TYPE, etc cases
	. drop several ack toolchain commands, but not all support
	  commands (e.g. aal is gone but acksize is not yet).
	. a few libc files moved to netbsd libc dir
	. new /bin/date as minix date used code in libc/
	. test compile fix
	. harmonize includes
	. /usr/lib is no longer special: without ack, /usr/lib plays no
	  kind of special bootstrapping role any more and bootstrapping
	  is done exclusively through packages, so releases depend even
	  less on the state of the machine making them now.
	. rename nbsd_lib* to lib*
	. reduce mtree
2012-02-14 14:52:02 +01:00
Gianluca Guida fa59fc6eb4 Move shared headers in common/include
Headers that will be shared between old includes and NetBSD-like includes
are moved into common/include tree. They are still copied in /usr/include
in 'make includes', so compilation and programs aren't be affected.
2011-02-06 22:59:02 +00:00
Tomas Hruby 74c5cd7668 The profile utility can set the sprofiling mode
- profile --nmi | --rtc sets the profiling mode

- --rtc is default, uses BIOS RTC, cannot profile kernel the presetted
  frequency values apply

- --nmi is only available in APIC mode as it uses the NMI watchdog, -f
  allows any frequency in Hz

- both modes use compatible data structures
2010-09-23 10:49:42 +00:00
Cristiano Giuffrida bde2109b7c IPC status code for receive().
IPC changes:
- receive() is changed to take an additional parameter, which is a pointer to
a status code.
- The status code is filled in by the kernel to provide additional information
to the caller. For now, the kernel only fills in the IPC call used by the
sender.

Syslib changes:
- sef_receive() has been split into sef_receive() (with the original semantics)
and sef_receive_status() which exposes the status code to userland.
- Ideally, every sys process should gradually switch to sef_receive_status()
and use is_ipc_notify() as a dependable way to check for notify.
- SEF has been modified to use is_ipc_notify() and demonstrate how to use the
new status code.
2010-03-23 00:09:11 +00:00
Tomas Hruby 728f0f0c49 Removal of the system task
* Userspace change to use the new kernel calls

	- _taskcall(SYSTASK...) changed to _kernel_call(...)

	- int 32 reused for the kernel calls

	- _do_kernel_call() to make the trap to kernel

	- kernel_call() to make the actuall kernel call from C using
	  _do_kernel_call()

	- unlike ipc call the kernel call always succeeds as kernel is
	  always available, however, kernel may return an error

* Kernel side implementation of kernel calls

	- the SYSTEm task does not run, only the proc table entry is
	  preserved

	- every data_copy(SYSTEM is no data_copy(KERNEL

	- "locking" is an empty operation now as everything runs in
	  kernel

	- sys_task() is replaced by kernel_call() which copies the
	  message into kernel, dispatches the call to its handler and
	  finishes by either copying the results back to userspace (if
	  need be) or by suspending the process because of VM

	- suspended processes are later made runnable once the memory
	  issue is resolved, picked up by the scheduler and only at
	  this time the call is resumed (in fact restarted) which does
	  not need to copy the message from userspace as the message
	  is already saved in the process structure.

	- no ned for the vmrestart queue, the scheduler will restart
	  the system calls

	- no special case in do_vmctl(), all requests remove the
	  RTS_VMREQUEST flag
2010-02-09 15:20:09 +00:00
David van Moolenbroek f175410902 rename message.m5_c[12] to m5_s[12] 2010-01-19 21:19:59 +00:00
David van Moolenbroek b31119abf5 Mount updates:
- allow mounting with "none" block device
- allow unmounting by mountpoint
- make VFS aware of file system process labels
- allow m3_ca1 to use the full available message size
- use *printf in u/mount(1), as mount(2) uses it already
- fix reference leaks for some mount error cases in VFS
2010-01-12 23:08:50 +00:00
Thomas Veerman 958b25be50 - Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
  the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
  functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
  the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
  - Several path lookup bugs in MFS.
  - A link can be too big for the path buffer.
  - A mountpoint can become inaccessible when the creation of a new inode
    fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
  suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
  unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
  named pipes. However, named pipes still reside on the (M)FS, as they are part
  of the file system on disk. To make this work VFS now has a concept of
  'mapped' inodes, which causes read, write, truncate and stat requests to be
  redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 20:27:14 +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
Erik van der Kouwe d1b4c5be5b Removed obsolete declarations in include/ipc.h 2009-08-16 15:12:07 +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
Philip Homburg cb2b7ada63 Nonblocking send. 2008-02-21 15:50:09 +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 36c764be1c Asynchronous send. 2007-04-23 11:59:19 +00:00
Ben Gras fa0ba56bc9 Merge of VFS by Balasz Gerofi with Minix trunk. 2006-10-25 13:40:36 +00:00
Ben Gras aaca17c36d . introduced DEV_READ_S, DEV_WRITE_S, DEV_SCATTER_S, DEV_GATHER_S
and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER,
  DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands
  pass 'grant ids' to the drivers which are referenced through a new set
  of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this
  copy to succeed, the grant must have previously been created in the
  address space of the granter.
. bitmap manipulation functions moved to <minix/bitmap.h>
. HIGHPOS introduced as field containing high 32 bits of position in
  device I/O message; TTY_FLAGS no longer used
. IO_GRANT field introduced for GRANTs, to replace ADDRESS
. REP_IO_GRANT field for un-SUSPEND messages introduced to indicate
  grant for which I/O was done to disambiguate messages
. SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls
. SYS_PRIV_SET_GRANTS code introduced as a code to set the address and
  size of the grant table in a process' own address space
. 'type' and 'direction' field of _ins* and _outs* I/O functions
  are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD
  etc. This allows for an additional parameter, _DIO_SAFE, which indicates
  the address in another address space isn't actually an address, but
  a grant id. Also needs an offset, for which fields had to be merged.
. SCP_* are field names for SYS_SAFECOPY* functions
. DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE,
  added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS
. removed obsolete BINCOMPAT and SRCCOMPAT options
. added GRANT_SEG type for use in vircopy - allows copying to a grant
  id (without offset)
. added _MINIX_IOCTL_* macros that decode information encoded by
  _IO* macros in ioctl codes, used to check which grants are necessary
  for an ioctl
. introduced the type endpoint_t for process endpoints, changed some
  prototypes and struct field types to match
. renamed protected to prot for g++
2006-06-20 08:38:15 +00:00
Jorrit Herder 021e3234d8 Jorrit's ... "progress?" 2006-03-10 16:10:05 +00:00
Ben Gras d11b2e4b8c Al's double-blank-line removal request 2005-08-22 15:23:47 +00:00