2021-08-30 10:24:51 -04:00
|
|
|
/**
|
2021-09-13 13:07:00 -04:00
|
|
|
* Implementation of 68000 specific syscall routines.
|
2021-09-13 20:39:41 -04:00
|
|
|
*
|
2021-08-30 10:24:51 -04:00
|
|
|
* NOTE: these routines are not called directly but are instead called through TRAP#13
|
|
|
|
*/
|
|
|
|
|
2021-09-03 17:49:24 -04:00
|
|
|
#include "types.h"
|
2021-09-13 13:07:00 -04:00
|
|
|
#include "syscalls.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "dev/channel.h"
|
2021-08-30 22:01:09 -04:00
|
|
|
|
2021-08-30 10:24:51 -04:00
|
|
|
/*
|
2021-09-13 13:07:00 -04:00
|
|
|
* Determine the correct system function implementation and call it.
|
2021-08-30 10:24:51 -04:00
|
|
|
*/
|
2021-09-13 13:07:00 -04:00
|
|
|
int32_t syscall_dispatch(int32_t function, int32_t param0, int32_t param1, int32_t param2, int32_t param3, int32_t param4, int32_t param5) {
|
2021-08-30 22:01:09 -04:00
|
|
|
switch (function) {
|
2021-09-17 12:01:24 -04:00
|
|
|
case KFN_CHAN_WRITE_B:
|
2021-09-13 13:07:00 -04:00
|
|
|
return chan_write_b((short)param0, (uint8_t)param1);
|
|
|
|
|
2021-09-17 12:01:24 -04:00
|
|
|
case KFN_CHAN_WRITE:
|
2021-09-13 13:07:00 -04:00
|
|
|
return chan_write((short)param0, (const uint8_t *)param1, (short)param2);
|
2021-08-30 10:24:51 -04:00
|
|
|
|
2021-08-30 22:01:09 -04:00
|
|
|
default:
|
2021-09-13 13:07:00 -04:00
|
|
|
DEBUG("syscall unknown function\n");
|
2021-08-30 22:01:09 -04:00
|
|
|
return -1;
|
|
|
|
}
|
2021-09-13 20:39:41 -04:00
|
|
|
}
|