akaros.git
10 years agoFree user memory only up to UVPT on x86
Barret Rhoden [Fri, 22 Jan 2010 06:24:57 +0000 (22:24 -0800)]
Free user memory only up to UVPT on x86

Not sure about sparc, but we don't want to free the page tables via the
UVPT or VPT mappings during user_mem_free() on x86.

10 years agoFixes set_timer() for x86
Barret Rhoden [Fri, 22 Jan 2010 01:41:24 +0000 (17:41 -0800)]
Fixes set_timer() for x86

10 years agoPrototype of env_user_mem_walk
Andrew Waterman [Fri, 22 Jan 2010 00:33:17 +0000 (16:33 -0800)]
Prototype of env_user_mem_walk

This is a general mechanism to apply some operator to
all pages mapped into a process's address space.  for
example, env_user_mem_free can be implemented using
this plus a callback that does page_decref.  it will
be useful for implementing fork/exec "right".

10 years agoImplemented syscall dispatch table
Andrew Waterman [Fri, 22 Jan 2010 00:30:28 +0000 (16:30 -0800)]
Implemented syscall dispatch table

...rather than the huge switch statement.  Also fixed a bug
in sys_brk (it's supposed to return the new break; an error
is indicated by retval != newbrk).

10 years agoadded memchr function to string.c
Andrew Waterman [Fri, 22 Jan 2010 00:28:05 +0000 (16:28 -0800)]
added memchr function to string.c

10 years agoadded memchr function to string.c
Andrew Waterman [Fri, 22 Jan 2010 00:26:28 +0000 (16:26 -0800)]
added memchr function to string.c

10 years agoenv_user_mem_free now frees procinfo/procdata pages
Andrew Waterman [Thu, 21 Jan 2010 01:18:20 +0000 (17:18 -0800)]
env_user_mem_free now frees procinfo/procdata pages

The trick is to free up to KERNBASE, not UTOP,
because the procinfo/procdata pages lie above UTOP.

10 years agoMerge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab...
Andrew Waterman [Tue, 19 Jan 2010 23:23:01 +0000 (15:23 -0800)]
Merge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab/src/parlab/ros

10 years agoSped up SPARC kernel crossings
Andrew Waterman [Tue, 19 Jan 2010 23:22:56 +0000 (15:22 -0800)]
Sped up SPARC kernel crossings

Trash the register windows on kernel->user transition,
rather than flushing them.

10 years agoAdded set_timer(usec) function
Andrew Waterman [Tue, 19 Jan 2010 23:22:24 +0000 (15:22 -0800)]
Added set_timer(usec) function

On i386, it uses lapic_set_timer; on SPARC it uses
the hacked-up RAMP interrupt timer.

10 years agoFixes procdata's ring buffers
Barret Rhoden [Mon, 11 Jan 2010 21:15:43 +0000 (13:15 -0800)]
Fixes procdata's ring buffers

Ring buffers need their space to be allocated directly after the sring
struct.

10 years agoProcdata and procinfo can be more than a page long
Barret Rhoden [Sat, 9 Jan 2010 02:47:29 +0000 (18:47 -0800)]
Procdata and procinfo can be more than a page long

These regions need to be contiguous so that the kernel can access them
via kernel addresses.

10 years agoMerge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab...
Andrew Waterman [Thu, 14 Jan 2010 20:07:20 +0000 (12:07 -0800)]
Merge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab/src/parlab/ros

10 years agoSped up fork/exec significantly
Andrew Waterman [Thu, 14 Jan 2010 20:05:51 +0000 (12:05 -0800)]
Sped up fork/exec significantly

It's still not copy on write, but it's much faster now.
Two main changes: don't have env_segment_free operate
on the entire address space, but rather just the text,
heap, data, and stack.  Also, I implemented pagecopy,
which is like memcpy but assumes a large size/alignment

10 years agoFixed issues with the RealTek network driver and the slab allocator
Paul Pearce [Tue, 12 Jan 2010 01:14:13 +0000 (20:14 -0500)]
Fixed issues with the RealTek network driver and the slab allocator

Previously the RealTek network driver would use kmalloc for allocating
the RX and TX descriptor rings. A requirement of the rings was that
they be 256 byte alligned. We had previously discussed this, and
determined that by default kmalloc would, if asked for X bytes, return
X byte aligned memory. This is no longer the case with the new
slab allocator, so the driver no longer functioned correctly

We now directly request pages, to ensure proper alignment.

10 years agoStartcore message uses printd instead of printk
Andrew Waterman [Mon, 11 Jan 2010 07:15:53 +0000 (23:15 -0800)]
Startcore message uses printd instead of printk

10 years agoMerge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab...
Andrew Waterman [Mon, 11 Jan 2010 05:59:53 +0000 (21:59 -0800)]
Merge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab/src/parlab/ros

10 years agoMade resource allocation use printd instead of printk
Andrew Waterman [Mon, 11 Jan 2010 05:59:40 +0000 (21:59 -0800)]
Made resource allocation use printd instead of printk

10 years agoMade SPARC SMP boot messages use printd instead of printk
Andrew Waterman [Mon, 11 Jan 2010 05:59:12 +0000 (21:59 -0800)]
Made SPARC SMP boot messages use printd instead of printk

10 years agoSped up memset
Andrew Waterman [Mon, 11 Jan 2010 05:58:24 +0000 (21:58 -0800)]
Sped up memset

Even if initial pointer isn't aligned, fast-forward to
use word or dword stores.  This speeds up BSS zeroing a lot.

10 years agoMatrix's behavior is less stupid
Andrew Waterman [Mon, 11 Jan 2010 05:53:12 +0000 (21:53 -0800)]
Matrix's behavior is less stupid

If you hit enter, it doesn't try to execute the current directory :-)

10 years agoMerge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab...
Andrew Waterman [Mon, 11 Jan 2010 05:52:18 +0000 (21:52 -0800)]
Merge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab/src/parlab/ros

10 years agoMade SPARC read()/write() more compliant
Andrew Waterman [Mon, 11 Jan 2010 05:52:07 +0000 (21:52 -0800)]
Made SPARC read()/write() more compliant

Attempt to do as many front-end calls as needed to
write or read an entire buffer, rather than stopping
at the end of a page.

10 years agoFixed proc state initialization
Andrew Waterman [Sun, 10 Jan 2010 02:18:41 +0000 (18:18 -0800)]
Fixed proc state initialization

10 years agoMerge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab...
Andrew Waterman [Sun, 10 Jan 2010 02:08:01 +0000 (18:08 -0800)]
Merge branch 'master' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab/src/parlab/ros

10 years agomade test_interrupts sparc compatible
Andrew Waterman [Sun, 10 Jan 2010 02:07:45 +0000 (18:07 -0800)]
made test_interrupts sparc compatible

10 years agoGave half of colors to global color map
Andrew Waterman [Sun, 10 Jan 2010 02:05:24 +0000 (18:05 -0800)]
Gave half of colors to global color map

10 years agoMade c99 compatibility changes
Andrew Waterman [Sun, 10 Jan 2010 02:04:06 +0000 (18:04 -0800)]
Made c99 compatibility changes

10 years agox86 thread local storage tweaks
Barret Rhoden [Sat, 9 Jan 2010 01:25:22 +0000 (17:25 -0800)]
x86 thread local storage tweaks

Pulls the actual LDT out of procdata, since the kernel doesn't need to
read/write the LDT, and allows userspace to mmap() only what it needs
based on the number of potential vcores.

10 years agoMonitor exit
Barret Rhoden [Sat, 9 Jan 2010 00:58:25 +0000 (16:58 -0800)]
Monitor exit

Can leave the monitor, which is useful when dealing with breakpoints for
debugging.  Also cleans up the x86 trap return path.

10 years agoThread local storage for x86
Barret Rhoden [Thu, 7 Jan 2010 21:53:47 +0000 (13:53 -0800)]
Thread local storage for x86

On parlib, using the TLS array.  There is no protection from
segmentation: userspace can write its own LDT (exposed via procdata),
which could also be a decent way to select different TLSs for a core
(for user threading).

This also fixes a bug where the stack_ptr_array pointer was too small
and was clobbering things next to it.

Note that procdata and procinfo are not currently contiguous, which
means if the kernel accesses them and they are more than one page long,
it is accessing random memory.

10 years agoRestored x86 compliation. Still unable to run under x86 due to no TLS
Paul Pearce [Wed, 6 Jan 2010 04:38:52 +0000 (23:38 -0500)]
Restored x86 compliation. Still unable to run under x86 due to no TLS

This commit provides various fixes, including several stubs, needed to allow
ROS to build for x86. Most of these stubs are syscalls that newlib_backend
needs to handle. I haven't decided how we should support these syscalls. Our
options are to either ship them off over the serial/network link to the
syscall server, or handle them locally.

There is an additional stub in trap.h to handle the setting of errno's
with respect to syscalls. We need to figure out how we wish to handle
this.

NOTE: Although this compiles, attempting to run this under x86 will
result in a page fault durin proc_run. This is a result of the lack
of any thread local store support on the x86 side. Paul plans to
take a look at adding x86 tls support, next.

10 years agoonly link in roslib for i386
Andrew Waterman [Sun, 3 Jan 2010 20:41:06 +0000 (12:41 -0800)]
only link in roslib for i386

10 years agoAdded fork, exec, wait
Andrew Waterman [Sun, 3 Jan 2010 01:10:34 +0000 (17:10 -0800)]
Added fork, exec, wait

This probably deserves more explanation than I'll give here,
but here's the skinny: fork is a naive implementation that
doesn't work with mmap'd pages and doesn't use copy-on-write.

exec still takes a binary blob as an argument, like run_binary,
but unlike run_binary, it overwrites the calling process.

wait relies on a new process field called exitcode, which is
set by sys_proc_destroy() (therefore on exit()).

also added ppid to procinfo.

10 years agoinlined get_page_color
Andrew Waterman [Sun, 3 Jan 2010 01:08:17 +0000 (17:08 -0800)]
inlined get_page_color

10 years agoChanged argc/argv/envp ABI
Andrew Waterman [Sun, 3 Jan 2010 01:07:51 +0000 (17:07 -0800)]
Changed argc/argv/envp ABI

10 years agoAdded process list (ps) to monitor
Andrew Waterman [Sun, 3 Jan 2010 01:07:11 +0000 (17:07 -0800)]
Added process list (ps) to monitor

10 years agoReduced boot time
Andrew Waterman [Sun, 3 Jan 2010 01:05:23 +0000 (17:05 -0800)]
Reduced boot time

Most boot time is spent adding pages to the free list.
I inlined the function to determine the page color, and
added the assumption that there is a power of two number
of colors (true for all commercial processor caches).

10 years agoEnabled reading performance counters in user space
Andrew Waterman [Sun, 3 Jan 2010 01:03:03 +0000 (17:03 -0800)]
Enabled reading performance counters in user space

I used a fast-trap (user trap 0x89) rather than a full syscall

10 years agoAdded errno support
Andrew Waterman [Sun, 3 Jan 2010 01:02:07 +0000 (17:02 -0800)]
Added errno support

10 years agoMerged proc_init_trapframe and proc_init_trapframe_vcoreid
Andrew Waterman [Sun, 3 Jan 2010 00:49:54 +0000 (16:49 -0800)]
Merged proc_init_trapframe and proc_init_trapframe_vcoreid

10 years agoReduced SPARC kernel binary size
Andrew Waterman [Sun, 3 Jan 2010 00:48:05 +0000 (16:48 -0800)]
Reduced SPARC kernel binary size

Moved page tables out of .data into .bss

10 years agoAdded compile option to link in fewer binaries
Andrew Waterman [Sun, 3 Jan 2010 00:44:40 +0000 (16:44 -0800)]
Added compile option to link in fewer binaries

-DMINIMAL_KFS will only link in matrix (the shell)

10 years agomade augment-gcc less stupid
Andrew Waterman [Sun, 3 Jan 2010 00:43:22 +0000 (16:43 -0800)]
made augment-gcc less stupid

10 years agoAdded more syscalls
Andrew Waterman [Sun, 3 Jan 2010 00:42:39 +0000 (16:42 -0800)]
Added more syscalls

Also some ABI changes (TLS, argv, etc)

10 years agoGot the kernel's nose out of cmdline args
Andrew Waterman [Mon, 21 Dec 2009 05:40:51 +0000 (21:40 -0800)]
Got the kernel's nose out of cmdline args

10 years agofixed makefile error if no ivycc
Andrew Waterman [Mon, 21 Dec 2009 02:57:47 +0000 (18:57 -0800)]
fixed makefile error if no ivycc

10 years agoFixed run_binary and SPARC processes
Andrew Waterman [Wed, 16 Dec 2009 21:11:45 +0000 (13:11 -0800)]
Fixed run_binary and SPARC processes

10 years agoSynced up SPARC port
Andrew Waterman [Wed, 16 Dec 2009 03:52:25 +0000 (19:52 -0800)]
Synced up SPARC port

10 years agoRevised system call forwarding for multiple processes
Andrew Waterman [Wed, 16 Dec 2009 03:19:24 +0000 (19:19 -0800)]
Revised system call forwarding for multiple processes

Added arch-specific process init/destroy hooks
Moved some system call forwarding code to user space

10 years agoMerge remote branch 'origin/sparc-dev'
Barret Rhoden [Thu, 3 Dec 2009 03:14:54 +0000 (19:14 -0800)]
Merge remote branch 'origin/sparc-dev'

Still a few outstanding issues, like fully merging roslib into parlib
and sorting brk() and mmap().

Conflicts:
GNUmakefile
kern/arch/i386/atomic.h
kern/arch/sparc/trap.c
kern/include/env.h
kern/include/page_alloc.h
kern/include/ros/procdata.h
kern/src/env.c
kern/src/init.c
kern/src/kfs.c
kern/src/manager.c
kern/src/page_alloc.c
kern/src/syscall.c
user/apps/roslib/mhello.c

10 years agoProcess reference counting
Barret Rhoden [Tue, 1 Dec 2009 07:28:11 +0000 (23:28 -0800)]
Process reference counting

This sorts out reference counting of processes.  This will keep
processes from dying while pointers are still floating around, among
other things.  Read the section in Documentation/process-internals.txt
for specifics and before you do anything that fundamentally messes with
processes.

There are still many outstanding issues: using atomics to properly
handle the reference counting (currently using the proc_lock, which has
issues), splitting core_request() up, and stacks getting annihilated
while holding references.

10 years agosped up run binary... realloc sux
Andrew Waterman [Tue, 1 Dec 2009 04:45:29 +0000 (20:45 -0800)]
sped up run binary... realloc sux

10 years agoreboot syscall added
Andrew Waterman [Tue, 1 Dec 2009 04:43:48 +0000 (20:43 -0800)]
reboot syscall added

10 years agofrontend-link code quality improvements
Andrew Waterman [Tue, 1 Dec 2009 04:32:51 +0000 (20:32 -0800)]
frontend-link code quality improvements

10 years agocleaned up harts stack allocation
Andrew Waterman [Tue, 1 Dec 2009 04:32:24 +0000 (20:32 -0800)]
cleaned up harts stack allocation

10 years agoadded reboot syscall
Andrew Waterman [Tue, 1 Dec 2009 04:31:21 +0000 (20:31 -0800)]
added reboot syscall

10 years agofixed bad spacing
Andrew Waterman [Tue, 1 Dec 2009 04:29:43 +0000 (20:29 -0800)]
fixed bad spacing

10 years agoMerge branch 'sparc-dev' of ssh://scm.millennium.berkeley.edu/project/cs/radlab/src...
Kevin Klues [Tue, 1 Dec 2009 04:27:53 +0000 (20:27 -0800)]
Merge branch 'sparc-dev' of ssh://scm.millennium.berkeley.edu/project/cs/radlab/src/parlab/ros into sparc-dev

10 years agoAdded stubs for additional newlib system calls
Kevin Klues [Tue, 1 Dec 2009 04:27:45 +0000 (20:27 -0800)]
Added stubs for additional newlib system calls

10 years agoGCC augmentation fixes
Andrew Waterman [Tue, 1 Dec 2009 04:24:26 +0000 (20:24 -0800)]
GCC augmentation fixes

10 years agoFixed GCC augmentation script
Andrew Waterman [Tue, 1 Dec 2009 04:22:40 +0000 (20:22 -0800)]
Fixed GCC augmentation script

10 years agoFixed some infrastructure stuff related to our crosscompilers
Kevin Klues [Mon, 30 Nov 2009 09:52:12 +0000 (01:52 -0800)]
Fixed some infrastructure stuff related to our crosscompilers

10 years agoTLS works in SPARC
Andrew Waterman [Mon, 30 Nov 2009 11:28:51 +0000 (03:28 -0800)]
TLS works in SPARC

10 years agoMakefile support for sparc-ros-gcc
Andrew Waterman [Mon, 30 Nov 2009 04:47:23 +0000 (20:47 -0800)]
Makefile support for sparc-ros-gcc

10 years agofixed pedantic gcc warning
Andrew Waterman [Mon, 30 Nov 2009 04:21:11 +0000 (20:21 -0800)]
fixed pedantic gcc warning

10 years agoExtern'd some harts functions
Andrew Waterman [Mon, 30 Nov 2009 04:20:25 +0000 (20:20 -0800)]
Extern'd some harts functions

10 years agoAdded external user binary support (usrbin/)
Andrew Waterman [Wed, 25 Nov 2009 00:17:22 +0000 (16:17 -0800)]
Added external user binary support (usrbin/)

Also some misc SPARC changes and minor harts change

10 years agochanged harts interface for proxykernel compat
Andrew Waterman [Tue, 24 Nov 2009 23:38:05 +0000 (15:38 -0800)]
changed harts interface for proxykernel compat

10 years agoManually spin_unlock_irqsave and a cleaner destroy
Barret Rhoden [Fri, 13 Nov 2009 00:18:57 +0000 (16:18 -0800)]
Manually spin_unlock_irqsave and a cleaner destroy

proc_destroy is no longer ghetto when it comes to decrefing, which will
help in some future commits regarding refcnts and atomic operations on
those refcnts.

10 years agoremoved user envp to fix link problems
Andrew Waterman [Wed, 11 Nov 2009 04:35:45 +0000 (20:35 -0800)]
removed user envp to fix link problems

10 years agofixed pthread_barrier_wait bug
Andrew Waterman [Wed, 11 Nov 2009 04:35:19 +0000 (20:35 -0800)]
fixed pthread_barrier_wait bug

10 years agoimproved code quality for C++ static constructor calls
Andrew Waterman [Wed, 11 Nov 2009 04:34:24 +0000 (20:34 -0800)]
improved code quality for C++ static constructor calls

10 years agoProc data structure management, env gutting
Barret Rhoden [Mon, 9 Nov 2009 19:03:11 +0000 (11:03 -0800)]
Proc data structure management, env gutting

Got rid of the static envs, uses a kmem_cache for allocating procs,
added better pid management, refactored old envs code.

There's a couple races, one on deschedule(), and another issue in
general with refcnting on any pointer acquisition.  See the comments in
__proc_free() if you're curious.

10 years agoHash table changes
Barret Rhoden [Sat, 7 Nov 2009 01:33:47 +0000 (17:33 -0800)]
Hash table changes

Changed how the hash table works, most notably that you must free your
keys on your own.  This way, you can either kfree, kmem_cache_free, or
just nothing, based on whatever is appropriate for what your key is.
(Just an int requires no freeing, but still requires a typecast).

This is a good example of packaged solutions being non-ideal, since they
make assumptions about its usage (kfree, let alone that the key is an
obkect).  I nearly ripped out the function pointers for hashing and
equality, in favor of the hashed value being passed to functions (where
needed), and the key just being a long.  It simplifies a lot and would
perform better, and I don't have an example of when I want an object for
a key where equivalence isn't the address of the object.  There may be a
case where the function pointers are nice, so I held off.

There are also generic functions for the hashfn and eqfn.  Don't call
these directly, etc.  Also, the hash entries (hentry) are now slab
allocated, instead of kmalloc'd.

NB: be warned that there is no checking for duplicate keys.

Also, another way to do these things is to embed the hash_entry in any
struct that will be hashed (like the struct proc).  You won't need
dynamic allocation of the hentry, you can check if you are hashed or
not, and the hentry doesn't need a pointer to you (can do something like
container_of()).  A downside is that concurrency can be weird - others
could temp touch your entry while walking a hash chain.  Not sure what's
best, overall.

10 years agoamt_wanted_min added to resource requests
Barret Rhoden [Fri, 6 Nov 2009 01:15:12 +0000 (17:15 -0800)]
amt_wanted_min added to resource requests

Allows userspace to say the minimum amount of resources that must be
present for it to run.  Note that this doesn't actually do anything with
the info, it simply tracks it in the resources array in the struct proc.

10 years agoMarked lock-required proc functions with __
Barret Rhoden [Fri, 6 Nov 2009 01:00:45 +0000 (17:00 -0800)]
Marked lock-required proc functions with __

In general, I'm using __ to denote a somewhat special function, usually
meant for more internal usage.  In the case of these proc functions, you
need to hold the lock before you call it.  In some other cases, the
functions are internal and not meant to be called directly in most cases
(like __spin_lock, or the active message handlers).

10 years agoAdding channels design doc
David Zhu [Fri, 6 Nov 2009 20:45:15 +0000 (12:45 -0800)]
Adding channels design doc

10 years agoFixed some parlib newlib errno difficulties
Andrew Waterman [Wed, 4 Nov 2009 06:31:13 +0000 (22:31 -0800)]
Fixed some parlib newlib errno difficulties

10 years agoMade static destructors thread-safe
Andrew Waterman [Wed, 4 Nov 2009 06:30:44 +0000 (22:30 -0800)]
Made static destructors thread-safe

10 years agoAdded changes to support C++ apps
Andrew Waterman [Wed, 4 Nov 2009 06:26:15 +0000 (22:26 -0800)]
Added changes to support C++ apps

Specifically, static initialization and destruction.  Need to
provide to g++ a __CTOR_LIST__ and __DTOR_LIST__ section in
the binary.  Also need to call all the CTORs before entering
main(), and need to use atexit() to call all the DTORs on exit.

10 years agoFixed up parlib pthreads/harts
Andrew Waterman [Wed, 4 Nov 2009 05:43:47 +0000 (21:43 -0800)]
Fixed up parlib pthreads/harts

Added a hart_current_harts() routine, fixed hart_yield()
to decrement that value; I leverage this in pthreads.

10 years agoParlib pthreads depends on fewer libc functions
Andrew Waterman [Mon, 2 Nov 2009 10:52:08 +0000 (02:52 -0800)]
Parlib pthreads depends on fewer libc functions

Also, deleted old pthreads files that should have already been gone

10 years agoFixed page coloring bug
Andrew Waterman [Mon, 2 Nov 2009 10:50:21 +0000 (02:50 -0800)]
Fixed page coloring bug

The round-robin allocator was always using next_color = prev_color,
rather than next_color = (prev_color + 1) % num_colors.

10 years agobacked out an accidental printk commit
Andrew Waterman [Mon, 2 Nov 2009 10:46:55 +0000 (02:46 -0800)]
backed out an accidental printk commit

10 years agoAdded kernel command line to SPARC port
Andrew Waterman [Mon, 2 Nov 2009 10:41:31 +0000 (02:41 -0800)]
Added kernel command line to SPARC port

10 years agoadded atoi()
Andrew Waterman [Mon, 2 Nov 2009 10:41:01 +0000 (02:41 -0800)]
added atoi()

10 years agoChanged hackish argc/argv setup
Andrew Waterman [Mon, 2 Nov 2009 10:40:10 +0000 (02:40 -0800)]
Changed hackish argc/argv setup

No longer uses varargs; instead taks argv array

10 years agoMore verbose multicore debugging
Andrew Waterman [Mon, 2 Nov 2009 10:39:03 +0000 (02:39 -0800)]
More verbose multicore debugging

We print out the pid for which a core has been started.

10 years agoMulti-cored process changes
Barret Rhoden [Fri, 30 Oct 2009 20:10:44 +0000 (13:10 -0700)]
Multi-cored process changes

Changes how yielding works and made transitions to and from _M states
more explicit.  Vcore0 can yield and come back up at the hart entry (you
need to prepare_for_multi_mode()).  In general, all cores are equal when
in an _M state, and vcore0 continues running the calling context only on
transition from _S to _M, and not whenever proc_run()ing a RUNNABLE_M.

Added documentation about how processes work, mostly with respect to
the kernel interface.  Part 2 has specific info about the transitions to
and from _M.

Finally moved current to per_cpu_info, and also added current_tf.
Current is still a pointer to the process that is on the core.
Current_tf is a pointer to the trapframe that is on the core's kernel
stack.  This is also stored in per_cpu_info.  It could be discovered
through arcane hackery, but probably isn't worth it.

10 years agoMoved pthreads into parlib
Andrew Waterman [Thu, 29 Oct 2009 07:33:45 +0000 (00:33 -0700)]
Moved pthreads into parlib

10 years agoImproved user binary loading
Andrew Waterman [Thu, 29 Oct 2009 03:37:38 +0000 (20:37 -0700)]
Improved user binary loading

load_icode no longer requires the new process' cr3 to be loaded.
Binaries can now be loaded from another process' address space
directly, so a large number of contiguous physical pages is
no longer needed.  This fixes a kmalloc failure on SPARC.

10 years agoFixed pthread library null-pointer dereference
Andrew Waterman [Wed, 28 Oct 2009 23:51:22 +0000 (16:51 -0700)]
Fixed pthread library null-pointer dereference

10 years agoAccidentally turned off output lock. Oops! Fixed.
Andrew Waterman [Wed, 28 Oct 2009 23:33:26 +0000 (16:33 -0700)]
Accidentally turned off output lock.  Oops!  Fixed.

10 years agoMerge branch 'sparc-dev' of ssh://waterman@scm.millennium.berkeley.edu/project/cs...
Andrew Waterman [Wed, 28 Oct 2009 15:19:41 +0000 (08:19 -0700)]
Merge branch 'sparc-dev' of ssh://waterman@scm.millennium.berkeley.edu/project/cs/radlab/src/parlab/ros into sparc-dev

10 years agoWay faster FDIV/FSQRT on SPARC
Andrew Waterman [Wed, 28 Oct 2009 15:19:19 +0000 (08:19 -0700)]
Way faster FDIV/FSQRT on SPARC

I hand-rolled a Newton-Raphson iterator that runs with
traps disabled! scary!

10 years agoFinished up the page coloring stuff
Kevin Klues [Wed, 28 Oct 2009 08:07:49 +0000 (09:07 +0100)]
Finished up the page coloring stuff

There are now functions to alloc/free colors on a process
by process basis, as well as alloc/free pages based on the
colors owned by a process.  See kern/include/colored_pages.h
and kern/include/page_alloc.h for the function definitions.

Also, a new matrix program has been added called run_binary_colored
which takes advantage of the fact that colors can be allocated
to a process.  Run it and try it out

10 years agomade some fixes to support gcc3 on sparc
Andrew Waterman [Wed, 28 Oct 2009 06:28:06 +0000 (23:28 -0700)]
made some fixes to support gcc3 on sparc

10 years agomade some fixes to support gcc3 on sparc
Andrew Waterman [Wed, 28 Oct 2009 06:27:50 +0000 (23:27 -0700)]
made some fixes to support gcc3 on sparc

10 years agoGet things to build with Ivy.
Zach Anderson [Tue, 27 Oct 2009 22:49:18 +0000 (15:49 -0700)]
Get things to build with Ivy.

Please make sure things compile with Ivy even if you have to use nodeputy, nosharc, TC() or TRUSTEDBLOCK.
That makes it much easier for me to go back and fix things.
I have also turned off the error logging, so compilation with Ivy should be a bit faster, now.