Commit Graph

32 Commits

Author SHA1 Message Date
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
287b7705da Towards working mkdir. 2008-04-14 14:38:04 +01:00
Bahadir Balban
7b2f9f96cf os_readdir() now using utcb as dirent buffer. 2008-04-13 16:32:34 +01: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
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
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
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
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
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
Bahadir Balban
4f2e1d3e94 Fixed various minor issues.
Tag setting before ipc via l4 libraries don't seem to work, whereas
c0 internally generated ipcs do it correctly.
2008-02-05 18:30:11 +00:00
Bahadir Balban
cab2e8bdd3 Finished adding untested bare functionality vfs
Finished adding untested shm syscalls.
Finished adding untested l4 send/recv helpers

Everything compiles. Now going to fix lots of bugs ;-)
2008-02-03 17:42:38 +00:00
Bahadir Balban
6bb5b45212 FS0 compiles now, with a mock-up rootfs.
Having progress on vfs slowly but surely ;-)
2008-01-15 00:34:10 +00:00
Bahadir Balban
e2b791a3d8 Initial commit 2008-01-13 13:53:52 +00:00