Commit graph

51 commits

Author SHA1 Message Date
Sanchayan Maity 368b5fc155 Initialise the "name" variable properly and compare all 32 bytes
Without this patch, calling sys_mq_open() with same names specified
results in two separate queues being opened and their descriptors
returned instead of the same descriptor being returned for both.

Do the initialisation and comparison properly, so that when the
same name is specified to sys_mq_open multiple times in same
process or different process, the same opened queue descriptor is
returned.
2016-03-23 11:11:30 +05:30
Sanchayan Maity 8501cb7ed8 Allow users to request a asynchronous notification
This patch adds functionality to request an asynchronous notification
if some other process has send a message to it. We currently send a
SIGALRM to avoid any changes to core infrastructure of signal handling.
Ideally we should implement a separate signal for this. Currently there
is an obvious disadvantage of not being able to use SIGALRM with alarm,
if we are using this functionality.
2016-03-22 17:51:09 +05:30
Sanchayan Maity 55d341bc54 Allow users to get and set attributes
Currently we only allow users to get and set number of queues. The
operation is always non blocking. There is no provision for non
blocking operation at the moment.

The queue sizes are set to MAX 256 by default. If a user changes the
attributes and sets the queue size or number of messages in a queue
to less than 256, it is the responsibility of the user to close any
queues which were opened with a descriptor greater than the value
currently set.

For example, by default queue sizes are 256. If 150 queues are opened
and then the user sets the number of queues to 32, all open descriptors
and queues from 32 to 150 must be closed. Note that descriptor number
allocation starts with zero and not one.
2016-03-22 15:57:53 +05:30
Sanchayan Maity d84b3d9248 Miscellaneous cleanup 2016-03-19 17:42:29 +05:30
Sanchayan Maity 0cc443d3c2 Fix message priority implementation
Functional specification mandates returning a message with a higher
timestamp in case two messages have the same priority. Somehow we
missed this in the implementation. This also introduced a bug where
all messages with same priority could cause problems.
2016-03-19 16:54:26 +05:30
Sanchayan Maity fe71ea4bc1 First round of assorted bug fixes
Fixed the following bugs:
1. Message priority was not set at all at two places
2. Limits check was not correct while returning error values
3. We are suppose to allow multiple users operate on the same queue
using a named descriptor. However any one user calling close before
the other would result in closing the queue even when other users
might be using it. Track number of users and close only if number of
users is zero. Yet to do functional tests for this, so this is untested,
but introduce it anyway at this juncture.
2016-03-19 11:49:48 +05:30
Sanchayan Maity d2fb3a4b8a Allow user processes to send messages to kernel
This patch allows user processes to send messages to kernel. Without
this change, trying to do a system call for using message queues like
sys_mq_open will fail with ECALLDENIED error number -210.
2016-03-16 23:30:06 +05:30
Sanchayan Maity 58ce9ca12b Fix return values used in mq_open 2016-03-15 19:51:08 +05:30
Sanchayan Maity df5a0e339c Limit the number of queues to 16 2016-03-15 19:39:03 +05:30
Sanchayan Maity 63062e7e15 Add message queue support for Minix
Implement message queues support for Minix.

Pending tasks:
Blocking or non blocking for send receive?
Sort by priority and time?
Test codes?
Bug fixes?
2016-03-07 17:41:07 +05:30
Sanchayan Maity 6f36b466f3 minix: Prepare for message queue support to Minix kernel
This commit adds preparatory support for forthcoming message
queue implementation to the Minix kernel. The core implementation
will be added with the next commit.
2016-02-29 20:43:07 +05:30
Sanchayan Maity dda907e345 kernel: main: Add name and IIT CWID to immediate startup message for Project 0 2016-01-28 14:24:53 +05:30
David van Moolenbroek bc2d75fa05 Rework getrusage(2) infrastructure
- the userland call is now made to PM only, and PM relays the call to
  other servers as appropriate; this is an ABI change that will
  ultimately allow us to add proper support for wait3() and the like;
  for the moment there is backward compatibility;
- the getrusage-specific kernel subcall has been removed, as it
  provided only redundant functionality, and did not provide the means
  to be extended correctly in the future - namely, allowing the kernel
  to return different values depending on whether resource usage of
  the caller (self) or its children was requested;
- VM is now told whether resource usage of the caller (self) or its
  children is requested, and it refrains from filling in wrong values
  for information it does not have;
- VM now uses the correct unit for the ru_maxrss values;
- VFS is cut out of the loop entirely, since it does not provide any
  values at the moment; a comment explains how it should be readded.

Change-Id: I27b0f488437dec3d8e784721c67b03f2f853120f
2015-09-28 14:06:59 +00:00
David van Moolenbroek 0f8e20a12c getrusage(2): zero out ru_nsignals field
The current value was both wrong (counting spawned kernel signals
rather than delivered user signals) and returned for the calling
process even if the request was for the process's children.
For now we are better off not populating this field at all.

Change-Id: I6c660be266b5746b7c3db57ae88fa7f872961ee2
2015-09-28 14:06:58 +00:00
David van Moolenbroek 20054ae93f Kernel: separate userland ABI on kernel page
Currently, the userland ABI uses a single field ('user_sp') far
into the very large 'kinfo' structure on the shared kernel
information page.  This precludes us from modifying or getting
rid of 'kinfo' in the future without breaking userland.  This
patch adds a separate 'kuserinfo' structure to the kernel
information page, with only information that is part of the
userland ABI, in an extensible manner.  Userland now uses this
field if it is present, and falls back to the old field if not.

Change-Id: Ib7b24b53a440f40a2edc28cdfa48447ac2179288
2015-09-23 12:01:15 +00:00
David van Moolenbroek 26f5c8f84b Kernel: store ARM frclock info in one structure
This change serves to reduce the clutter inside the top-level kerninfo
structure, and allows other ARM-specific values to be added on the
kernel page in one place.

Change-Id: I36a6aada9dbd1230b25014728be675d389088667
2015-09-23 12:01:10 +00:00
David van Moolenbroek d91f738bd8 Kernel: export clock information on kernel page
Please note that this information is for use by system services only!
The clock facility is not ready to be used directly by userland, and
thus, this kernel page extension is NOT part of the userland ABI.

For service programmers' convenience, change the prototype of the
getticks(3) to return the uptime clock value directly, since the call
can no longer fail.

Correct the sys_times(2) reply message to use the right field type
for the boot time.

Restructure the kernel internals a bit so as to have all the clock
stuff closer together.

Change-Id: Ifc050b7bd253aecbe46e3bd7d7cc75bd86e45555
2015-09-23 12:00:46 +00:00
David van Moolenbroek 7f79fb8810 Improve asynsend support for process swapping
This resolves various system stalls while running testrelpol.

Change-Id: Ie70fc2dbcdb0a8c9e3800cc0df564be747e111ec
2015-09-17 14:08:30 +00:00
David van Moolenbroek 3779ed93c3 Kernel: IPC filter support for VM memory requests
The filtering also exposed the risk that a process be killed or
swapped while on the list of VM memory requests.  These cases are
now handled properly as well.

Change-Id: Ibd3897b34abdf33bce19d37b8e5f65fbd0fd9316
2015-09-17 13:46:23 +00:00
Ben Gras 8bab0dfa2a Kernel: delivermsg improvements
. make arch-independent, and local to proc.c, reduce code duplication
    . make vm_suspend public but unduplicated in proc.c
    . ask VM for handling once, 2nd time SIGSEGV process
    . remove debug printfs
    . test case for bogus sendrec() address argument

Change-Id: I3893758910c01de60b8fe3e50edd594296a0b73e
2015-09-17 13:41:09 +00:00
Cristiano Giuffrida 50b7f13f9f Add live update-friendly annotations.
Change-Id: I7d7d79893836a20799ca548a350f3288e92581f0
2015-09-17 13:25:38 +00:00
Cristiano Giuffrida 53398d733f vm: Separate mmap regions.
Add support for compact address layout.  This feature can be enabled
through the ac_layout=1 boot option.

Change-Id: Ie20b808fce32b5c54d0a7e7210e0084a540e9613
2015-09-16 11:06:17 +00:00
Cristiano Giuffrida 01c875ce91 kernel: Debug printing at live update time.
Change-Id: I0fa896eb248b3b62e1858f76196d3d6862a30f2b
2015-09-16 11:03:04 +00:00
Cristiano Giuffrida 062400c0e2 kernel: Handle IPC properly at live update time.
Change-Id: I2dfc6c6cf4d2bfe198e159d3e4b7c50d0bb499c8
2015-09-16 11:02:53 +00:00
Cristiano Giuffrida 56e56d2af2 kernel: Inherit allowed memory, IRQ & I/O ranges
Inherit at live update time all the priviledges previously acquired by
the process.

Change-Id: I1fd6ab16680ea85a1f3d8d1c106a7c716bf65e8e
2015-09-16 11:02:44 +00:00
Cristiano Giuffrida 9e6b1315c3 kernel: Allow kernel calls to return ENOTREADY.
This is required to avoid races with safecopy() at live update time.

Change-Id: I1f3e22d40f22d94bd2b850915f9b8163a08b5616
2015-09-16 11:02:31 +00:00
Cristiano Giuffrida c8a9900b0c kernel: Add support for IPC filters.
Edited by David van Moolenbroek.

Change-Id: Ia0052c42a0f218d011dd2da1e3db6c5b2107adc7
2015-09-16 11:02:24 +00:00
Cristiano Giuffrida 6fc5006250 kernel: Add SYS_PRIV_CLEAR_IPC_REFS support.
Change-Id: Ie5e86191d5040f305a5a42942d83319cd600bfb6
2015-09-16 11:02:13 +00:00
Cristiano Giuffrida a1760b573b kernel: Extend the {sys,vm}_update() interfaces.
Change-Id: I9ada3c04c08d219b198e9081f4e1942b11c722f6
2015-09-16 11:01:47 +00:00
Cristiano Giuffrida 76bf77a21f kernel: Extend the sys_whoami() interface.
Add support for init flags.

Change-Id: Ibb4d7eb9064d2bbee6d51112ad0c56b2750a5f8e
2015-09-16 11:01:36 +00:00
Cristiano Giuffrida 41022be182 kernel: Extend the sys_statectl() interface.
Change-Id: Ica37640f61513db9466dacf861a8148e3fb799d5
2015-09-16 11:01:15 +00:00
David van Moolenbroek d09f72c453 Kernel: improve stacktrace printing
- corrupt stack traces could trigger a kernel panic;
- output consistency and spelling.

Change-Id: I04c9ac7db77593d6e837a28c83f1734adc8d9da7
2015-09-07 22:56:00 +00:00
David van Moolenbroek efa7e3e6d2 Kernel: correctly set USE_ defines from Makefile
Without defining these to 1, #if statements on them will fail.

Change-Id: Ifc4824a6ffacc4bebcfd6f1110c864d7eb16401a
2015-08-08 16:56:37 +00:00
David van Moolenbroek 3091b8cf26 Kernel: fix async message failure handling crash
If an asynchronous message is delivered during an ipc_receive(2) call,
but a failure occurred while copying out the status to the sending
process, then the receiving process would be left in an inconsistent
state, leading to a kernel crash shortly after.

For now, we fix this by altogether ignoring errors while copying out
the status field to the sending process.  While this resolves the
kernel crash, it is hardly ideal, since it will likely cause the same
message to be delivered repeatedly.  It would be better to disable
asynchronous communication from the sender process altogether, but this
solution requires more changes and thus more testing.

Change-Id: Ib00bf01ad29cdd10a5dee731d4788254d9037a76
2015-08-08 16:55:52 +00:00
David van Moolenbroek e10ce184e4 libsys: make tickdelay(3) more reliable
Previously, there was a tiny chance that tickdelay(3) would return
early or that it would fail to reinstate a previous alarm.

- sys_setalarm(2) now returns TMR_NEVER instead of 0 for the time
  left if no previous alarm was set;
- sys_setalarm(2) now also returns the current time, to allow the
  caller to determine whether it got an alarm notification for the
  alarm it set or for a previous alarm that has just gone off;
- tickdelay(3) now makes use of these facilities.

Change-Id: Id4f8fe19a61ca8574f43131964e6f0317f613f49
2015-08-08 16:55:23 +00:00
Emmanuel Blot 41b870c890 arm: Make sure __k_unpaged_MINIX is first
Do not rely on build order to set startup symbol (`__k_unpaged_MINIX`)
at kernel binary start

Change-Id: I1ed3f9309fe66ff97e24915938c114d5a159deaf
2015-03-18 07:50:31 +01:00
Lionel Sambuc 3d0f2c86c4 Fix arm build for GCC, noassert, -Os
Change-Id: I706fdfc8fc9a5e0c9076e3657ac1a6ef0745bd14
2015-03-05 15:42:21 +01:00
Ben Gras 5ae1a533c7 ARM: can build with llvm, switch to EABI
. bitcode fixes
	. switch to compiler-rt instead of netbsd libc functions
	  or libgcc for support functions for both x86 and arm
	. minor build fixes
	. allow  build with llvm without crossbuilding llvm itself
	. can now build minix/arm using llvm and eabi - without C++
	  support for now (hence crossbuilding llvm itself is turned off
	  for minix/arm)

Change-Id: If5c44ef766f5b4fc4394d4586ecc289927a0d6eb
2014-12-12 13:04:56 +01:00
Ben Gras 3c8950cce9 minix/ changes for arm llvm build
. fixes needed to build Minix/ARM with LLVM without errors,
	  mostly size_t cleanness

Change-Id: If4dd0a23bc5cb399296073920a8940c34b4caef4
2014-12-03 23:40:56 +01:00
Ben Gras 3a9e392b3a remove unused PSW restore code
. now done in-kernel so IOPL gets restored

Change-Id: I9905d2844a4715004054a788613ff7efd02a227d
2014-11-25 10:51:01 +01:00
Ben Gras c9278f9170 restore PSW like 9393439a20 for AMD syscall
Change-Id: Ide0a8727af8d0d81361382dbd2460c7a6c5743fc
2014-11-24 12:05:45 +01:00
Lionel Sambuc 5d8311761a Turn PCI into a character driver
Change-Id: Ia9c83af4d52e82e845b6a847c3e82e33d1920ae0
2014-11-10 14:43:27 +01:00
Lionel Sambuc 9393439a20 Fix iopl flag when sysenter/exit are used
Change-Id: If8c12f987c3adb8f329ae163da6b2f1cb8cc772f
2014-11-07 16:20:39 +01:00
David van Moolenbroek 1dcfbcd173 Remove support for call profiling
The entire infrastructure relied on an ACK feature, and as such, it
has been broken for years now, with no easy way to repair it.

Change-Id: I783c2a21276967af115a642199f31fef0f14a572
2014-09-30 12:39:03 +00:00
David van Moolenbroek bb9431cb88 Kernel: update copyright year
Change-Id: I1776f1bc6402f264c7095c17a9ace087036cf010
2014-09-10 13:01:45 +00:00
Lionel Sambuc da9af514b5 Make the kernel less chatty
Change some messages from always printed to varying level of the "verbose"
argument.

Change-Id: I6899268aa895c66e72806ca4d02bb53a0e4ea785
2014-09-01 16:36:26 +02:00
David van Moolenbroek 502b6bda83 Kernel: fix sys_trace
Change-Id: I44bdd3b1d79bf751923581b75c3d44f011d2a5e0
2014-08-30 19:10:12 +00:00
Lionel Sambuc 5f5dcc545f Fix bitcode support for kernel 2014-08-29 12:57:03 -04:00
Ben Gras bad58c9c51 merge libminlib with libc
Change-Id: I79cc4ea90c378a1da3dac16487b53034953827a7
2014-08-28 18:49:19 +02:00
Ben Gras 222afb38ac arm am335x: disable watchdog timer on bootup
. for new uboot (specifically beaglebone black rev c) compliance

Change-Id: I28fd0ca15f5365e14bf2bb9407f266e3e570b6d9
2014-08-22 14:30:49 +02:00