Commit graph

4838 commits

Author SHA1 Message Date
Thomas Veerman 77dbd766c1 VFS: Use safe string copy functions 2012-07-16 10:57:43 +00:00
Ben Gras 1d48c0148e segmentless smp fixes
adjust the smp booting procedure for segmentless operation. changes are
mostly due to gdt/idt being dependent on paging, because of the high
location, and paging being on much sooner because of that too.

also smaller fixes: redefine DESC_SIZE, fix kernel makefile variable name
(crosscompiling), some null pointer checks that trap now because of a
sparser pagetable, acpi sanity checking
2012-07-15 22:47:20 +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 cfe1ed4df4 profiling related cleanup
. do not declare any data in <minix/profile.h>
	. addr check no longer necessary
2012-07-15 21:56:55 +02:00
Ben Gras c6a2f353c3 boot programs gzip/strip changes
as disk space typically isn't a concern when crosscompiling, but
convenience and ability to debug is, change the strip and gzip defaults

	. do not strip or gzip the binaries when crosscompiling

this makes it faster to rebuild and restart a compiled system, with
debugging info if so desired.
2012-07-05 18:12:03 +02:00
Kees Jongenburger c4d9681327 Add entry in fstab and let the mount system call start devman.
After this commit you will need an additional entry in fstab for
the /sys file system (see docs/UPDATING).
2012-07-05 14:52:16 +02:00
Kees Jongenburger 30b5c227e9 Allow to specify the rslabel to use for a file system.
When a file system is mounted some heuristics are used to define
a RS label for that system. This commit allows to specify the
label to use in an optional mount argument using either
mount -o rslabel=fs_myfs or as a mount option in fstab.

This can be used to start services that later also need to be
accessed directly.
2012-07-05 14:52:16 +02:00
Kees Jongenburger 1fb60d0811 Fixes for mount -a.
* Display an error message upon failure to mount a device.
* Handle a special case when the source device is "none"
* pass the mount options stored in fourth field of fstab
  to mount(3).
2012-07-05 14:45:30 +02:00
Kees Jongenburger c9b3bd9d45 Add a /sys entry to minix.mtree 2012-07-05 11:09:40 +02:00
Kees Jongenburger c755b5784a Cleanup minix.mtree.
Use consistent indenting and sort entries alphabetically.
2012-07-05 11:07:25 +02:00
Kees Jongenburger 101b99bc77 devmand call the cleanup method before doing an exit.
Call the cleanup mehtod before doing an exit to prevent stale pid
files.
2012-07-05 11:07:25 +02:00
Ben Gras ed993cd557 don't leave _VCS_REVISION in 2012-06-29 16:34:41 +02:00
Ben Gras 08f8084a21 align messages
Has a small but measurable performance improvement.
2012-06-29 16:13:54 +02:00
Ben Gras c3db1c6939 various symbol referencing fixes
make weak symbol references and namespace renames references
the renamed versions.

function renaming, weak symbol references and libc namespace.h
protection interact in hairy ways and causes weak symbol references
for renamed functions to be unresolved; e.g. vfork should be an
alias for _vfork but _vfork doesn't exist because __vfork14()
exists.

this is a problem for dynamically linked executables as all symbols
have to be resolved, used or not, at link time. it was masked by
clang-compiled base system libraries but is a problem when gcc does
it.
2012-06-28 15:20:53 +02:00
Thomas Veerman 8d1c219676 libvassert: don't build shared lib 2012-06-26 09:32:15 +00:00
Thomas Veerman f26d79e0ff releasetools: use build system macros 2012-06-26 09:32:15 +00:00
Ben Gras c58712f0f0 xz: add libc dependency 2012-06-25 17:21:01 +02:00
Ben Gras 6a6b7b5769 ld.so: be more mmap()-behaviour-independent
. if the layout of virtual address regions as returned
	  by mmap() without a location hint changes, ld.so could
	  trip itself up (under minix). this change allocates
	  the full size it needs for every object that's loaded
	  so that if that succeeds, it's sure there's virtual address
	  space for the whole thing no matter what other bits happen
	  to be there already.

	. this fix exposed a bug in the test; at atexit() execution
	  time the loaded object is unmapped, so that part of the
	  test is removed.
2012-06-25 14:13:07 +02:00
Thomas Veerman 3f40eb3511 fetch.sh: serve tarballs ourselves
And use the original sources as backup.
2012-06-25 10:46:31 +00:00
Thomas Veerman e3209ae766 Import lib{mpc,gmp,mpfr}
This decreases external dependencies for crosscompilation. Note that
these libraries are not built nor used by Minix itself.

Furthermore, the shell scripts that download the tarballs for these
libraries, gcc, binutils, and gmake now also support curl in addition
to wget.
2012-06-25 09:15:27 +00:00
Thomas Veerman f8c6b27b69 sed: unbreak crosscompilation 2012-06-21 14:07:59 +00:00
Ben Gras 1906a5b9b4 sed: add compatability symlink properly 2012-06-20 15:47:44 +02:00
Kees Jongenburger ace9a62765 Include bsd.own.mk in /usr/Makefile to have INSTALL_DIR defined. 2012-06-20 14:52:29 +02:00
Ben Gras 4725854459 sed: add compatability symlink 2012-06-20 14:47:01 +02:00
Thomas Veerman 305dacf6ea setup: copy boot.cfg.default to /boot.cfg
This way the setup stays in sync with the source tree.
2012-06-20 10:48:39 +00:00
Thomas Veerman 6759b24c57 /etc/rc: use mount -a instead of manual parsing
The rc script manually parses /etc/fstab to mount all file systems.
To do that it needs /bin/sed which does not exist anymore. mount(8)
now supports the -a flag which causes it to mount all file systems
listed in /etc/fstab except for '/'. File systems marked with 'noauto'
are skipped.
2012-06-20 10:48:38 +00:00
Kees Jongenburger eecd451343 Adding a symlink from /usr/bin/strip to /usr/pkg/bin/strip.
When calling the new install with the -s (strip) argument it will
use the hard coded /usr/bin/strip unless a STRIP environment is set.
2012-06-19 16:30:02 +02:00
Kees Jongenburger b15f6fdf41 Removed unused control fifo in devmand. 2012-06-19 16:30:02 +02:00
Kees Jongenburger a55f435a36 Decrease verbosity of devmand.
Display warnings(non critical errors) only when the verbose flag
is set.
2012-06-19 16:30:02 +02:00
Ben Gras cb1418a5e1 generate offsets for ucontext.S 2012-06-19 15:47:25 +02:00
Thomas Veerman 9b7938d815 Fix release script 2012-06-19 08:50:33 +00:00
Thomas Veerman 5b91b11b9c Release script: tools -> releasetools rename 2012-06-18 16:05:38 +00:00
Thomas Veerman 4bb9af63c6 mkfs.mfs: no need to include a.out.h 2012-06-18 13:39:21 +00:00
Thomas Veerman 39dfb2bc55 Don't build ext2 ramdisk for cross compilation
. as mkfs.mfs is now cross compilable, we can remove the ext2 ramdisk
  special case for cross compilation.
2012-06-18 10:54:56 +00:00
Thomas Veerman aab6eb7615 Clean up generated files for ash,ramdisk,libutil,libc 2012-06-18 10:54:56 +00:00
Thomas Veerman 791aa4e16f Cross compile MFS ramdisk 2012-06-18 10:54:55 +00:00
Thomas Veerman bb226763a0 Make mkfs.mfs cross compilable 2012-06-18 10:54:54 +00:00
Thomas Veerman a82a56d788 Not every shell understands 'let' 2012-06-18 10:54:54 +00:00
Thomas Veerman 4def69f293 Update nbsd_ports to account for new utils 2012-06-18 10:54:53 +00:00
Thomas Veerman 891c812cba Build file cross compilation tool 2012-06-18 10:54:53 +00:00
Thomas Veerman 966cbef4fd xinstall fix for cross compilation 2012-06-18 10:54:52 +00:00
Thomas Veerman b2731fd668 Update gitignore for releasetools 2012-06-18 10:54:52 +00:00
Thomas Veerman c8a0e2f4c6 Import NetBSD tools and build.sh
This commit finalizes support for cross compilation. The tools
directory are all links to the actual tools and are built on the
host system to build Minix. build.sh is the work horse that takes
care of all environment settings. It's slightly adjusted for Minix.
The /usr/src/Makefile has additional targets needed for cross
compilation.
2012-06-18 10:54:51 +00:00
Thomas Veerman 2ed11343a6 Remove duplicate sed 2012-06-18 10:54:51 +00:00
Thomas Veerman ff555cdea6 Fix sed for cross compilation 2012-06-18 10:54:50 +00:00
Thomas Veerman 9d04c193d2 Import NetBSD xinstall
Also, fix mk files for cross compilation.
2012-06-18 10:54:50 +00:00
Thomas Veerman d433a56288 Import NetBSD mtree
mtree is only used for cross compilation at this point. Also, the
required patches to make it compile on Minix cripple it probably
enough to make it unusable anyway.
2012-06-18 10:54:49 +00:00
Thomas Veerman 0b2db08aec Import NetBSD mktemp 2012-06-18 10:54:48 +00:00
Thomas Veerman 2e2caf5919 Import NetBSD make 2012-06-18 10:54:48 +00:00
Thomas Veerman 357f105029 Import NetBSD flex 2012-06-18 10:54:47 +00:00