3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: SkyOS library
5 * FILE: lib/libsky/stubs.c
6 * PURPOSE: libsky.dll stubs
7 * NOTES: If you implement a function, remove it from this file
18 typedef void (__cdecl
*func_ptr
) (void);
24 ctor_dtor_initialize(func_ptr
*__CTOR_LIST__
,
25 func_ptr
*__DTOR_LIST__
,
28 STUB("ctor_dtor_initialize: __CTOR_LIST__=0x%x __DTOR_LIST__=0x%x unknown=0x%x\n", __CTOR_LIST__
, __DTOR_LIST__
, unknown
);
30 /* unknown apparently is the virtual address of the .bss section, but what should
31 * we do with it?! Perhaps load a list of constructor/destructor addresses to this
32 * address before we call them?
38 if(__CTOR_LIST__
!= NULL
)
42 * If the first entry in the constructor list is -1 then the list
43 * is terminated with a null entry. Otherwise the first entry was
44 * the number of pointers in the list.
46 DBG("Calling constructors...\n");
47 nptrs
= (unsigned long)__CTOR_LIST__
[0];
50 for(nptrs
= 0; __CTOR_LIST__
[nptrs
+ 1] != NULL
; nptrs
++);
52 DBG("There are %d constructors to call...\n", nptrs
);
55 * Go through the list backwards calling constructors.
56 * FIXME - backwards?! This is ripped off crtdll\misc\gccmain.c
58 for(; nptrs
> 0; nptrs
--)
60 DBG("call constructor 0x%x\n", __CTOR_LIST__
[nptrs
]);
61 __CTOR_LIST__
[nptrs
]();
63 DBG("Called all constructors\n");
69 if(__DTOR_LIST__
!= NULL
)
73 * If the first entry in the destructor list is -1 then the list
74 * is terminated with a null entry. Otherwise the first entry was
75 * the number of pointers in the list.
77 DBG("Calling destructors...\n");
78 nptrs
= (unsigned long)__DTOR_LIST__
[0];
81 for(nptrs
= 0; __DTOR_LIST__
[nptrs
+ 1] != NULL
; nptrs
++);
83 DBG("There are %d destructors to call...\n", nptrs
);
86 * Go through the list backwards calling constructors.
87 * FIXME - backwards?! This is ripped off crtdll\misc\gccmain.c
89 for(; nptrs
> 0; nptrs
--)
91 DBG("call destructor 0x%x\n", __DTOR_LIST__
[nptrs
]);
92 __DTOR_LIST__
[nptrs
]();
94 DBG("Called all destructors\n");
101 unsigned long long __cdecl
102 get_usec_counter(void)
104 /* FIXME - better implementation */
105 return (unsigned long long)GetTickCount() * 1000LL;