/kernel/trunk/generic/include/syscall/syscall.h |
---|
29,6 → 29,8 |
#ifndef __SYSCALL_H__ |
#define __SYSCALL_H__ |
#include <typedefs.h> |
typedef enum { |
SYS_CTL = 0, |
SYS_IO = 1, |
38,7 → 40,7 |
typedef int (*syshandler_t)(); |
extern int sys_ctl(void); |
extern int sys_io(void); |
extern int sys_io(int fd, const void *buf, size_t count); |
extern syshandler_t syscall_table[SYSCALL_END]; |
/kernel/trunk/generic/src/syscall/syscall.c |
---|
26,14 → 26,24 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <arch/types.h> |
#include <syscall/syscall.h> |
#include <print.h> |
#include <putchar.h> |
int sys_ctl(void) { |
printf("SYS_CTL\n"); |
return 0; |
} |
int sys_io(void) { |
int sys_io(int fd, const void * buf, size_t count) { |
// TODO: buf sanity checks and a lot of other stuff ... |
size_t i; |
for (i = 0; i < count; i++) |
putchar(((char *) buf)[i]); |
return 0; |
} |
/kernel/trunk/arch/ia32/src/interrupt.c |
---|
27,6 → 27,7 |
*/ |
#include <arch/interrupt.h> |
#include <syscall/syscall.h> |
#include <print.h> |
#include <debug.h> |
#include <panic.h> |
110,10 → 111,14 |
} |
} |
void syscall(int n, void *stack) |
void syscall(int n, void *st) |
{ |
printf("cpu%d: syscall\n", CPU->id); |
thread_usleep(1000); |
__native *stack = (__native *) st; |
if (stack[-2] < SYSCALL_END) |
syscall_table[stack[-2]](stack[-5], stack[-3], stack[-4]); |
else |
panic("Undefined syscall %d", stack[-2]); |
} |
void tlb_shootdown_ipi(int n, void *stack) |