summaryrefslogtreecommitdiffhomepage
path: root/arch
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-06-21 15:55:17 -0400
committermidipix <writeonce@midipix.org>2016-06-21 15:55:17 -0400
commit4df0787e8987ab789e70a57ce7e480dffec14b80 (patch)
treeb664054495179b6eed5592dee922b00564436493 /arch
parent2d8d618a3998933912e5dba9a1f814fc646ca30c (diff)
downloadmmglue-4df0787e8987ab789e70a57ce7e480dffec14b80.tar.bz2
mmglue-4df0787e8987ab789e70a57ce7e480dffec14b80.tar.xz
__syscall_alert(): initial implementation and integration.
Diffstat (limited to 'arch')
-rw-r--r--arch/nt32/syscall_arch.h15
-rw-r--r--arch/nt64/src/vtbl.c15
-rw-r--r--arch/nt64/syscall_arch.h15
3 files changed, 31 insertions, 14 deletions
diff --git a/arch/nt32/syscall_arch.h b/arch/nt32/syscall_arch.h
index fb3cc46..9a5d4af 100644
--- a/arch/nt32/syscall_arch.h
+++ b/arch/nt32/syscall_arch.h
@@ -1,4 +1,5 @@
extern unsigned long ** __syscall_vtbl;
+extern long __syscall_alert(long);
typedef long __syscall0_fn(void);
typedef long __syscall1_fn(long a1);
@@ -14,43 +15,43 @@ typedef long __syscall6_fn(long a1, long a2, long a3, long a4, long a5, long a6)
static __inline long __syscall0(long n)
{
sysfn_from_fn(__syscall0_fn);
- return sysfn();
+ return sysfn ? sysfn() : __syscall_alert(n);
}
static __inline long __syscall1(long n, long a1)
{
sysfn_from_fn(__syscall1_fn);
- return sysfn(a1);
+ return sysfn ? sysfn(a1) : __syscall_alert(n);
}
static __inline long __syscall2(long n, long a1, long a2)
{
sysfn_from_fn(__syscall2_fn);
- return sysfn(a1, a2);
+ return sysfn ? sysfn(a1, a2) : __syscall_alert(n);
}
static __inline long __syscall3(long n, long a1, long a2, long a3)
{
sysfn_from_fn(__syscall3_fn);
- return sysfn(a1, a2, a3);
+ return sysfn ? sysfn(a1, a2, a3) : __syscall_alert(n);
}
static __inline long __syscall4(long n, long a1, long a2, long a3, long a4)
{
sysfn_from_fn(__syscall4_fn);
- return sysfn(a1, a2, a3, a4);
+ return sysfn ? sysfn(a1, a2, a3, a4) : __syscall_alert(n);
}
static __inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
{
sysfn_from_fn(__syscall5_fn);
- return sysfn(a1, a2, a3, a4, a5);
+ return sysfn ? sysfn(a1, a2, a3, a4, a5) : __syscall_alert(n);
}
static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
{
sysfn_from_fn(__syscall6_fn);
- return sysfn(a1, a2, a3, a4, a5, a6);
+ return sysfn ? sysfn(a1, a2, a3, a4, a5, a6) : __syscall_alert(n);
}
diff --git a/arch/nt64/src/vtbl.c b/arch/nt64/src/vtbl.c
index 028f153..c89cf07 100644
--- a/arch/nt64/src/vtbl.c
+++ b/arch/nt64/src/vtbl.c
@@ -1,4 +1,5 @@
#include "psxglue.h"
+#include "errno.h"
unsigned long ** __syscall_vtbl = 0;
struct __ldso_vtbl * __ldso_vtbl = 0;
@@ -10,3 +11,17 @@ void ___chkstk_ms(void)
{
}
+long __syscall_alert(long n)
+{
+ char __lmsg[] = "DING ALARM! UNIMPLEMENTED SYSCALL 000\n";
+
+ __lmsg[36] = '0' + n % 10; n /= 10;
+ __lmsg[35] = '0' + n % 10; n /= 10;
+ __lmsg[34] = '0' + n % 10;
+
+ __psx_vtbl->log_output(
+ __lmsg,
+ sizeof(__lmsg));
+
+ return -ENOSYS;
+}
diff --git a/arch/nt64/syscall_arch.h b/arch/nt64/syscall_arch.h
index fb3cc46..9a5d4af 100644
--- a/arch/nt64/syscall_arch.h
+++ b/arch/nt64/syscall_arch.h
@@ -1,4 +1,5 @@
extern unsigned long ** __syscall_vtbl;
+extern long __syscall_alert(long);
typedef long __syscall0_fn(void);
typedef long __syscall1_fn(long a1);
@@ -14,43 +15,43 @@ typedef long __syscall6_fn(long a1, long a2, long a3, long a4, long a5, long a6)
static __inline long __syscall0(long n)
{
sysfn_from_fn(__syscall0_fn);
- return sysfn();
+ return sysfn ? sysfn() : __syscall_alert(n);
}
static __inline long __syscall1(long n, long a1)
{
sysfn_from_fn(__syscall1_fn);
- return sysfn(a1);
+ return sysfn ? sysfn(a1) : __syscall_alert(n);
}
static __inline long __syscall2(long n, long a1, long a2)
{
sysfn_from_fn(__syscall2_fn);
- return sysfn(a1, a2);
+ return sysfn ? sysfn(a1, a2) : __syscall_alert(n);
}
static __inline long __syscall3(long n, long a1, long a2, long a3)
{
sysfn_from_fn(__syscall3_fn);
- return sysfn(a1, a2, a3);
+ return sysfn ? sysfn(a1, a2, a3) : __syscall_alert(n);
}
static __inline long __syscall4(long n, long a1, long a2, long a3, long a4)
{
sysfn_from_fn(__syscall4_fn);
- return sysfn(a1, a2, a3, a4);
+ return sysfn ? sysfn(a1, a2, a3, a4) : __syscall_alert(n);
}
static __inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
{
sysfn_from_fn(__syscall5_fn);
- return sysfn(a1, a2, a3, a4, a5);
+ return sysfn ? sysfn(a1, a2, a3, a4, a5) : __syscall_alert(n);
}
static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
{
sysfn_from_fn(__syscall6_fn);
- return sysfn(a1, a2, a3, a4, a5, a6);
+ return sysfn ? sysfn(a1, a2, a3, a4, a5, a6) : __syscall_alert(n);
}