Commit graph

119 commits

Author SHA1 Message Date
Kees van Reeuwijk 064cb7583a Lots of small code cleanup: make symbols local, remove unused symbols,
fixed a typo, removed a now unused header file.
Use #include <..> for header files that represent libraries.
2010-02-09 15:23:38 +00:00
Kees van Reeuwijk c6eb51d66a Rewrite some functions to ANSI style. 2010-01-27 10:19:13 +00:00
Cristiano Giuffrida d1fd04e72a Initialization protocol for system services.
SYSLIB CHANGES:
- SEF framework now supports a new SEF Init request type from RS. 3 different
callbacks are available (init_fresh, init_lu, init_restart) to specify
initialization code when a service starts fresh, starts after a live update,
or restarts.

SYSTEM SERVICE CHANGES:
- Initialization code for system services is now enclosed in a callback SEF will
automatically call at init time. The return code of the callback will
tell RS whether the initialization completed successfully.
- Each init callback can access information passed by RS to initialize. As of
now, each system service has access to the public entries of RS's system process
table to gather all the information required to initialize. This design
eliminates many existing or potential races at boot time and provides a uniform
initialization interface to system services. The same interface will be reused
for the upcoming publish/subscribe model to handle dynamic 
registration / deregistration of system services.

VM CHANGES:
- Uniform privilege management for all system services. Every service uses the
same call mask format. For boot services, VM copies the call mask from init
data. For dynamic services, VM still receives the call mask via rs_set_priv
call that will be soon replaced by the upcoming publish/subscribe model.

RS CHANGES:
- The system process table has been reorganized and split into private entries
and public entries. Only the latter ones are exposed to system services.
- VM call masks are now entirely configured in rs/table.c
- RS has now its own slot in the system process table. Only kernel tasks and
user processes not included in the boot image are now left out from the system
process table.
- RS implements the initialization protocol for system services.
- For services in the boot image, RS blocks till initialization is complete and
panics when failure is reported back. Services are initialized in their order of
appearance in the boot image priv table and RS blocks to implements synchronous
initialization for every system service having the flag SF_SYNCH_BOOT set.
- For services started dynamically, the initialization protocol is implemented
as though it were the first ping for the service. In this case, if the
system service fails to report back (or reports failure), RS brings the service
down rather than trying to restart it.
2010-01-08 01:20:42 +00:00
David van Moolenbroek 123683d4a5 Console function keys and color support:
- if "debug_fkeys" boot monitor variable is set to 0:
  - pass Fn, Shift+Fn, Ctrl+Fn, Shift+Ctrl+Fn to applications
  - don't start IS
- update termcap files with function key, color, end key support
2009-12-22 23:30:50 +00:00
David van Moolenbroek 492d663444 TTY fixes:
- reenable code to restore screen/cursor at shutdown
- add proper signal checking logic
- lock to first console during shutdown
2009-12-21 23:19:01 +00:00
Cristiano Giuffrida 1f5841c8ed Basic System Event Framework (SEF) with ping and live update.
SYSLIB CHANGES:
- SEF must be used by every system process and is thereby part of the system
library.
- The framework provides a receive() interface (sef_receive) for system
processes to automatically catch known system even messages and process them.
- SEF provides a default behavior for each type of system event, but allows
system processes to register callbacks to override the default behavior.
- Custom (local to the process) or predefined (provided by SEF) callback
implementations can be registered to SEF.
- SEF currently includes support for 2 types of system events:
  1. SEF Ping. The event occurs every time RS sends a ping to figure out
  whether a system process is still alive. The default callback implementation
  provided by SEF is to notify RS back to let it know the process is alive
  and kicking.
  2. SEF Live update. The event occurs every time RS sends a prepare to update
  message to let a system process know an update is available and to prepare
  for it. The live update support is very basic for now. SEF only deals with
  verifying if the prepare state can be supported by the process, dumping the
  state for debugging purposes, and providing an event-driven programming
  model to the process to react to state changes check-in when ready to update.
- SEF should be extended in the future to integrate support for more types of
system events. Ideally, all the cross-cutting concerns should be integrated into
SEF to avoid duplicating code and ease extensibility. Examples include:
  * PM notify messages primarily used at shutdown.
  * SYSTEM notify messages primarily used for signals.
  * CLOCK notify messages used for system alarms.
  * Debug messages. IS could still be in charge of fkey handling but would
  forward the debug message to the target process (e.g. PM, if the user
  requested debug information about PM). SEF would then catch the message and
  do nothing unless the process has registered an appropriate callback to
  deal with the event. This simplifies the programming model to print debug
  information, avoids duplicating code, and reduces the effort to print
  debug information.

SYSTEM PROCESSES CHANGES:
- Every system process registers SEF callbacks it needs to override the default
system behavior and calls sef_startup() right after being started.
- sef_startup() does almost nothing now, but will be extended in the future to
support callbacks of its own to let RS control and synchronize with every
system process at initialization time.
- Every system process calls sef_receive() now rather than receive() directly,
to let SEF handle predefined system events.

RS CHANGES:
- RS supports a basic single-component live update protocol now, as follows:
  * When an update command is issued (via "service update *"), RS notifies the
  target system process to prepare for a specific update state.
  * If the process doesn't respond back in time, the update is aborted.
  * When the process responds back, RS kills it and marks it for refreshing.
  * The process is then automatically restarted as for a buggy process and can
  start running again.
  * Live update is currently prototyped as a controlled failure.
2009-12-21 14:12:21 +00:00
David van Moolenbroek 56d485c1d6 Various small IS, TTY, isofs fixes
IS:
- do not use p_getfrom_e for a process that is sending
- register with TTY only function keys that are used
- various header and formatting fixes
- proper shutdown code

TTY:
- restore proper Ctrl+F1 dump contents

isofs:
- don't even try to call sys_exit()
2009-11-02 23:04:52 +00:00
Erik van der Kouwe 4c2f0eb22f Suppress spurious scancodes in VMWare 2009-10-18 07:12:42 +00:00
Tomas Hruby 4dad30937b Removed macros that depend on NOTIFY_FROM from servers and drivers. They
determine the information defined by these macros from the m_source field of the
notify message.
2009-09-29 18:47:56 +00:00
Ben Gras 89bf7bae27 - tty: only report unrecognized scancodes once; forget about
remembering the origin and cursor position as that feature didn't
   really work properly anyway
 - tty: map in video and font memory using a vm call, access it from C,
   thereby eliminating pesky weird segment calls and assembly to access it,
   and unbreaks loadfont (Roman Ignatov)
 - bios_wini: fix bios_wini by allocating a <1MB buffers for it
 - memory: preallocate ramdisk, makes it a bit faster (and doesn't
   fail halfway if you allocate a huge one)
 - floppy: use <1MB buffer
 - ramdisk proto: because of the 2x1 page reservations, binaries
   got a little fatter and didn't fit on the ramdisk any more.
   increase it.
2009-09-21 14:25:54 +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 4cd6875d05 don't flush output for SIGWINCH. found by Joren l'Ami. 2009-04-06 09:39:42 +00:00
Ben Gras 46d28c6ffb workaround for qemu writing the configuration byte on the AUX port pre-0.10. 2009-03-24 15:41:18 +00:00
Ben Gras bb18be5d06 simplified the code a little, corrected some hasty statements. 2009-02-04 17:30:01 +00:00
Ben Gras 6a0e8e3b80 Added a separate keymap for escaped scancodes. This makes the code
a little cleaner (escaped scancodes are less of a special case) and
lets us be completely flexible when assigning meaning to them.

Future: a tool and ioctl to load the escaped keymap.
2009-02-04 17:04:16 +00:00
Ben Gras ba4687e519 the escaped keymap is usually the same as the original. 2009-02-04 16:55:30 +00:00
Ben Gras 80f5eea8b8 If serial debugging in the boot monitor / kernel is enabled, don't touch
the serial line in use for it (mostly so that input isn't eaten by tty).
2009-01-29 15:06:40 +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 36909196cf make bootinfo valid immediately 2009-01-14 08:56:20 +00:00
Ben Gras 0579810535 don't ignore the fact that scancodes are escaped.
if not understood explicitly, print diagnostic and 
ignore scancode.
2008-12-21 03:53:25 +00:00
Ben Gras f4d0d635fd - hz dynamic
- new map /dev/video implementation
 - ser_putc into library
2008-12-08 16:40:29 +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 00ef93d6a2 Use nonblocking sends to reply, fixed reply message for DIAGNOSTICS(_S) 2008-02-22 16:03:00 +00:00
Ben Gras 2c45324c47 keymap contributed by Roman Ignatov. 2008-02-06 15:16:50 +00:00
Philip Homburg 1d4afb3599 Compile-time option to duplicate console output to the first serial line 2007-08-07 11:27:03 +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 b918f61820 Boot monitor flag that enables 'sticky right-alt', permanent change
to col selected from the keymap untill right-alt is pressed again.

Sticky alt code and russian keymap contributed by Roman Ignatov
and Yaroslav Schekin.
2007-05-16 13:14:37 +00:00
Philip Homburg bb659b1ad6 Disabled ser_putc for reporting debug internal to tty over the serial line.
Disabled return statement for serial debug input in the kernel.
2007-04-23 14:59:32 +00:00
Ben Gras 9f2f3dd488 don't call mkdep with an absolute path 2007-02-08 16:26:20 +00:00
Ben Gras 8ea438ae93 Retired DEV_{READ,WRITE,GATHER,SCATTER,IOCTL} (safe versions *_S are to
be used and drivers should never receieve these 'unsafe' variants
any more).
2007-02-07 16:22:19 +00:00
Ben Gras 753f7bebde Don't let rs232 code send REVIVEs. 2007-01-04 12:06:04 +00:00
Ben Gras 6f77685609 Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.

 . kernel does not program the interrupt controller directly, do any
   other architecture-dependent operations, or contain assembly any more,
   but uses architecture-dependent functions in arch/$(ARCH)/.
 . architecture-dependent constants and types defined in arch/$(ARCH)/include.
 . <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
   architecture-independent functions.
 . int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
   and live in arch/i386/do_* now.
 . i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
   gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
   If 86 support is to return, it should be a new architecture.
 . prototypes for the architecture-dependent functions defined in
   kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
 . /etc/make.conf included in makefiles and shell scripts that need to
   know the building architecture; it defines ARCH=<arch>, currently only
   i386.
 . some basic per-architecture build support outside of the kernel (lib)
 . in clock.c, only dequeue a process if it was ready
 . fixes for new include files

files deleted:
 . mpx/klib.s - only for choosing between mpx/klib86 and -386
 . klib86.s - only for 86

i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
 . mpx386.s (entry point)
 . klib386.s
 . sconst.h
 . exception.c
 . protect.c
 . protect.h
 . i8269.c
2006-12-22 15:22:27 +00:00
Ben Gras 7195fe3325 System statistical and call profiling
support by Rogier Meurs <rogier@meurs.org>.
2006-10-30 15:53:38 +00:00
Philip Homburg 0ac9521c94 TTY should not panic when it is impossible to reply. A driver may crash
before receiving the reply from TTY.
2006-08-28 12:16:15 +00:00
Ben Gras 9d9e14941e At least 8k stack for all drivers so that malloc() works, for grants,
for printf().
2006-08-02 22:51:47 +00:00
Ben Gras 82173212ee Introduction of a 'big' ioctl, with more bits (20) reserved for encoding the
size field. The TIOCSFON ioctl size (8192) didn't get encoded properly,
as there weren't enough bits for it (12) in the regular format.

The new format has only one type field, and an extra flag (_IOC_BIG)
turned on. FS checks for this flag and uses the alternative decoding
of the ioctl codes to determine the size when doing grants.

This unbreaks loadfont, although that still uses a phys copy in tty.
2006-07-25 09:41:40 +00:00
Ben Gras cbfcdcc4c2 Use grant address type in loadfont ioctl. 2006-07-21 14:39:48 +00:00
Philip Homburg f6d1f6fdf6 Switch to vc 0 and softscrolling when /dev/video is opened and switch back
at the close. This should prevent problems with X on (emulated) Cirrus
cards.
2006-07-19 11:50:18 +00:00
Philip Homburg ee09d50403 Changed to use sys_readbios to get screen parameters. Added safecopy version
to get log messages.
2006-07-10 12:37:39 +00:00
Ben Gras 1561067ee4 Grant system dynamic-only. 2006-06-30 14:40:29 +00:00
Ben Gras 1c8b206a5d . Safe I/O, ioctl() and DIAGNOSTICS variants conversion - safe copies,
include grant id in DEV_REVIVE messages.
. Removal of TTY_FLAGS field (and so O_NONBLOCK support).
. Fixed CANCEL behaviour and return code on blocking I/O,
  previously handled by O_NONBLOCK
. Totally removed REVIVE replies, previously still possible on
  blocking ioctls (REVIVE directly called) and ptys (missing TTY_REVIVE
  check), removes deadlock bug with FS
. Removed obsolete *COMPAT options and associated code
2006-06-20 09:02:54 +00:00
Philip Homburg e9aabcf2f8 Disabled building rescue driver (no longer needed). Moved allocmem from
library to the memory driver. Always put output from within TTY directly on
the console. Removed second include of driver.h from tty.c. Made tty_inrepcode
bigger. First step to move PM and FS calls that are not regular (API)
system calls out of callnr.h (renumbered them, and removed them from the
table.c files). Imported the Minix-vmd uname implementation. This provides
a more stable ABI than the current implementation. Added a bit of security
checking. Unfortunately not nearly enough to get a secure system. Fixed a
bug related to the sizes of the programs in the image (in PM patch_mem_chunks).
2006-05-19 12:19:37 +00:00
Ben Gras 5a8315cf5b call cons_stop() before sys_abort() to not break tty on shutdown 2006-05-11 14:01:44 +00:00
Ben Gras 2ab95796b5 Don't install in /sbin - confusing with real tty command 2006-03-29 12:41:11 +00:00
Ben Gras 0524ed35cd Install tty in /sbin 2006-03-26 16:22:02 +00:00
Ben Gras dac520e6f2 Compile warnings 2006-03-24 23:02:56 +00:00
Ben Gras 9f6b2666e1 Compiler warnings fix 2006-03-24 14:16:13 +00:00
Ben Gras 471c1e5f00 reply failed to whom? 2006-03-24 12:45:35 +00:00
Ben Gras e76a222de7 Rename latin-am to latin-america 2006-03-22 13:02:28 +00:00
Ben Gras 9d564995cd Fix rename 2006-03-20 10:44:43 +00:00