Commit Graph

55 Commits

Author SHA1 Message Date
Bahadir Balban
ea5c0bff45 Removed unused files from other projects. 2009-06-08 17:35:01 +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
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
5ac5889a0f Unstable changes for ipc - Fork fails for some reason 2009-05-23 18:43:55 +03:00
Bahadir Balban
cc96e2c86c Full IPC working.
- Test0 has a full ipc mr read/write test.
- A full ipc occurs for definite only if both parties use the FULL IPC flag.
  Otherwise the thread that makes the ipc copy rules on whether it was a short
  or a full copy.
2009-05-19 15:39:01 +03:00
Bahadir Balban
40e088b042 Modifications towards full ipc
- Added a full ipc send/recv test
- Removed non-zero value checking in r2 for ipc that was there
  to catch inadvertent full ipc calls.
- Added correct hanlding for read/write mrs for current status of utcb.

TODO:
- Add mapping of every utcb to every task for privileged access so that
  the kernel can access every utcb without switching spaces.
- Removal of same mappings
- Upon thread creation need to copy page tables accordingly i.e.
  each task will have its own utcb mapped with USER access, but every
  other utcb as kernel access only. Need to handle this case upon page
  table copying.
2009-05-17 20:49:13 +03:00
Bahadir Balban
814eba43dd l4lib changes to accomodate extended and full ipc.
- Added ARM register ipc usage explanation to glue/arm/message.h
- In the current design, the unused r2 register is a system register
  that kernel checks for ipc flags such as:
  - IPC type: e.g. full or extended.
  - In extended IPC, MR index containing message buffer ptr.
  - In extended IPC, message size
2009-05-14 20:23:10 +03:00
Bahadir Balban
548617660f Added l4_send/receive full/extended ipc prototype proposals 2009-05-14 18:38:28 +03:00
Bahadir Balban
680d20ff94 Initial changes to libl4 for full and extended ipc.
- Tag word will be used to specify full and extended ipc, and its size.
2009-05-13 16:08:37 +03:00
Bahadir Balban
cada0f8f18 New UTCB implementation almost working.
- KIP's pointer to UTCB seems to work with existing l4lib ipc functions.
- Works up to clone()
- In clone we mmap() the same UTCB on each new thread - excessive.
- Generally during page fault handling, cloned threads may fault on the same page
  multiple times even though a single handling would be enough for all of them.
  Need to detect and handle this.
2009-05-01 10:11:47 +03:00
Bahadir Balban
7a81db8782 Ongoing work for adding per-thread UTCB structures.
Added setting of utcb address to l4_thread_control.
This is going to be moved to exchange_registers() since we need to pass
both the utcb physical and virtual address and exregs fits such context
modification better than thread_control.
2009-04-29 16:53:04 +03:00
Bahadir Balban
54a9b2901d Removed allocation of utcb shared pages by mm0 completely.
- Now libl4 has no references to utcb page or shmat etc.
- Pager does not deal with special case utcb page allocation.
  It instead allocates a shared page from shm memory pool.
- All tasks working to original standard.

Next:
- Add per-thread utcb allocation from the kernel
- Add larger register file for standard ipc
- Add long ipc (up to 1Kb)
2009-04-22 14:48:43 +03:00
Bahadir Balban
203f053878 Removed special-case utcb shared page from posix services.
Previously a so-called utcb shared page was used for transfering
data between posix services. This was a special shmat/get/dt case
allocating from its own virtual pool. Now the term utcb is renamed
as a shared page and integrated with the shm* handling routines.

Generic l4 threads will use long-ipc and not this method. Posix
services will continue to communicate on a shared page for now.
	modified:   tasks/libl4/include/l4lib/ipcdefs.h
	modified:   tasks/libl4/src/init.c
	new file:   tasks/libposix/init.c
	modified:   tasks/mm0/include/shm.h
	modified:   tasks/mm0/include/task.h
	deleted:    tasks/mm0/include/utcb.h
	modified:   tasks/mm0/main.c
	modified:   tasks/mm0/src/boot.c
	modified:   tasks/mm0/src/clone.c
	modified:   tasks/mm0/src/execve.c
	modified:   tasks/mm0/src/exit.c
	modified:   tasks/mm0/src/init.c
	modified:   tasks/mm0/src/shm.c
	modified:   tasks/mm0/src/task.c
	deleted:    tasks/mm0/src/utcb.c
	deleted:    tools/l4-qemu
2009-04-22 11:58:58 +03:00
Bahadir Balban
d182b5b35a Initial changes for execve() support 2008-11-13 21:45:30 +02:00
Bahadir Balban
13b1b405a5 Cleaned up libposix mmap()
Now we have proper setting of errno and using pfn based mmap for both types of mmap calls.
2008-10-29 20:01:31 +02:00
Bahadir Balban
4046ad9e3f Added msync(), added handling of munmap/msync to pager main.c 2008-10-29 19:22:01 +02:00
Bahadir Balban
0db0f7e334 Multiple updates on sleeping, vma dropping and thread suspend.
- Updated sleeping paths such that a task is atomically put into
  a runqueue and made RUNNABLE, or removed from a runqueue and made SLEEPING.
- Modified vma dropping sources to handle both copy_on_write() and exit() cases
  in a common function.
- Added the first infrastructure to have a pager to suspend a task and wait for
  suspend completion from the scheduler.
2008-10-13 12:22:10 +03:00
Bahadir Balban
c54d505709 Changes towards exit. Need to fix thread suspend first. 2008-09-27 22:15:34 +03:00
Bahadir Balban
6b11d3cf02 Added exit() call to libposix 2008-09-18 16:28:51 +03:00
Bahadir Balban
9c2c9676e8 Added exregs_set_mr() function
Moved all exregs-related calls to libl4 since these are part of the L4 api.
2008-09-15 17:57:09 +03:00
Bahadir Balban
df2317e7aa exchange_registers(), modified thread_control calls seem to work
- Fixed do_mmap() so that it returns mapped address, and various bugs.
- A child seems to fork with new setup, but with incorrect return value.
  Need to use and test exregs() for fork + clone.
- Shmat searches an unmapped area if input arg is invalid, do_mmap()
  should do this.
2008-09-15 15:59:44 +03:00
Bahadir Balban
4fb5277123 Towards finishing exchange_registers()
- Added mutex_trylock()
- Implemented most of exchange_registers()
- thread_control() now needs a lock for operations that can modify thread context.
- thread_start() does not initialise scheduler flags, now done in thread_create.

TODO:
- Fork/clone'ed threads should retain their context in tcb, not syscall stack.
- exchange_registers() calls in userspace need cleaning up.
2008-09-13 18:07:00 +03:00
Bahadir Balban
0b3ab05a98 Some minor changes
Need to reimplement exchange_registers
2008-09-12 10:47:36 +03:00
Bahadir Balban
af03975dc1 Towards adding sys_clone()
Stopped working on self_spawn() - going to finish clone() syscall first.
Arch-specific clone() library call that does ipc() and cloned child setup.
- Need to finish thread_create() that satisfy clone() necessities. i.e. setting up its stack.
  Question: Does the pager (and thus the microkernel) have to explicitly set SP_USR?
  Once the call is known to be successful, the library could set it.
2008-09-11 16:56:41 +03:00
Bahadir Balban
002fe79a54 Added thread group identification to c0 and libl4
tgid will be used when threads will be created in same address space.
2008-09-09 15:39:56 +03:00
Bahadir Balban
1a90b655c7 Added child utcb initialisation to fork call implementation in libposix. 2008-08-22 00:26:19 +03:00
Bahadir Balban
1d15821acb Added ipc to notify vfs about a forked child.
TODO: Need to ensure child shmat()s its own utcb
after a fork (possibly in libposix/fork.c)
2008-08-22 00:11:06 +03:00
Bahadir Balban
6be310f460 Added sys_close and sys_fsync
Untested.
2008-05-23 03:59:18 +00:00
Bahadir Balban
00b47117b0 Added sys_stat, sys_fstat and their libposix glue. 2008-05-22 11:21:27 +00:00
Bahadir Balban
bd8b182f1b Added syscall to update filestats (size) from pager.
After flushing written/truncated pages, stats are updated
so that vfs is synced with new file info such as its size.
2008-05-21 10:23:11 +00:00
Bahadir Balban
e8bb529dcb Now we save/restore utcb registers if we do a second ipc before returning the first. 2008-04-22 00:30:07 +01:00
Bahadir Balban
9992d100d7 Few fixes in libposix error checking.
size_t is a non-negative type and negative error checking didn't work. Now fixed.
Fixed various issues with reading file pages in the sys_read() path.
2008-04-20 02:12:53 +01:00
Bahadir Balban
cff7a505e8 Changed time representation to posix style struct timeval/ gettimeofday. 2008-04-18 13:58:37 +01:00
Bahadir Balban
5563cc1c6b Minor changes on sys_time
A get/set flag determines whether to read or write time.
2008-04-18 01:03:39 +01:00
Bahadir Balban
a87914910c Added a new system call sys_timer.
sys_timer accumulates timer ticks into seconds, minutes, hours and days.
It's left to the user to calculate from days into a date. It is not yet
known if the calculation is even roughly correct.

Reduced 2 kmem_reclaim/grant calls into one kmem_control call.
2008-04-18 00:46:29 +01:00
Bahadir Balban
7b2f9f96cf os_readdir() now using utcb as dirent buffer. 2008-04-13 16:32:34 +01:00
Bahadir Balban
55d24dbbdf Managed to pass utcb information to tasks via an ipc() call.
Removed setting of tag during ipc_return(). So it does not overwrite
return value anymore.

Next stage is for the tasks to map their utcb via shmget/shmat before
accessing.
2008-03-19 02:55:31 +00:00
Bahadir Balban
16617eed36 Various changes to incorporate new utcb setup.
Issues with l4_return value not reaching client side
	modified:   libs/c/include/stdio.h
	modified:   src/arch/arm/exception.c
	modified:   src/glue/arm/init.c
	modified:   tasks/fs0/src/task.c
	modified:   tasks/libl4/include/l4lib/arch-arm/utcb.h
	modified:   tasks/libl4/src/arm/syscalls.S
	modified:   tasks/libl4/src/init.c
	deleted:    tasks/libl4/tagfilelist
	modified:   tasks/libposix/open.c
	modified:   tasks/mm0/include/utcb.h
	modified:   tasks/mm0/include/vm_area.h
	modified:   tasks/mm0/main.c
	modified:   tasks/mm0/src/init.c
	modified:   tasks/mm0/src/task.c
	modified:   tasks/mm0/src/utcb.c
	modified:   tasks/mm0/src/vm_object.c
2008-03-19 02:27:53 +00:00
Bahadir Balban
ac3935a5d9 Initial efforts to transform utcb handling. 2008-03-18 21:50:47 +00:00
Bahadir Balban
58b833dd7f Forks and COW situations show that we need vm objects rather than vm_files.
This is the first commit towards implementing vm object based paging with
right COW methods.
2008-03-03 22:05:01 +00:00
Bahadir Balban
4f346cea53 Added the first means to pass information between 2 tasks using the
utcb as a shared page instead of the message registers.

Implemented the code that passes task information from mm0 to fs0
using the fs0 utcb. The code seems to work OK but:

There's an issue with anon pages that they end up on the same swapfile
and with same file offsets (e.g. utcb and stack at offset 0). Need to
fix this issue but otherwise this implementation seems to work.

TODO:
- Separate anon regions into separate vmfiles.
- Possibly map the stacks from virtual files so that they can be
  read from userspace in the future for debugging.
- Possibly utcb could be created as a shared memory object using shmget/shmat
  during startup.
2008-02-29 21:56:05 +00:00
Bahadir Balban
e7b0e46065 Preparing to add utcbs at disjoint virtual addresses.
This will help when syscalls have long arguments individual
utcbs can be mapped to server tasks and kept mapped in until the
tasks die, as opposed to map requests every time a server task maps
a different utcb at the same virtual address.

The changes have preparation code to also passing the utcb info
through the stack as part of the environment.

To sum up env and arg regions have also been added above the stack and
env region is to be used to pass on the utcb address information at
task startup.
2008-02-28 00:25:04 +00:00
Bahadir Balban
f078116901 Added per-task curdir. and chdir, pager_read/write, mmap and munmap calls.
They look like what they should look like, but untested.
2008-02-20 00:50:03 +00:00
Bahadir Balban
a160f6f151 Added vfs_read and vfs_write ipc calls to mm0 2008-02-18 22:42:33 +00:00
Bahadir Balban
0fdc64ba2d Added vfs_create() to create files and directories.
Moved mkdir to mknod so that mknod is the common handler for all node creation.
2008-02-16 15:22:08 +00:00
Bahadir Balban
193430d226 Added test code for testing of directory listing.
Added system call prototypes and posix glue for reading a directory.

TODO:
FS0 should implement the L4_IPC_TAG_READDIR ipc call.
2008-02-12 19:09:46 +00:00
Bahadir Balban
86dfd6a753 Changed name of utcb get function to match with general name conventions in syslib.h 2008-02-11 11:50:19 +00:00
Bahadir Balban
dce3a9a47c Merged some libl4 utcb headers, moved mr defs to kernel message.h
Headers 3 headers related to message registers and utcbs are now merged under
utcb.h in libl4. Some message register definitions used by the kernel are now
moved into kernel's glue/message.h. This avoids the duplication of same
definitions. Also the total number of mregs are now determined by arch-specific
kernel header, which is good.
2008-02-11 11:45:21 +00:00
Bahadir Balban
e0492d672f Kernel inspects and sets sender id instead of userspace.
Modified ipc handling so that from now on the kernel inspects and sets
the sender id if the receiver is receiving from L4_ANYTHREAD. This posed
a security problem since the receiver could not trust the sender for
sender information.
2008-02-11 11:11:17 +00:00
Bahadir Balban
0c7d2bbfd1 swapped write_mr() arguments.
write_mr() now works as write_mr(mr_offset, mr_val), which makes sense.
2008-02-09 15:57:44 +00:00