view src/os/scall.c @ 109:b3fe51f1d753

Added an ls program, fixed plenty of bugs Added an ls program which displays all files on the disk Moved all the file system structures to a separate file, fsstructs Added finfo system call which is a nice wrapper for the getFInfo function The kernel stack start and program stack start are both defined correctly now (*facepalm*)
author Jonathan Pevarnek <pevarnj@gmail.com>
date Sun, 05 Jun 2011 17:33:54 -0400
parents bda048879e28
children d971d4288a5a
line wrap: on
line source

#include <os/scall.h>
#include <os/svcNums.h>
#include <os/fs.h>
#include <svc.h>
/*
#include <stdio.h>
#include <string.h>
*/

u64 svc_handler(u64 callCode, u64 a, u64 b, u64 c, u64 d)
{
	Psw psw;
	u64 registers[16];
	savecontext(&psw, registers);
	switch(callCode) {
		case SVC_EXIT:
			setcontext(&shellPsw, shellRegisters);
			break;
		case SVC_PRINT: //print
			registers[2] = putline((char*)a, (u32)b);
			break;
		case SVC_FINFO:
			registers[2] = getFInfo(a, (void*) b);
			break;
		default:
			registers[2] = -1; //TODO HACK
			break;
	}
	setcontext(&psw, registers);
	return -1; //the code should never get here
}