Moved shared crtdll/ntdll functions into ntdll.
[wine.git] / dlls / ntdll / misc.c
blob224b3961c3b99083905478abfc848e7c2971bb10
1 /*
2 * Helper functions for ntdll
3 */
4 #include <time.h>
6 #include "config.h"
8 #include "debugtools.h"
9 #include "ntdll_misc.h"
11 DEFAULT_DEBUG_CHANNEL(ntdll);
13 #if defined(__GNUC__) && defined(__i386__)
14 #define USING_REAL_FPU
15 #define DO_FPU(x,y) __asm__ __volatile__( x " %0;fwait" : "=m" (y) : )
16 #define POP_FPU(x) DO_FPU("fstpl",x)
17 #endif
19 void dump_ObjectAttributes (POBJECT_ATTRIBUTES oa)
21 if (oa)
22 TRACE("%p:(name=%s, attr=0x%08lx, hRoot=0x%08x, sd=%p) \n",
23 oa, debugstr_us(oa->ObjectName),
24 oa->Attributes, oa->RootDirectory, oa->SecurityDescriptor);
27 void dump_AnsiString(PANSI_STRING as, BOOLEAN showstring)
29 if (as)
31 if (showstring)
32 TRACE("%p %p(%s) (%u %u)\n", as, as->Buffer, debugstr_as(as), as->Length, as->MaximumLength);
33 else
34 TRACE("%p %p(<OUT>) (%u %u)\n", as, as->Buffer, as->Length, as->MaximumLength);
38 void dump_UnicodeString(PUNICODE_STRING us, BOOLEAN showstring)
40 if (us)
42 if (showstring)
43 TRACE("%p %p(%s) (%u %u)\n", us, us->Buffer, debugstr_us(us), us->Length, us->MaximumLength);
44 else
45 TRACE("%p %p(<OUT>) (%u %u)\n", us, us->Buffer, us->Length, us->MaximumLength);
49 LPCSTR debugstr_as (PANSI_STRING us)
51 if (!us) return NULL;
52 return debugstr_an(us->Buffer, us->Length);
55 LPCSTR debugstr_us (PUNICODE_STRING us)
57 if (!us) return NULL;
58 return debugstr_wn(us->Buffer, us->Length);
61 /*********************************************************************
62 * _ftol (NTDLL)
64 #ifdef USING_REAL_FPU
65 LONG __cdecl NTDLL__ftol(void)
67 /* don't just do DO_FPU("fistp",retval), because the rounding
68 * mode must also be set to "round towards zero"... */
69 double fl;
70 POP_FPU(fl);
71 return (LONG)fl;
73 #else
74 LONG __cdecl NTDLL__ftol(double fl)
76 FIXME("should be register function\n");
77 return (LONG)fl;
79 #endif
81 /*********************************************************************
82 * _CIpow (NTDLL)
84 #ifdef USING_REAL_FPU
85 LONG __cdecl NTDLL__CIpow(void)
87 double x,y;
88 POP_FPU(y);
89 POP_FPU(x);
90 return pow(x,y);
92 #else
93 LONG __cdecl NTDLL__CIpow(double x,double y)
95 FIXME("should be register function\n");
96 return pow(x,y);
98 #endif