4df078 __syscall_alert(): initial implementation and integration.

Authored and Committed by midipix 8 years ago
    __syscall_alert(): initial implementation and integration.
    
        
file modified
+8 -7
arch/nt32/syscall_arch.h CHANGED
@@ -1,4 +1,5 @@
1
1
extern unsigned long ** __syscall_vtbl;
2
+ extern long __syscall_alert(long);
2
3
3
4
typedef long __syscall0_fn(void);
4
5
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)
14
15
static __inline long __syscall0(long n)
15
16
{
16
17
sysfn_from_fn(__syscall0_fn);
17
- return sysfn();
18
+ return sysfn ? sysfn() : __syscall_alert(n);
18
19
}
19
20
20
21
static __inline long __syscall1(long n, long a1)
21
22
{
22
23
sysfn_from_fn(__syscall1_fn);
23
- return sysfn(a1);
24
+ return sysfn ? sysfn(a1) : __syscall_alert(n);
24
25
}
25
26
26
27
static __inline long __syscall2(long n, long a1, long a2)
27
28
{
28
29
sysfn_from_fn(__syscall2_fn);
29
- return sysfn(a1, a2);
30
+ return sysfn ? sysfn(a1, a2) : __syscall_alert(n);
30
31
}
31
32
32
33
static __inline long __syscall3(long n, long a1, long a2, long a3)
33
34
{
34
35
sysfn_from_fn(__syscall3_fn);
35
- return sysfn(a1, a2, a3);
36
+ return sysfn ? sysfn(a1, a2, a3) : __syscall_alert(n);
36
37
}
37
38
38
39
static __inline long __syscall4(long n, long a1, long a2, long a3, long a4)
39
40
{
40
41
sysfn_from_fn(__syscall4_fn);
41
- return sysfn(a1, a2, a3, a4);
42
+ return sysfn ? sysfn(a1, a2, a3, a4) : __syscall_alert(n);
42
43
}
43
44
44
45
static __inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
45
46
{
46
47
sysfn_from_fn(__syscall5_fn);
47
- return sysfn(a1, a2, a3, a4, a5);
48
+ return sysfn ? sysfn(a1, a2, a3, a4, a5) : __syscall_alert(n);
48
49
}
49
50
50
51
static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
51
52
{
52
53
sysfn_from_fn(__syscall6_fn);
53
- return sysfn(a1, a2, a3, a4, a5, a6);
54
+ return sysfn ? sysfn(a1, a2, a3, a4, a5, a6) : __syscall_alert(n);
54
55
}
55
56
56
57
file modified
+15 -0
arch/nt64/src/vtbl.c CHANGED
@@ -1,4 +1,5 @@
1
1
#include "psxglue.h"
2
+ #include "errno.h"
2
3
3
4
unsigned long ** __syscall_vtbl = 0;
4
5
struct __ldso_vtbl * __ldso_vtbl = 0;
@@ -10,3 +11,17 @@ void ___chkstk_ms(void)
10
11
{
11
12
}
12
13
14
+ long __syscall_alert(long n)
15
+ {
16
+ char __lmsg[] = "DING ALARM! UNIMPLEMENTED SYSCALL 000\n";
17
+
18
+ __lmsg[36] = '0' + n % 10; n /= 10;
19
+ __lmsg[35] = '0' + n % 10; n /= 10;
20
+ __lmsg[34] = '0' + n % 10;
21
+
22
+ __psx_vtbl->log_output(
23
+ __lmsg,
24
+ sizeof(__lmsg));
25
+
26
+ return -ENOSYS;
27
+ }
file modified
+8 -7
arch/nt64/syscall_arch.h CHANGED
@@ -1,4 +1,5 @@
1
1
extern unsigned long ** __syscall_vtbl;
2
+ extern long __syscall_alert(long);
2
3
3
4
typedef long __syscall0_fn(void);
4
5
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)
14
15
static __inline long __syscall0(long n)
15
16
{
16
17
sysfn_from_fn(__syscall0_fn);
17
- return sysfn();
18
+ return sysfn ? sysfn() : __syscall_alert(n);
18
19
}
19
20
20
21
static __inline long __syscall1(long n, long a1)
21
22
{
22
23
sysfn_from_fn(__syscall1_fn);
23
- return sysfn(a1);
24
+ return sysfn ? sysfn(a1) : __syscall_alert(n);
24
25
}
25
26
26
27
static __inline long __syscall2(long n, long a1, long a2)
27
28
{
28
29
sysfn_from_fn(__syscall2_fn);
29
- return sysfn(a1, a2);
30
+ return sysfn ? sysfn(a1, a2) : __syscall_alert(n);
30
31
}
31
32
32
33
static __inline long __syscall3(long n, long a1, long a2, long a3)
33
34
{
34
35
sysfn_from_fn(__syscall3_fn);
35
- return sysfn(a1, a2, a3);
36
+ return sysfn ? sysfn(a1, a2, a3) : __syscall_alert(n);
36
37
}
37
38
38
39
static __inline long __syscall4(long n, long a1, long a2, long a3, long a4)
39
40
{
40
41
sysfn_from_fn(__syscall4_fn);
41
- return sysfn(a1, a2, a3, a4);
42
+ return sysfn ? sysfn(a1, a2, a3, a4) : __syscall_alert(n);
42
43
}
43
44
44
45
static __inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
45
46
{
46
47
sysfn_from_fn(__syscall5_fn);
47
- return sysfn(a1, a2, a3, a4, a5);
48
+ return sysfn ? sysfn(a1, a2, a3, a4, a5) : __syscall_alert(n);
48
49
}
49
50
50
51
static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
51
52
{
52
53
sysfn_from_fn(__syscall6_fn);
53
- return sysfn(a1, a2, a3, a4, a5, a6);
54
+ return sysfn ? sysfn(a1, a2, a3, a4, a5, a6) : __syscall_alert(n);
54
55
}
55
56
56
57