win32.c
changeset 3341 b20541ef8945
parent 3340 8e89a10f9e4c
child 3394 f8a308a11171
equal deleted inserted replaced
3340:8e89a10f9e4c 3341:b20541ef8945
    60 	}
    60 	}
    61 	return true;
    61 	return true;
    62 }
    62 }
    63 
    63 
    64 #ifdef _MSC_VER
    64 #ifdef _MSC_VER
    65 #	ifdef _M_AMD64
       
    66 void* _get_save_esp(void);
       
    67 uint64 _rdtsc(void);
       
    68 #	endif
       
    69 
       
    70 static const char *_exception_string;
    65 static const char *_exception_string;
    71 #endif
    66 #endif
    72 
    67 
    73 void ShowOSErrorBox(const char *buf)
    68 void ShowOSErrorBox(const char *buf)
    74 {
    69 {
   592 }
   587 }
   593 
   588 
   594 static void Win32InitializeExceptions(void)
   589 static void Win32InitializeExceptions(void)
   595 {
   590 {
   596 #ifdef _M_AMD64
   591 #ifdef _M_AMD64
       
   592 	extern void *_get_save_esp(void);
   597 	_safe_esp = _get_save_esp();
   593 	_safe_esp = _get_save_esp();
   598 #else
   594 #else
   599 	_asm {
   595 	_asm {
   600 		mov _safe_esp, esp
   596 		mov _safe_esp, esp
   601 	}
   597 	}
   602 #endif
   598 #endif
   603 
   599 
   604 	SetUnhandledExceptionFilter(ExceptionHandler);
   600 	SetUnhandledExceptionFilter(ExceptionHandler);
   605 }
   601 }
   606 #endif
   602 #endif /* _MSC_VER */
   607 
   603 
   608 static char *_fios_path;
   604 static char *_fios_path;
   609 static char *_fios_save_path;
   605 static char *_fios_save_path;
   610 static char *_fios_scn_path;
   606 static char *_fios_scn_path;
   611 static FiosItem *_fios_items;
   607 static FiosItem *_fios_items;
  1055 	} while (n != max_argc);
  1051 	} while (n != max_argc);
  1056 
  1052 
  1057 	return n;
  1053 	return n;
  1058 }
  1054 }
  1059 
  1055 
  1060 
       
  1061 #if defined(_MSC_VER) && !defined(_M_AMD64)
       
  1062 uint64 _declspec(naked) _rdtsc(void)
       
  1063 {
       
  1064 	_asm {
       
  1065 		rdtsc
       
  1066 		ret
       
  1067 	}
       
  1068 }
       
  1069 #endif
       
  1070 
       
  1071 void CreateConsole(void)
  1056 void CreateConsole(void)
  1072 {
  1057 {
  1073 	HANDLE hand;
  1058 	HANDLE hand;
  1074 	CONSOLE_SCREEN_BUFFER_INFO coninfo;
  1059 	CONSOLE_SCREEN_BUFFER_INFO coninfo;
  1075 
  1060