Mercurial > sos > sos
changeset 132:abf1f35f5935
Very simple program interrupt handler, added broken program to test
author | Jonathan Pevarnek <pevarnj@gmail.com> |
---|---|
date | Sun, 11 Sep 2011 23:10:18 -0400 |
parents | b6b3f04a732f |
children | d1e835a25f28 |
files | .hgignore Makefile arch/except.c arch/progint.S arch/progint.h arch/progint.o include/system.h src/os/std.c src/prog/broken.c |
diffstat | 9 files changed, 62 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Wed Aug 31 23:58:33 2011 -0400 +++ b/.hgignore Sun Sep 11 23:10:18 2011 -0400 @@ -9,6 +9,7 @@ ^rpn$ ^dynamic$ ^testFS$ +^broken$ ^loader\.bin$ ^cscope\.out$ \.swp$
--- a/Makefile Wed Aug 31 23:58:33 2011 -0400 +++ b/Makefile Sun Sep 11 23:10:18 2011 -0400 @@ -12,7 +12,7 @@ LDFLAGS=-m elf64_s390 OSBINS=shell -PROGBINS=hello ls echo dynamic rpn +PROGBINS=hello ls echo dynamic rpn broken shell_OBJS=src/os/shell.o src/os/std.o src/os/fs.o src/os/string.o src/os/stdio.o src/os/scall.o src/os/heap.o src/os/memStack.o arch/arch.a hello_OBJS=src/prog/hello.o src/prog/std.o src/prog/string.o @@ -20,11 +20,12 @@ echo_OBJS=src/prog/echo.o src/prog/std.o src/prog/string.o dynamic_OBJS=src/prog/dynamic.o src/prog/std.o src/prog/string.o src/prog/stack.o rpn_OBJS=src/prog/rpn.o src/prog/std.o src/prog/string.o src/prog/stack.o src/prog/operations.o src/prog/math.o +broken_OBJS=src/prog/broken.o arch/arch.a testFS_OBJS=src/testFS.o src/std.o src/string.o src/os/fs.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 + arch/svc.o arch/svcint.o arch/progint.o arch/except.o .PHONY: all build clean tags @@ -57,6 +58,8 @@ $(LD) $(LDFLAGS) -T scripts/linkerProg.script -o $@ $^ echo: $(echo_OBJS) $(LD) $(LDFLAGS) -T scripts/linkerProg.script -o $@ $^ +broken: $(broken_OBJS) + $(LD) $(LDFLAGS) -T scripts/linkerProg.script -o $@ $^ dynamic: $(dynamic_OBJS) $(LD) $(LDFLAGS) -T scripts/linkerProg.script -o $@ $^ rpn: $(rpn_OBJS)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arch/except.c Sun Sep 11 23:10:18 2011 -0400 @@ -0,0 +1,20 @@ +#include <os/psw.h> +#include <die.h> +#include "progint.h" + +extern void PROGINT(void); + +void init_prog_int() +{ + Psw psw; + __builtin_memset(&psw, 0, sizeof(psw)); + psw.ea = 1; + psw.ba = 1; + psw.ptr = (u64) &PROGINT; + __builtin_memcpy(((void*) PROGINT_PSW_NEW), &psw, sizeof(psw)); +} + +void prog_int_handler() { + putline("PIA\n", 4); //just so I know this has been called + die(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arch/progint.S Sun Sep 11 23:10:18 2011 -0400 @@ -0,0 +1,17 @@ +#include "progint.h" + +.text + .align 4 +.globl PROGINT + .type PROGINT, @function +PROGINT: + stmg %r0,%r15,PROGINT_REG_LOC #save current registers + +# llilf %r15,PROGINT_STACK + lhi %r15,0x30 + sla %r15,16(%r0) + + larl %r14,prog_int_handler + basr %r14,%r14 #so, I think this is just copying the psw to the stack, right? + + #so, I do not know what any of the other stuff below this did in the SVCINT function...
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arch/progint.h Sun Sep 11 23:10:18 2011 -0400 @@ -0,0 +1,12 @@ +#ifndef __PROGINT_H +#define __PROGINT_H + +#define PROGINT_REG_LOC 0x300 + +#define PROGINT_PSW_OLD 0x150 +#define PROGINT_PSW_NEW 0x1D0 + +#define PROGINT_STACK 0x300000 +#define PROGINT_STACK_SHIFT 0x30 + +#endif
--- a/include/system.h Wed Aug 31 23:58:33 2011 -0400 +++ b/include/system.h Sun Sep 11 23:10:18 2011 -0400 @@ -32,6 +32,8 @@ extern void init_io_int(void); extern void init_console(void); + extern void init_prog_int(void); + extern int putline(char *buf, int len); extern int getline(char *buf, int len);