serving mm0, if it page faults, system deadlocks because mm0 is waiting to be served by vfs.
FIX: To fix this, mm0 will need to fork itself and keep a separate thread solely for
page fault handling.
When copying file pages back and forth, we need both dst and src
offsets since the cursor offset and read/write buffer page offsets
are different. This is now fixed.
Also done some mods to close().
- Added logic to calculate which pages are in the file and which are new
for writing.
- Nearly finished the template for sys_write.
- Need to implement write_cache_pages().
- Need to distinguish dirty/clean pages and implement flushing dirty
pages back to vfs.
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.
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.
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.
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.
Normally anon && shared pages need to COW once and any newer
accesses by other sharing processes should simply map the COW'ed
pages to themselves as writeable. We didn't have that but instead
every ANON && SHARED write fault was going into the COW path, causing
the same offset'ed page to be COW'ed twice.
Next: Factor out the l4_map code to a common point at the end of all
fault handling paths.
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.)