kolibrios/programs/demos/cubeline/trunk/SysCall.h

189 lines
5.3 KiB
C
Raw Normal View History

#ifndef __cplusplus
//"inline" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Kolibri <20> C - <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//SysCall# (<28><><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,...)
static inline int SysCall1 (int EAX__) __attribute__((always_inline));
static inline int SysCall2 (int EAX__, int EBX__) __attribute__((always_inline));
static inline int SysCall3 (int EAX__, int EBX__, int ECX__) __attribute__((always_inline));
static inline int SysCall4 (int EAX__, int EBX__, int ECX__, int EDX__) __attribute__((always_inline));
static inline int SysCall5 (int EAX__, int EBX__, int ECX__, int EDX__, int ESI__) __attribute__((always_inline));
static inline int SysCall6 (int EAX__, int EBX__, int ECX__, int EDX__, int ESI__, int EDI__) __attribute__((always_inline));
static inline int SysCall1 (int EAX__)
{
asm volatile(""::"a"(EAX__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall2 (int EAX__, int EBX__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall3 (int EAX__, int EBX__, int ECX__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile(""::"c"(ECX__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall4 (int EAX__, int EBX__, int ECX__, int EDX__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile(""::"c"(ECX__));
asm volatile(""::"d"(EDX__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall5 (int EAX__, int EBX__, int ECX__, int EDX__, int ESI__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile(""::"c"(ECX__));
asm volatile(""::"d"(EDX__));
asm volatile(""::"S"(ESI__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall6 (int EAX__, int EBX__, int ECX__, int EDX__, int ESI__, int EDI__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile(""::"c"(ECX__));
asm volatile(""::"d"(EDX__));
asm volatile(""::"S"(ESI__));
asm volatile(""::"D"(EDI__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
#else
//"inline" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Kolibri <20> C++
//SysCall(<28><><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,...)
static inline int SysCall (int EAX__) __attribute__((always_inline));
static inline int SysCall (int EAX__, int EBX__) __attribute__((always_inline));
static inline int SysCall (int EAX__, int EBX__, int ECX__) __attribute__((always_inline));
static inline int SysCall (int EAX__, int EBX__, int ECX__, int EDX__) __attribute__((always_inline));
static inline int SysCall (int EAX__, int EBX__, int ECX__, int EDX__, int ESI__) __attribute__((always_inline));
static inline int SysCall (int EAX__, int EBX__, int ECX__, int EDX__, int ESI__, int EDI__) __attribute__((always_inline));
static inline int SysCall (int EAX__)
{
asm volatile(""::"a"(EAX__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall (int EAX__, int EBX__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall (int EAX__, int EBX__, int ECX__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile(""::"c"(ECX__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall (int EAX__, int EBX__, int ECX__, int EDX__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile(""::"c"(ECX__));
asm volatile(""::"d"(EDX__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall (int EAX__, int EBX__, int ECX__, int EDX__, int ESI__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile(""::"c"(ECX__));
asm volatile(""::"d"(EDX__));
asm volatile(""::"S"(ESI__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
static inline int SysCall (int EAX__, int EBX__, int ECX__, int EDX__, int ESI__, int EDI__)
{
asm volatile(""::"a"(EAX__));
asm volatile(""::"b"(EBX__));
asm volatile(""::"c"(ECX__));
asm volatile(""::"d"(EDX__));
asm volatile(""::"S"(ESI__));
asm volatile(""::"D"(EDI__));
asm volatile("int $0x40");
register int res;
asm volatile("":"=a"(res):);
return res;
}
#endif