Commit Graph

97 Commits

Author SHA1 Message Date
Bahadir Balban
81ebffdc87 VFS updates, readme updates.
Separated vfs file as a specific file. vm file is not always a vfs file.
Updated the README
sys_open was not returning back to client, added that.
Added comments for future vfs additions.
2008-04-09 16:55:54 +01:00
Bahadir Balban
dd3f35bbd4 Moved vnum to priv_data of vm_file since its only related to vfs files. 2008-03-25 23:32:51 +00:00
Bahadir Balban
4b1abc60a6 Various minor fixes.
Removed some commented out code.
Removed excessive printfs.
Fixed spid not initialising for mm0
Fixed some faults with fs0.

TODO:
- Need to store vfs files in a separate list.
- Need to define vnum as a vfs-file-specific data, i.e. in priv_data field of vm_file.
- Need to then fix vfs_receive_sys_open.
2008-03-24 22:39:21 +00:00
Bahadir Balban
13b9e5407a Removed non-standard allocation of mm0 utcb.
It is now allocated in a generic way using shm_new() which creates a
posix shmat()/shmget()'able utcb.
2008-03-24 00:46:31 +00:00
Bahadir Balban
35d2d275b6 Multiple above-minor updates.
- fixed is_err(x), was evaluating x twice, resulting in calling a
function x twice.

- Divided task initialisation into multiple parts.
- MM0 now creates a tcb for itself and maintains memory regions of its own.
- MM0's tcb is used for mmapping other tasks' regions. MM0 mmaps and prefaults
  those regions, instead of the typical mmap() and fault approach used by
  non-pager tasks.
  For example there's an internal shmget_shmat() path to map in other tasks'
  shm utcbs. Those mappings are then prefaulted into mm0's address space using
  the default fault handling path.

- FS0 now reads task data into its utcb from mm0 via a syscall.
  FS0 shmat()s to utcbs of other tasks, e.g. mm0 and test0.

  FS0 then crashes, that is to be fixed and where this commit is left last.
2008-03-24 00:34:14 +00:00
Bahadir Balban
82a7228d89 Prefaulting of utcb pages seem to work.
Next: fs0 should shmat() on others' utcbs.
2008-03-22 15:57:20 +00:00
Bahadir Balban
0dfbde6bc0 Update to README
modified:   README
2008-03-21 19:38:46 +00:00
Bahadir Balban
d0084b2ee0 Trivial changes in comments for copy_on_write. 2008-03-21 16:06:08 +00:00
Bahadir Balban
0b279081b6 shm file didn't initialise with VM_WRITE. Added that.
Otherwise copy_on_write() tries to create a r/w shadow which is wrong.
Also fixed the fault print functions to print SHM file type as well.
2008-03-21 16:00:20 +00:00
Bahadir Balban
b369ff6efe Added copy-on-write shared memory but untested yet.
For anonymous shm, mmap now adds a shm_file and devzero behind it
as two vm_objects. Faults are handled by copy_on_write(). Just as
shadows copy r/w pages from original files, it should copy r/w
pages from devzero into the shm_file in front.

shmat/shmget uses mmap to set-up their areas.

Untested yet so bugs expected.

	modified:   tasks/libl4/src/init.c
	modified:   tasks/mm0/include/shm.h
	modified:   tasks/mm0/include/vm_area.h
	modified:   tasks/mm0/src/fault.c
	modified:   tasks/mm0/src/mmap.c
	modified:   tasks/mm0/src/shm.c
2008-03-21 15:40:54 +00:00
Bahadir Balban
466138f125 shmat/shmget for utcbs are working for now.
faults on shared memory needs to be implemented.
2008-03-19 22:26:38 +00: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
26e6366014 Added a memlayout.txt, revised README, reduced env size to 4kb 2008-03-18 18:21:09 +00:00
Bahadir Balban
d2aa9a552b Minor changes in README. Added fault debugging printfs that can be turned on/off.
Tasks boot fine up to doing ipc using their utcbs.

UTCB PLAN:

- Push ipc registers into private environment instead of a shared utcb,
  but map-in a shared utcb to pass on long data to server tasks.
- Shared utcb has unique virtual address for every thread.
- Forked child does inherit parent's utcb, but cannot use it to communicate to
  any server. It must explicitly obtain its own utcb for that.
- Clone could have a flag to explicitly not inherit parent utcb, which is the
  right thing to do.
- MM0 serves a syscall to obtain self utcb.
- By this method, upon forks tasks don't need to map-in a utcb unless they want
  to pass long data.
2008-03-17 17:09:19 +00:00
Bahadir Balban
509e949983 Added a few vm_object debug functions. Fixed few bugs.
Next issues: For every read fault, the fault must traverse the
vma's object stack until the page is found. The problem was that
we were only searching the first object, that object was a writable
shadow, and the shadow didn't have the read-only page, and the 0
return value was interpreted with IS_ERR() and failed, so address
0 was mapped into the location, and QEMU blew off.
2008-03-16 18:57:26 +00:00
Bahadir Balban
0f4a4ae5b4 Changes in README. Fixes to fault handling.
Yet to investigate why adding a printf format attribute to
stdio.h does not generate warnings for invalid arguments to printf.
2008-03-16 14:58:47 +00:00
Bahadir Balban
1cc6a87547 Previous commit. 2008-03-14 18:53:53 +00:00
Bahadir Balban
b0900ad6c3 Forgotten to add vma to file reference in do_mmap(). This adds that. 2008-03-14 15:39:25 +00:00
Bahadir Balban
ed68f934aa Fixed few more issues
The svc images must be pushed to boot file list in correct order
otherwise if test0 starts earlier than fs0, it gets fs0's predefined
thread and space id (since that's the first unallocated one) and
fs0 fails to initalise. In the future we can pre-allocate ids from
the kernel but current temporary fix is simple enough to use.
2008-03-14 15:39:00 +00:00
Bahadir Balban
dc3b63d924 Fixed detection of devzero file.
Fixed adding VMA_ANONYMOUS flag explicitly if no file was given
2008-03-14 15:37:10 +00:00
Bahadir Balban
2ecc7612c3 Fixed the error that file length was referenced without checking that
the file pointer was valid.
2008-03-14 15:36:25 +00:00
Bahadir Balban
285e39870f Added #ifdef flags for enable/disabling data abort messages from c0 2008-03-14 15:35:41 +00:00
Bahadir Balban
4f87b6672e Few map_address fixes to mmap() 2008-03-13 00:56:21 +00:00
Bahadir Balban
d27f942702 Very minor fixes. 2008-03-13 00:40:12 +00:00
Bahadir Balban
e304bb26c6 Clarified handling of anon and non-anon shared mappings. 2008-03-12 23:10:50 +00:00
Bahadir Balban
d718b8efd5 Got mm0 to compile. A lot of issues expected. 2008-03-12 22:58:26 +00:00
Bahadir Balban
cd79fa8f58 Fixed most compiler errors. Need to do more. 2008-03-12 22:20:32 +00:00
Bahadir Balban
8447cd6ce3 Fixed minor faults. More progress on vma merge.
More to be done about vm object flags, page refcounts etc.
2008-03-11 01:07:44 +00:00
Bahadir Balban
e8561aa541 Minor updates to README 2008-03-10 23:19:00 +00:00
Bahadir Balban
47a6a31249 More progress on VMA merge/shadow collapse.
Done the merging, but deleting pages from different pagers is the
current issue.
2008-03-10 18:38:08 +00:00
Bahadir Balban
584815a4db Bit more progress on dropping the vm_obj_link upon a collapse.
Need to implement merging of a vm object with the only shadow
reference left.
2008-03-09 01:18:33 +00:00
Bahadir Balban
ed23d82fd7 More progress on copy_on_write().
Copying phase is OK. Now writing the shadow collapse logic.
2008-03-09 00:19:55 +00:00
Bahadir Balban
7a54d722a7 Initial efforts to add copy on write and shadow vmas. 2008-03-07 18:35:40 +00:00
Bahadir Balban
98b5c217f5 Revised mmap, implemented find_unmapped_area properly.
find_unmapped_area() requires the vma list is an ordered list.
2008-03-07 00:30:30 +00:00
Bahadir Balban
783904574d Revised task initialisation, revising mmap yet. 2008-03-06 20:55:46 +00:00
Bahadir Balban
5681f3d1cb More changes. 2008-03-05 01:59:31 +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
e2e6c89da2 Prepare to reimplement copy-on-write. previous commit stable. 2008-03-01 15:15:36 +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
55117c600b Back to the same fs0 bug point as before, but environment, disjoint utcb addresses
and passing of utcb address information via the environment are implemented.
2008-02-29 12:33:53 +00:00
Bahadir Balban
617d24b4f0 Modified task initialisation so that stack now comes beneath the environment
Environment is backed by a special per-task file maintained by mm0 for each task.
This file is filled in by the env pager, by simple copying of env data into the
faulty page upon a fault. UTCB and all anon regions (stack) could use the same
scheme.

Fixed IS_ERR(x) to accept negative values that are above -1000 for errors. This
protects against false positives for pointers such as 0xE0000000.

	modified:   include/l4/generic/scheduler.h
	modified:   include/l4/macros.h
	modified:   src/arch/arm/exception.c
	modified:   tasks/fs0/include/linker.lds
	modified:   tasks/libl4/src/init.c
	modified:   tasks/libposix/shm.c
	new file:   tasks/mm0/include/env.h
	modified:   tasks/mm0/include/file.h
	new file:   tasks/mm0/include/lib/addr.h
	deleted:    tasks/mm0/include/lib/vaddr.h
	modified:   tasks/mm0/include/task.h
	new file:   tasks/mm0/include/utcb.h
	new file:   tasks/mm0/src/env.c
	modified:   tasks/mm0/src/fault.c
	modified:   tasks/mm0/src/file.c
	modified:   tasks/mm0/src/init.c
	new file:   tasks/mm0/src/lib/addr.c
	modified:   tasks/mm0/src/lib/idpool.c
	deleted:    tasks/mm0/src/lib/vaddr.c
	modified:   tasks/mm0/src/mmap.c
	modified:   tasks/mm0/src/shm.c
	modified:   tasks/mm0/src/task.c
	new file:   tasks/mm0/src/utcb.c
	modified:   tasks/test0/include/linker.lds
2008-02-29 01:43:56 +00:00
Bahadir Balban
5b7bb88008 Wrote the bits that would fill in arg/env info to first page of task stack. 2008-02-28 00:40:43 +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
6e6a92be8b Minor readme fix. 2008-02-27 01:24:02 +00:00
Bahadir Balban
0c9b42121a Adds reading pages into page-cache in an ordered manner.
Added reading pages from the page cache into user buffer for sys_read.
Increases stack sizes to 4 pages.
Updated README to include more details about multi-pager environments.
2008-02-27 01:17:36 +00:00
Bahadir Balban
2a5cdf80b5 incomplete changes for sys_write/sys_close 2008-02-20 22:47:22 +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