You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.2 KiB

#define stdin 0
#define stdout 1
#define stderr 2
U0 free() {
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: free(0x%08x)\n", p0);
Free(p0);
POP_SYSV_REGS
}
I64 @fwrite(U8 *ptr, I64 size, I64 nmemb, U64 stream) {
U8 *tmp;
switch (stream) {
case stdout:
case stderr:
tmp = CAlloc(size * nmemb);
MemCpy(tmp, ptr, nmemb - 1);
PutS(tmp);
Free(tmp);
"\n";
break;
default:
break;
}
return size * nmemb;
}
U0 fwrite() {
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: fwrite(0x%08x, %d, %d, 0x%08x)\n", p0, p1, p2, p3);
@fwrite(p0, p1, p2, p3);
POP_SYSV_REGS
}
U0 malloc() {
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: malloc(%d)\n", p0);
MAlloc(p0);
POP_SYSV_REGS
}
U0 memcpy() {
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: memcpy(0x%08x, 0x%08x, %d)\n", p0, p1, p2);
MemCpy(p0, p1, p2);
POP_SYSV_REGS
}
U0 memset() {
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: memset(0x%08x, %d, %d)\n", p0, p1, p2);
MemSet(p0, p1, p2);
POP_SYSV_REGS
}
U0 strlen() {
PUSH_SYSV_REGS
GET_SYSV_ARGS
debug_print("called: strlen(\"%s\")\n", p0);
StrLen(p0);
POP_SYSV_REGS
}