Mercurial > sos > sos
changeset 105:fb73c5728eaf
osTest is a hello world program. It works.
So, there is a lot of uncommitted code here. I probably should have committed
more while working on this... Oh well... It works, mostly, I think.
I got rid of infLoop.c and replaced it with osTest.c which I will gradually add
to as I feel like testing more things about the operating system.
Added the svcCalls.h program which defines static inlines to access the
syscalls. TODO rename (and get some #defines for the syscall numbers)
I fixed the macros in svc_prog.h so they actually work (I think). This may
have already been fixed but 31bts is down at the moment and I cannot check (I
really should have tried compiling that code sooner too... I was very stupid
with the development here...)
scall.h now does what it is supposed to do with saving and setting context
(TODO: make the structure) (TODO: set up actual return codes that work)
Removed debugging message about going to the memory address, I know that works
at this point...
author | Jonathan Pevarnek <pevarnj@gmail.com> |
---|---|
date | Sat, 04 Jun 2011 23:20:53 -0400 |
parents | 1144f2491a39 |
children | 6243450db431 |
files | .hgignore Makefile include/svcCalls.h include/svc_prog.h src/infLoop.c src/os/scall.c src/osTest.c src/shell.c |
diffstat | 8 files changed, 48 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Tue May 31 23:58:29 2011 -0400 +++ b/.hgignore Sat Jun 04 23:20:53 2011 -0400 @@ -6,7 +6,7 @@ ^dynamic$ ^testFS$ ^shell$ -^infLoop$ +^osTest$ ^loader\.bin$ ^cscope\.out$ \.swp$
--- a/Makefile Tue May 31 23:58:29 2011 -0400 +++ b/Makefile Sat Jun 04 23:20:53 2011 -0400 @@ -11,13 +11,13 @@ CXXFLAGS=$(CFLAGS) LDFLAGS=-m elf64_s390 -BINS=sarpn dynamic testFS shell infLoop +BINS=sarpn dynamic testFS shell osTest 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/os/fs.o arch/arch.a shell_OBJS=src/shell.o src/std.o src/os/fs.o src/string.o src/stdio.o src/os/scall.o arch/arch.a -infLoop_OBJS=src/infLoop.o +osTest_OBJS=src/osTest.o ARCH_OBJS=arch/io.o arch/cons.o arch/ebcdic.o arch/fba.o arch/ioint.o \ arch/svc.o arch/svcint.o @@ -48,7 +48,7 @@ $(LD) $(LDFLAGS) -T scripts/linker.script -o $@ $^ shell: $(shell_OBJS) $(LD) $(LDFLAGS) -T scripts/linker.script -o $@ $^ -infLoop: $(infLoop_OBJS) +osTest: $(osTest_OBJS) $(LD) $(LDFLAGS) -T scripts/linkerProg.script -o $@ $^ arch/arch.a: $(ARCH_OBJS) @@ -103,6 +103,7 @@ src/dynamic.o: include/std.h include/die.h include/string.h include/stack.h src/operations.o: include/operations.h include/std.h include/die.h src/operations.o: include/stack.h include/string.h include/math.h +src/osTest.o: include/svcCalls.h include/svc_prog.h 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/svcCalls.h Sat Jun 04 23:20:53 2011 -0400 @@ -0,0 +1,19 @@ +#ifndef __SVCCALLS_H +#define __SVCCALLS_H + +#include <svc_prog.h> + +static inline int exit() +{ + invoke_svc0(0); + return 0; //TODO HACK +} + +static inline int printLine(char *buf, int len) +{ + invoke_svc2(1, buf, len); + return 0; //TODO HACK +} + + +#endif //__SVCCALLS_H
--- a/include/svc_prog.h Tue May 31 23:58:29 2011 -0400 +++ b/include/svc_prog.h Sat Jun 04 23:20:53 2011 -0400 @@ -27,7 +27,7 @@ : /* output */ \ "=r" (_ret) \ : /* input */ \ - "i" (n) \ + "i" (n), \ "d" (a1) \ : /* clobber */ \ "cc", "r2", "r3" \ @@ -45,8 +45,8 @@ : /* output */ \ "=r" (_ret) \ : /* input */ \ - "i" (n) \ - "d" (a1) \ + "i" (n), \ + "d" (a1), \ "d" (a2) \ : /* clobber */ \ "cc", "r2", "r3" \ @@ -65,9 +65,9 @@ : /* output */ \ "=r" (_ret) \ : /* input */ \ - "i" (n) \ - "d" (a1) \ - "d" (a2) \ + "i" (n), \ + "d" (a1), \ + "d" (a2), \ "d" (a3) \ : /* clobber */ \ "cc", "r2", "r3", "r4" \ @@ -87,9 +87,9 @@ : /* output */ \ "=r" (_ret) \ : /* input */ \ - "i" (n) \ - "d" (a1) \ - "d" (a2) \ + "i" (n), \ + "d" (a1), \ + "d" (a2), \ "d" (a3) \ : /* clobber */ \ "cc", "r2", "r3", "r4", "r5" \
--- a/src/infLoop.c Tue May 31 23:58:29 2011 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -void start() -{ - for(;;) - ; -}
--- a/src/os/scall.c Tue May 31 23:58:29 2011 -0400 +++ b/src/os/scall.c Sat Jun 04 23:20:53 2011 -0400 @@ -1,8 +1,12 @@ #include <os/scall.h> #include <svc.h> +//TODO define the opcodes (not opcodes, but I know what I am talking about) somewhere u64 svc_handler(u64 callCode, u64 a, u64 b, u64 c, u64 d) { + Psw psw; + u64 registers[16]; + savecontext(&psw, registers); switch(callCode) { case 0: //exit setcontext(&shellPsw, shellRegisters); @@ -12,5 +16,6 @@ putline((char*)a, (u32)b); break; } - return 0; //TODO HACK + setcontext(&psw, registers); + return 0; //TODO HACK ??? }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/osTest.c Sat Jun 04 23:20:53 2011 -0400 @@ -0,0 +1,9 @@ +#include <svcCalls.h> + +void start() +{ + printLine("Hello world!\n", 13); + exit(); + for(;;) + ; +}
--- a/src/shell.c Tue May 31 23:58:29 2011 -0400 +++ b/src/shell.c Sat Jun 04 23:20:53 2011 -0400 @@ -59,8 +59,6 @@ psw.ea = 1; psw.ba = 1; psw.ptr = eHdr->e_entry; - sprintf(buffer, "Going to memory address %i\n", eHdr->e_entry); - sPrint(buffer); swapcontext(&shellPsw, shellRegisters, &psw, registers); loopCont: free(data);