8 typedef struct Linuxcall Linuxcall
;
14 int (*stub
)(Ureg
*, void *);
17 static int fcall0(Ureg
*, void *func
){return ((int (*)(void))func
)();}
18 static int fcall1(Ureg
*u
, void *func
){return ((int (*)(int))func
)(u
->bx
);}
19 static int fcall2(Ureg
*u
, void *func
){return ((int (*)(int, int))func
)(u
->bx
, u
->cx
);}
20 static int fcall3(Ureg
*u
, void *func
){return ((int (*)(int, int, int))func
)(u
->bx
, u
->cx
, u
->dx
);}
21 static int fcall4(Ureg
*u
, void *func
){return ((int (*)(int, int, int, int))func
)(u
->bx
, u
->cx
, u
->dx
, u
->si
);}
22 static int fcall5(Ureg
*u
, void *func
){return ((int (*)(int, int, int, int, int))func
)(u
->bx
, u
->cx
, u
->dx
, u
->si
, u
->di
);}
23 static int fcall6(Ureg
*u
, void *func
){return ((int (*)(int, int, int, int, int, int))func
)(u
->bx
, u
->cx
, u
->dx
, u
->si
, u
->di
, u
->bp
);}
25 #include "linuxcalltab.out"
27 static Linuxcall nocall
= {
41 trace("linuxret(%lux: %s, %lux: %E)", u
->pc
, p
->syscall
, (ulong
)errno
, errno
);
42 if(errno
== -ERESTART
){
43 p
->restart
->syscall
= p
->syscall
;
48 p
->restart
->syscall
= nil
;
64 /* CD 80 = INT 0x80 */
66 if(pc
[0] != 0xcd || pc
[1] != 0x80){
67 trace("linuxcall(): not a syscall pc=%lux sp=%lux", u
->pc
, u
->sp
);
70 c
= &linuxcalltab
[u
->ax
];
71 if(c
> &linuxcalltab
[nelem(linuxcalltab
)-1])
75 if(p
->restart
->syscall
)
76 trace("linuxcall(): restarting %s", p
->syscall
);
77 linuxret(c
->stub(u
, c
->func
));