9 years agoAdded all of the old tests from roslib back in
Kevin Klues [Tue, 30 Mar 2010 04:31:20 +0000 (21:31 -0700)]
Added all of the old tests from roslib back in

Also had to chnge the makefiles to support compiling all
c files contained in the tests directory without explicitly
listing them.

9 years agoAdded ability to query what arch you are building
Kevin Klues [Fri, 26 Mar 2010 08:10:42 +0000 (01:10 -0700)]
Added ability to query what arch you are building

Just run 'make arch'

9 years agoAdded support for building simple user programs
Kevin Klues [Fri, 26 Mar 2010 08:06:16 +0000 (01:06 -0700)]
Added support for building simple user programs

This includes the addition of some files in the
tests directory that test libraries built in user/parlib

9 years agoWe never actually removed <ros/error.h>, now we do
Kevin Klues [Fri, 26 Mar 2010 07:57:51 +0000 (00:57 -0700)]
We never actually removed <ros/error.h>, now we do

This caused alot of files to trivially change to include
the new <error.h> file that replaced it.

9 years agoMade real* names more consistent in Makefiles
Kevin Klues [Fri, 26 Mar 2010 07:41:07 +0000 (00:41 -0700)]
Made real* names more consistent in Makefiles

In the last commit I made it possible to switch targets more easily.
In this commit I made it more clear what it meant to make the realclean
and realall targets.  This actually fixed a small bug that caused erroneous
simlinks to be created by certain targets.

9 years agoMade pmap.c more consistent with demand paging
Andrew Waterman [Tue, 30 Mar 2010 07:21:09 +0000 (00:21 -0700)]
Made pmap.c more consistent with demand paging

Used the PAGE_PRESENT, etc. macros more consistently, and
made page_remove do the right thing if the page is paged out

9 years agoRemoved env_segment_alloc/free
Andrew Waterman [Tue, 30 Mar 2010 06:13:48 +0000 (23:13 -0700)]
Removed env_segment_alloc/free

The remaining uses (sys_brk and load_icode) have been replaced
with calls to mmap.  This makes load_icode ugly, but that will
be removed soon anyway.

9 years agoAdded MAP_POPULATE
Andrew Waterman [Tue, 30 Mar 2010 05:18:07 +0000 (22:18 -0700)]

Faults pages in before returning from mmap.
This will let us get rid of env_segment_alloc.
Also, fixed up handle_page_fault a bit

9 years agoFixed bug in SPARC trap entry
Andrew Waterman [Tue, 30 Mar 2010 04:55:50 +0000 (21:55 -0700)]
Fixed bug in SPARC trap entry

Condition codes were being clobbered by the kernel.  This
didn't show up until demand paging was added, because this
caused more random kernel crossings.

9 years agoAdded icache flushing
Andrew Waterman [Sat, 27 Mar 2010 08:38:17 +0000 (01:38 -0700)]
Added icache flushing

Some ISAs (cough) require icache flushes after code has been
self-modified, e.g. after faulting in a new page.  The lack
of this support caused the RAMP HW to crash.  I've added an
arch-specific "icache_flush_page" primitive; it's a nop on
x86, and on SPARC it flushes the I$/D$.

9 years agoAdded demand paging support
Andrew Waterman [Sat, 27 Mar 2010 04:06:31 +0000 (21:06 -0700)]
Added demand paging support

mmap'd pages are now faulted in on demand.  Metadata about paged-out
pages are stored in the unused bits of the PTE when the PTE is invalid.
Metadata comes in the form of a pointer to type pfault_info_t.

The main thing to keep in mind is it's often no longer sufficient to
check user PTEs against PTE_P to determine their state.  Use the
exactly one of the three must be true at any time.

On any call to mmap with fd != -1, a new struct file is instantiated.
It is reference-counted, once per mmap'd page.  When a page is faulted
in, or when a paged-out page is freed, the file is decref'd.  Allocating
and freeing a pfault_info_t will automatically incref/decref the associated
file, if any.

9 years agoFiles are represented with struct file
Andrew Waterman [Sat, 27 Mar 2010 00:52:26 +0000 (17:52 -0700)]
Files are represented with struct file

Right now, struct file pretty much just wraps an appserver fd,
but this provides enough abstraction so that the future
demand-paging stuff doesn't look so ghetto.

(Additionally, sys_exec now takes an fd, rather than a string.)

9 years agoMoved pte_t definition to arch-specific file
Andrew Waterman [Sat, 27 Mar 2010 00:38:34 +0000 (17:38 -0700)]
Moved pte_t definition to arch-specific file

Andrew Waterman [Fri, 26 Mar 2010 22:20:07 +0000 (15:20 -0700)]

These macros are helpful for page table management.
At this point, only the first two can be true.  In
general, exactly one must be true for any PTE.

9 years agoUse env_segment_alloc for stacks, not mmap
Andrew Waterman [Fri, 26 Mar 2010 22:17:05 +0000 (15:17 -0700)]
Use env_segment_alloc for stacks, not mmap

SPARC register window handlers expect the stack to be
mapped-in at all times.  Thus, demand-paging the stack
will break SPARC.  This restriction is not fundamental,
but it would be very difficult to work around.

9 years agofrontend_syscall now accepts NULL for &errno
Andrew Waterman [Fri, 26 Mar 2010 22:15:32 +0000 (15:15 -0700)]
frontend_syscall now accepts NULL for &errno

This reduces lots of typing when we don't actually care about errno

9 years agoFixed bugs in SPARC trap handlers
Andrew Waterman [Fri, 26 Mar 2010 22:09:52 +0000 (15:09 -0700)]
Fixed bugs in SPARC trap handlers

Data access exceptions were all detected as loads,
and trap frames were being clobbered on print.

9 years agoAdded arch framework for handling page faults
Andrew Waterman [Fri, 26 Mar 2010 05:36:14 +0000 (22:36 -0700)]
Added arch framework for handling page faults

Both ports call into a handle_page_fault routine accordingly

9 years agoMaking now keeps track of which target you want
Kevin Klues [Fri, 26 Mar 2010 03:02:33 +0000 (20:02 -0700)]
Making now keeps track of which target you want

Do a 'make realclean' to make it forget which target you want to
compile for, and then type 'make' again.  The rest should be

9 years agoAdded support for returning errors from syscalls
Kevin Klues [Thu, 25 Mar 2010 04:41:13 +0000 (21:41 -0700)]
Added support for returning errors from syscalls

9 years agoCleaned up front-end code a bit
Kevin Klues [Thu, 25 Mar 2010 00:59:10 +0000 (17:59 -0700)]
Cleaned up front-end code a bit

More consistent function names; unnecessary functions removed

9 years agoMade glibc compile and run x86
Kevin Klues [Wed, 24 Mar 2010 07:49:32 +0000 (00:49 -0700)]
Made glibc compile and run x86

Environment variables now work right for dynamically-linked
programs (they didn't show up before).

TLS support has been added for x86.

9 years agoFixed logical bug in memcpy_from/to_user
Kevin Klues [Wed, 24 Mar 2010 07:48:58 +0000 (00:48 -0700)]
Fixed logical bug in memcpy_from/to_user

9 years agoRemoved intptr_t
Kevin Klues [Wed, 24 Mar 2010 07:48:22 +0000 (00:48 -0700)]
Removed intptr_t

intptr_t considered harmful because arithmetic on pointers
greater than 0x80000000 can produce unexpected results.

9 years agoremoved debug printks from mm
Kevin Klues [Wed, 24 Mar 2010 07:48:07 +0000 (00:48 -0700)]
removed debug printks from mm

9 years agoFixes for fork and exec
Kevin Klues [Wed, 24 Mar 2010 07:44:04 +0000 (00:44 -0700)]
Fixes for fork and exec

First, exec was moved from elf.c to syscall.c

Fork now copies the old process's procinfo and procdata pages,
but in doing so also updates the pid/ppid.

9 years agokfree now gracefully accepts null pointers
Kevin Klues [Wed, 24 Mar 2010 07:33:32 +0000 (00:33 -0700)]
kfree now gracefully accepts null pointers

9 years agoSet the default syscall return value to 0
Kevin Klues [Wed, 24 Mar 2010 07:22:03 +0000 (00:22 -0700)]
Set the default syscall return value to 0

In case syscall() does not return, we want to indicate
success by default.  (This applies to e.g. yield and
the child process after fork.)

9 years agoFixed bug in sysenter/sysexit
Kevin Klues [Wed, 24 Mar 2010 07:18:22 +0000 (00:18 -0700)]
Fixed bug in sysenter/sysexit

Registers ecx and edx are (intentionally) clobbered by sysexit code.
However, the sysenter implementation does not assume this, leading
to incorrect code generation.  We now push them to the stack before

A better implementation would simply add them to the clobber list,
but the lack of GPRs in x86 made glibc compilation encounter register
allocation failures using this approach.

9 years agoproc_init_trapframe now zeros all fields initially
Kevin Klues [Wed, 24 Mar 2010 07:16:10 +0000 (00:16 -0700)]
proc_init_trapframe now zeros all fields initially

This was to fix a problem where gs being nonzero caused
kernel panics when popping a trap frame.  This was encountered
after an exec(), because gs had the old program's value but
not its LDT.

9 years agoAdded a bad implementation of get_free_va_range
Kevin Klues [Wed, 24 Mar 2010 07:14:54 +0000 (00:14 -0700)]
Added a bad implementation of get_free_va_range

Terribly inefficient, but we needed some implementation.


9 years agoCleaned up NIC code for appserver
Kevin Klues [Wed, 24 Mar 2010 07:14:00 +0000 (00:14 -0700)]
Cleaned up NIC code for appserver

9 years agoRemoved symlink-following in doxygen
Kevin Klues [Wed, 24 Mar 2010 07:11:34 +0000 (00:11 -0700)]
Removed symlink-following in doxygen

Following symlinks resulted in make running in an infinite loop

9 years agoRemoved references to intptr_t
Kevin Klues [Wed, 24 Mar 2010 07:09:31 +0000 (00:09 -0700)]
Removed references to intptr_t

It's unnecessary and leads to arithmetic bugs

9 years agoRemoved proc_init_arch; created frontend_proc_init
Kevin Klues [Wed, 24 Mar 2010 07:28:39 +0000 (00:28 -0700)]
Removed proc_init_arch; created frontend_proc_init

9 years agoELF Loader now sets heap_bottom/heap_top correctly
Kevin Klues [Tue, 23 Mar 2010 02:33:43 +0000 (19:33 -0700)]
ELF Loader now sets heap_bottom/heap_top correctly

9 years agoFixed kernel page fault on x86 port
Kevin Klues [Tue, 23 Mar 2010 02:26:44 +0000 (19:26 -0700)]
Fixed kernel page fault on x86 port

On sysenter, we now push zeros for esp and ss
onto the stack.  Thus, examining these fields
does not cause a page fault anymore.

9 years agoadded front-end link code
Andrew Waterman [Mon, 22 Mar 2010 02:07:50 +0000 (19:07 -0700)]
added front-end link code

9 years agoMade make -j work
Andrew Waterman [Mon, 22 Mar 2010 01:48:08 +0000 (18:48 -0700)]
Made make -j work

9 years agoMore work towards getting the appservers combined
Kevin Klues [Mon, 22 Mar 2010 01:07:18 +0000 (18:07 -0700)]
More work towards getting the appservers combined

9 years agoMajor reorganization in prep for appserver merge
Kevin Klues [Sun, 21 Mar 2010 19:32:01 +0000 (12:32 -0700)]
Major reorganization in prep for appserver merge

1) Now that our cross compiler is actually i686 instead of i386, I've moved
kern/arch/i386 to kern/arch/i686, changing the references in the top level
GNUmakefile as well as the Makefile for the cross compiler.

2) I reorganized all of the frontend syscall stuff from being sparc/ramp
specific to being platform independent.  This mostly required moving stuff out
of the sparc specific frontend.c/h files and putting them in
kern/src/frontend.c and kern/include/frontend.c files respectively.
Additionally, I moved stuff from the sparc specific syscall.c file directly
into kern/src/syscall.c, taking care to move all of the 'helper' functions that
were in this file into frontend.c.  That may not be the very best place for
them, as they don't really do anything frontend specific, but for now it seems
to make sense because the only syscalls that use them are those being forwarded
to the frontend appserver.

3) I started messing with Paul's ne2k driver to get it to forward system calls
the way the unified app server expects them.  I have things compiling (probably
not working), but I talked to Paul and he said this was really old code and I
should actually just rebase from the lwip branch and work off the code from
there.  So now I am committing so I can do just that...

9 years agoAdded -fpermissive to the gcc-glibc make process to allow it to compile with newer...
Kevin Klues [Fri, 19 Mar 2010 21:53:24 +0000 (14:53 -0700)]
Added -fpermissive to the gcc-glibc make process to allow it to compile with newer versions of gcc

9 years agoAdded support for kernel-aware stack pointers to glibc
Andrew Waterman [Sat, 13 Mar 2010 05:45:22 +0000 (21:45 -0800)]
Added support for kernel-aware stack pointers to glibc

9 years agoUser programs now tell kernel the stack pointers for new harts
Andrew Waterman [Sat, 13 Mar 2010 05:10:42 +0000 (21:10 -0800)]
User programs now tell kernel the stack pointers for new harts

...using procdata.  This change also eliminated the functions
proc_set_tfcoreid and proc_set_program_counter; instead, they
are args to proc_init_trapframe.

9 years agomade dynamically linked c++ programs work right
Andrew Waterman [Tue, 9 Mar 2010 08:56:51 +0000 (00:56 -0800)]
made dynamically linked c++ programs work right

9 years agoFixed gcc-glibc build on more up-to-date systems
Andrew Waterman [Sat, 6 Mar 2010 02:49:19 +0000 (18:49 -0800)]
Fixed gcc-glibc build on more up-to-date systems

gcc 4.3.2 only builds with autoconf older than 2.64, so we now distribute
the configure script rather than requiring autoconf.  (this is standard
practice in distributions, anyway.)

9 years agoFixed a trapframe-initialization bug in sys_exec
Andrew Waterman [Fri, 5 Mar 2010 22:20:41 +0000 (14:20 -0800)]
Fixed a trapframe-initialization bug in sys_exec

load_elf sets up the entry point in env_tf, but that change
must be propagated to current_tf

9 years agocleand up and sped up SPAARC kernel entry
Andrew Waterman [Wed, 3 Mar 2010 09:32:08 +0000 (01:32 -0800)]
cleand up and sped up SPAARC kernel entry

9 years agogcc-glibc compiles on both SPARC and i386
Andrew Waterman [Sun, 28 Feb 2010 01:07:58 +0000 (17:07 -0800)]
gcc-glibc compiles on both SPARC and i386

9 years agotake 2 at i386 sysdeps (glibc)
Andrew Waterman [Thu, 25 Feb 2010 08:11:22 +0000 (00:11 -0800)]
take 2 at i386 sysdeps (glibc)

9 years agocreated arch-specific glibc sysdep.h
Andrew Waterman [Thu, 25 Feb 2010 07:34:20 +0000 (23:34 -0800)]
created arch-specific glibc sysdep.h

9 years agoExposed SPARC iobus to userspace
Andrew Waterman [Wed, 24 Feb 2010 22:22:53 +0000 (14:22 -0800)]
Exposed SPARC iobus to userspace

users can now load_iobus and store_iobus.

9 years agoAdded 'sim' to .gitignore since older gits are stupid
Kevin Klues [Mon, 22 Feb 2010 15:34:00 +0000 (07:34 -0800)]
Added 'sim' to .gitignore since older gits are stupid

9 years agofixed hart_max_harts bug
Andrew Waterman [Sat, 20 Feb 2010 23:53:55 +0000 (15:53 -0800)]
fixed hart_max_harts bug

9 years agoAdded back harts support
Andrew Waterman [Sat, 20 Feb 2010 01:25:30 +0000 (17:25 -0800)]
Added back harts support

9 years agoglibc might compile for x86 now
Andrew Waterman [Fri, 19 Feb 2010 09:50:14 +0000 (01:50 -0800)]
glibc might compile for x86 now

removed sparc-specific dependencies from sysdeps/ros

9 years agoMassive glibc and directory structure change
Kevin Klues [Thu, 18 Feb 2010 23:22:27 +0000 (15:22 -0800)]
Massive glibc and directory structure change


10 years agoCheckin of Andrews stuff needed to compile glibc
Kevin Klues [Thu, 18 Feb 2010 22:33:11 +0000 (14:33 -0800)]
Checkin of Andrews stuff needed to compile glibc

We may want to roll this back eventually or combine
it with another commit if Andrew ever gets his act together.

10 years agoHella ABI changes for ELF dynamic linking
Andrew Waterman [Wed, 10 Feb 2010 08:44:38 +0000 (00:44 -0800)]
Hella ABI changes for ELF dynamic linking

  1) sys_exec now takes a filename, not a binary blob

  2) load_elf does the grunt work of mmap()ing a program.
     it's hella fast!

  3) added some cruft to tell the dynamic linker about the
     program it's supposed to operate on (entry point,
     elf headers, etc.)

10 years agoBrief NE2K driver fix
Paul Pearce [Wed, 24 Feb 2010 00:59:18 +0000 (16:59 -0800)]
Brief NE2K driver fix

There there are some cases in which a new packet is signaled of zero length.
This was causing errors further up the stack, so I added a fix to deal with
this at the driver layer.

10 years agoFixed NE2K support. WIP Commit
Paul Pearce [Tue, 23 Feb 2010 03:18:14 +0000 (22:18 -0500)]
Fixed NE2K support. WIP Commit

This commit fixes the NE2K support.

10 years agoFunctonal webserver with supporting code changes. WIP COMMIT
Paul Pearce [Fri, 19 Feb 2010 19:19:44 +0000 (14:19 -0500)]
Functonal webserver with supporting code changes. WIP COMMIT

This commit includes a functional webserver (that serves 1 page)
along with all the required code changes to support it.

This commit BREAKS remote system calls on x86, as well as the
ne2k driver.

This is meant to be a checkpoint on the path before merging into

10 years agoFinished glue logic to link LWIP to the OS. This is a WIP commit and contains evil...
Paul Pearce [Sat, 13 Feb 2010 00:49:43 +0000 (19:49 -0500)]
Finished glue logic to link LWIP to the OS. This is a WIP commit and contains evil hacks.

This commit contains a bunch of really ugly evil hacks whose sole job is to test
the underlying network logic. This has no way to receive packets, and the hart_entry()
code is not safe.

10 years agoFirst run at integrating LWIP into the tree (again)
Paul Pearce [Tue, 9 Feb 2010 04:13:14 +0000 (23:13 -0500)]
First run at integrating LWIP into the tree (again)

Things compile and turn on, but the functions in
user/lwip/core/sys_arch.c need to be filled in, and
user/lwip/netif/ethernetif.c needs to be verified.

10 years agoFixed issue with make not working right on Fedora, if ivycc wasn't installed
Paul Pearce [Thu, 18 Mar 2010 00:36:59 +0000 (17:36 -0700)]
Fixed issue with make not working right on Fedora, if ivycc wasn't installed

On some systems (Fedora confirmed) 'which non_existant_file' will generate
errors instead of simply not returning anything. The result of this is
attempting to do any of the make operations without ivycc installed would
generate a series of errors. This occured even if the system was configured
to use standard gcc.

10 years agoFixes race in x86 smp boot
Barret Rhoden [Wed, 10 Mar 2010 21:49:45 +0000 (13:49 -0800)]
Fixes race in x86 smp boot

Barriers before returning from smp_final_core_init().

10 years agoUserspace x86 mmap() calls portability
Barret Rhoden [Tue, 9 Feb 2010 22:47:27 +0000 (14:47 -0800)]
Userspace x86 mmap() calls portability

Passing -1 for the fd when making anonymous mappings.

10 years agoMade BusyBox work
Andrew Waterman [Tue, 9 Feb 2010 09:51:57 +0000 (01:51 -0800)]
Made BusyBox work

Minor tweaks to mmap, mostly.

We need a systematic way for the kernel to execute system
calls "anonymously"--for example, to launch the login shell
without having it stored in KFS, we need to be able to
open, read, and close a file.  I made special internal
versions of these, but it's a bit ugly...

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



10 years agoadded tcgetattr/tcsetattr for bash
Andrew Waterman [Mon, 8 Feb 2010 23:00:35 +0000 (15:00 -0800)]
added tcgetattr/tcsetattr for bash

10 years agoMM touchups
Barret Rhoden [Mon, 8 Feb 2010 20:02:00 +0000 (12:02 -0800)]
MM touchups

Fixes mmap() for x86 - at least for what it's used for now.

Keeps the sys_ functions in syscall.c.  The general model I'd like is
for the sys_ to be a wrapper with basic checks and a callout to a more
complicated function that might get used elsewhere in system.  We don't
do it well yet, but that's the idea.

Also keeps the bits in mman.h in sync with Linux, which might make
things easier.  If we're going to change them back and forth, there
ought to be a reason at least.

Please keep the syscalls in order in syscall.h and syscall.c, and try to
group related calls together.

10 years agoProcinfo set to read-only
Barret Rhoden [Mon, 8 Feb 2010 19:23:13 +0000 (11:23 -0800)]
Procinfo set to read-only

If you have something you want RW to userspace, it belongs in PROCDATA,

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

10 years agoAdded mprotect; made mmap work (dumbly) for files
Andrew Waterman [Sat, 6 Feb 2010 23:38:06 +0000 (15:38 -0800)]
Added mprotect; made mmap work (dumbly) for files

Had to add sys_pread to accomplish this

10 years agomatrix now sets up default PATH
Andrew Waterman [Sat, 6 Feb 2010 23:35:54 +0000 (15:35 -0800)]
matrix now sets up default PATH

10 years agoFixes double-free when destroying a process
Barret Rhoden [Thu, 4 Feb 2010 03:07:33 +0000 (19:07 -0800)]
Fixes double-free when destroying a process

Just free up to UVPT.  memwalking through UVPT (or VPT) will lead to
headaches and usually something other than what you want.

10 years agomon_cpuinfo takes a decimal
Barret Rhoden [Thu, 4 Feb 2010 01:21:34 +0000 (17:21 -0800)]
mon_cpuinfo takes a decimal

Instead of hex.

10 years agox86 core id reordering
Barret Rhoden [Thu, 4 Feb 2010 01:07:27 +0000 (17:07 -0800)]
x86 core id reordering

Provides support for non-contiguous hardware core ids, since x86 encodes
topological information in their lapic ids.  If you use send_ipi, you
usually will want to convert to the hardware id using

Also, if you want to send a group IPI (logical), there is a separate
function for that now.

10 years agoChanged env_user_mem_walk to use return codes
Andrew Waterman [Mon, 1 Feb 2010 06:42:35 +0000 (22:42 -0800)]
Changed env_user_mem_walk to use return codes

This way, a walk can be aborted in the middle--say, if
you found what you wanted or if you encountered an error.
Fork uses mem_walk to copy pages now.

10 years agoAdded env_user_mem_walk
Andrew Waterman [Mon, 1 Feb 2010 02:18:23 +0000 (18:18 -0800)]
Added env_user_mem_walk

..which calls a user-specified function on each resident
page in a specified range.  can be used to free memory
(env_user_mem_free was rewritten to use it), or other
neat things.

10 years agofixed a bug in kpage_alloc
Andrew Waterman [Mon, 1 Feb 2010 01:49:55 +0000 (17:49 -0800)]
fixed a bug in kpage_alloc

10 years agoSplit headers up to reduce namespace pollution
Andrew Waterman [Wed, 27 Jan 2010 21:49:55 +0000 (13:49 -0800)]
Split headers up to reduce namespace pollution

10 years agoAdded distinct user mmap and brk segments
Andrew Waterman [Wed, 27 Jan 2010 21:49:26 +0000 (13:49 -0800)]
Added distinct user mmap and brk segments

brk only works below UMMAP_START and mmap only works above it.
This is a bit of a ghetto hack but will get us out of trouble for now.

10 years agobacktrace on user fault in SPARC port
Andrew Waterman [Wed, 27 Jan 2010 21:48:07 +0000 (13:48 -0800)]
backtrace on user fault in SPARC port

10 years agoadded sparc syscalls to makefile
Andrew Waterman [Wed, 27 Jan 2010 21:47:06 +0000 (13:47 -0800)]
added sparc syscalls to makefile

10 years agoUse stdbool.h to define bool
Andrew Waterman [Wed, 27 Jan 2010 21:46:50 +0000 (13:46 -0800)]
Use stdbool.h to define bool

10 years agoSplit procinfo.h from procdata.h to reduce namespace pollution
Andrew Waterman [Wed, 27 Jan 2010 21:46:24 +0000 (13:46 -0800)]
Split procinfo.h from procdata.h to reduce namespace pollution

10 years agoMinor SPARC header file changes to make glibc compile
Andrew Waterman [Wed, 27 Jan 2010 21:45:54 +0000 (13:45 -0800)]
Minor SPARC header file changes to make glibc compile

10 years agoAdded forwarded POSIX syscalls to SPARC port
Andrew Waterman [Wed, 27 Jan 2010 21:44:54 +0000 (13:44 -0800)]
Added forwarded POSIX syscalls to SPARC port

10 years agoMoved memory-barrier macros out of arch/atomic.h
Andrew Waterman [Wed, 27 Jan 2010 21:44:15 +0000 (13:44 -0800)]
Moved memory-barrier macros out of arch/atomic.h

...just so the Xen ring buffer header doesn't have to suck in
the entire arch/atomic.h.  (The real reason is that glibc chokes
on atomic_add, so don't want it polluting the namespace...)

10 years agoI hate failed merges
Andrew Waterman [Wed, 27 Jan 2010 21:37:57 +0000 (13:37 -0800)]
I hate failed merges

10 years agoMade fork/exec slow but correct.
Andrew Waterman [Wed, 27 Jan 2010 21:32:45 +0000 (13:32 -0800)]
Made fork/exec slow but correct.

Since mmap is actually used now, we need to scan the whole
virtual address range to determine what to copy or unmap.
But this is really slow, so need to walk the pagetable for
efficiency (using env_user_mem_walk or the like)

10 years agoAdded dumb implementation of get_free_va_range.
Andrew Waterman [Wed, 27 Jan 2010 21:27:55 +0000 (13:27 -0800)]
Added dumb implementation of get_free_va_range.

Right now it just linearly scans the user's address space,
which is obviously a low-performance implementation.  But
it works...

10 years agoFixes some syscall issues, esp getpid
Barret Rhoden [Mon, 25 Jan 2010 20:17:24 +0000 (12:17 -0800)]
Fixes some syscall issues, esp getpid

Adds sys_getpid to the syscall table, provides return values for calls
like proc_yield, keeps the table entries in the order in ros/syscall.h,
and reorganizes the syscalls into groups.

10 years agoFixes multiboot memory detection for weird types
Barret Rhoden [Fri, 22 Jan 2010 19:25:51 +0000 (11:25 -0800)]
Fixes multiboot memory detection for weird types

IAW the spec, type 1 is free, all others are reserved.  Some machines
(the new nehalem) had types greater than our array of strings.

10 years agoFixes trapframes on x86
Barret Rhoden [Fri, 22 Jan 2010 19:10:07 +0000 (11:10 -0800)]
Fixes trapframes on x86

Missed the extra segmentation registers in the specialized irq handler
when implementing TLS.

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).