Commit graph

805 commits

Author SHA1 Message Date
Ben Gras 196021cd82 drop safemap code 2012-10-30 13:55:42 +01:00
Lionel Sambuc 85fee539f4 Upgrading pax.
This also means importing librmt.

Change-Id: Ie5b314aeaad28dca46acb64f20f2d70746ea52d0
2012-10-24 13:42:44 +02:00
Ben Gras bd3cde4571 Move primary cache code to libminixfs.
Add primary cache management feature to libminixfs as mfs and ext2
currently do separately, remove cache code from mfs and ext2, and make
them use the libminixfs interface. This makes all fields of the buf
struct private to libminixfs and FS clients aren't supposed to access
them at all. Only the opaque 'void *data' field (the FS block contents,
used to be called bp) is to be accessed by the FS client.

The main purpose is to implement the interface to the 2ndary vm cache
just once, get rid of some code duplication, and add a little
abstraction to reduce the code inertia of the whole caching business.

Some minor sanity checking and prohibition done by mfs in this code
as removed from the generic primary cache code as a result:
        - checking all inodes are not in use when allocating/resizing
          the cache
        - checking readonly filesystems aren't written to
        - checking the superblock isn't written to on mounted filesystems

The minixfslib code relies on fs_blockstats() in the client filesystem to
return some FS usage information.
2012-10-23 19:48:38 +02:00
David van Moolenbroek 23907fa712 libvboxfs: fix setting file mtimes 2012-10-17 23:01:24 +02:00
Tomas Hruby ee99bb81b9 LIBC - getifaddrs() fix
ifpa must be set to something meaningful every time it returns 0.
2012-10-11 09:43:33 +00:00
Arun Thomas 471a03a362 ARM support for kernel and vm 2012-10-07 21:38:03 -04:00
Arne Welzel bf33a1c097 libsys: add sys_safememset() 2012-09-26 02:18:00 +02: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 8a3b6ca3bb remove unused <tools.h> 2012-09-20 12:24:22 +02:00
Ben Gras d526f1a0db some coverity fixes. 2012-09-18 15:11:51 +02:00
Ben Gras ed1af3c86c VM: full munmap
complete munmap implementation; single-page references made
a general munmap() implementation possible to write cleanly.

	. memory: let the MIOCRAMSIZE ioctl set the imgrd device
	  size (but only to 0)
	. let the ramdisk command set sizes to 0
	. use this command to set /dev/imgrd to 0 after mounting /usr
	  in /etc/rc, so the boot time ramdisk is freed (about 4MB
	  currently)
2012-09-18 13:17:52 +02:00
Ben Gras 2cb560297c VM: remove unused dma memory support functions from vm
. unused calls / data structures
2012-09-18 13:17:47 +02:00
Ben Gras d3d8c30c2e libc/libminc malloc reorganization
. rename minix malloc sources to minix-* so Makefile
    references aren't ambiguous
  . throw out malloc source file copies in libminc
  . make libminc use phkmalloc instead of minix malloc (slightly faster)
2012-09-18 13:17:44 +02:00
David van Moolenbroek 41df1b59f1 libsys: let optset parse largeish positive values
Note that strtoul() also parses negative numbers correctly.
2012-09-03 12:20:17 +00:00
David van Moolenbroek 6b97790a38 libblockdriver: minor whitespace fix 2012-08-31 12:36:17 +00:00
Ben Gras 053fa581b5 vm: remove stack handling for signals
. moved to the kernel as the handling was only
	  reading it; the kernel may as well write it too
2012-08-29 17:31:38 +02:00
Arun Thomas fd43d93ce5 ARM support for system libraries 2012-08-28 13:49:27 -04:00
Arun Thomas 9a9d555f56 machine/ipcconst.h for arch-specific constants 2012-08-27 19:46:41 -04:00
David van Moolenbroek 201031fb38 libaudiodriver: properly deallocate memory 2012-08-24 09:17:27 +00:00
David van Moolenbroek 9821bbf780 libaudiodriver: call drv_init() again 2012-08-24 09:17:26 +00:00
David van Moolenbroek ca216b3d97 libaudiodriver: resolve Coverity warnings 2012-08-24 09:17:25 +00:00
Arun Thomas a57a591f25 Reorganize arch consts and types
-DEFAULT_HZ const moved to archconst.h
-cpu_info struct moved to archtypes.h
2012-08-16 17:07:43 +02:00
Arun Thomas 697f0d097f Rename sys_vmctl_get_cr3_i386 2012-08-12 23:30:54 +02:00
Arun Thomas ed9152a1a3 csu: build for ARM 2012-08-12 23:30:54 +02:00
Ben Gras 31d8526346 libexec: add load_offset feature, used for ld.so
. ld.so is linked at 0 but it can relocate itself; we
	  wish to load ld.so higher though to trap NULL dereferences.
	  if we know we have to execute ld.so, vfs tells libexec to put it
	  higher.
2012-08-12 23:22:54 +02:00
Arun Thomas fbd456ee2b libc/mallocdebug: Make arch-generic 2012-08-10 22:45:35 +02:00
Arun Thomas caa798bbe1 brksize: Remove non-ELF code 2012-08-10 22:45:35 +02:00
Arun Thomas 65a87d5bcb Fix prototypes for getdents, read, readlink 2012-08-10 22:09:43 +02:00
Arun Thomas fbad9eaf95 Clean up arch Makefiles for libminc 2012-08-10 19:02:38 +02:00
Arun Thomas ad95bad8f7 Restore and use C version of oneC_sum 2012-08-10 14:48:48 +02:00
David van Moolenbroek 378164d359 libnetsock: resolve Coverity warnings 2012-08-09 00:16:36 +02:00
David van Moolenbroek ebc85e54c4 libsys: resolve Coverity warnings 2012-08-09 00:16:36 +02:00
David van Moolenbroek 49aed1ad97 libsys: remove unused stacktrace variant 2012-08-09 00:16:35 +02:00
Arun Thomas 0ae2e2df94 libc: ARM generateasm 2012-08-07 17:01:25 +02:00
Arun Thomas 19ffad7692 Remove ACK EM_WSIZE/EM_PSIZE macro usage 2012-08-06 17:49:22 +02:00
Arun Thomas 6723dcfab7 Replace MACHINE/CHIP macros with compiler macros 2012-08-06 17:49:22 +02:00
David van Moolenbroek 5909c8ba20 libvtreefs: resolve Coverity warnings 2012-07-30 14:00:22 +00:00
David van Moolenbroek ee71bbbcb5 libsffs: resolve Coverity warnings 2012-07-30 12:10:14 +00:00
David van Moolenbroek 0b30c0a1bb libchardriver: resolve Coverity warnings 2012-07-30 12:10:13 +00:00
David van Moolenbroek 55c3f4800e libbdev: resolve Coverity warnings 2012-07-30 12:10:12 +00: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
David van Moolenbroek 8caec1b57b libsys: 64-bit numbers support for printf()
Change some drivers accordingly.
2012-07-26 09:45:05 +00:00
Ben Gras cbcdb838f1 various coverity-inspired fixes
. some strncpy/strcpy to strlcpy conversions
	. new <minix/param.h> to avoid including other minix headers
	  that have colliding definitions with library and commands code,
	  causing parse warnings
	. removed some dead code / assignments
2012-07-16 14:00:56 +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
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
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
Ben Gras cb1418a5e1 generate offsets for ucontext.S 2012-06-19 15:47:25 +02:00
Thomas Veerman aab6eb7615 Clean up generated files for ash,ramdisk,libutil,libc 2012-06-18 10:54:56 +00:00
Thomas Veerman 357f105029 Import NetBSD flex 2012-06-18 10:54:47 +00:00