Commit Graph

48 Commits

Author SHA1 Message Date
Bahadir Balban
2c01463482 In FS0 filesystem image buffer was smaller than the memfs-defined maximum.
- Now fs size is in sync with memfs max size.
2009-05-13 16:09:20 +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
2d5a08ff32 More progress on parsing elf files. Fixes to memfs file read/write
Increased inode block pointers to 40. The current maximum allowed (and checked).
Updates to file size after every file write ensures subsequent writes can
correctly operate using updated file size information (i.e. not try to add
more pages that are already present). We cannot do this inside write() because
directory writes rely on byte-granularity updates on file buffers, whereas
file updates are by page-granularity (currently).
2008-11-21 19:26:10 +02:00
Bahadir Balban
d182b5b35a Initial changes for execve() support 2008-11-13 21:45:30 +02:00
Bahadir Balban
63fb907cd0 Made changes to have shared tcb parts in fs0 in preparation for clone()
fs_data and files structures can now be shared in the vfs task.
Currently no means to free shared structures in tcb destruction. Need to add that.
2008-11-09 10:07:24 +02:00
Bahadir Balban
122214f9b5 Increased memfs fixed maximum file size to 40 blocks (i.e. 40 pages) 2008-11-07 16:29:24 +02:00
Bahadir Balban
46fcdc9b31 Added same global task management mechanism from mm0 to fs0 2008-10-24 14:59:25 +03: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
86e752be59 Removed find_task(sender) + l4_ipc_return(ret) from fs0 syscalls.
Both moved to topmost request handler so syscalls need not call them.
2008-09-16 22:19:54 +03:00
Bahadir Balban
510852b8b8 Redesigned sys_open call
fs0 used to receive open() requests and notify pager about them via a syscall ipc.
This caused deadlocks because normally request flow is mm0 -> fs0 on all other calls.
The solution was to have mm0 ask and validate file descriptors from fs0 on the first
request instance that involved that file descriptor. By this method we delay the
validation of the fd until its first use, and avoid deadlock. It also fits well with
the lazy request handling design philosophy.
2008-09-16 15:50:00 +03:00
Bahadir Balban
476bac5142 Cleaned up all compile errors. 2008-08-25 16:59:00 +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
8c4c436925 Reorganised sys_open.
vfs_create and mknod now returns the newly created vnode.
(which might be used by upper layers).
2008-04-19 00:40:48 +01:00
Bahadir Balban
73058dc249 Added sys_close() but its not done yet.
close() needs to flush dirty buffers.
pager needs to have read/write support properly implemented.
open() needs to record mode and access times.
The need for access times means we need rtc and time implementation.
Also need to add stat() access() etc.
2008-04-17 21:47:37 +01:00
Bahadir Balban
730e7c210f Added resolving of current directory in case lookup starts from current dir. 2008-04-16 14:48:05 +01:00
Bahadir Balban
ab588c279b Fixed the component-consumption-every-lookup problem.
Now components only consumed on child lookup recursions.
2008-04-16 00:04:54 +01:00
Bahadir Balban
9ba6638d01 Added new path parsing functions that work cleaner, better.
Input paths are now parsed at the beginning and components
put into an ordered linked list headed by struct pathdata.
Lookup functions use these components to look up vnodes.
2008-04-15 19:36:07 +01:00
Bahadir Balban
a9420d3dc9 mkdir almost working.
Added changes to pathname lookup code so that the root
directory special case is handled properly.
2008-04-15 00:51:58 +01:00
Bahadir Balban
d6d97876bb Page fault handling fix.
Factored out mapping of the physical page as the final generic code
after all fault-specific handling is done.

Fixed the error that zero page didn't have an owner (devzero).

Fixed the error that struct dirent did not have the record length
field as u16 as expected by userspace.
2008-04-14 00:09:57 +01:00
Bahadir Balban
2efffdfa88 Seem to have fixed dirbuf allocation.
Dirbuf allocation was broken, fixed it.
Added more comments on reading directories.

Issues: fs0 ought to check buf address for sys_readdir(). Currently
test0 is passing an area on its stack and fs0 is writing the data to its own
address space (i.e. an area on its own stack.)
2008-04-13 00:23:21 +01:00
Bahadir Balban
367e455506 Fixed compilation errors for filldir/sys_readdir() changes. 2008-04-12 18:03:49 +01:00
Bahadir Balban
d7b06b5304 sys_readdir and root vnode fixes.
Changes towards successfully filling dirent structures for sys_readdir
and creating a root vnode for the filesystem.
2008-04-12 17:57:45 +01: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
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
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
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
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
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
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
57420942ba Removed unnecessary printks, fixed few minor issues. 2008-02-09 15:48:10 +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
b725d09eff Added some forgotten files.
new file:   tasks/fs0/include/memfs/file.h
	new file:   tasks/fs0/include/stat.h
	new file:   tasks/fs0/include/vfs.h
2008-02-04 23:44:28 +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
05e9028e90 Some more minor changes. 2008-01-22 13:26:19 +00:00
Bahadir Balban
adf54578f8 Improvising on disk layout of simple unix-like filesystem.
modified:   tasks/fs0/include/fs.h
	new file:   tasks/fs0/src/simplefs/sfslayout.h
2008-01-18 15:20:46 +00:00
Bahadir Balban
66abb3d7f8 Added a public domain malloc temporarily.
More changes to fs0, still improvising.
2008-01-16 18:12:20 +00:00
Bahadir Balban
c921197e69 A first step in writing a dynamically created bootfs for boot images. 2008-01-16 01:37:24 +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
7a388f22b7 Removed all ignorable files from git.
Previously python hex() would put an extra 'L' after printing out the
value and this would be trimmed in readelf.py. Now it doesn't seem to
do that so the lsd of the number was trimmed. This patch fixes that.
2008-01-14 12:23:40 +00:00
Bahadir Balban
e2b791a3d8 Initial commit 2008-01-13 13:53:52 +00:00