First steps

This commit is contained in:
JusicP
2020-11-19 22:37:27 +02:00
parent 6920a3bd08
commit 3434111923
1341 changed files with 883624 additions and 46746 deletions

View File

@@ -66,7 +66,12 @@
static bool s_bShowDiag;
#define DEBUG_MSG( ... ) if ( s_bShowDiag ) fprintf( stderr, ##__VA_ARGS__ )
#define DEBUG_BREAK() __asm__ __volatile__ ( "int $3" )
#ifndef __arm__
#define DEBUG_BREAK() __asm__ __volatile__ ( "int $3" )
#else
#define DEBUG_BREAK()
#endif
#define _COMPILE_TIME_ASSERT(pred) switch(0){case 0:case pred:;}
#define WRAP( fn, ret, ... ) \
@@ -750,7 +755,7 @@ extern "C" {
return CALL(fopen)( mpath, mode );
}
#ifndef ANDROID
WRAP(fopen64, FILE *, const char *path, const char *mode)
{
// if mode does not have w, a, or +, it's open for read.
@@ -759,6 +764,7 @@ extern "C" {
return CALL(fopen64)( mpath, mode );
}
#endif
WRAP(open, int, const char *pathname, int flags, mode_t mode)
{
@@ -805,7 +811,8 @@ extern "C" {
{
return CALL(opendir)( CWrap( name, false ) );
}
#ifndef ANDROID
WRAP(__xstat, int, int __ver, __const char *__filename, struct stat *__stat_buf)
{
return CALL(__xstat)( __ver, CWrap( __filename, false), __stat_buf );
@@ -825,6 +832,7 @@ extern "C" {
{
return CALL(__lxstat64)( __ver, CWrap( __filename, false), __stat_buf );
}
#endif
WRAP(chmod, int, const char *path, mode_t mode)
{

View File

@@ -6,6 +6,9 @@
// $NoKeywords: $
//=============================================================================//
// cpu.cpp from tier0 already has the same code, so should it be removed?
#ifndef __arm__
#define cpuid(in,a,b,c,d) \
asm("pushl %%ebx\n\t" "cpuid\n\t" "movl %%ebx,%%esi\n\t" "pop %%ebx": "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (in));
@@ -45,3 +48,13 @@ bool Check3DNowTechnology(void)
}
return false;
}
#else
// these guys don't exist in any ARM processor
bool Check3DNowTechnology( void ) { return false; }
bool CheckMMXTechnology( void ) { return false; }
bool CheckSSE2Technology( void ) { return false; }
bool CheckSSETechnology( void ) { return false; }
#endif

View File

@@ -83,6 +83,8 @@ int64 CReliableTimer::GetPerformanceCountNow()
uint64 ulNow;
SYS_TIMEBASE_GET( ulNow );
return ulNow;
#elif defined(__arm__) && defined(ANDROID)
return Plat_Rdtsc();
#else
uint64 un64;
__asm__ __volatile__ (

View File

@@ -47,7 +47,11 @@
#include <stdarg.h>
#ifdef POSIX
#ifdef ANDROID
#include "../thirdparty/libiconv-1.15/include/iconv.h"
#else
#include <iconv.h>
#endif
#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>