Commit Graph

313 Commits

Author SHA1 Message Date
Bahadir Balban
de087eb1f8 Clean up to kernel code, Added `used' field to capabilities
With the addition of used field, capability structure can be
used for resource accounting over the capability.
2009-08-21 12:10:34 +03:00
Bahadir Balban
d14f91c668 Cleaned up pager initialization code. 2009-08-19 17:07:08 +03:00
Bahadir Balban
dabc448c4e Added freeing of pager init memory, but this memory is currently not utilized. 2009-08-19 16:26:44 +03:00
Bahadir Balban
9c03d57d63 Carried over pager's virtual address alloc range to its own address space area. 2009-08-19 15:18:10 +03:00
Bahadir Balban
95b7b65c89 Pager virtual address pool bookkeeping added for all pager virtual addresses
Previously virt_to_phys/phys_to_virt macros were used such that they did a
blind offset translation for creating a pager internal virtual address for
user mappings.

This is now changed such that a properly bookkeeped virtual address pool is
used which will avoid any clashes on the virtual space.
2009-08-19 14:44:36 +03:00
Bahadir Balban
d351d6846a Merge branch 'buildDevel' of http://www.russel.org.uk/Git/Codezero into devel
Conflicts:

	tasks/test0/SConscript
	tasks/test0/test_exec.S
2009-08-17 22:57:41 +03:00
Russel Winder
ce62459d13 Correct the problem of not loading test_exec.
Remove the linker script and assembler load source in favour of generating
the source so that the correct path is in the source.
2009-08-17 19:24:18 +01:00
Bahadir Balban
13d14bca89 Includes the test_exec.axf in test0 elf file.
Cannot build test_exec.axf yet.
2009-08-17 19:30:33 +03:00
Bahadir Balban
c64c1a4515 MM0 do_close() without IO was segfaulting. now fixed.
This was triggered by incorrect test0 build that omits to embed
the test executable.
2009-08-17 15:36:09 +03:00
Bahadir Balban
89c50d17f2 Fixed bootdesc relocation - Needs revising.
- Used os.system to call objcopy
- Changed source image to mm0.axf instead of start.axf
2009-08-17 12:10:09 +03:00
Bahadir Balban
5bee43ae99 Merge branch 'newBuild' of /opt/c0-trees/codezero-russel into devel
Conflicts:

	SConstruct
	src/api/SConscript
	src/arch/arm/SConscript
	src/generic/SConscript
	tasks/bootdesc/SConstruct
2009-08-14 17:09:58 +03:00
Bahadir Balban
4f4532210a Fixed a bug with page_map size by dynamically allocating it. 2009-08-10 23:47:58 +03:00
Bahadir Balban
aa71161a04 Seems phys_to_page/page_to_phys macros are fixed in mm0 2009-08-09 17:59:32 +03:00
Bahadir Balban
02a3f1ac91 Pager works until end of init_physmem_secondary 2009-08-09 17:22:13 +03:00
Bahadir Balban
a45b5676ab Made container/capability control syscall changes to libl4 2009-08-06 16:34:20 +03:00
Bahadir Balban
f7ade97906 Relocated bootdesc at the end of mm0 instead of kernel image. 2009-08-06 15:03:57 +03:00
Russel Winder
6f3d3fdf49 Got the bootdesc building. 2009-08-05 18:33:37 +01:00
Russel Winder
38a0fdd4e2 Got the tasks linking. 2009-08-05 16:24:13 +01:00
Russel Winder
eb45780f16 Safety check-in of the next stage in getting the tasks linked. 2009-08-05 12:21:02 +01:00
Russel Winder
8b9b254f6c Make the coding style more consistent with PEP-8. 2009-08-05 11:15:26 +01:00
Russel Winder
a14ff1be5c Rearrange include path and linker script specification so as to get a successful compile.
Link not yet successful since physical_base.lds is not yet made.
2009-08-05 10:23:00 +01:00
Russel Winder
02d3c9f07c Correct the include path so that task compilation succeeds. 2009-08-05 10:06:39 +01:00
Russel Winder
7cf85c4428 Remove a few redundant paths from the include path. 2009-08-05 07:44:05 +01:00
Russel Winder
b3f4ea2169 Add zeroth draft SCons files for the tasks themselves. 2009-08-05 06:33:24 +01:00
Russel Winder
e7820903d9 Add in the task support libraries. 2009-08-02 13:46:07 +01:00
Russel Winder
27c0c50728 Make a start on building the tasks. 2009-08-01 18:14:34 +01:00
Russel Winder
9b2ff087d0 Add in all the amendments and new files needed to get the kernel building. 2009-08-01 17:50:59 +01:00
Russel Winder
d40c76de84 Remove all the SCons files pending starting a new build system. 2009-07-28 14:47:00 +01:00
Bahadir Balban
ba1cc0c6bc Updated LICENSE/README files, removed unused code from tasks. 2009-06-15 14:58:41 +03:00
Bahadir Balban
ea5c0bff45 Removed unused files from other projects. 2009-06-08 17:35:01 +03:00
Bahadir Balban
276b4643c6 Removed linux linked list dependency. 2009-06-02 13:19:17 +03:00
Bahadir Balban
6c78f149e5 Comments for libl4 userspace mutex implementation has been updated. 2009-06-01 16:36:59 +03:00
Bahadir Balban
968f6b4d56 Removed a few minor dependencies on linux C library headers that I forgot in the past. 2009-06-01 16:11:11 +03:00
Bahadir Balban
13d469f659 Removed all unecessary prints from the mutex test and the kernel
- removed (%d) Sleeping print from contended kernel mutexes.
- removed (%d) Waiting print from WAIT_EVENT used by the pager for suspending tasks.
- removed prints from the mutex_control syscall and user mutex test.
2009-06-01 16:02:10 +03:00
Bahadir Balban
5a616d1eb5 Simplified l4_mutex test, in that the test now updates a variable by thread
switching instead of updating a whole page.
2009-06-01 15:51:54 +03:00
Bahadir Balban
78a5ec9d6d Enhanced execve test error handling 2009-06-01 15:33:36 +03:00
Bahadir Balban
87eae2c941 Verbose error reporting on execve test. 2009-06-01 15:07:24 +03:00
Bahadir Balban
33200c92df Mutex implementation almost working.
- Fixed a wrong instruction in mutex.S user library
- Added support for blocking lock/unlock
- Divided waiting into wait_on_prepare and wait_on_prepared_wait
  so that mutex_control lock is released after getting in the waitqueue.
- Declaring waitqueue on the stack should be done outside wait_on_prepare

Issues:
- Tests can be simplified for atomic data access instead of producer/consumer.
- kmalloc variable sized memory caches are not freed properly. Currently only the
  last slot can be freed, occupied correctly. it should be done in any slot, i.e.
  1, 2, 3, 4 instead of just 5.
- Need to add a mutex to kmalloc.
2009-06-01 14:11:40 +03:00
Bahadir Balban
2bd26ce684 Added mmap support for MAP_SHARED + MAP_ANONYMOUS
mmap() with MAP_ANON | MAP_SHARED is used for creating shared
memory mappings that can be shared among a process and its descendants
(think fork())

Currently shmget/at creates shared virtual files on the fly and calls
do_mmap to create anonymous shared mappings. Now sys_mmap uses this
interface to create virtual files on the fly and call do_mmap on those
files.

In the future a common shared virtual file creation method should be
added and commonly used by both interfaces.
2009-05-31 15:55:16 +03:00
Bahadir Balban
d0652fcb21 Updated mutextest - it is not yet there, we need semaphores 2009-05-31 14:18:19 +03:00
Bahadir Balban
ce79aa2b73 Mutex test progress
- Mutex test added. Forked tasks demonstrate produce/consumer using a
  shared mmap'ed page.
- Added l4lib assembler syscall
- Added forgotten SWI to mutex control offset in syscall page.
- Added mutex head initialization
- Contended child successfully sleeps in a waitqueue.

Issues:
- Somehow the child's produced page buffer is altered at about [4020] offset.
  Parent fails to validate buffer therefore.
- Need to add syncing to test so that parent does not unlock and lock again
  before child has a chance to lock buffer and produce.
2009-05-30 16:46:30 +03:00
Bahadir Balban
b11d4c4607 Added mutex_control syscall for userspace mutexes.
- Compiles and Codezero runs as normal without touching mutex implementation
- Mutex implementation needs testing.

The mutex control syscall allows userspace programs to declare any virtual
address as a mutex lock and ask for help from the kernel syscall
for resolving locking contentions.
2009-05-29 15:34:04 +03:00
Bahadir Balban
ab9e036cb7 Updated test pass/fail print messages for test0 2009-05-28 13:23:44 +03:00
Bahadir Balban
b977e6597e Added per-task ipc flags checking instead of the active task flags.
Previously during ipc copy, only the currently active task flags were
checked. This means the flags of whoever doing the actual copy was used
in the ipc. Now flags are stored in the ktcb and checked by the copy routine.

Current use of the flags is to determine short/full/extended ipc.
2009-05-28 11:50:39 +03:00
Bahadir Balban
53310aa31b Extended IPC Support added.
Benefits & Facts:
- Messages up to 2 kilobytes may be sent.
- Both parties may use non-disjoint user buffers. E.g. any userspace address.
- Userspace buffers can page fault.
- Page faults punish timeslice of only the faulting thread.
- Any number of extended ipcs can take place at any one time, since
  only ktcbs of ipc parties are engaged. No global buffer is used.
  - This also provides smp-safety benefit.

Disadvantages:
- There is triple copying penalty. This has to be done:
  - Sender buffer to sender ktcb
  - Sender ktcb to receiver ktcb
  - Receiver ktcb to receiver buffer.
  This is due to the fact that buffers can be on non-disjoint userspace addresses.

If you want to avoid disadvantages and lose some of the benefits,
(e.g. address freedom, shorter copy size) use FULL IPC.
2009-05-27 14:36:11 +03:00
Bahadir Balban
3ff519439b Added first part of extended ipc support.
- Extended ipc tests
- Need to copy from ktcb-to-ktcb instead of ktcb-to-user
- Need to check flags of both ipc parties before ipc copy type.
2009-05-27 14:07:17 +03:00
Bahadir Balban
93c7cf1995 Fixed fork() errors where forked thread is a copy of any cloned thread in parent address space.
Upon fork, child was created in a new space but as a copy of any
cloned thread in the parent space. This was due to the search of forker thread
by its space id (which is shared among many cloned threads).

Now fixed.
	modified:   src/api/thread.c
	modified:   tasks/mm0/src/task.c
2009-05-26 17:02:32 +03:00
Bahadir Balban
bece68fbf7 Fixed omission of if curly brackets causing stack corruption.
Initialization a local pointer variable was only done in some conditions
causing the uninitialized pointer to corrupt kernel stack of current.
2009-05-25 12:12:21 +03:00
Bahadir Balban
5ac5889a0f Unstable changes for ipc - Fork fails for some reason 2009-05-23 18:43:55 +03:00
Bahadir Balban
379f7ab2b1 Added the omitted utcb.h to mm0 2009-05-19 16:20:05 +03:00