Commit graph

45 commits

Author SHA1 Message Date
David van Moolenbroek aa5531fc67 IS: resolve Coverity warnings 2012-08-09 00:16:35 +02:00
Ben Gras 50e2064049 No more intel/minix segments.
This commit removes all traces of Minix segments (the text/data/stack
memory map abstraction in the kernel) and significance of Intel segments
(hardware segments like CS, DS that add offsets to all addressing before
page table translation). This ultimately simplifies the memory layout
and addressing and makes the same layout possible on non-Intel
architectures.

There are only two types of addresses in the world now: virtual
and physical; even the kernel and processes have the same virtual
address space. Kernel and user processes can be distinguished at a
glance as processes won't use 0xF0000000 and above.

No static pre-allocated memory sizes exist any more.

Changes to booting:
        . The pre_init.c leaves the kernel and modules exactly as
          they were left by the bootloader in physical memory
        . The kernel starts running using physical addressing,
          loaded at a fixed location given in its linker script by the
          bootloader.  All code and data in this phase are linked to
          this fixed low location.
        . It makes a bootstrap pagetable to map itself to a
          fixed high location (also in linker script) and jumps to
          the high address. All code and data then use this high addressing.
        . All code/data symbols linked at the low addresses is prefixed by
          an objcopy step with __k_unpaged_*, so that that code cannot
          reference highly-linked symbols (which aren't valid yet) or vice
          versa (symbols that aren't valid any more).
        . The two addressing modes are separated in the linker script by
          collecting the unpaged_*.o objects and linking them with low
          addresses, and linking the rest high. Some objects are linked
          twice, once low and once high.
        . The bootstrap phase passes a lot of information (e.g. free memory
          list, physical location of the modules, etc.) using the kinfo
          struct.
        . After this bootstrap the low-linked part is freed.
        . The kernel maps in VM into the bootstrap page table so that VM can
          begin executing. Its first job is to make page tables for all other
          boot processes. So VM runs before RS, and RS gets a fully dynamic,
          VM-managed address space. VM gets its privilege info from RS as usual
          but that happens after RS starts running.
        . Both the kernel loading VM and VM organizing boot processes happen
	  using the libexec logic. This removes the last reason for VM to
	  still know much about exec() and vm/exec.c is gone.

Further Implementation:
        . All segments are based at 0 and have a 4 GB limit.
        . The kernel is mapped in at the top of the virtual address
          space so as not to constrain the user processes.
        . Processes do not use segments from the LDT at all; there are
          no segments in the LDT any more, so no LLDT is needed.
        . The Minix segments T/D/S are gone and so none of the
          user-space or in-kernel copy functions use them. The copy
          functions use a process endpoint of NONE to realize it's
          a physical address, virtual otherwise.
        . The umap call only makes sense to translate a virtual address
          to a physical address now.
        . Segments-related calls like newmap and alloc_segments are gone.
        . All segments-related translation in VM is gone (vir2map etc).
        . Initialization in VM is simpler as no moving around is necessary.
        . VM and all other boot processes can be linked wherever they wish
          and will be mapped in at the right location by the kernel and VM
          respectively.

Other changes:
        . The multiboot code is less special: it does not use mb_print
          for its diagnostics any more but uses printf() as normal, saving
          the output into the diagnostics buffer, only printing to the
          screen using the direct print functions if a panic() occurs.
        . The multiboot code uses the flexible 'free memory map list'
          style to receive the list of free memory if available.
        . The kernel determines the memory layout of the processes to
          a degree: it tells VM where the kernel starts and ends and
          where the kernel wants the top of the process to be. VM then
          uses this entire range, i.e. the stack is right at the top,
          and mmap()ped bits of memory are placed below that downwards,
          and the break grows upwards.

Other Consequences:
        . Every process gets its own page table as address spaces
          can't be separated any more by segments.
        . As all segments are 0-based, there is no distinction between
          virtual and linear addresses, nor between userspace and
          kernel addresses.
        . Less work is done when context switching, leading to a net
          performance increase. (8% faster on my machine for 'make servers'.)
	. The layout and configuration of the GDT makes sysenter and syscall
	  possible.
2012-07-15 22:30:15 +02:00
Ben Gras 7336a67dfe retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
Ben Gras 0a70e23d1d is - no more getlocktimings. 2011-02-04 13:34:43 +00:00
Ben Gras 35a108b911 panic() cleanup.
this change
   - makes panic() variadic, doing full printf() formatting -
     no more NO_NUM, and no more separate printf() statements
     needed to print extra info (or something in hex) before panicing
   - unifies panic() - same panic() name and usage for everyone -
     vm, kernel and rest have different names/syntax currently
     in order to implement their own luxuries, but no longer
   - throws out the 1st argument, to make source less noisy.
     the panic() in syslib retrieves the server name from the kernel
     so it should be clear enough who is panicing; e.g.
         panic("sigaction failed: %d", errno);
     looks like:
         at_wini(73130): panic: sigaction failed: 0
         syslib:panic.c: stacktrace: 0x74dc 0x2025 0x100a
   - throws out report() - printf() is more convenient and powerful
   - harmonizes/fixes the use of panic() - there were a few places
     that used printf-style formatting (didn't work) and newlines
     (messes up the formatting) in panic()
   - throws out a few per-server panic() functions
   - cleans up a tie-in of tty with panic()

merging printf() and panic() statements to be done incrementally.
2010-03-05 15:05:11 +00:00
David van Moolenbroek 61bb82a44b VM information interface 2010-01-19 21:00:20 +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
Ben Gras 08d291da53 no more scheduling queue dumps (kernel will print this over serial);
initial vm stats retrieve support
2009-09-21 14:47:24 +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 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 3512a86b44 . DS understands publishing and subscribing where keys are in string
form. Subscriptions are regular expressions.
 . different types are stored per key; currently u32 and/or string.
   the same key can be referenced (publish, subscribe, check) as any type.
 . notify()s are sent when subscriptions are triggered (publishing or
   updating of matching keys); optionally, a subscribe flag sends
   updates for all matching keys at subscription time, instead of only
   after updates after subscribing
 . all interfacing to ds is in /usr/src/lib/syslib/ds.c.
 . subscribe is ds_subscribe
   publish functions are ds_publish_<type>
   retrieve functions are ds_retrieve_<type> (one-time retrieval of a value)
   check functions are ds_check_<type> (check for updated key caller
      subscribes to not yet checked for, or ESRCH for none)
 . ramdisk driver updated with new ds interface
2006-07-13 14:50:23 +00:00
Ben Gras 7a76a7a495 Rename protected to prot
Also print size of grant table known in system
2006-06-20 10:03:48 +00:00
Jorrit Herder 021e3234d8 Jorrit's ... "progress?" 2006-03-10 16:10:05 +00:00
Jorrit Herder 288860f6e6 New dumps for RS and DS server. 2005-10-20 20:28:54 +00:00
Ben Gras abd0b53e0a PM: added possibility to copy hole list from alloc.c to outside, for
misc.c to copy it away by getsysinfo
IS: prints out hole list + stats such as largest contiguous chunk
2005-10-13 12:48:43 +00:00
Jorrit Herder 5a9dec8bd2 New signal handling behaviour at PM (services can be killed).
New Shift-F6 dump for RS server at IS.
New getnpid, getnproc, getpproc library calls at PM.
New reincarnation server (basic functionality is there now).
2005-10-12 15:07:38 +00:00
Ben Gras 6a44098b96 Added Shift+F5 debug dump - show debug dumps. 2005-09-22 12:21:26 +00:00
Ben Gras dabaebfeb2 No more F9 2005-09-22 11:41:47 +00:00
Jorrit Herder 7bf400a709 *** empty log message *** 2005-08-23 11:31:32 +00:00
Ben Gras d11b2e4b8c Al's double-blank-line removal request 2005-08-22 15:23:47 +00:00
Jorrit Herder 872687ddfc Scheduling updates to the kernel. Sched() function now is single point for
policy. Actual policy not yet implemented.

PM calculates nice values for processes in boot image.

IS debug dumps improved (Shift+F1-F4).
2005-08-22 15:14:11 +00:00
Jorrit Herder b69ca94efb Fixed 'bug' in log driver that caused kernel messages not to be displayed.
This was caused by a change in the shared driver code. Not log's fault.

Renamed #definitions of driver process numbers, e.g., TTY now is TTY_PROC_NR.
All known (special) processes now have consistent naming scheme. Kernel tasks
don't follow this scheme.
2005-08-03 08:14:08 +00:00
Jorrit Herder 1198491af2 *** empty log message *** 2005-07-29 15:33:31 +00:00
Jorrit Herder 808202ee30 Removed printing functionality from IS server.
This functionality is now provided by the LOG driver.
2005-07-21 18:31:27 +00:00
Jorrit Herder 570eac1f53 Renamed system library functionality.
Updated debug dumps of IS server.
2005-07-14 15:16:12 +00:00
Jorrit Herder bfa25ba41f Changed debug dumps of kernel process table (F1) 2005-06-30 15:55:43 +00:00
Jorrit Herder ec24a0798c Updated function key mapping because of possible changes to NOTIFY.
The TTY driver now only notifies the IS server about function key event,
but does not tell which keys are pressed. The IS servers queries the TTY
driver to find out about this.
2005-06-20 14:23:31 +00:00
Jorrit Herder 37a1e3f8e3 Removed mem chunks dump. (No longer available from kernel.) 2005-06-17 09:13:32 +00:00
Jorrit Herder c2cd510adf Removed debug dumps from the PM and FS servers. The dumps are now done by the
IS servers, which obtains a copy of the data through the getsysinfo() system
call. CTRL-F1 now is a special TTY key to shows function key mappings.
2005-06-07 14:43:35 +00:00
Jorrit Herder f2a85e58d9 Various updates.
* Removed some variants of the SYS_GETINFO calls from the kernel;
  replaced them with new PM and utils libary functionality. Fixed
  bugs in utils library that used old get_kenv() variant.
* Implemented a buffer in the kernel to gather random data.
  Memory driver periodically checks this for /dev/random.
  A better random algorithm can now be implemented in the driver.
  Removed SYS_RANDOM; the SYS_GETINFO call is used instead.
* Remove SYS_KMALLOC from the kernel. Memory allocation can now
  be done at the process manager with new 'other' library functions.
2005-06-03 13:55:06 +00:00
Jorrit Herder 6d23f072f3 Cleaned up src/lib/utils library. Renamed server_ functions to more logical
names. All system processes can now either use panic() or report() from
libutils, or redefine their own function. Assertions are done via the standard
<assert.h> functionality.
2005-06-01 14:31:00 +00:00
Ben Gras bd12703b76 Able to dump lock()/unlock() timing data 2005-06-01 09:40:27 +00:00
Jorrit Herder 322ec9ef8b Moved stime, time, times POSIX calls from FS to PM. Removed child time
accounting from kernel (now in PM).  Large amount of files in this commit
is due to system time problems during development.
2005-05-31 09:50:51 +00:00
Jorrit Herder 852008d669 Kinfo counts lock_notify() and lock_send() calls. 2005-05-27 14:54:40 +00:00
Jorrit Herder c2be104821 Improved NOTIFY system: fixed a minor error, ignore pending notifications
on SENDREC system calls. To be done: resource (buffer pool) management;
make it structurally impossible to run out of buffers.
2005-05-27 12:44:14 +00:00
Jorrit Herder 77c3213948 Optimized scheduling code. Old code is still available withing DEAD_CODE
and NEW_SCHED_Q definitions. Some minor problems are being traced at the
moment. This commit is meant to backup my files.
  --- Jorrit
2005-05-26 13:17:57 +00:00
Jorrit Herder 0899f82ab2 Fixed some minor issues with the NOTIFY call. 2005-05-24 14:35:58 +00:00
Jorrit Herder ccd17ecfed New NOTIFY system call! Queued at kernel. Duplicate messages (with same source
and type) are overwritten with newer flags/ arguments. The interface from
within the kernel is lock_notify(). User processes can make a system call with
notify(). NOTIFY fully replaces the old notification mechanism.
2005-05-24 10:06:17 +00:00
Jorrit Herder 1cb880b158 Intermediate update---please await next commit. 2005-05-19 09:36:44 +00:00
Jorrit Herder 1ecc6bf3b3 Removed 'system process' magic from PM and FS. 2005-05-13 08:57:08 +00:00
Jorrit Herder fbe1641bd3 User-space networking!
- RTL8139 driver moved to user-space;
- PCI code moved to user-space;
Fixed IRQ hook dump at IS server.
2005-05-11 09:02:00 +00:00
Jorrit Herder ab39ce451b Fixed some system call checks;
Added SYS_PHYSVCOPY system call;
Fixed IRQ hooks dump in IS server;
2005-05-10 11:06:24 +00:00
Jorrit Herder ac0995259d *** empty log message *** 2005-05-02 14:30:04 +00:00
Jorrit Herder 89ac678b9b *** empty log message *** 2005-04-29 15:36:43 +00:00
Ben Gras 9865aeaa79 Initial revision 2005-04-21 14:53:53 +00:00