Commit graph

778 commits

Author SHA1 Message Date
Dirk Vogt c735b0bb2c Makefile fixups for cross compilation 2012-06-18 10:53:24 +00:00
Dirk Vogt 207e4d2a71 Let the kernel load figure out where to put mods
This patch makes the mkimage tool obsolete
2012-06-18 10:53:22 +00:00
Ben Gras 0fb2f83da9 drop from segments physcopy/vircopy invocations
. sys_vircopy always uses D for both src and dst
	. sys_physcopy uses PHYS_SEG if and only if corresponding
	  endpoint is NONE, so we can derive the mode (PHYS_SEG or D)
	  from the endpoint arg in the kernel, dropping the seg args
	. fields in msg still filled in for backwards compatability,
	  using same NONE-logic in the library
2012-06-18 12:28:40 +00:00
Ben Gras 0e35eb0c6b drop segments from safemap/safeunmap invocations 2012-06-18 12:28:40 +00:00
Ben Gras 2bfeeed885 drop segment from safecopy invocations
. all invocations were S or D, so can safely be dropped
	  to prepare for the segmentless world
	. still assign D to the SCP_SEG field in the message
	  to make previous kernels usable
2012-06-16 16:22:51 +00:00
Ben Gras 769af57274 further libexec generalization
. new mode for sys_memset: include process so memset can be
	  done in physical or virtual address space.
	. add a mode to mmap() that lets a process allocate uninitialized
	  memory.
	. this allows an exec()er (RS, VFS, etc.) to request uninitialized
	  memory from VM and selectively clear the ranges that don't come
	  from a file, leaving no uninitialized memory left for the process
	  to see.
	. use callbacks for clearing the process, clearing memory in the
	  process, and copying into the process; so that the libexec code
	  can be used from rs, vfs, and in the future, kernel (to load vm)
	  and vm (to load boot-time processes)
2012-06-07 15:15:02 +02:00
Ben Gras 040362e379 exec() cleanup, generalization, improvement
. make exec() callers (i.e. vfs and rs) determine the
	  memory layout by explicitly reserving regions using
	  mmap() calls on behalf of the exec()ing process,
	  i.e. handling all of the exec logic, thereby eliminating
	  all special exec() knowledge from VM.
	. the new procedure is: clear the exec()ing process
	  first, then call third-party mmap()s to reserve memory, then
	  copy the executable file section contents in, all using callbacks
	  tailored to the caller's way of starting an executable
	. i.e. no more explicit EXEC_NEWMEM-style calls in PM or VM
	  as with rigid 2-section arguments
	. this naturally allows generalizing exec() by simply loading
	  all ELF sections
	. drop/merge of lots of duplicate exec() code into libexec
	. not copying the code sections to vfs and into the executable
	  again is a measurable performance improvement (about 3.3% faster
	  for 'make' in src/servers/)
2012-06-07 15:15:01 +02:00
Ben Gras 1daf36038c kernel: compact utility functions 2012-06-07 11:25:32 +02:00
Ben Gras 910a0e1093 kernel: make sure mpx.S is linked early
. for qemu multiboot detection
2012-06-01 16:58:00 +02:00
Ben Gras ad0db93247 no USE_BOOTPARAM 2012-05-31 01:13:27 +02:00
Ben Gras 3803c55856 kernel: neater arch-dependent split in Makefiles
. files in kernel/ references in kernel/Makefile, but
	  in kernel/arch/i386/ in kernel/arch/i386/Makefile.inc
2012-05-31 01:06:19 +02:00
Ben Gras cfb2d7bca5 retire BIOS_SEG and umap_bios
. readbios call is now a physical copy with range check in
	  the kernel call instead of BIOS_SEG+umap_bios
	. requires all access to physical memory in bios range to go
	  through sys_readbios
	. drivers/dpeth: wasn't using it
	. adjusted printer
2012-05-09 19:03:59 +02:00
Ben Gras b41df2eb0d kernel: mon_return cleanup
cleanup of boot monitor related code.
2012-04-25 17:59:43 +02:00
Ben Gras a149be43fc use linker to align fpu state save area 2012-04-19 15:06:47 +02:00
Ben Gras 53002f6f6c recognize and execute dynamically linked executables
. generalize libexec slightly to get some more necessary information
	  from ELF files, e.g. the interpreter
	. execute dynamically linked executables when exec()ed by VFS
	. switch to netbsd variant of elf32.h exclusively, solves some
	  conflicting headers
2012-04-16 00:41:42 +00:00
Ben Gras 927b9ef243 kernel: align gdt and idt base addresses
patch my fdmanana:
As recommended by the Intel 64 and IA-32 Architectures Developer's
Manual Volume 3A, the GDT and IDT base addresses should be aligned on an
8 byte boundary to yield better processor performance.
2012-04-15 20:41:36 +02:00
Ben Gras 8c4cdbd3c5 import genassym and use it for sconst.h in kernel 2012-03-31 15:29:53 +02:00
David van Moolenbroek fa805ebd1e Kernel/servers/drivers: resolve a few warnings
Flagged by clang 3.1.
2012-03-30 16:55:06 +02:00
Arun Thomas b0666ba6b6 kernel: Remove unnecessary ACK conditionals 2012-03-29 13:29:09 +02:00
Tomas Hruby 5ab87a6c38 ioapic - missing volatiles
leads to a kernel panic when using clang and SMP

reported by trd <trdempsey.201201@gmail.com>
2012-03-29 00:53:38 -07:00
Ben Gras 1e399dd8bd various kernel printing fixes
. remove some call cycles by low-level functions invoking printf(); e.g.
	  send_sig() gets a return value that the caller should check
	. reason: very-early-phase printf() would trigger a printf() causing
	  infinite recursion -> GPF
	. move serial initialization a little earlier so DEBUG_EXTRA works for
	  serial earlier (e.g. its first instance, for "cstart")
	. closes tracker item 583:
	  System Fails to Complete Startup with Verbose 2 and 3 Boot Parameters,
	  reported by Stephen Hatton / pikpik.
2012-03-28 18:23:12 +02:00
Ben Gras a5190194a0 build: don't -L/usr/pkg/lib
You might have to update the compiler-rt package! See UPDATING.

	. the purpose of this -L was solely to find compiler-rt, which contains
	  runtime support code for clang-compiled binaries
	. this also makes all other packaged libraries visible, however
	. it is cleaner to isolate the base system from packages, and so
	  compiler-rt puts itself in /usr/pkg/compiler-rt/lib/ too, which the
	  base system henceforth uses exclusively
	. e.g. this solves a link failure when libfetch is installed as a
	  package
	. the new compiler-rt package also puts itself in /usr/pkg/lib for 'old'
	  systems; that is harmless. The benefit of 'new' systems is that the other
	  packages are hidden.
2012-03-27 12:31:30 +02:00
David van Moolenbroek 9cca9d7566 Kernel: arch-related cleanup
- move umap_bios() into arch-specific code
- move proc.p_fpu_state access into arch-specific blocks
2012-03-26 14:19:33 +02:00
Ben Gras 204ae72525 retire _ANSI and <minix/ansi.h> 2012-03-25 21:58:27 +02:00
Ben Gras 7336a67dfe retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +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
David van Moolenbroek 70abb127cc Add sys_vumap() kernel call
This new call is a vectored version of sys_umap(). It supports batch
lookups, non-contiguous memory, faulting in memory, and basic access
checks.
2012-03-24 19:51:13 +01:00
David van Moolenbroek 2a395dd8b4 Kernel: introduce vm_check_range 2012-03-24 19:51:13 +01:00
David van Moolenbroek 08af3f672b Kernel: replace vm_contiguous with vm_lookup_range 2012-03-24 19:51:12 +01:00
Ben Gras 6af9856d4a libcompat_minix-centric cleanup
remove some old minix-userland-specific stuff

	. /etc/ttytab as a file, and minix-compat function (fftyslot()),
	  replaced by /etc/ttys and new libc functions
	. also remove minix-specific nlist(), cuserid(), fttyslot(), v8 regex
	  functions and <compat/regex.h>
	. and remaining minix-only utilities that use them
	. also unused <compat/pwd.h> and <compat/syslog.h> and
	  redundant <sys/sigcontext.h>
2012-03-16 17:06:24 +01:00
David van Moolenbroek 1512dc5c23 Kernel: do not retry message delivery upon failure 2012-03-05 22:38:04 +01:00
David van Moolenbroek c8c9565a03 Kernel: only reset/reload FPU state when necessary 2012-03-05 22:32:14 +01:00
David van Moolenbroek a615a7d4d2 Kernel: retain FPU state upon save
On the x86, saving FPU state has the side effect of resetting this
state. In some cases (fork, getcontext), this would cause the state
to be lost. This patch restores the FPU state right after saving it,
except when different state is loaded immediately after.
2012-03-05 22:32:14 +01:00
David van Moolenbroek 0a8a2ecfb5 Kernel: pass FPU restore exception to user process
Previously, user processes could cause a kernel panic upon FPU state
restore, by passing bogus FPU state to the kernel (through e.g.
sigreturn). With this patch, the process is now sent a SIGFPE signal
instead.
2012-03-05 22:32:14 +01:00
David van Moolenbroek 4b6a98de5f Kernel: adjust FPU state upon process slot swap
This fixes seemingly random FPU exceptions and kernel panics occurring
after a system server restart.
2012-03-05 22:32:14 +01:00
Tomas Hruby 036ce9d4db Revert "SMP - no_apic=0 and acpi=1 set when CONFIG_SMP=y"
This reverts commit c468f4efa5.

Since we use the new boot loader, this hack is no longer necessary.
2012-02-24 10:16:55 +01:00
Arun Thomas 1f0bfa8519 kernel: Update copyright date 2012-02-22 16:36:26 +01:00
Ben Gras ca47635d0a try multiple reset methods
. fixes reboot-hang under vbox
	. makes experience nicer under vmware
	. taken from netbsd reset code
2012-02-20 23:46:38 +01:00
Arun Thomas 96940bcd57 kernel/utility.c: fix implicit decl warnings 2012-02-17 15:30:03 +01:00
Arun Thomas ff56906879 Remove obsolete INSTALLFLAGS from makefiles 2012-02-16 23:26:38 +01:00
Antoine Leca 3fb8cb760c More cleaning up 2012-02-15 19:04:58 +00:00
Antoine Leca f4ffbc6072 Make ELF kernel boot faster 2012-02-14 14:52:15 +01: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
Evgeniy Ivanov 2487445f5f make panic() work for multiboot/elf case
. we cannot use the boot monitor to print the system diag buffer
	. for serial, we do nothing, just reset, everything is already printed
	. for not-serial, we print the current diag buffer using direct video
	  memory access from the kernel
2012-02-14 14:48:10 +01:00
Ben Gras 636264c1c6 Fixes for loading kernel with multiboot
While parsing command line, only consider "variable=value" to
be part of environment.

Patch by Antoine Leca.
2012-02-09 18:54:45 +01:00
Tomas Hruby 5c0927e108 SMP - clock calibration spurious IRQ deadlock fix
- this patch fixes a deadlock which may occur if we get a
   spurious interrupt while calibrating clocks during the boot
   time. Since we never handle interrupts while in the kernel
   (BKL locked) the interrupt code locks the lock. This is a
   different situation, a corner case, boot time only. We do not
   return to userspace but to the kernel, so the BKL is not
   unlocked. So we need irq handler which leaves the BKL
   unlocked.  The clock handler does it already, this patch adds
   a dummy spurious irq handler for the same reason. It is better
   to handle the situation this way to keep the normal runtime
   code simple.
2012-01-26 11:39:40 +00:00
Tomas Hruby c468f4efa5 SMP - no_apic=0 and acpi=1 set when CONFIG_SMP=y
- this is a temporary change which makes images compiled for SMP
  boot in SMP mode by default.

- this change is needed until we can configure the multiboot
  images from the boot loader again.
2012-01-25 19:02:13 +00:00
Tomas Hruby 9e1d244cbe Revert 93b9873a56
- non need to have free PDEs per CPU since we only run one
  instance of the kernel at any time
2012-01-25 18:59:18 +00:00
Thomas Veerman a6d0ee24c3 Use correct value for _NSIG
User processes can send signals with number up to _NSIG. There are a few
signal numbers above that used by the kernel, but should explicitly not
be included in the range or range checks in PM will fail.

The system processes use a different version of sigaddset, sigdelset,
sigemptyset, sigfillset, and sigismember which does not include a range
check on signal numbers (as opposed to the normal functions used by normal
processes).

This patch unbreaks test37 when the boot image is compiled with GCC/Clang.
2012-01-16 11:42:29 +00:00
Tomas Hruby 758d788bbe SMP - asyn send SMP safe
- we must not deliver messages from/to unstable address spaces.
  In such a case, we must postpone the delivery. To make sute
  that a process which is expecting an asynchronous message does
  not starve, we must remember that we skipped delivery of some
  messages and we must try to deliver again once the source
  address space is stable again.
2012-01-13 11:30:01 +00:00