}
// The wctype table is 144 KB, too much for poor freeldr
-int iswctype(wint_t wc, wctype_t wctypeFlags)
+int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
{
return _isctype((char)wc, wctypeFlags);
}
#include <debug.h>
#include "apic.h"
-void HackEoi(void);
+void __cdecl HackEoi(void);
#ifndef _M_AMD64
#define APIC_LAZY_IRQL
NTAPI
ApicInitializeTimer(ULONG Cpu);
-VOID ApicSpuriousService(VOID);
+VOID __cdecl ApicSpuriousService(VOID);
#ifndef __ASM__
-void TscCalibrationISR(void);
+void __cdecl TscCalibrationISR(void);
extern LARGE_INTEGER HalpCpuClockFrequency;
VOID NTAPI HalpInitializeTsc();
#include <debug.h>
#include <setjmp.h>
-void HalpTrap0D();
+void __cdecl HalpTrap0D();
/* GLOBALS ********************************************************************/
typedef
VOID
-(*PHAL_SW_INTERRUPT_HANDLER)(
+(__cdecl *PHAL_SW_INTERRUPT_HANDLER)(
VOID
);
);
VOID
+__cdecl
HalpHardwareInterruptLevel(
VOID
);
/* pic.c */
VOID NTAPI HalpInitializePICs(IN BOOLEAN EnableInterrupts);
-VOID HalpApcInterrupt(VOID);
-VOID HalpDispatchInterrupt(VOID);
-VOID HalpDispatchInterrupt2(VOID);
+VOID __cdecl HalpApcInterrupt(VOID);
+VOID __cdecl HalpDispatchInterrupt(VOID);
+VOID __cdecl HalpDispatchInterrupt2(VOID);
DECLSPEC_NORETURN VOID FASTCALL HalpApcInterrupt2ndEntry(IN PKTRAP_FRAME TrapFrame);
DECLSPEC_NORETURN VOID FASTCALL HalpDispatchInterrupt2ndEntry(IN PKTRAP_FRAME TrapFrame);
/* timer.c */
VOID NTAPI HalpInitializeClock(VOID);
-VOID HalpClockInterrupt(VOID);
-VOID HalpProfileInterrupt(VOID);
+VOID __cdecl HalpClockInterrupt(VOID);
+VOID __cdecl HalpProfileInterrupt(VOID);
VOID
NTAPI
);
VOID
-DECLSPEC_NORETURN
+__cdecl
HalpRealModeStart(
VOID
);
#if defined(__GNUC__)
#define HalpDelayedHardwareInterrupt(x) \
- VOID HalpHardwareInterrupt##x(VOID); \
+ VOID __cdecl HalpHardwareInterrupt##x(VOID); \
VOID \
+ __cdecl \
HalpHardwareInterrupt##x(VOID) \
{ \
asm volatile ("int $%c0\n"::"i"(PRIMARY_VECTOR_BASE + x)); \
#elif defined(_MSC_VER)
#define HalpDelayedHardwareInterrupt(x) \
- VOID HalpHardwareInterrupt##x(VOID); \
+ VOID __cdecl HalpHardwareInterrupt##x(VOID); \
VOID \
+ __cdecl \
HalpHardwareInterrupt##x(VOID) \
{ \
__asm \
/* Handlers for pending interrupts */
PHAL_SW_INTERRUPT_HANDLER SWInterruptHandlerTable[20] =
{
- KiUnexpectedInterrupt,
+ (PHAL_SW_INTERRUPT_HANDLER)KiUnexpectedInterrupt,
HalpApcInterrupt,
HalpDispatchInterrupt2,
- KiUnexpectedInterrupt,
+ (PHAL_SW_INTERRUPT_HANDLER)KiUnexpectedInterrupt,
HalpHardwareInterrupt0,
HalpHardwareInterrupt1,
HalpHardwareInterrupt2,
}
VOID
+__cdecl
HalpHardwareInterruptLevel(VOID)
{
PKPCR Pcr = KeGetPcr();
}
VOID
+__cdecl
HalpDispatchInterrupt2(VOID)
{
ULONG PendingIrqlMask, PendingIrql;
#pragma intrinsic(__readcr3)
//#pragma intrinsic(__readcr4)
// HACK: MSVC is broken
-unsigned long ___readcr4(void);
+unsigned long __cdecl ___readcr4(void);
#define __readcr4 ___readcr4
#pragma intrinsic(__readcr8)
#pragma intrinsic(__readdr)
_In_ size_t _N);
int
+ __cdecl
wmemcmp(
_In_reads_(_N) const wchar_t *_S1,
_In_reads_(_N) const wchar_t *_S2,
VOID
);
+DECLSPEC_NORETURN
VOID
+__cdecl
KiUnexpectedInterrupt(
VOID
);
#include "debug.c"
__MINGW_ATTRIB_MALLOC
-void *malloc(size_t size)
+void * __cdecl malloc(size_t size)
{
return LocalAlloc(0, size);
}
-void free(void *ptr)
+void __cdecl free(void *ptr)
{
LocalFree(ptr);
}
-void *realloc(void *ptr, size_t size)
+void * __cdecl realloc(void *ptr, size_t size)
{
if (ptr == NULL) return malloc(size);
return LocalReAlloc(ptr, size, LMEM_MOVEABLE);
}
__MINGW_ATTRIB_MALLOC
-char *_strdup(const char *str)
+char * __cdecl _strdup(const char *str)
{
char *newstr = malloc(strlen(str) + 1);
if (newstr) strcpy(newstr, str);
/*
* @implemented
*/
-int _isnan(double __x)
+int CDECL _isnan(double __x)
{
union
{
/*
* @implemented
*/
-int _finite(double __x)
+int CDECL _finite(double __x)
{
union
{
* @implemented
*/
int
+__cdecl
abs(int j)
{
return j<0 ? -j : j;
* @implemented
*/
div_t
+CDECL
div(int num, int denom)
{
div_t r;
/*
* @implemented
*/
-int rand(void)
+int __cdecl rand(void)
{
#if defined(__GNUC__)
next = next * 0x5deece66dLL + 11;
/*
* @implemented
*/
-void srand(unsigned seed)
+void __cdecl srand(unsigned seed)
{
next = seed;
}
/*
* @implemented
*/
-size_t _mbstrlen( const char *str )
+size_t __cdecl _mbstrlen( const char *str )
{
size_t len = 0;
while(*str)
void *
+__cdecl
_memccpy (void *to, const void *from,int c,size_t count)
{
char t;
#pragma function(memchr)
#endif /* _MSC_VER */
-void* memchr(const void *s, int c, size_t n)
+void* __cdecl memchr(const void *s, int c, size_t n)
{
if (n)
{
#pragma function(memcmp)
#endif
-int memcmp(const void *s1, const void *s2, size_t n)
+int __cdecl memcmp(const void *s1, const void *s2, size_t n)
{
if (n != 0) {
const unsigned char *p1 = s1, *p2 = s2;
#endif /* _MSC_VER */
/* NOTE: This code is a duplicate of memmove implementation! */
-void* memcpy(void* dest, const void* src, size_t count)
+void* __cdecl memcpy(void* dest, const void* src, size_t count)
{
char *char_dest = (char *)dest;
char *char_src = (char *)src;
* @implemented
*/
int
+CDECL
_memicmp(const void *s1, const void *s2, size_t n)
{
if (n != 0)
#include <string.h>
/* NOTE: This code is duplicated in memcpy function */
-void * memmove(void *dest,const void *src,size_t count)
+void * __cdecl memmove(void *dest,const void *src,size_t count)
{
char *char_dest = (char *)dest;
char *char_src = (char *)src;
#pragma function(memset)
#endif /* _MSC_VER */
-void* memset(void* src, int val, size_t count)
+void* __cdecl memset(void* src, int val, size_t count)
{
char *char_src = (char *)src;
#include <winuser.h>
#include <ndk/rtlfuncs.h>
+// Our headers are pretty messed up
+#undef CDECL
+#if defined(_M_IX86)
+#define CDECL __cdecl
+#else
+#define CDECL
+#endif
+
#if !defined(_MSC_VER)
#include <stdint.h>
#endif
int __cdecl wstreamout(FILE *stream, const wchar_t *format, va_list argptr);
int
+__cdecl
_vscwprintf(
const wchar_t *format,
va_list argptr)
* @implemented
*/
void *
+__cdecl
bsearch(const void *key, const void *base0, size_t nelem,
size_t size, int (__cdecl *cmp)(const void *ck, const void *ce))
{
/*
* @implemented
*/
-void *_lfind(const void *key, const void *base, unsigned int *nelp,
+void * __cdecl _lfind(const void *key, const void *base, unsigned int *nelp,
unsigned int width, int (__cdecl *compar)(const void *, const void *))
{
char* char_base = (char*)base;
/*
* @implemented
*/
-void *_lsearch(const void *key, void *base, unsigned int *nelp, unsigned int width,
+void * __cdecl _lsearch(const void *key, void *base, unsigned int *nelp, unsigned int width,
int (__cdecl *compar)(const void *, const void *))
{
void *ret_find = _lfind(key,base,nelp,width,compar);
* (And there are only three places where this is done).
*/
-static void
+static void __cdecl
qst(size_t size, int (__cdecl *compar)(const void*, const void*), char *base, char *max)
{
char c, *i, *j, *jj;
* @implemented
*/
void
+__cdecl
qsort(void *base0, size_t n, size_t size, int (__cdecl *compar)(const void*, const void*))
{
char *base = (char *)base0;
* @implemented
*/
int
+CDECL
_ttoi(const _TCHAR *str)
{
return (int)_ttoi64(str);
* @implemented
*/
__int64
+CDECL
_atoi64(const char *nptr)
{
char *s = (char *)nptr;
/*
* @implemented
*/
-long atol(const char *str)
+long CDECL atol(const char *str)
{
return (long)_atoi64(str);
}
/*
* @unimplemented
*/
-int _atoldbl(_LDOUBLE *value, char *str)
+int CDECL _atoldbl(_LDOUBLE *value, char *str)
{
/* FIXME needs error checking for huge/small values */
#if 0
/*
* @implemented
*/
-int isalpha(int c)
+int __cdecl isalpha(int c)
{
return(_isctype(c, _ALPHA));
}
/*
* @implemented
*/
-int isalnum(int c)
+int __cdecl isalnum(int c)
{
return(_isctype(c, _ALPHA | _DIGIT));
}
/*
* @implemented
*/
-int iswalnum(wint_t c)
+int __cdecl iswalnum(wint_t c)
{
return iswctype(c, _ALPHA | _DIGIT);
}
/*
* @implemented
*/
-int __isascii(int c)
+int __cdecl __isascii(int c)
{
return ((unsigned char)c <= 0x7f);
}
/*
* @implemented
*/
-int iswascii(wint_t c)
+int __cdecl iswascii(wint_t c)
{
return __isascii(c);
}
/*
* @implemented
*/
-int iscntrl(int c)
+int __cdecl iscntrl(int c)
{
return(_isctype(c, _CONTROL));
}
/*
* @implemented
*/
-int __iscsym(int c)
+int __cdecl __iscsym(int c)
{
return (c < 127 && (isalnum(c) || (c == '_')));
}
/*
* @implemented
*/
-int __iscsymf(int c)
+int __cdecl __iscsymf(int c)
{
return (c < 127 && (isalpha(c) || (c == '_')));
}
/*
* @implemented
*/
-int isdigit(int c)
+int __cdecl isdigit(int c)
{
return(_isctype(c, _DIGIT));
}
/*
* @implemented
*/
-int isgraph(int c)
+int __cdecl isgraph(int c)
{
return (_isctype (c, _PUNCT | _ALPHA | _DIGIT));
}
/*
* @implemented
*/
-int islower(int c)
+int __cdecl islower(int c)
{
return (_isctype (c, _LOWER));
}
/*
* @implemented
*/
-int isprint(int c)
+int __cdecl isprint(int c)
{
return (_isctype (c, _BLANK | _PUNCT | _ALPHA | _DIGIT));
}
/*
* @implemented
*/
-int ispunct(int c)
+int __cdecl ispunct(int c)
{
return (_isctype (c, _PUNCT));
}
/*
* @implemented
*/
-int isspace(int c)
+int __cdecl isspace(int c)
{
return (_isctype (c, _SPACE));
}
/*
* @implemented
*/
-int isupper(int c)
+int __cdecl isupper(int c)
{
return (_isctype (c, _UPPER));
}
/*
* @implemented
*/
-int isxdigit(int c)
+int __cdecl isxdigit(int c)
{
return (_isctype (c, _HEX));
}
/*
* @implemented
*/
-int iswalpha(wint_t c)
+int __cdecl iswalpha(wint_t c)
{
return (iswctype (c, _ALPHA));
}
/*
* @implemented
*/
-int iswcntrl(wint_t c)
+int __cdecl iswcntrl(wint_t c)
{
return iswctype(c, _CONTROL);
}
/*
* @implemented
*/
-int iswdigit(wint_t c)
+int __cdecl iswdigit(wint_t c)
{
return (iswctype (c, _DIGIT));
}
/*
* @implemented
*/
-int iswgraph(wint_t c)
+int __cdecl iswgraph(wint_t c)
{
return iswctype(c,_PUNCT | _ALPHA | _DIGIT);
}
/*
* @implemented
*/
-int iswprint(wint_t c)
+int __cdecl iswprint(wint_t c)
{
return iswctype((unsigned short)c,_BLANK | _PUNCT | _ALPHA | _DIGIT);
}
/*
* @implemented
*/
-int iswpunct(wint_t c)
+int __cdecl iswpunct(wint_t c)
{
return iswctype(c, _PUNCT);
}
/*
* @implemented
*/
-int iswlower(wint_t c)
+int __cdecl iswlower(wint_t c)
{
return (iswctype (c, _LOWER));
}
/*
* @implemented
*/
-int iswupper(wint_t c)
+int __cdecl iswupper(wint_t c)
{
return iswctype(c, _UPPER);
}
/*
* @implemented
*/
-int iswspace(wint_t c)
+int __cdecl iswspace(wint_t c)
{
return (iswctype (c, _SPACE));
}
/*
* @implemented
*/
-int iswxdigit(wint_t c)
+int __cdecl iswxdigit(wint_t c)
{
return (iswctype (c, _HEX));
}
/*
* @implemented
*/
-int __toascii(int c)
+int __cdecl __toascii(int c)
{
return((unsigned int)(c) & 0x7f);
}
/*
* @implemented
*/
-int _tolower(int c)
+int __cdecl _tolower(int c)
{
if (_isctype (c, _UPPER))
return (c - upalpha);
/*
* @implemented
*/
-int _toupper(int c)
+int __cdecl _toupper(int c)
{
if (_isctype (c, _LOWER))
return (c + upalpha);
/*
* @implemented
*/
-int tolower(int c)
+int __cdecl tolower(int c)
{
if (_isctype (c, _UPPER))
return (c - upalpha);
/*
* @implemented
*/
-int toupper(int c)
+int __cdecl toupper(int c)
{
if (_isctype (c, _LOWER))
return (c + upalpha);
/*
* @implemented
*/
-wint_t towlower(wint_t c)
+wint_t __cdecl towlower(wint_t c)
{
if (iswctype (c, _UPPER))
return (c - upalpha);
/*
* @implemented
*/
-wint_t towupper(wint_t c)
+wint_t __cdecl towupper(wint_t c)
{
if (iswctype (c, _LOWER))
return (c + upalpha);
/*
* @implemented
*/
-int iswctype(wint_t wc, wctype_t wctypeFlags)
+int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
{
return (wine_wctype_table[wine_wctype_table[wc >> 8] + (wc & 0xff)] & wctypeFlags);
}
* @implemented
*/
char *
+CDECL
_i64toa(__int64 value, char *string, int radix)
{
ULONGLONG val;
* @implemented
*/
char *
+CDECL
_ui64toa(unsigned __int64 value, char *string, int radix)
{
char buffer[65];
* @implemented
*/
char *
+CDECL
_itoa(int value, char *string, int radix)
{
return _ltoa(value, string, radix);
* @implemented
*/
char *
+CDECL
_ltoa(long value, char *string, int radix)
{
unsigned long val;
* @implemented
*/
char *
+CDECL
_ultoa(unsigned long value, char *string, int radix)
{
char buffer[33];
* @implemented
*/
wchar_t *
+CDECL
_i64tow(__int64 value, wchar_t *string, int radix)
{
ULONGLONG val;
* @implemented
*/
int
+CDECL
_i64tow_s(__int64 value, wchar_t *str, size_t size, int radix)
{
unsigned __int64 val;
* @implemented
*/
wchar_t *
+CDECL
_ui64tow(unsigned __int64 value, wchar_t *string, int radix)
{
WCHAR buffer[65];
* @implemented
*/
int
+CDECL
_ui64tow_s( unsigned __int64 value, wchar_t *str,
size_t size, int radix )
{
* @implemented
*/
wchar_t *
+CDECL
_itow(int value, wchar_t *string, int radix)
{
return _ltow(value, string, radix);
* @implemented
*/
int
+CDECL
_itow_s(int value, wchar_t *str, size_t size, int radix)
{
return _ltow_s(value, str, size, radix);
* @implemented
*/
wchar_t *
+CDECL
_ltow(long value, wchar_t *string, int radix)
{
unsigned long val;
* @implemented
*/
int
+CDECL
_ltow_s(long value, wchar_t *str, size_t size, int radix)
{
unsigned long val;
* @implemented
*/
wchar_t *
+CDECL
_ultow(unsigned long value, wchar_t *string, int radix)
{
WCHAR buffer[33];
* @implemented
*/
int
+CDECL
_stricmp(const char *s1, const char *s2)
{
while (toupper(*s1) == toupper(*s2))
* @implemented
*/
int
+CDECL
_strcmpi(const char *s1, const char *s2)
{
return _stricmp(s1,s2);
/*
* @implemented
*/
-char * _strlwr(char *x)
+char * CDECL _strlwr(char *x)
{
char *y=x;
/*
* @implemented
*/
-int _strnicmp(const char *s1, const char *s2, size_t n)
+int CDECL _strnicmp(const char *s1, const char *s2, size_t n)
{
if (n == 0)
#define BIT_SIZE (CHAR_BIT * sizeof(unsigned long) / sizeof(char))
-char* strpbrk(const char *s1, const char *s2)
+char* __cdecl strpbrk(const char *s1, const char *s2)
{
if (*s2 == 0)
{
/*
* @implemented
*/
-char * _strrev(char *s)
+char * CDECL _strrev(char *s)
{
char a, *b, *e;
b=e=s;
* @implemented
*/
char *
+CDECL
strstr(const char *s, const char *find)
{
char c, sc;
* @implemented
*/
long
+CDECL
strtol(const char *nptr, char **endptr, int base)
{
const char *s = nptr;
#include <precomp.h>
unsigned long long
+CDECL
strtoull(const char *nptr, char **endptr, int base)
{
const char *s = nptr;
/*
* @implemented
*/
-char *_strupr(char *x)
+char * CDECL _strupr(char *x)
{
char *y=x;
#include <limits.h>
#include <string.h>
-size_t _strxspn(const char *s1, const char *s2)
+size_t __cdecl _strxspn(const char *s1, const char *s2)
{
unsigned char char_map[1 << CHAR_BIT * sizeof(char)];
const unsigned char * us2 = (const unsigned char *)s2;
* @implemented
*/
long
+CDECL
wcstol(const wchar_t *nptr, wchar_t **endptr, int base)
{
const wchar_t *s = nptr;
* @implemented
*/
unsigned long
+CDECL
wcstoul(const wchar_t *nptr, wchar_t **endptr, int base)
{
const wchar_t *s = nptr;
* @implemented
*/
__int64
+CDECL
_wtoi64 (const wchar_t *nptr)
{
int c;
* @unimplemented
*/
__int64
+CDECL
_wcstoi64 (const wchar_t *nptr, wchar_t **endptr, int base)
{
TRACE("_wcstoi64 is UNIMPLEMENTED\n");
* @unimplemented
*/
unsigned __int64
+CDECL
_wcstoui64 (const wchar_t *nptr, wchar_t **endptr, int base)
{
TRACE("_wcstoui64 is UNIMPLEMENTED\n");
/*
* @unimplemented
*/
-int _wcsncoll (const wchar_t *s1, const wchar_t *s2, size_t c)
+int CDECL _wcsncoll (const wchar_t *s1, const wchar_t *s2, size_t c)
{
/* FIXME: handle collates */
return wcsncmp(s1,s2,c);
/*
* @unimplemented
*/
-int _wcsnicoll (const wchar_t *s1, const wchar_t *s2, size_t c)
+int CDECL _wcsnicoll (const wchar_t *s1, const wchar_t *s2, size_t c)
{
/* FIXME: handle collates */
return _wcsnicmp(s1,s2,c);
/*
* @implemented
*/
-size_t wcscspn(const wchar_t *str,const wchar_t *reject)
+size_t CDECL wcscspn(const wchar_t *str,const wchar_t *reject)
{
wchar_t *s;
wchar_t *t;
/*
* @implemented
*/
-int _wcsicmp(const wchar_t* cs,const wchar_t * ct)
+int CDECL _wcsicmp(const wchar_t* cs,const wchar_t * ct)
{
while (towlower(*cs) == towlower(*ct))
{
/*
* @implemented
*/
-wchar_t * _wcslwr(wchar_t *x)
+wchar_t * CDECL _wcslwr(wchar_t *x)
{
wchar_t *y=x;
/*
* @implemented
*/
-int _wcsnicmp (const wchar_t *cs, const wchar_t *ct, size_t count)
+int CDECL _wcsnicmp (const wchar_t *cs, const wchar_t *ct, size_t count)
{
if (count == 0)
return 0;
/*
* @implemented
*/
-size_t wcsspn(const wchar_t *str,const wchar_t *accept)
+size_t CDECL wcsspn(const wchar_t *str,const wchar_t *accept)
{
wchar_t *s;
wchar_t *t;
/*
* @implemented
*/
-wchar_t *wcsstr(const wchar_t *s,const wchar_t *b)
+wchar_t * CDECL wcsstr(const wchar_t *s,const wchar_t *b)
{
wchar_t *x;
wchar_t *y;
/*
* @implemented
*/
-wchar_t *_wcsupr(wchar_t *x)
+wchar_t * CDECL _wcsupr(wchar_t *x)
{
wchar_t *y = x;
/*
* @implemented
*/
-size_t wcsxfrm(wchar_t *dst,const wchar_t *src, size_t n)
+size_t CDECL wcsxfrm(wchar_t *dst,const wchar_t *src, size_t n)
{
size_t r = 0;
int c;
KiEoiHelper(TrapFrame);
}
+DECLSPEC_NORETURN
VOID
+__cdecl
KiUnexpectedInterrupt(VOID)
{
/* Crash the machine */
#define NDEBUG
#include <debug.h>
-VOID KiFastCallEntry(VOID);
-VOID KiFastCallEntryWithSingleStep(VOID);
+VOID __cdecl KiFastCallEntry(VOID);
+VOID __cdecl KiFastCallEntryWithSingleStep(VOID);
extern PVOID FrRestore;
VOID FASTCALL Ke386LoadFpuState(IN PFX_SAVE_AREA SaveArea);