mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-23 21:02:11 +00:00
Get rid of dead code in the OSX backend
Not used by anything.
This commit is contained in:
parent
42841c2435
commit
cab89769b4
10 changed files with 0 additions and 483 deletions
|
@ -634,13 +634,10 @@ if (APPLE)
|
||||||
sys/posix/posix_input.cpp
|
sys/posix/posix_input.cpp
|
||||||
sys/osx/PickMonitor.cpp
|
sys/osx/PickMonitor.cpp
|
||||||
sys/osx/PreferencesDialog.cpp
|
sys/osx/PreferencesDialog.cpp
|
||||||
sys/osx/macosx_guids.cpp
|
|
||||||
sys/osx/DOOMController.mm
|
sys/osx/DOOMController.mm
|
||||||
sys/osx/macosx_event.mm
|
sys/osx/macosx_event.mm
|
||||||
sys/osx/macosx_glimp.mm
|
sys/osx/macosx_glimp.mm
|
||||||
sys/osx/macosx_misc.mm
|
sys/osx/macosx_misc.mm
|
||||||
# sys/osx/macosx_utils.mm
|
|
||||||
# sys/osx/macosx_sys.mm
|
|
||||||
)
|
)
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
set(src_sys_base
|
set(src_sys_base
|
||||||
|
|
|
@ -44,7 +44,6 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#import "idlib/Str.h"
|
#import "idlib/Str.h"
|
||||||
#import "framework/Licensee.h"
|
#import "framework/Licensee.h"
|
||||||
#import "framework/Common.h"
|
#import "framework/Common.h"
|
||||||
#import "sys/osx/macosx_common.h"
|
|
||||||
#import "sys/osx/macosx_local.h"
|
#import "sys/osx/macosx_local.h"
|
||||||
#import "sys/osx/macosx_sys.h"
|
#import "sys/osx/macosx_sys.h"
|
||||||
|
|
||||||
|
@ -136,12 +135,10 @@ FPU_EXCEPTION_DIVIDE_BY_ZERO | \
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void CL_Quit_f(void);
|
extern void CL_Quit_f(void);
|
||||||
//extern void SetProgramPath(const char *path);
|
|
||||||
|
|
||||||
|
|
||||||
- (IBAction)requestTerminate:(id)sender;
|
- (IBAction)requestTerminate:(id)sender;
|
||||||
{
|
{
|
||||||
//osxQuit();
|
|
||||||
common->Quit();
|
common->Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,11 +330,6 @@ extern void CL_Quit_f(void);
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
#ifdef OMNI_TIMER
|
|
||||||
OTPeriodicTimerReset();
|
|
||||||
OTNodeStart(RootNode);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// maintain exceptions in case system calls are turning them off (is that needed)
|
// maintain exceptions in case system calls are turning them off (is that needed)
|
||||||
//Sys_FPU_EnableExceptions( TEST_FPU_EXCEPTIONS );
|
//Sys_FPU_EnableExceptions( TEST_FPU_EXCEPTIONS );
|
||||||
|
|
||||||
|
@ -346,9 +338,6 @@ extern void CL_Quit_f(void);
|
||||||
// We should think about doing this less frequently than every frame
|
// We should think about doing this less frequently than every frame
|
||||||
[pool release];
|
[pool release];
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
#ifdef OMNI_TIMER
|
|
||||||
OTNodeStop(RootNode);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
const char *macosx_scanForLibraryDirectory(void);
|
|
||||||
|
|
|
@ -455,13 +455,6 @@ GLimp_Init
|
||||||
Don't return unless OpenGL has been properly initialized
|
Don't return unless OpenGL has been properly initialized
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef OMNI_TIMER
|
|
||||||
static void GLImp_Dump_Stamp_List_f(void) {
|
|
||||||
OTStampListDumpToFile(glThreadStampList, "/tmp/gl_stamps");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool GLimp_Init( glimpParms_t parms ) {
|
bool GLimp_Init( glimpParms_t parms ) {
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
|
@ -1227,11 +1220,6 @@ GLExtension_t GLimp_ExtensionPointer(const char *name) {
|
||||||
return (GLExtension_t)(NSAddressOfSymbol(symbol));
|
return (GLExtension_t)(NSAddressOfSymbol(symbol));
|
||||||
}
|
}
|
||||||
|
|
||||||
void * wglGetProcAddress(const char *name) {
|
|
||||||
return (void *)GLimp_ExtensionPointer( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** GLW_InitExtensions
|
** GLW_InitExtensions
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#include "sys/platform.h"
|
|
||||||
|
|
||||||
#define INITGUID
|
|
||||||
|
|
||||||
#include "sound/snd_local.h"
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
#include "sys/sys_public.h"
|
#include "sys/sys_public.h"
|
||||||
|
|
||||||
void OutputDebugString( const char *text );
|
|
||||||
|
|
||||||
// input
|
// input
|
||||||
void Sys_InitInput( void );
|
void Sys_InitInput( void );
|
||||||
void Sys_ShutdownInput( void );
|
void Sys_ShutdownInput( void );
|
||||||
|
@ -15,8 +13,4 @@ void IN_ActivateMouse( void);
|
||||||
void IN_Activate (bool active);
|
void IN_Activate (bool active);
|
||||||
void IN_Frame (void);
|
void IN_Frame (void);
|
||||||
|
|
||||||
void * wglGetProcAddress(const char *name);
|
|
||||||
|
|
||||||
void Sleep( const int time );
|
|
||||||
|
|
||||||
void Sys_UpdateWindowMouseInputRect( void );
|
void Sys_UpdateWindowMouseInputRect( void );
|
||||||
|
|
|
@ -6,20 +6,11 @@
|
||||||
#import <ApplicationServices/ApplicationServices.h>
|
#import <ApplicationServices/ApplicationServices.h>
|
||||||
#import <OpenGL/CGLTypes.h>
|
#import <OpenGL/CGLTypes.h>
|
||||||
|
|
||||||
// sys
|
|
||||||
|
|
||||||
const char *macosx_scanForLibraryDirectory(void);
|
|
||||||
|
|
||||||
// In macosx_input.m
|
// In macosx_input.m
|
||||||
void Sys_InitInput(void);
|
|
||||||
void Sys_ShutdownInput(void);
|
|
||||||
CGDirectDisplayID Sys_DisplayToUse(void);
|
CGDirectDisplayID Sys_DisplayToUse(void);
|
||||||
//extern void osxQuit();
|
|
||||||
void SetProgramPath(char *path);
|
void SetProgramPath(char *path);
|
||||||
void Sys_SetMouseInputRect(CGRect newRect);
|
void Sys_SetMouseInputRect(CGRect newRect);
|
||||||
|
|
||||||
void Sys_AnnoyingBanner();
|
|
||||||
|
|
||||||
// In macosx_glimp.m
|
// In macosx_glimp.m
|
||||||
bool Sys_Hide();
|
bool Sys_Hide();
|
||||||
bool Sys_Unhide();
|
bool Sys_Unhide();
|
||||||
|
|
|
@ -1,254 +0,0 @@
|
||||||
/*
|
|
||||||
===========================================================================
|
|
||||||
|
|
||||||
Doom 3 GPL Source Code
|
|
||||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
|
||||||
|
|
||||||
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
|
|
||||||
|
|
||||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
|
||||||
|
|
||||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
|
||||||
|
|
||||||
===========================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
// -*- mode: objc -*-
|
|
||||||
#import <AppKit/AppKit.h>
|
|
||||||
|
|
||||||
#import <sys/types.h>
|
|
||||||
#import <sys/param.h>
|
|
||||||
#import <sys/mount.h>
|
|
||||||
#import <sys/wait.h>
|
|
||||||
#import <unistd.h>
|
|
||||||
#import <dlfcn.h>
|
|
||||||
|
|
||||||
#import "sys/platform.h"
|
|
||||||
#import "sys/osx/macosx_common.h"
|
|
||||||
#import "sys/osx/macosx_local.h"
|
|
||||||
#import "sys/osx/macosx_sys.h"
|
|
||||||
|
|
||||||
#ifdef OMNI_TIMER
|
|
||||||
#import "sys/osx/macosx_timers.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void Sys_Init (void);
|
|
||||||
|
|
||||||
char *Sys_GetCurrentUser( void );
|
|
||||||
|
|
||||||
void Sys_Error( const char *error, ...);
|
|
||||||
void Sys_Quit (void);
|
|
||||||
char *Sys_GetClipboardData( void ); // note that this isn't journaled...
|
|
||||||
|
|
||||||
void Sys_Print( const char *msg );
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
return NSApplicationMain(argc, (const char **)argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
void EditorPrintConsole( const char *test ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
Sys_UnloadDll
|
|
||||||
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void Sys_UnloadDll( void *dllHandle ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
Sys_LoadDll
|
|
||||||
|
|
||||||
Used to load a development dll instead of a virtual machine
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
extern char *FS_BuildOSPath( const char *base, const char *game, const char *qpath );
|
|
||||||
|
|
||||||
void *Sys_LoadDll( const char *name, int (**entryPoint)(int, ...),
|
|
||||||
int (*systemcalls)(int, ...) )
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
char *Sys_GetClipboardData(void) // FIXME
|
|
||||||
{
|
|
||||||
NSPasteboard *pasteboard;
|
|
||||||
NSArray *pasteboardTypes;
|
|
||||||
|
|
||||||
pasteboard = [NSPasteboard generalPasteboard];
|
|
||||||
pasteboardTypes = [pasteboard types];
|
|
||||||
if ([pasteboardTypes containsObject:NSStringPboardType]) {
|
|
||||||
NSString *clipboardString;
|
|
||||||
|
|
||||||
clipboardString = [pasteboard stringForType:NSStringPboardType];
|
|
||||||
if (clipboardString && [clipboardString length] > 0) {
|
|
||||||
return strdup([clipboardString cString]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
void Sys_BeginProfiling(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sys_EndProfiling(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
Sys_Init
|
|
||||||
|
|
||||||
The cvar and file system has been setup, so configurations are loaded
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
void Sys_Init(void)
|
|
||||||
{
|
|
||||||
// Sys_InitNetwork();
|
|
||||||
Sys_InitInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
Sys_Shutdown
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void Sys_Shutdown(void)
|
|
||||||
{
|
|
||||||
common->Printf( "----- Sys_Shutdown -----\n" );
|
|
||||||
Sys_EndProfiling();
|
|
||||||
Sys_ShutdownInput();
|
|
||||||
common->Printf( "------------------------\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sys_Error(const char *error, ...)
|
|
||||||
{
|
|
||||||
va_list argptr;
|
|
||||||
NSString *formattedString;
|
|
||||||
|
|
||||||
Sys_Shutdown();
|
|
||||||
|
|
||||||
va_start(argptr,error);
|
|
||||||
formattedString = [[NSString alloc] initWithFormat:[NSString stringWithCString:error] arguments:argptr];
|
|
||||||
va_end(argptr);
|
|
||||||
|
|
||||||
NSLog(@"Sys_Error: %@", formattedString);
|
|
||||||
NSRunAlertPanel(@"DOOM Error", formattedString, nil, nil, nil);
|
|
||||||
|
|
||||||
Sys_Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sys_Quit(void)
|
|
||||||
{
|
|
||||||
Sys_Shutdown();
|
|
||||||
[NSApp terminate:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
Sys_Print
|
|
||||||
|
|
||||||
This is called for all console output, even if the game is running
|
|
||||||
full screen and the dedicated console window is hidden.
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *ansiColors[8] =
|
|
||||||
{ "\033[30m" , /* ANSI Black */
|
|
||||||
"\033[31m" , /* ANSI Red */
|
|
||||||
"\033[32m" , /* ANSI Green */
|
|
||||||
"\033[33m" , /* ANSI Yellow */
|
|
||||||
"\033[34m" , /* ANSI Blue */
|
|
||||||
"\033[36m" , /* ANSI Cyan */
|
|
||||||
"\033[35m" , /* ANSI Magenta */
|
|
||||||
"\033[37m" }; /* ANSI White */
|
|
||||||
|
|
||||||
void Sys_Print(const char *text)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
/* Okay, this is a stupid hack, but what the hell, I was bored. ;) */
|
|
||||||
char *scan = text;
|
|
||||||
char code;
|
|
||||||
int index;
|
|
||||||
|
|
||||||
/* Make sure terminal mode is reset at the start of the line... */
|
|
||||||
fputs("\033[0m", stdout);
|
|
||||||
|
|
||||||
while(*scan) {
|
|
||||||
/* See if we have a color control code. If so, snarf the character,
|
|
||||||
print what we have so far, print the ANSI Terminal color code,
|
|
||||||
skip over the color control code and continue */
|
|
||||||
if(Q_IsColorString(scan)) {
|
|
||||||
index = ColorIndex(scan[1]);
|
|
||||||
|
|
||||||
/* Flush current message */
|
|
||||||
if(scan != text) {
|
|
||||||
fwrite(text, scan - text, 1, stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write ANSI color code */
|
|
||||||
fputs(ansiColors[index], stdout);
|
|
||||||
|
|
||||||
/* Reset search */
|
|
||||||
text = scan+2;
|
|
||||||
scan = text;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
scan++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Flush whatever's left */
|
|
||||||
fputs(text, stdout);
|
|
||||||
|
|
||||||
/* Make sure terminal mode is reset at the end of the line too... */
|
|
||||||
fputs("\033[0m", stdout);
|
|
||||||
|
|
||||||
#else
|
|
||||||
fputs(text, stdout);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void OutputDebugString( const char *text ) {
|
|
||||||
Sys_Print( text );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sys_OutputDebugString( const char *text ) {
|
|
||||||
OutputDebugString( text );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
Sys_CheckCD
|
|
||||||
|
|
||||||
Return true if the proper CD is in the drive
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
bool Sys_CheckCD( void ) {
|
|
||||||
return macosx_scanForLibraryDirectory() != NULL;
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
#ifdef OMNI_TIMER
|
|
||||||
|
|
||||||
#import <OmniTimer/OTTimerNode.h>
|
|
||||||
|
|
||||||
extern OTTimerNode *RootNode;
|
|
||||||
extern OTTimerNode *FrameNode;
|
|
||||||
extern OTTimerNode *UpdateScreenNode;
|
|
||||||
extern OTTimerNode *SurfaceMeshNode;
|
|
||||||
extern OTTimerNode *LerpMeshVertexesNode;
|
|
||||||
extern OTTimerNode *LerpMeshVertexesNode1;
|
|
||||||
extern OTTimerNode *LerpMeshVertexesNode2;
|
|
||||||
extern OTTimerNode *VectorArrayNormalizeNode;
|
|
||||||
|
|
||||||
extern void InitializeTimers();
|
|
||||||
extern void PrintTimers();
|
|
||||||
|
|
||||||
#endif // OMNI_TIMER
|
|
|
@ -1,164 +0,0 @@
|
||||||
/*
|
|
||||||
===========================================================================
|
|
||||||
|
|
||||||
Doom 3 GPL Source Code
|
|
||||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
|
||||||
|
|
||||||
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
|
|
||||||
|
|
||||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
|
||||||
|
|
||||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
|
||||||
|
|
||||||
===========================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
// -*- mode: objc -*-
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <mach/mach.h>
|
|
||||||
#import <mach/vm_map.h>
|
|
||||||
|
|
||||||
#import "sys/platform.h"
|
|
||||||
#import "sys/osx/macosx_local.h"
|
|
||||||
#import "sys/osx/macosx_sys.h"
|
|
||||||
|
|
||||||
//extern "C" void *vm_allocate(unsigned, unsigned*, unsigned, int);
|
|
||||||
//extern "C" void vm_deallocate(unsigned, unsigned*, unsigned);
|
|
||||||
|
|
||||||
const char *macosx_scanForLibraryDirectory(void)
|
|
||||||
{
|
|
||||||
return "/Library/DOOM";
|
|
||||||
}
|
|
||||||
|
|
||||||
// EEEK!
|
|
||||||
static long size_save;
|
|
||||||
|
|
||||||
void *osxAllocateMemoryNV(long size, float readFrequency, float writeFrequency, float priority)
|
|
||||||
{
|
|
||||||
kern_return_t kr;
|
|
||||||
vm_address_t buffer;
|
|
||||||
|
|
||||||
kr = vm_allocate(mach_task_self(),
|
|
||||||
(vm_address_t *)&buffer,
|
|
||||||
size,
|
|
||||||
VM_FLAGS_ANYWHERE);
|
|
||||||
if(kr == 0) {
|
|
||||||
size_save = size;
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
size_save = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void osxFreeMemoryNV(void *pointer)
|
|
||||||
{
|
|
||||||
if(size_save) {
|
|
||||||
vm_deallocate(mach_task_self(),
|
|
||||||
(vm_address_t)pointer,
|
|
||||||
size_save);
|
|
||||||
size_save = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void *osxAllocateMemory(long size)
|
|
||||||
{
|
|
||||||
kern_return_t kr;
|
|
||||||
vm_address_t buffer;
|
|
||||||
|
|
||||||
size += sizeof( int );
|
|
||||||
kr = vm_allocate(mach_task_self(),
|
|
||||||
(vm_address_t *)&buffer,
|
|
||||||
size,
|
|
||||||
VM_FLAGS_ANYWHERE);
|
|
||||||
if(kr == 0) {
|
|
||||||
int *ptr = buffer;
|
|
||||||
*ptr = size;
|
|
||||||
ptr = ptr + 1;
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void osxFreeMemory(void *pointer)
|
|
||||||
{
|
|
||||||
int size;
|
|
||||||
int *ptr = pointer;
|
|
||||||
ptr = ptr - 1;
|
|
||||||
size = *ptr;
|
|
||||||
vm_deallocate(mach_task_self(), (vm_address_t)ptr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void __eieio(void)
|
|
||||||
{
|
|
||||||
__asm__ ("eieio");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void __sync(void)
|
|
||||||
{
|
|
||||||
__asm__ ("sync");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void __isync(void)
|
|
||||||
{
|
|
||||||
__asm__ ("isync");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void __dcbf(void *base, unsigned long offset)
|
|
||||||
{
|
|
||||||
__asm__ ("dcbf %0, %1"
|
|
||||||
:
|
|
||||||
: "r" (base), "r" (offset)
|
|
||||||
: "r0");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void __dcbst(void *base, unsigned long offset)
|
|
||||||
{
|
|
||||||
__asm__ ("dcbst %0, %1"
|
|
||||||
:
|
|
||||||
: "r" (base), "r" (offset)
|
|
||||||
: "r0");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void __dcbz(void *base, unsigned long offset)
|
|
||||||
{
|
|
||||||
__asm__ ("dcbz %0, %1"
|
|
||||||
:
|
|
||||||
: "r" (base), "r" (offset)
|
|
||||||
: "r0");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sys_FlushCacheMemory( void *base, int bytes ) {
|
|
||||||
unsigned long i;
|
|
||||||
|
|
||||||
for(i = 0; i < bytes; i+= 32) {
|
|
||||||
__dcbf(base,i);
|
|
||||||
}
|
|
||||||
__sync();
|
|
||||||
__isync();
|
|
||||||
__dcbf(base, i);
|
|
||||||
__sync();
|
|
||||||
__isync();
|
|
||||||
*(volatile unsigned long *)(base + i);
|
|
||||||
__isync();
|
|
||||||
}
|
|
Loading…
Reference in a new issue