changeset 107:a57cb2d58b2a

Added defines for syscall numbers
author Jonathan Pevarnek <pevarnj@gmail.com>
date Sun, 05 Jun 2011 15:40:40 -0400
parents 6243450db431
children bda048879e28
files include/os/svcNums.h include/svcCalls.h src/os/scall.c
diffstat 3 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/os/svcNums.h	Sun Jun 05 15:40:40 2011 -0400
@@ -0,0 +1,10 @@
+#ifndef __SVCNUMS_H
+#define __SVCNUMS_H
+
+#define SVC_EXIT 0
+#define SVC_PRINT 1
+#define SVC_FINFO 2
+
+#define SVC_MAX 2
+
+#endif //__SVCNUMS_H
--- a/include/svcCalls.h	Sun Jun 05 15:31:51 2011 -0400
+++ b/include/svcCalls.h	Sun Jun 05 15:40:40 2011 -0400
@@ -2,15 +2,16 @@
 #define __SVCCALLS_H
 
 #include <svc_prog.h>
+#include <os/svcNums.h>
 
 static inline void exit()
 {
-	invoke_svc0(0);
+	invoke_svc0(SVC_EXIT);
 }
 
 static inline int printLine(char *buf, int len)
 {
-	return invoke_svc2(1, buf, len);
+	return invoke_svc2(SVC_PRINT, buf, len);
 }
 
 
--- a/src/os/scall.c	Sun Jun 05 15:31:51 2011 -0400
+++ b/src/os/scall.c	Sun Jun 05 15:40:40 2011 -0400
@@ -1,4 +1,5 @@
 #include <os/scall.h>
+#include <os/svcNums.h>
 #include <svc.h>
 
 //TODO define the opcodes (not opcodes, but I know what I am talking about) somewhere
@@ -8,12 +9,15 @@
 	u64 registers[16];
 	savecontext(&psw, registers);
 	switch(callCode) {
-		case 0: //exit
+		case SVC_EXIT:
 			setcontext(&shellPsw, shellRegisters);
 			break;
-		case 1: //print
+		case SVC_PRINT: //print
 			registers[2] = putline((char*)a, (u32)b);
 			break;
+		default:
+			registers[2] = -1; //TODO HACK
+			break;
 	}
 	setcontext(&psw, registers);
 	return -1; //the code should never get here