Ignore:
Timestamp:
Apr 10, 2003, 12:28:07 PM (22 years ago)
Author:
sandervl
Message:

PF: MSVCRT update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/msvcrt/misc.c

    r9633 r10005  
    2121#include "msvcrt.h"
    2222#include <stdlib.h>
    23 
     23#include <string.h>
     24#include <math.h>
     25#include "emxheader.h"
    2426#include "msvcrt/stdlib.h"
    2527
     
    5052 *              _sleep (MSVCRT.@)
    5153 */
    52 void _sleep(unsigned long timeout)
     54void MSVCRT__sleep(unsigned long timeout)
    5355{
    5456  TRACE("_sleep for %ld milliseconds\n",timeout);
     
    5961 *              _lfind (MSVCRT.@)
    6062 */
    61 void* _lfind(const void* match, const void* start,
     63void* MSVCRT__lfind(const void* match, const void* start,
    6264             unsigned int* array_size, unsigned int elem_size,
    6365             MSVCRT_compar_fn_t cf)
    6466{
    6567  unsigned int size = *array_size;
     68  dprintf(("MSVCRT: _lfind"));
    6669  if (size)
    6770    do
     
    7780 *              _lsearch (MSVCRT.@)
    7881 */
    79 void* _lsearch(const void* match, void* start,
     82void* MSVCRT__lsearch(const void* match, void* start,
    8083               unsigned int* array_size, unsigned int elem_size,
    8184               MSVCRT_compar_fn_t cf)
    8285{
    8386  unsigned int size = *array_size;
     87  dprintf(("MSVCRT: _lsearch"));
    8488  if (size)
    8589    do
     
    96100}
    97101
     102
    98103/*********************************************************************
    99104 *              _chkesp (MSVCRT.@)
     105 *
     106 * Trap to a debugger if the value of the stack pointer has changed.
     107 *
     108 * PARAMS
     109 *  None.
     110 *
     111 * RETURNS
     112 *  Does not return.
     113 *
     114 * NOTES
     115 *  This function is available for iX86 only.
     116 *
     117 *  When VC++ generates debug code, it stores the value of the stack pointer
     118 *  before calling any external function, and checks the value following
     119 *  the call. It then calls this function, which will trap if the values are
     120 *  not the same. Usually this means that the prototype used to call
     121 *  the function is incorrect.  It can also mean that the .spec entry has
     122 *  the wrong calling convention or parameters.
    100123 */
    101 void _chkesp(void)
     124#ifdef __i386__
     125
     126# ifdef __GNUC__
     127__ASM_GLOBAL_FUNC(_chkesp,
     128                  "jnz 1f\n\t"
     129                  "ret\n"
     130                  "1:\tpushl %ebp\n\t"
     131                  "movl %esp,%ebp\n\t"
     132                  "pushl %eax\n\t"
     133                  "pushl %ecx\n\t"
     134                  "pushl %edx\n\t"
     135                  "call " __ASM_NAME("MSVCRT_chkesp_fail") "\n\t"
     136                  "popl %edx\n\t"
     137                  "popl %ecx\n\t"
     138                  "popl %eax\n\t"
     139                  "popl %ebp\n\t"
     140                  "ret");
     141
     142void MSVCRT_chkesp_fail(void)
    102143{
     144  ERR("Stack pointer incorrect after last function call - Bad prototype/spec entry?\n");
     145  DebugBreak();
     146}
    103147
    104 }
     148# else  /* __GNUC__ */
     149void _chkesp(void) { }
     150# endif  /* __GNUC__ */
     151
     152#endif  /* __i386__ */
     153
     154
    105155
    106156#ifdef __WIN32OS2__
     
    116166 *      [GNUC && i386]
    117167 */
     168double _emx_rint (double);
     169
    118170#if defined(__GNUC__) && defined(__i386__)
    119 LONG __cdecl _ftol(void)
     171LONGLONG __cdecl _ftol(double fl)
    120172{
    121173        /* don't just do DO_FPU("fistp",retval), because the rounding
    122174         * mode must also be set to "round towards zero"... */
    123         double fl;
    124175        POP_FPU(fl);
    125         return (LONG)fl;
     176        return (LONGLONG)(fl);
     177
    126178}
    127179#endif /* defined(__GNUC__) && defined(__i386__) */
Note: See TracChangeset for help on using the changeset viewer.