mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-05 06:41:55 +03:00
caaa70b394
git-svn-id: svn://kolibrios.org@1789 a494cfbc-eb01-0410-851d-a64ba20cac60
189 lines
5.3 KiB
C
189 lines
5.3 KiB
C
#ifndef __cplusplus
|
|
|
|
//"inline" ôóíêöèè äëÿ âûçîâà ñèñòåìíûõ ôóíêöèé Kolibri â C - â èìåíè ôóíêöèè êîë-âî ïàðàìåòðîâ
|
|
//SysCall# (íîìåð_ñèñòåìíîé_ôóíêöèè, ïàðàìåòðû,...)
|
|
|
|
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" ôóíêöèè äëÿ âûçîâà ñèñòåìíûõ ôóíêöèé Kolibri â C++
|
|
//SysCall(íîìåð_ñèñòåìíîé_ôóíêöèè, ïàðàìåòðû,...)
|
|
|
|
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
|