Commit Graph

111 Commits

Author SHA1 Message Date
Bahadir Balban
6093214981 Added sharing of pager capabilities with children or siblings
Pagers can now share their own private capabilities with their
paged children, or their siblings with whom they have a common pager
ancestor.

Added flags CAP_SHARE_CHILD and CAP_SHARE_SIBLINGS for that.
2009-10-23 13:50:32 +03:00
Bahadir Balban
89d49ef495 Lots of fixes, notion of pager hierarchy, fixed tgroup capability checking
Notion of pager hierarchy introduced using the existing but unused
pagerid field.

Thread creation now has two more flags TC_AS_PAGER and TC_SHARE_PAGER.
The former sets creator as pager, the latter sets creator's pager as pager.

Thread group capability sharing now correctly carries shared capabilities
to the thread group leader's tgr_cap_list list, and this list is checked
during capability checking.
2009-10-23 02:36:12 +03:00
Bahadir Balban
df776b568f Tests working up to neverending suspend - Will be fixed. 2009-10-22 22:50:50 +03:00
Bahadir Balban
0f9ea9674c Progress on capabilities
Capabilities will be shared among collection of threads. A pager
will have a right to share its own capabilities with its space,
its thread group and its container.

Currently sharing is possible with only all of the caps. Next,
it will be support for cap splitting, granting, and partial sharing
and granting.
2009-10-22 14:04:25 +03:00
Bahadir Balban
cc2d740900 Neater thread creation flags. 2009-10-21 16:58:10 +03:00
Bahadir Balban
9c06bea41a Changed name of kernel_container to kernel_resources 2009-10-20 13:14:49 +03:00
Bahadir Balban
655e135300 Removed zombie test and any verbose printks 2009-10-19 19:45:04 +03:00
Bahadir Balban
62c4249d95 Renamed many thread_* line of calls.
Renamed so that task_* gets a ktcb directly, and thread_* line of
calls make the search for the ktcb.
2009-10-19 19:24:40 +03:00
Bahadir Balban
cfa35e4a66 Added support for faulty pagers and their threads to become zombies
Added support for pagers that fault to suspend and become zombies
along with all the threads that they manage. Zombie killing is to
be done at a later time, from this special zombie queue.

The implementation works same as a suspension, with the added action
that the thread is moved to a queue in kernel container.
2009-10-19 18:48:55 +03:00
Bahadir Balban
9177166817 Managed to self-destruct pager.
Issues:
- A page-faulting thread suspends if receives -1 from pager page fault ipc.
  This is fine if pager is about to delete the thread, but it is not if
  it is a buggy pager.
- Need to find a way to completely get rid of suspended pager.
- A method of deleting suspended tasks could remedy both cases above.
2009-10-19 00:33:10 +03:00
Bahadir Balban
c3b0399485 Debug commit to be removed 2009-10-18 18:53:31 +03:00
Bahadir Balban
72af4a843a Added userptr access check to exchange_registers 2009-10-18 15:05:56 +03:00
Bahadir Balban
2bd3266498 Removed bits from kernel where pager utcb is set.
Pagers now set their own utcb explicitly via exchange_registers.
exregs accepts calls from active pagers for this purpose only.
2009-10-18 15:01:38 +03:00
Bahadir Balban
d19c5c26fd Removed hard-coded area definitions from kernel 2009-10-17 13:42:49 +03:00
Bahadir Balban
72c6ca1ed0 Added an extended ipc return library function. 2009-10-08 15:35:54 +03:00
Bahadir Balban
942865e6fc Working compilation, but adding variant_dir = BUILD it doesn't work 2009-09-11 13:55:46 +03:00
Russel Winder
6ca0f2607a Switch to using a different strategy for building the kernel. 2009-08-27 16:43:47 +01:00
Bahadir Balban
de087eb1f8 Clean up to kernel code, Added `used' field to capabilities
With the addition of used field, capability structure can be
used for resource accounting over the capability.
2009-08-21 12:10:34 +03:00
Bahadir Balban
5bee43ae99 Merge branch 'newBuild' of /opt/c0-trees/codezero-russel into devel
Conflicts:

	SConstruct
	src/api/SConscript
	src/arch/arm/SConscript
	src/generic/SConscript
	tasks/bootdesc/SConstruct
2009-08-14 17:09:58 +03:00
Bahadir Balban
f82db61519 Added freeing/unmapping of boot memory 2009-08-11 15:01:27 +03:00
Bahadir Balban
f4d9520fef First working Codezero & POSIX Services with container/capability changes 2009-08-11 11:23:26 +03:00
Bahadir Balban
15b659eaf0 Removed any refs to global id pools.
Also added container reference setup to thread creation
2009-08-10 15:16:57 +03:00
Bahadir Balban
02a3f1ac91 Pager works until end of init_physmem_secondary 2009-08-09 17:22:13 +03:00
Bahadir Balban
961b255257 Replaced kread and kmem_control syscalls with capability_control and container_control respectively. 2009-08-06 16:22:55 +03:00
Bahadir Balban
e329a7c91a Removed kmalloc. Initialization path resolved, almost done. 2009-08-06 14:15:39 +03:00
Russel Winder
8b9b254f6c Make the coding style more consistent with PEP-8. 2009-08-05 11:15:26 +01:00
Bahadir Balban
7e8845abf8 Code that compiles until initialization of containers and pagers. 2009-08-02 23:43:14 +03:00
Russel Winder
9b2ff087d0 Add in all the amendments and new files needed to get the kernel building. 2009-08-01 17:50:59 +01:00
Bahadir Balban
723cf7bde9 Code that compiles and works up to initializing the first memcache. 2009-07-29 19:08:29 +03:00
Russel Winder
d40c76de84 Remove all the SCons files pending starting a new build system. 2009-07-28 14:47:00 +01:00
Bahadir Balban
0dd8918ae5 Remove all references to ARM registers in system call arguments. 2009-06-10 17:30:02 +03:00
Bahadir Balban
4e43d09325 wait_on_prepare and wait_on_prepared_wait with preemption considered 2009-06-10 15:48:34 +03:00
Bahadir Balban
7ef479733f Fix to l4_mutex_control for the unexpected sleeping with mutex held
when preemption occurs after call to wait_on_prepare
2009-06-10 15:41:30 +03:00
Bahadir Balban
6b3ddadcf5 Cleaned up code for userspace mutexes.
- Issues: wait_on_prepare and wait_on_prepared_wait use cases
  are erroneous because they may sleep with mutex_control_lock
  taken if preemption occurs.
2009-06-10 14:37:23 +03:00
Bahadir Balban
276b4643c6 Removed linux linked list dependency. 2009-06-02 13:19:17 +03:00
Bahadir Balban
4757f46f71 Minor comment fixes. 2009-06-02 10:26:21 +03:00
Bahadir Balban
13d469f659 Removed all unecessary prints from the mutex test and the kernel
- removed (%d) Sleeping print from contended kernel mutexes.
- removed (%d) Waiting print from WAIT_EVENT used by the pager for suspending tasks.
- removed prints from the mutex_control syscall and user mutex test.
2009-06-01 16:02:10 +03:00
Bahadir Balban
4206c6e3fc An extra mutex_unlock has been removed 2009-06-01 15:06:07 +03:00
Bahadir Balban
33200c92df Mutex implementation almost working.
- Fixed a wrong instruction in mutex.S user library
- Added support for blocking lock/unlock
- Divided waiting into wait_on_prepare and wait_on_prepared_wait
  so that mutex_control lock is released after getting in the waitqueue.
- Declaring waitqueue on the stack should be done outside wait_on_prepare

Issues:
- Tests can be simplified for atomic data access instead of producer/consumer.
- kmalloc variable sized memory caches are not freed properly. Currently only the
  last slot can be freed, occupied correctly. it should be done in any slot, i.e.
  1, 2, 3, 4 instead of just 5.
- Need to add a mutex to kmalloc.
2009-06-01 14:11:40 +03:00
Bahadir Balban
ce79aa2b73 Mutex test progress
- Mutex test added. Forked tasks demonstrate produce/consumer using a
  shared mmap'ed page.
- Added l4lib assembler syscall
- Added forgotten SWI to mutex control offset in syscall page.
- Added mutex head initialization
- Contended child successfully sleeps in a waitqueue.

Issues:
- Somehow the child's produced page buffer is altered at about [4020] offset.
  Parent fails to validate buffer therefore.
- Need to add syncing to test so that parent does not unlock and lock again
  before child has a chance to lock buffer and produce.
2009-05-30 16:46:30 +03:00
Bahadir Balban
b11d4c4607 Added mutex_control syscall for userspace mutexes.
- Compiles and Codezero runs as normal without touching mutex implementation
- Mutex implementation needs testing.

The mutex control syscall allows userspace programs to declare any virtual
address as a mutex lock and ask for help from the kernel syscall
for resolving locking contentions.
2009-05-29 15:34:04 +03:00
Bahadir Balban
ab9e036cb7 Updated test pass/fail print messages for test0 2009-05-28 13:23:44 +03:00
Bahadir Balban
e61e9e9533 Moved ipc flags manipulation to ipc.h glue file 2009-05-28 13:02:37 +03:00
Bahadir Balban
ba31e1b823 Added ipc save/restore for page-fault ipcs.
The save restore routines save all primary message registers and ipc flags.
2009-05-28 12:52:14 +03:00
Bahadir Balban
391b0ca1d0 Updated ipc flag names with kernel-only versions without the L4 prefix. 2009-05-28 12:01:48 +03:00
Bahadir Balban
b977e6597e Added per-task ipc flags checking instead of the active task flags.
Previously during ipc copy, only the currently active task flags were
checked. This means the flags of whoever doing the actual copy was used
in the ipc. Now flags are stored in the ktcb and checked by the copy routine.

Current use of the flags is to determine short/full/extended ipc.
2009-05-28 11:50:39 +03:00
Bahadir Balban
53310aa31b Extended IPC Support added.
Benefits & Facts:
- Messages up to 2 kilobytes may be sent.
- Both parties may use non-disjoint user buffers. E.g. any userspace address.
- Userspace buffers can page fault.
- Page faults punish timeslice of only the faulting thread.
- Any number of extended ipcs can take place at any one time, since
  only ktcbs of ipc parties are engaged. No global buffer is used.
  - This also provides smp-safety benefit.

Disadvantages:
- There is triple copying penalty. This has to be done:
  - Sender buffer to sender ktcb
  - Sender ktcb to receiver ktcb
  - Receiver ktcb to receiver buffer.
  This is due to the fact that buffers can be on non-disjoint userspace addresses.

If you want to avoid disadvantages and lose some of the benefits,
(e.g. address freedom, shorter copy size) use FULL IPC.
2009-05-27 14:36:11 +03:00
Bahadir Balban
3ff519439b Added first part of extended ipc support.
- Extended ipc tests
- Need to copy from ktcb-to-ktcb instead of ktcb-to-user
- Need to check flags of both ipc parties before ipc copy type.
2009-05-27 14:07:17 +03:00
Bahadir Balban
19c71cc658 Cleaned up thread_control functions 2009-05-26 17:29:10 +03:00
Bahadir Balban
93c7cf1995 Fixed fork() errors where forked thread is a copy of any cloned thread in parent address space.
Upon fork, child was created in a new space but as a copy of any
cloned thread in the parent space. This was due to the search of forker thread
by its space id (which is shared among many cloned threads).

Now fixed.
	modified:   src/api/thread.c
	modified:   tasks/mm0/src/task.c
2009-05-26 17:02:32 +03:00