# HG changeset patch # User Jonathan Pevarnek # Date 1305812410 14400 # Node ID d8f21e4a75e3bd1e322c14fa6ddcfac4ef2c481a # Parent 2a0aa3efc228f76a7305855810719735338aa0a4 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 diff -r 2a0aa3efc228 -r d8f21e4a75e3 Makefile --- 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 diff -r 2a0aa3efc228 -r d8f21e4a75e3 include/psw.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 diff -r 2a0aa3efc228 -r d8f21e4a75e3 include/system.h --- 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("") diff -r 2a0aa3efc228 -r d8f21e4a75e3 src/infLoop.c --- /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(;;) + ; +} diff -r 2a0aa3efc228 -r d8f21e4a75e3 src/shell.c --- 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 #include #include +#include +#include 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); } diff -r 2a0aa3efc228 -r d8f21e4a75e3 src/std.c --- 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"); } diff -r 2a0aa3efc228 -r d8f21e4a75e3 utility/fsGen.py --- 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: