Commit graph

752 commits

Author SHA1 Message Date
Ben Gras 4857d5d554 add -lminixfs with fs support routines
. move cache size heuristic from mfs there
	  so mfs and ext2 can share it
	. add vfs credentials retrieving function, with
	  backwards compatability from previous struct
	  format, to be used by both ext2 and mfs
	. fix for ext2 - STATICINIT was fed no.
	  of bytes instead of no. of elements, overallocating
	  memory by a megabyte or two for the superblock
2011-09-08 16:52:13 +00:00
Thomas Veerman 8a266a478e Increase gid_t and uid_t to 32 bits
Increase gid_t and uid_t to 32 bits and provide backwards compatibility
where needed.
2011-09-05 13:56:14 +00:00
Thomas Veerman fde9a258d0 Make dev_t 32-bits and provide backwards compatibility 2011-09-05 08:52:57 +00:00
Ben Gras 86b5fa5102 get rid of leftover _DIRENT_NAME_LEN=61 2011-09-01 16:27:28 +00:00
Ben Gras f984dbba70 increase system-wide filename limit to 255
. move mfs-specific struct, constants to mfs/, so
	  mfs-specific, on-disk format structs and consts are
	  fully isolated from generic structs and functions
	. removes de and readfs utils
2011-08-17 16:00:01 +00:00
Ben Gras 51ffecc181 import elf-only -lcurses
. abandons mixer, gomoku, talk, talkd, top from base system
	. compile top with clang so no ack-compiled program
	  needs -lcurses any more
2011-07-25 11:08:17 +02:00
Ben Gras 02081e4b62 rename mmap() and munmap()
. it's a good extra interface to have but doesn't
	  meet standardised functionality
	. applications (in pkgsrc) find it and expect
	  full functionality the minix mmap doesn't offter
	. on the whole probably better to hide these functions
	  (mmap and friends) until they are grown up; the base system
	  can use the new minix_* names
2011-07-16 13:01:19 +02:00
Ben Gras 85f6d866e6 rename mmap MAP_SHARED to MAP_IPC_SHARED
. MAP_SHARED was used to implement sysv shared memory
	. used to signal shareable memory region to VM
	. assumptions about this situation break when processes
	  use MAP_SHARED for its normal, standardised meaning
2011-07-15 18:10:50 +02:00
Evgeniy Ivanov ef0a265086 New stat structure.
* VFS and installed MFSes must be in sync before and after this change *

Use struct stat from NetBSD. It requires adding new STAT, FSTAT and LSTAT
syscalls. Libc modification is both backward and forward compatible.

Also new struct stat uses modern field sizes to avoid ABI
incompatibility, when we update uid_t, gid_t and company.
Exceptions are ino_t and off_t in old libc (though paddings added).
2011-07-12 16:39:55 +02:00
Ben Gras f3d5a9dc61 Reduce compiler/libraries/headers cases to only two
1. ack, a.out, minix headers (moved to /usr/include.ack),
	   minix libc
	2. gcc/clang, elf, netbsd headers (moved to /usr/include),
	   netbsd libc (moved to /usr/lib)

So this obsoletes the /usr/netbsd hierarchy.

No special invocation for netbsd libc necessary - it's always used
for gcc/clang.
2011-07-04 04:09:52 +02:00
Arun Thomas 93ae43f577 boot: Add multiboot support
Not yet fully spec-compliant; work in progress
2011-06-24 17:21:51 +02:00
Ben Gras e785381d4d introduce option to time assert()s
. remove a few asserts in the kernel and 64bi library
    that are not compatible with the timing code
  . change the TIME_BLOCKS code a little to work in-kernel
2011-06-24 16:00:42 +02:00
Gianluca Guida 4e86b0d53f Move back resolv.h, nameser.h and netdb.h as they conflict with NetBSD headers and libc. 2011-04-08 18:50:58 +00:00
Gianluca Guida 6f4e3dd910 Move elf headers in common/include and libexec.h in lib/libexec.
It also fixes elf headers for NBSD compilation.
2011-03-18 15:13:05 +00:00
Gianluca Guida f4814901af Move even more includes to common/include.
This patch moves more includes (most of them, to tell the truth) to
common/include directory. This completes the list of includes needed
to compile current trunk with the new libc (but to do that you need
more patches in queue).

This patch also contains some modification (for compilation with new
headers) to the common includes under __NBSD_LIBC, the define used
in mk script to specialize compilation with new includes.
2011-03-03 16:39:02 +00:00
Ben Gras 493ea15714 rename aligned() macro to _minix_aligned 2011-03-02 16:05:59 +00:00
Ben Gras b6f25271a9 only declare builtin prototypes in C mode 2011-02-28 11:01:31 +00:00
Ben Gras 813ba29677 build fix 2011-02-26 11:42:25 +00:00
Dirk Vogt 3c9012886f added DDEkit headers 2011-02-25 12:31:20 +00:00
Dirk Vogt 00dcbb9dc6 Added Device Manager (USB hotplug support) 2011-02-23 13:48:03 +00:00
Dirk Vogt 083d30afbb added libusb, a IPC abstraction lib for USB stuff 2011-02-22 10:23:38 +00:00
Dirk Vogt 55ccdba0f6 USB chapter 9 definitions 2011-02-21 14:09:08 +00:00
Dirk Vogt 8f860a27d1 Increase maximum filename length for /sys/ 2011-02-18 12:47:25 +00:00
Gianluca Guida 05480c229a Move network includes and lib.h into common/include subdir.
This patch moves further includes (the network part and lib.h) in common/.
It is the last part to get the netbsd libc to compile under minix. Further moves will be needed as we get the netbsd libc to compile minix itself.

Also, this patch add #ifndef's to termios.h, as it create problems with netbsd's namespace.h.
2011-02-14 12:49:18 +00:00
Gianluca Guida fa59fc6eb4 Move shared headers in common/include
Headers that will be shared between old includes and NetBSD-like includes
are moved into common/include tree. They are still copied in /usr/include
in 'make includes', so compilation and programs aren't be affected.
2011-02-06 22:59:02 +00:00
Ben Gras 0203ea37bf include - throw out gettiminglocks stuff from include 2011-02-04 13:42:54 +00:00
Ben Gras 4fc9428808 <ansi.h> -> <minix/ansi.h> 2011-01-28 11:50:47 +00:00
Ben Gras dc1cc91df1 <ansi.h> -> <minix/ansi.h> 2011-01-28 11:35:02 +00:00
Ben Gras e50070e3b3 added uint typedef declaration in <minix/types.h>
. needed for xmlrpc (needed for cmake (needed for compiler-rt))
2011-01-26 14:36:19 +00:00
Ben Gras 7b2d6c3c98 added <complex.h> (needed for compiler-rt) 2011-01-26 14:35:34 +00:00
David van Moolenbroek 5d8d5e0c3a change bitchunk_t from 16-bit to 32-bit 2010-12-21 10:44:45 +00:00
David van Moolenbroek d23c3d110e sys/queue.h: add LIST_FOREACH_SAFE 2010-12-20 23:52:53 +00:00
Arun Thomas 372b873413 VFS/RS support for ELF 2010-12-10 09:27:56 +00:00
David van Moolenbroek a7285dfabc Kernel/RS: fix permission computation with 32+ system processes 2010-12-07 10:32:42 +00:00
Dirk Vogt 9ed280d1ec decouple file system server start/termination from mount/umount 2010-11-23 19:34:56 +00:00
Arun Thomas 6b5c8751da Add machine/param.h 2010-11-23 11:05:09 +00:00
Tomas Hruby 504abf4b34 Inlining 64bit integer handling functions
- if gcc/clang is used the C functions that use long long can be
  inlined to get better performance (yes, it makes difference)
2010-11-18 16:37:40 +00:00
Dirk Vogt 6208131459 libdriver without mandatory driver main loop 2010-11-17 15:10:20 +00:00
Dirk Vogt c22564335f Added possibility to inject input events to tty
M    include/Makefile
A    include/minix/input.h
M    include/minix/com.h
M    drivers/tty/keyboard.c
M    drivers/tty/tty.c
M    drivers/tty/tty.h
M    include/minix/syslib.h
M    lib/libsys/Makefile
A    lib/libsys/input.c
2010-11-17 14:53:07 +00:00
Arun Thomas f0ab18377d GCC/clang: int64 routines in C 2010-11-12 18:38:10 +00:00
Erik van der Kouwe afeb246328 Remove global variable 'i' 2010-11-11 14:12:48 +00:00
Arun Thomas 998af6f111 Move minix/paths.h to paths.h
Also, merge in relevant macros from NetBSD
2010-11-06 20:40:15 +00:00
Tomas Hruby ac780f36a0 sys_getcpuinfo() 2010-10-26 21:07:50 +00:00
Tomas Hruby c9bfb13cdb Kernel keeps information about each cpu
- kernel maintains a cpu_info array which contains various
  information about each cpu as filled when each cpu boots

- the information contains idetification, features etc.
2010-10-26 21:07:27 +00:00
Tomas Hruby 40bfed28cd ACPI pci-to-pci bridges
- every pci device which implements _PRT acpi method is considered to
  be a pci-to-pci bridge

- acpi driver constructs a hierarchy of pci-to-pci bridges

- when pci driver identifies a pci-to-pci bridge it tells acpi driver
  what is the primary and the secondary bus for this device

- when pci requests IRQ routing information from acpi, it passes the
  bus number too to be able to identify the device accurately
2010-10-21 17:07:09 +00:00
Ben Gras b0d7ce8d09 <minix/hash.h> 2010-10-15 11:25:40 +00:00
Ben Gras 26de8dd299 change SSIZE_MAX to INT_MAX instead of 32767.
With this change, suggested by Gautam Tirumala, ports for pkgin and
pkg_install are cleaner and so easier to upstream.  Presumably other
ports will be smoother too.

There doesn't seem to be a reason SSIZE_MAX was so small to begin with.
2010-10-10 22:33:23 +00:00
Ben Gras e0ac271e5a include <sys/cdefs.h> in <minix/sysutil> (clang fix) 2010-10-06 13:09:49 +00:00
Erik van der Kouwe ada0b4ca04 Fix warnings due to missing __dead attribute on exit 2010-10-05 07:25:47 +00:00
Erik van der Kouwe 7bc944c8a9 fflush is neither needed nor allowed in system srvers, which is where SEF is used 2010-10-04 17:38:53 +00:00
Arun Thomas 40ccb7ed54 Add include/memory.h
Some ports expect that it exists.
2010-10-04 13:37:46 +00:00
Thomas Veerman a7072a5e1c Revamp the mthread library and update test59
Before, the 'main thread' of a process was never taken into account anywhere in
the library, causing mutexes not to work properly (and consequently, neither
did the condition variables). For example, if the 'main thread' (that is, the
thread which is started at the beginning of a process; not a spawned thread by
the library) would lock a mutex, it wasn't actually locked.
2010-09-30 13:44:13 +00:00
Tomas Hruby 274fcf8d1f neg64() makes a 64bit integer negative
- neg64(a) == -a

- although we only support 64 bit unsigned arithmetics sometimes it's good to
  have a 2-complement negative number
2010-09-23 14:42:26 +00:00
Tomas Hruby 8eece1c00c CPU type detection
- sometimes the system needs to know precisely on what type of cpu is
  running. The cpu type id detected during arch specific
  initialization and kept in the machine structure for later use.

- as a side-effect the information is exported to userland
2010-09-23 14:42:19 +00:00
Tomas Hruby 74c5cd7668 The profile utility can set the sprofiling mode
- profile --nmi | --rtc sets the profiling mode

- --rtc is default, uses BIOS RTC, cannot profile kernel the presetted
  frequency values apply

- --nmi is only available in APIC mode as it uses the NMI watchdog, -f
  allows any frequency in Hz

- both modes use compatible data structures
2010-09-23 10:49:42 +00:00
Tomas Hruby db12229ce3 New profile protocol
- when kernel profiles a process for the first time it saves an entry
  describing the process [endpoint|name]

- every profile sample is only [endpoint|pc]

- profile utility creates a table of endpoint <-> name relations and
  translates endpoints of samples into names and writing out the
  results to comply with the processing tools

- "task" endpoints like KERNEL are negative thus we must cast it to
  unsigned when hashing
2010-09-23 10:49:39 +00:00
Thomas Veerman 62aba4396e Get rid of erroneous define 2010-09-23 08:52:49 +00:00
Ben Gras d55eab30fa includes - minor compile fixes. 2010-09-22 14:31:51 +00:00
Thomas Veerman 12e167f672 Add libmthread and test59 to test the implementation 2010-09-21 12:22:38 +00:00
Tomas Hruby a665ae3de1 Userspace scheduling - exporting stats
- contributed by Bjorn Swift

- adds process accounting, for example counting the number of messages
  sent, how often the process was preemted and how much time it spent
  in the run queue. These statistics, along with the current cpu load,
  are sent back to the user-space scheduler in the Out Of Quantum
  message.

- the user-space scheduler may choose to make use of these statistics
  when making scheduling decisions. For isntance the cpu load becomes
  especially useful when scheduling on multiple cores.
2010-09-19 15:52:12 +00:00
Tomas Hruby 1f89845bb2 SMP - can boot even if some cpus fail to boot
- EBADCPU is returned is scheduler tries to run a process on a CPU
  that either does not exist or isn't booted

- this change was originally meant to deal with stupid cpuid
  instruction which provides totally useless information about
  hyper-threading and MPS which does not deal with ht at all. ACPI
  provides correct information. If ht is turned off it looks like some
  CPUs failed to boot.  Nevertheless this patch may be handy for
  testing/benchmarking in the future.
2010-09-15 14:11:21 +00:00
Tomas Hruby 6513d20744 SMP - Process is stopped when VM modifies the page tables
- RTS_VMINHIBIT flag is used to stop process while VM is fiddling with
  its pagetables

- more generic way of sending synchronous scheduling events among cpus

- do the x-cpu smp sched calls only if the target process is runnable.
  If it is not, it cannot be running and it cannot become runnable
  this CPU holds the BKL
2010-09-15 14:11:12 +00:00
Tomas Hruby 06b6e5624a SMP - Changed prototype of sys_schedule()
- sys_schedule can change only selected values, -1 means that the
  current value should be kept unchanged. For instance we mostly want
  to change the scheduling quantum and priority but we want to keep
  the process at the current cpu

- RS can hand off its processes to scheduler

- service can read the destination cpu from system.conf

- RS can pass the information farther
2010-09-15 14:10:42 +00:00
Tomas Hruby 1e273f640e SMP - Scheduler can assign process to a cpu
- machine information contains the number of cpus and the bsp id

- a dummy SMP scheduler which keeps all system processes on BSP and
  all other process on APs. The scheduler remembers how many processes
  are assigned to each CPU and always picks the one with the least
  processes for a new process.
2010-09-15 14:10:33 +00:00
Tomas Hruby 62c666566e SMP - We boot APs
- kernel detects CPUs by searching ACPI tables for local apic nodes

- each CPU has its own TSS that points to its own stack. All cpus boot
  on the same boot stack (in sequence) but switch to its private stack
  as soon as they can.

- final booting code in main() placed in bsp_finish_booting() which is
  executed only after the BSP switches to its final stack

- apic functions to send startup interrupts

- assembler functions to handle CPU features not needed for single cpu
  mode like memory barries, HT detection etc.

- new files kernel/smp.[ch], kernel/arch/i386/arch_smp.c and
  kernel/arch/i386/include/arch_smp.h

- 16-bit trampoline code for the APs. It is executed by each AP after
  receiving startup IPIs it brings up the CPUs to 32bit mode and let
  them spin in an infinite loop so they don't do any damage.

- implementation of kernel spinlock

- CONFIG_SMP and CONFIG_MAX_CPUS set by the build system
2010-09-15 14:09:52 +00:00
Tomas Hruby 13a0d5fa5e SMP - Cpu local variables
- most global variables carry information which is specific to the
  local CPU and each CPU must have its own copy

- cpu local variable must be declared in cpulocal.h between
  DECLARE_CPULOCAL_START and DECLARE_CPULOCAL_END markers using
  DECLARE_CPULOCAL macro

- to access the cpu local data the provided macros must be used

	get_cpu_var(cpu, name)
	get_cpu_var_ptr(cpu, name)

	get_cpulocal_var(name)
	get_cpulocal_var_ptr(name)

- using this macros makes future changes in the implementation
  possible

- switching to ELF will make the declaration of cpu local data much
  simpler, e.g.

  CPULOCAL int blah;

  anywhere in the kernel source code
2010-09-15 14:09:46 +00:00
Ben Gras 467a01024e bump trunk version to 3.1.9
make issue.install not include version
2010-09-15 08:47:42 +00:00
Ben Gras 2065c9982b include - minor compile fixes (including <ansi.h> in files that use it)
workaround for kernel/debug.h that causes <ansi.h> to be included in mpx.S
indirectly.
2010-09-15 08:47:10 +00:00
David van Moolenbroek 354da24f5b make getsysinfo() a system-land call 2010-09-14 21:50:05 +00:00
David van Moolenbroek d269f5fb90 ProcFS integration 2010-09-14 21:27:31 +00:00
David van Moolenbroek 2c5c5c06ea ProcFS server, by Alen Stojanov and David van Moolenbroek 2010-09-14 21:25:25 +00:00
David van Moolenbroek 3eb65448a6 VM: expose secondary cache size 2010-09-14 21:22:56 +00:00
Ben Gras a5a8c57fe7 add EHOSTDOWN errno. 2010-09-14 11:51:41 +00:00
Tomas Hruby ad5ecf906b asm.h not installed 2010-09-03 17:01:18 +00:00
Tomas Hruby 9560b6dea8 ACPI driver
- 99% of the code is Intel's ACPICA. The license is compliant with BSD
  and GNU and virtually all systems that use ACPI use this code, For
  instance it is part of the Linux kernel.

- The only minix specific files are

  acpi.c
  osminixxf.c
  platform/acminix.h

  and

  include/minix/acpi.h

- At the moment the driver does not register interrupt hooks which I
  believe is mainly for handling PnP, events like "battery level is
  low" and power management. Should not be difficult to add it if need
  be.

- The interface to the outside world is virtually non-existent except
  a trivial message based service for PCI driver to query which device
  is connected to what IRQ line. This will evolve as more components
  start using this driver. VM, Scheduler and IOMMU are the possible
  users right now.

- because of dependency on a native 64bit (long long, part of c99) it
  is compiled only with a gnu-like compilers which in case of Minix
  includes gcc llvm-gcc and clang
2010-09-02 15:44:04 +00:00
Tomas Hruby 43a4725423 pci_*.h headers moved from drivers/pci to include/machine 2010-09-02 15:43:59 +00:00
Tomas Hruby 2440ffae49 Kernel exports DSDP and apic_enabled in machine structure
- kernel exports DSDP (the root pointer where ACPI parsing starts) and
  apic_enabled in the machine structure.

- ACPI driver uses DSDP to locate ACPI in memory. acpi_enabled tell
  PCI driver to query ACPI for IRQ routing information.
2010-09-02 15:43:56 +00:00
Tomas Hruby 344e9221ec Kernel supports up to 64 IRQs
- enough for 2 io apics (usually with 24 pins)
2010-09-02 15:43:54 +00:00
Ben Gras b1847ae244 make service look in /etc/system.conf.d/<progname> first for config file.
This makes it easier to
  - have non-base system drivers (get clobbered by global system.conf)
  - have drivers as packages (can't touch global system.conf)
  - make configs part of the drivers/servers instead of in global file
    (makes system parts more self-contained)
2010-08-31 14:33:31 +00:00
Erik van der Kouwe 1f2054c89c Shutdown changes for multiboot: CTRL-ALT-DEL resets, panic halts 2010-08-30 19:01:58 +00:00
Arun Thomas 36fb30dfef cdefs.h: Allow __CONCAT() macro to be nested 2010-08-30 14:34:58 +00:00
Thomas Veerman 2297e26660 Prepare headers to support file descriptor passing over UNIX Domain Sockets.
Contributed by Thomas Cort.
2010-08-30 13:41:22 +00:00
Ben Gras 5d6c2aae0a gcov support, based on work contributed by Anton Kuijsten. 2010-08-25 13:06:43 +00:00
Ben Gras 0f4eda33eb new base libaudiodriver out of -lcommon in drivers/audio.
- this lets the drivers that used that library be compiled easily with
   different compilers.
2010-08-25 11:03:53 +00:00
Ben Gras 1d0e0e217d <stddef.h> - alternative definition of offsetof for gcc using builtin 2010-08-25 07:25:32 +00:00
Erik van der Kouwe 3211be5d14 Avoid duplicate type definitions, especially wchar_t which was inconsstent and caused trouble in libarchive 2010-08-23 17:00:04 +00:00
Arun Thomas de231a713e Move MIN() and MAX() macros to sys/params.h 2010-08-21 13:10:41 +00:00
Arun Thomas 60a71efca8 easprintf() and evasprintf() 2010-08-21 13:07:25 +00:00
Erik van der Kouwe b337d3f8e5 move rrrrrrread_tsc from libsys to libc so anyone can use it 2010-08-20 18:43:56 +00:00
Arun Thomas 9a21d1a2fd Macros for symbols used in both ASM and C
-The macros take care of prepending the leading underscore when
 necessary.
2010-08-17 16:44:07 +00:00
Erik van der Kouwe 551374c228 Add ftello function 2010-08-16 17:07:40 +00:00
Erik van der Kouwe a3e4dcafe0 Add fseeko function 2010-08-16 17:06:08 +00:00
David van Moolenbroek 484b2f43d6 at_wini/ahci: write cache ioctls 2010-08-12 14:09:34 +00:00
David van Moolenbroek bee1f38e01 VTreeFS library 2010-08-10 20:05:51 +00:00
Tomas Hruby d5482f6e75 Reverted __packed for ACK
- ack does not produce packed structures
2010-08-06 10:28:40 +00:00
Tomas Hruby 6e614336d6 __packed defined for ACK 2010-08-06 09:53:53 +00:00
Erik van der Kouwe 42a2c1a03a Increase max number of open files to 255 (more should be possible but does not seem necessary for now) 2010-08-04 13:35:19 +00:00
Erik van der Kouwe a719ab7780 Auto-detect ext2 partitions in mount 2010-08-03 06:28:58 +00:00
Thomas Veerman 253b4b3fe5 - Add support for ST_NOTRUNC to struct statvfs.
- Let tests that test for long file names check for that flag, so that they can
  verify the results properly.
2010-08-02 11:16:32 +00:00
David van Moolenbroek 20eced94e7 libdriver: allow driver to break out of message loop 2010-08-01 22:07:46 +00:00