diff options
| author | Charles.Forsyth <devnull@localhost> | 2009-04-02 12:47:45 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2009-04-02 12:47:45 +0000 |
| commit | 0b2199ffc78ecd6fbb8754fa975bebb8d5814a06 (patch) | |
| tree | bca935c240a745b06df16d6c87bbe1a77a78c289 /emu/Linux | |
| parent | a3d4017d8d3be485b256b15d2344afac09112204 (diff) | |
20090402-1346
Diffstat (limited to 'emu/Linux')
| -rw-r--r-- | emu/Linux/asm-mips.S | 58 | ||||
| -rw-r--r-- | emu/Linux/asm-spim.S | 12 | ||||
| -rw-r--r-- | emu/Linux/emu-g | 3 | ||||
| -rw-r--r-- | emu/Linux/emu-wrt | 3 | ||||
| -rw-r--r-- | emu/Linux/mkfile | 5 | ||||
| -rw-r--r-- | emu/Linux/os.c | 12 | ||||
| -rw-r--r-- | emu/Linux/segflush-386.c | 11 | ||||
| -rw-r--r-- | emu/Linux/segflush-arm.c | 14 | ||||
| -rw-r--r-- | emu/Linux/segflush-mips.S | 16 | ||||
| -rw-r--r-- | emu/Linux/segflush-power.c | 9 | ||||
| -rw-r--r-- | emu/Linux/segflush-spim.S | 16 |
11 files changed, 133 insertions, 26 deletions
diff --git a/emu/Linux/asm-mips.S b/emu/Linux/asm-mips.S new file mode 100644 index 00000000..087b8550 --- /dev/null +++ b/emu/Linux/asm-mips.S @@ -0,0 +1,58 @@ +#include "syscall.h" +#include <sys/asm.h> +#include <sys/regdef.h> +#include <asm/cachectl.h> + +/* + * executeonnewstack(void *tos, void (*tramp)(void *arg), void *arg) + */ + +LEAF(executeonnewstack) + and a0,a0,~7 + addu sp,a0,-16 + move a0,a2 + move t9,a1 + jalr t9 + + li v0,SYS_exit + li a0,0 + syscall + + END(executeonnewstack) + +/* + * unlockandexit(int *key) + */ + +LEAF(unlockandexit) + lw a1,0(a0) + li v0,SYS_exit + li a0,0 + sw a0,0(a1) + syscall + END(unlockandexit) + +LEAF(FPsave) + cfc1 t0, $31 + sw t0, 0(a0) /* a0 is argument */ + j $31 + END(FPsave) + +LEAF(FPrestore) + lw t0, 0(a0) /* a0 is argument */ + ctc1 t0, $31 + j $31 + END(FPrestore) + +LEAF(_tas) + .set noreorder +1: + ll v0,0(a0) /* a0 is argument */ + or t1, v0, 1 + sc t1,0(a0) + beq t1,zero,1b + nop + j $31 /* lock held */ + nop + .set reorder + END(_tas) diff --git a/emu/Linux/asm-spim.S b/emu/Linux/asm-spim.S index 5e281187..087b8550 100644 --- a/emu/Linux/asm-spim.S +++ b/emu/Linux/asm-spim.S @@ -56,15 +56,3 @@ LEAF(_tas) nop .set reorder END(_tas) - -/* - * int segflush(void *p, ulong len) - */ - -LEAF(segflush) - li a2,BCACHE - li v0,SYS_cacheflush - syscall - li v0,0 - j $31 - END(segflush) diff --git a/emu/Linux/emu-g b/emu/Linux/emu-g index 31d29125..3884cb1d 100644 --- a/emu/Linux/emu-g +++ b/emu/Linux/emu-g @@ -1,3 +1,6 @@ +env + X11LIBS= + dev root cons diff --git a/emu/Linux/emu-wrt b/emu/Linux/emu-wrt index c89ffedc..be6c23d2 100644 --- a/emu/Linux/emu-wrt +++ b/emu/Linux/emu-wrt @@ -1,3 +1,6 @@ +env + X11LIBS= + dev root cons diff --git a/emu/Linux/mkfile b/emu/Linux/mkfile index 77693e4e..ebb6e3c4 100644 --- a/emu/Linux/mkfile +++ b/emu/Linux/mkfile @@ -12,6 +12,8 @@ INSTALLDIR=$ROOT/$SYSTARG/$OBJTYPE/bin #path of directory where kernel is instal #end configurable parameters +X11LIBS= -lX11 -lXext # can remove or override using env section in config files + <$ROOT/mkfiles/mkfile-$SYSTARG-$OBJTYPE #set vars based on target system <| $SHELLNAME ../port/mkdevlist $CONF #sets $IP, $DEVS, $PORT, $LIBS @@ -19,6 +21,7 @@ INSTALLDIR=$ROOT/$SYSTARG/$OBJTYPE/bin #path of directory where kernel is instal OBJ=\ asm-$OBJTYPE.$O\ os.$O\ + segflush-$OBJTYPE.$O\ $CONF.root.$O\ lock.$O\ $DEVS\ @@ -30,7 +33,7 @@ LIBNAMES=${LIBS:%=lib%.a} HFILES=\ CFLAGS='-DROOT="'$ROOT'"' -DEMU -I. -I../port -I$ROOT/$SYSTARG/$OBJTYPE/include -I$ROOT/include -I$ROOT/libinterp $CTHREADFLAGS $CFLAGS $EMUOPTIONS -SYSLIBS= -lm -lX11 -lXext +SYSLIBS= $X11LIBS -lm KERNDATE=`{$NDATE} default:V: $O.$CONF diff --git a/emu/Linux/os.c b/emu/Linux/os.c index b11ec83a..3106cb90 100644 --- a/emu/Linux/os.c +++ b/emu/Linux/os.c @@ -525,15 +525,3 @@ stackalloc(Proc *p, void **tos) *(Proc **)rv = p; return rv; } - -#ifdef LINUX_ARM -#define SYS_cacheflush __ARM_NR_cacheflush - -int -segflush(void *a, ulong n) -{ - if(n) - syscall(SYS_cacheflush, a, (char*)a+n-1, 1); - return 0; -} -#endif diff --git a/emu/Linux/segflush-386.c b/emu/Linux/segflush-386.c new file mode 100644 index 00000000..18c940d2 --- /dev/null +++ b/emu/Linux/segflush-386.c @@ -0,0 +1,11 @@ +#include <sys/types.h> +#include <sys/syscall.h> + +#include "dat.h" + +int +segflush(void *a, ulong n) +{ + USED(a); USED(n); + return 0; +} diff --git a/emu/Linux/segflush-arm.c b/emu/Linux/segflush-arm.c new file mode 100644 index 00000000..03929777 --- /dev/null +++ b/emu/Linux/segflush-arm.c @@ -0,0 +1,14 @@ +#include <sys/types.h> +#include <sys/syscall.h> + +#include "dat.h" + +#define SYS_cacheflush __ARM_NR_cacheflush + +int +segflush(void *a, ulong n) +{ + if(n) + syscall(SYS_cacheflush, a, (char*)a+n-1, 1); + return 0; +} diff --git a/emu/Linux/segflush-mips.S b/emu/Linux/segflush-mips.S new file mode 100644 index 00000000..458172fa --- /dev/null +++ b/emu/Linux/segflush-mips.S @@ -0,0 +1,16 @@ +#include "syscall.h" +#include <sys/asm.h> +#include <sys/regdef.h> +#include <asm/cachectl.h> + +/* + * int segflush(void *p, ulong len) + */ + +LEAF(segflush) + li a2,BCACHE + li v0,SYS_cacheflush + syscall + li v0,0 + j $31 + END(segflush) diff --git a/emu/Linux/segflush-power.c b/emu/Linux/segflush-power.c index 07f9a3cb..8fa58189 100644 --- a/emu/Linux/segflush-power.c +++ b/emu/Linux/segflush-power.c @@ -1,9 +1,15 @@ +#include <sys/types.h> +#include <sys/syscall.h> + +#include "dat.h" + + /* * from geoff collyer's port * invalidate instruction cache and write back data cache from a to a+n-1, * at least. */ -void +int segflush(void *a, ulong n) { ulong *p; @@ -24,4 +30,5 @@ segflush(void *a, ulong n) : // no output : ); + return 0; } diff --git a/emu/Linux/segflush-spim.S b/emu/Linux/segflush-spim.S new file mode 100644 index 00000000..458172fa --- /dev/null +++ b/emu/Linux/segflush-spim.S @@ -0,0 +1,16 @@ +#include "syscall.h" +#include <sys/asm.h> +#include <sys/regdef.h> +#include <asm/cachectl.h> + +/* + * int segflush(void *p, ulong len) + */ + +LEAF(segflush) + li a2,BCACHE + li v0,SYS_cacheflush + syscall + li v0,0 + j $31 + END(segflush) |
