Mercurial > sos > sos
changeset 100:d8f21e4a75e3
Added a simple program that is just an infinite loop
The heap now starts at 8MB
I now try to set the context to the loaded program when it is called in the shell script
author | Jonathan Pevarnek <pevarnj@gmail.com> |
---|---|
date | Thu, 19 May 2011 09:40:10 -0400 |
parents | 2a0aa3efc228 |
children | 6f81e6ae3f64 |
files | Makefile include/psw.h include/system.h src/infLoop.c src/shell.c src/std.c utility/fsGen.py |
diffstat | 7 files changed, 30 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Sat May 14 19:40:18 2011 -0400 +++ b/Makefile Thu May 19 09:40:10 2011 -0400 @@ -11,12 +11,13 @@ CXXFLAGS=$(CFLAGS) LDFLAGS=-m elf64_s390 -BINS=sarpn dynamic testFS shell +BINS=sarpn dynamic testFS shell infLoop sarpn_OBJS=src/sarpn.o src/std.o src/string.o src/stack.o src/operations.o src/math.o arch/arch.a dynamic_OBJS=src/dynamic.o src/std.o src/string.o src/stack.o arch/arch.a testFS_OBJS=src/testFS.o src/std.o src/string.o src/fs.o arch/arch.a shell_OBJS=src/shell.o src/std.o src/fs.o src/string.o src/stdio.o arch/arch.a +infLoop_OBJS=src/infLoop.o arch/arch.a ARCH_OBJS=arch/io.o arch/cons.o arch/ebcdic.o arch/fba.o arch/ioint.o \ arch/svc.o arch/svcint.o @@ -47,6 +48,8 @@ $(LD) $(LDFLAGS) -T scripts/linker.script -o $@ $^ shell: $(shell_OBJS) $(LD) $(LDFLAGS) -T scripts/linker.script -o $@ $^ +infLoop: $(infLoop_OBJS) + $(LD) $(LDFLAGS) -T scripts/linkerProg.script -o $@ $^ arch/arch.a: $(ARCH_OBJS) $(AR) rc $@ $^ @@ -105,7 +108,8 @@ src/sarpn.o: include/std.h include/die.h include/string.h src/sarpn.o: include/operations.h include/stack.h src/shell.o: include/std.h include/die.h include/string.h include/stdio.h -src/shell.o: include/error.h include/fs.h include/elf.h +src/shell.o: include/error.h include/fs.h include/elf.h include/psw.h +src/shell.o: include/svc.h src/stack.o: include/stack.h include/std.h include/die.h src/std.o: include/std.h include/die.h include/string.h src/stdio.o: include/stdio.h include/std.h include/die.h include/string.h
--- a/include/psw.h Sat May 14 19:40:18 2011 -0400 +++ b/include/psw.h Thu May 19 09:40:10 2011 -0400 @@ -28,4 +28,6 @@ u64 ptr; }; +typedef struct psw Psw; + #endif
--- a/include/system.h Sat May 14 19:40:18 2011 -0400 +++ b/include/system.h Thu May 19 09:40:10 2011 -0400 @@ -6,7 +6,7 @@ #define NULL ((void*) 0) #define CON_LEN 132 -#define HEAP_START 0x200000 +#define HEAP_START 0x800000 #define INF __builtin_inff() #define NAN __builtin_nanf("")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/infLoop.c Thu May 19 09:40:10 2011 -0400 @@ -0,0 +1,5 @@ +void start(u64 __memsize) +{ + for(;;) + ; +}
--- a/src/shell.c Sat May 14 19:40:18 2011 -0400 +++ b/src/shell.c Thu May 19 09:40:10 2011 -0400 @@ -5,6 +5,8 @@ #include <fs.h> #include <die.h> #include <elf.h> +#include <psw.h> +#include <svc.h> void start(u64 __memsize) { @@ -41,8 +43,18 @@ if(diff) memset(toLoc + pHdr->p_filesz, 0, diff); } } + Psw psw; + u64 registers[16]; + memset(&psw, 0, sizeof(psw)); + memset(registers, 0, sizeof(registers)); + registers[15] = 0x400000 - 8; + psw.p = 1; + psw.ea = 1; + psw.ba = 1; + psw.ptr = eHdr->e_entry; sprintf(buffer, "Going to memory address %i\n", eHdr->e_entry); sPrint(buffer); + setcontext(&psw, registers); loopCont: free(data); }
--- a/src/std.c Sat May 14 19:40:18 2011 -0400 +++ b/src/std.c Thu May 19 09:40:10 2011 -0400 @@ -141,7 +141,7 @@ allocp->size = 0; allocp->next = (void*)HEAP_START; allocp->next->next = &base; - allocp->next->size = memSize/sizeof(blockUnit); + allocp->next->size = (memSize - HEAP_START)/sizeof(blockUnit); if((sizeof(blockUnit)%sizeof(u64))) { sPrint("WARNING: MEMORY NOT 8-BYTE ALIGNED\n"); }
--- a/utility/fsGen.py Sat May 14 19:40:18 2011 -0400 +++ b/utility/fsGen.py Thu May 19 09:40:10 2011 -0400 @@ -117,6 +117,7 @@ blocks[t] = y i = make_inode(l, fb) + foo, bar, fn = fn.rpartition('/') d += (fn + (" " * (28 - len(fn)))) + word(i) db = rand_block() @@ -136,3 +137,5 @@ else: assert (len(blocks[k]) == BLOCK_SIZE) sys.stdout.write(blocks[k]) + +# vim: set noexpandtab: