Commit Graph

71 Commits

Author SHA1 Message Date
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
Bahadir Balban
c5713ae37d Add file.h to mm0 2008-02-18 22:29:09 +00:00
Bahadir Balban
d67d6b84a9 Wiring between mm0 page cache and vfs almost what it should look like.
This implements the infrastructure for read/write system calls where
file content is first searched in mm0's page cache and then read-in
or written via the vfs read/write functions.
	modified:   tasks/fs0/src/syscalls.c
	modified:   tasks/mm0/include/lib/bit.h
	modified:   tasks/mm0/include/lib/idpool.h
	modified:   tasks/mm0/include/task.h
	modified:   tasks/mm0/include/vm_area.h
	modified:   tasks/mm0/main.c
	modified:   tasks/mm0/src/devzero.c
	modified:   tasks/mm0/src/fault.c
	new file:   tasks/mm0/src/file.c
	modified:   tasks/mm0/src/init.c
	modified:   tasks/mm0/src/lib/bit.c
	modified:   tasks/mm0/src/lib/idpool.c
	modified:   tasks/mm0/src/task.c
2008-02-18 22:26:39 +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
08b1e0e42c Adds tracking of hardlinks when reading a directory. 2008-02-16 12:36:50 +00:00
Bahadir Balban
09bd001e1a Added sys_mkdir and memfs_vnode_mkdir() functions. Untested but all implemented. 2008-02-15 17:32:41 +00:00
Bahadir Balban
5de93f707c Fixed lookup return value. Now using generic_lookup directy, i.e.
not through a vnode, because it really isn't fs-specific.
2008-02-15 12:22:07 +00:00
Bahadir Balban
7bbc21d105 Another minor fix in lookup.c 2008-02-14 21:32:39 +00:00
Bahadir Balban
329dc53982 FS0 compiles with the changes, also caught an unparanthesised double-statement
if clause in lookup.c
2008-02-14 21:23:49 +00:00
Bahadir Balban
b54a0f78e8 minor commit just to be able to push 2008-02-14 19:55:10 +00:00
Bahadir Balban
1b387a1704 Implemented vfs_lookup_byvnum() close to what it should look like. 2008-02-14 15:46:30 +00:00
Bahadir Balban
d3b6817887 Some more additional changes in same places. 2008-02-14 15:13:08 +00:00
Bahadir Balban
a989e1f774 sys_readdir and memfs_readdir closer to targeted look and feel.
We now have a single dirbuf of size PAGE_SIZE kept on the vnode. This is
to be used for directory contents only. The reason it's kept on FS0 is
because the contents are modified by calls such as mkdir or create, and otherwise
these would have been handled by mm0 on the page cache buffers, which wouldn't work.
2008-02-14 14:37:56 +00:00
Bahadir Balban
2440b5be61 Some efforts to adding better support for readdir 2008-02-14 12:08:21 +00:00
Bahadir Balban
60cce15a4d Some preliminary efforts to reading directory contents in fs0.
Need to still decide whether content buffers are provided by mm0,
whether need to return them back to mm0, and the read count.
	modified:   tasks/fs0/src/memfs/vnode.c
	modified:   tasks/fs0/src/syscalls.c
2008-02-13 00:24:57 +00:00
Bahadir Balban
7f9380cc78 Errno is set by the posix calls read/write/open/close etc. rather than their l4_xxx equivalent.
mmap.c is the only one not done yet.
2008-02-12 19:17:19 +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
Bahadir Balban
57420942ba Removed unnecessary printks, fixed few minor issues. 2008-02-09 15:48:10 +00:00
Bahadir Balban
cd170c1b7c Changed unit macro to use section attribute directly.` 2008-02-09 14:33:37 +00:00
Bahadir Balban
cc23568629 Added locking to id pool allocation and free. 2008-02-09 14:30:03 +00:00
Bahadir Balban
ba0e3ada21 Few more fixes.
Boot files and tasks are now initialised together. Theads can ask for particular
space and thread ids, if they're unused. This enables us to get predefined ids for
known tasks such as the VFS task.

Fixes to README
Other minor fixes.
2008-02-09 14:24:49 +00:00
Bahadir Balban
4aa26af61d readme change. 2008-02-06 12:35:41 +00:00
Bahadir Balban
f29c18ec09 Fixed various errors with ipc message passing.
Previously we had changed the method of setting the ipc tag from l4_ipc() call
argument to being passed as a message register.

- This change was not reflected in l4_ipc() signature as it still had a 3rd argument,
  even though ignored.

- l4_set_sender and _set_tag had their arguments wrong way around.
- Previously 5 mrs were passed onto utcb instead of 6, relying on the fact that
  l4_ipc tag argument was being passed in r3 directly, this wasnt true anymore
  with new convention, but wasn't catered for.

TODO:
- MM0 shouldn't really allocate tids itself, but use ones supplied by C0.
- Sender tid shouldn't really passed by the sender task, but rather by C0. Otherwise
  security can be easily breached by user tasks pretending to be other tasks. This
  would also save us a message register.
2008-02-06 12:26:31 +00:00