Merge remote-tracking branch 'origin/master' into gcc12-update
This commit is contained in:
commit
d77e4d1411
|
@ -1,4 +1,4 @@
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
// Test: do things work well enough for us to get to main()?
|
// Test: do things work well enough for us to get to main()?
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Test.h"
|
#include "Test.h"
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
TEST_LOG_OK();
|
TEST_LOG_OK();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
char readWriteData[6] = "Three";
|
char readWriteData[6] = "Three";
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
// constant initialized data
|
// constant initialized data
|
||||||
TEST_LOG_SIZED("One",3);
|
TEST_LOG_SIZED("One",3);
|
||||||
|
|
|
@ -6,7 +6,7 @@ __attribute__((noinline)) static void* foo(size_t x)
|
||||||
return malloc(x);
|
return malloc(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
if(*(short*)&foo != 0x60FF)
|
if(*(short*)&foo != 0x60FF)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#include <FixMath.h>
|
#include <FixMath.h>
|
||||||
#include "Test.h"
|
#include "Test.h"
|
||||||
|
|
||||||
short calc()
|
short calc(void)
|
||||||
{
|
{
|
||||||
return FixRound(FixRatio(42,5));
|
return FixRound(FixRatio(42,5));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
if(calc() == 8)
|
if(calc() == 8)
|
||||||
TEST_LOG_OK();
|
TEST_LOG_OK();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
void _start()
|
void _start(void)
|
||||||
{
|
{
|
||||||
// Test: do things work well enough for us to get to a startup function?
|
// Test: do things work well enough for us to get to a startup function?
|
||||||
// Note: this won't work for multisegment 68K apps, as the startup function will be in the wrong segment.
|
// Note: this won't work for multisegment 68K apps, as the startup function will be in the wrong segment.
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
int variable;
|
int variable;
|
||||||
|
|
||||||
void Foo();
|
void Foo(void);
|
||||||
void Bar();
|
void Bar(void);
|
||||||
|
|
||||||
Boolean Test(Boolean unloadFoo, Boolean unloadBar, Boolean compact)
|
Boolean Test(Boolean unloadFoo, Boolean unloadBar, Boolean compact)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ Boolean Test(Boolean unloadFoo, Boolean unloadBar, Boolean compact)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
Size grow, maxblock, maxblock2, freemem, freemem2;
|
Size grow, maxblock, maxblock2, freemem, freemem2;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
extern int variable;
|
extern int variable;
|
||||||
#include <SegLoad.h>
|
#include <SegLoad.h>
|
||||||
void Foo()
|
void Foo(void)
|
||||||
{
|
{
|
||||||
variable *= 9;
|
variable *= 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bar()
|
void Bar(void)
|
||||||
{
|
{
|
||||||
variable /= 9;
|
variable /= 9;
|
||||||
variable *= 7;
|
variable *= 7;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
FILE *f = fopen("out", "w");
|
FILE *f = fopen("out", "w");
|
||||||
fprintf(f, "OK\n");
|
fprintf(f, "OK\n");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Test.h"
|
#include "Test.h"
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
TEST_LOG_SIZED("One",3);
|
TEST_LOG_SIZED("One",3);
|
||||||
TEST_LOG_SIZED("Two",3);
|
TEST_LOG_SIZED("Two",3);
|
||||||
|
|
|
@ -8,7 +8,7 @@ int commonSymbol;
|
||||||
int zeroInited = 0;
|
int zeroInited = 0;
|
||||||
EventRecord e;
|
EventRecord e;
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if(commonSymbol)
|
if(commonSymbol)
|
||||||
|
|
|
@ -23,6 +23,7 @@ set(CMAKE_C_STANDARD 99)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type -Wno-multichar")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type -Wno-multichar")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror=return-type -Werror=strict-prototypes -Wno-multichar")
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ enum ReferenceFlags { // flags field of kReference
|
||||||
|
|
||||||
kUnknownReferenceFlags = 0x6E // rather a lot, isn't it?
|
kUnknownReferenceFlags = 0x6E // rather a lot, isn't it?
|
||||||
// The following flags are known to exist from DumpOBJ,
|
// The following flags are known to exist from DumpOBJ,
|
||||||
// but their value is unkown as I haven't actually seen them yet:
|
// but their value is unknown as I haven't actually seen them yet:
|
||||||
// k32BitOffsets (default k16BitOffsets)
|
// k32BitOffsets (default k16BitOffsets)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,13 @@
|
||||||
#include "Elf2Mac.h"
|
#include "Elf2Mac.h"
|
||||||
#include "SegmentMap.h"
|
#include "SegmentMap.h"
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <sstream>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
const char * scriptStart = R"ld(/* ld script for Elf2Mac */
|
const char * scriptStart = R"ld(/* ld script for Elf2Mac */
|
||||||
|
@ -214,7 +216,11 @@ void SegmentInfo::WriteFiltersKeep(std::ostream &out, string section)
|
||||||
|
|
||||||
void SegmentInfo::CreateLdScript(std::ostream &out, string entryPoint)
|
void SegmentInfo::CreateLdScript(std::ostream &out, string entryPoint)
|
||||||
{
|
{
|
||||||
out << "\t.code" << id << " : {\n";
|
std::ostringstream ss;
|
||||||
|
ss << std::setw(5) << std::setfill('0') << id;
|
||||||
|
const std::string zero_padded_id = ss.str();
|
||||||
|
|
||||||
|
out << "\t.code" << zero_padded_id << " : {\n";
|
||||||
out << "\t\tFILL(0x4E71);\n";
|
out << "\t\tFILL(0x4E71);\n";
|
||||||
if(id == 1)
|
if(id == 1)
|
||||||
{
|
{
|
||||||
|
@ -259,7 +265,7 @@ void SegmentInfo::CreateLdScript(std::ostream &out, string entryPoint)
|
||||||
if(id == 1)
|
if(id == 1)
|
||||||
out << "\t\t__EH_FRAME_BEGIN__" << " = .;\n";
|
out << "\t\t__EH_FRAME_BEGIN__" << " = .;\n";
|
||||||
else
|
else
|
||||||
out << "\t\t__EH_FRAME_BEGIN__" << id << " = .;\n";
|
out << "\t\t__EH_FRAME_BEGIN__" << zero_padded_id << " = .;\n";
|
||||||
WriteFiltersKeep(out, ".eh_frame");
|
WriteFiltersKeep(out, ".eh_frame");
|
||||||
out << "\t\tLONG(0);\n";
|
out << "\t\tLONG(0);\n";
|
||||||
WriteFiltersKeep(out, ".gcc_except_table");
|
WriteFiltersKeep(out, ".gcc_except_table");
|
||||||
|
@ -278,7 +284,7 @@ void SegmentInfo::CreateLdScript(std::ostream &out, string entryPoint)
|
||||||
FILL(0);
|
FILL(0);
|
||||||
. += 32;
|
. += 32;
|
||||||
LONG(__EH_FRAME_BEGIN__@N@ - .);
|
LONG(__EH_FRAME_BEGIN__@N@ - .);
|
||||||
)ld", "@N@", boost::lexical_cast<string>(id));
|
)ld", "@N@", zero_padded_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
out << "\t}\n";
|
out << "\t}\n";
|
||||||
|
|
|
@ -29,11 +29,12 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
|
|
||||||
#include "ResourceFork.h"
|
#include "ResourceFork.h"
|
||||||
#include "BinaryIO.h"
|
#include "BinaryIO.h"
|
||||||
|
@ -315,7 +316,12 @@ void Object::MultiSegmentApp(string output, SegmentMap& segmentMap)
|
||||||
|
|
||||||
string exceptionInfoMarker = "__EH_FRAME_BEGIN__";
|
string exceptionInfoMarker = "__EH_FRAME_BEGIN__";
|
||||||
if(id != 1)
|
if(id != 1)
|
||||||
exceptionInfoMarker += boost::lexical_cast<string>(id);
|
{
|
||||||
|
std::ostringstream ss;
|
||||||
|
ss << std::setw(5) << std::setfill('0') << id;
|
||||||
|
const std::string zero_padded_id = ss.str();
|
||||||
|
exceptionInfoMarker += zero_padded_id;
|
||||||
|
}
|
||||||
int exceptionInfoSym = symtab->FindSym(exceptionInfoMarker);
|
int exceptionInfoSym = symtab->FindSym(exceptionInfoMarker);
|
||||||
if(exceptionInfoSym != -1)
|
if(exceptionInfoSym != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,12 +47,12 @@ For Arch Linux, this should do the trick:
|
||||||
|
|
||||||
On a Mac, get the homebrew package manager and:
|
On a Mac, get the homebrew package manager and:
|
||||||
|
|
||||||
brew install boost cmake gmp mpfr libmpc bison
|
brew install boost cmake gmp mpfr libmpc bison texinfo
|
||||||
|
|
||||||
You can also run Retro68 on a PowerMac G4 or G5 running Mac OS 10.4 (Tiger).
|
You can also run Retro68 on a PowerMac G4 or G5 running Mac OS 10.4 (Tiger).
|
||||||
In that case, get the tigerbrew package manager and
|
In that case, get the tigerbrew package manager and
|
||||||
|
|
||||||
brew install gcc cmake gmp mpfr libmpc bison
|
brew install gcc cmake gmp mpfr libmpc bison texinfo
|
||||||
brew install boost --c++11
|
brew install boost --c++11
|
||||||
|
|
||||||
### Apple Universal Interfaces vs. Multiversal Interfaces
|
### Apple Universal Interfaces vs. Multiversal Interfaces
|
||||||
|
|
|
@ -42,7 +42,7 @@ pascal void ButtonFrameProc(DialogRef dlg, DialogItemIndex itemNo)
|
||||||
FrameRoundRect(&box,16,16);
|
FrameRoundRect(&box,16,16);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if !TARGET_API_MAC_CARBON
|
||||||
InitGraf(&qd.thePort);
|
InitGraf(&qd.thePort);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
void Explain()
|
void Explain(void)
|
||||||
{
|
{
|
||||||
printf("*********************************************************\n");
|
printf("*********************************************************\n");
|
||||||
printf("This program is intended to make developing software\n");
|
printf("This program is intended to make developing software\n");
|
||||||
|
@ -41,7 +41,7 @@ void Explain()
|
||||||
printf("*********************************************************\n");
|
printf("*********************************************************\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EjectOldDisk()
|
void EjectOldDisk(void)
|
||||||
{
|
{
|
||||||
Handle h = GetResource('LNCH', 128);
|
Handle h = GetResource('LNCH', 128);
|
||||||
if(h)
|
if(h)
|
||||||
|
@ -55,7 +55,7 @@ void EjectOldDisk()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
Explain();
|
Explain();
|
||||||
EjectOldDisk();
|
EjectOldDisk();
|
||||||
|
|
|
@ -48,12 +48,12 @@ struct MPWFile;
|
||||||
|
|
||||||
struct fsysTable
|
struct fsysTable
|
||||||
{
|
{
|
||||||
void (*quit)();
|
void (*quit)(void);
|
||||||
void (*access)();
|
void (*access)(void);
|
||||||
void (*close)(struct MPWFile *);
|
void (*close)(struct MPWFile *);
|
||||||
void (*read)(struct MPWFile *);
|
void (*read)(struct MPWFile *);
|
||||||
void (*write)(struct MPWFile *);
|
void (*write)(struct MPWFile *);
|
||||||
void (*ioctl)();
|
void (*ioctl)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct devtable
|
struct devtable
|
||||||
|
@ -101,7 +101,7 @@ struct pgminfo
|
||||||
|
|
||||||
|
|
||||||
// Get MPW's magic struct
|
// Get MPW's magic struct
|
||||||
struct pgminfo2 * getPgmInfo()
|
struct pgminfo2 *getPgmInfo(void)
|
||||||
{
|
{
|
||||||
struct pgminfo *pgm0 = *(struct pgminfo**) 0x316;
|
struct pgminfo *pgm0 = *(struct pgminfo**) 0x316;
|
||||||
if(!pgm0)
|
if(!pgm0)
|
||||||
|
@ -132,7 +132,7 @@ void _exit(int status)
|
||||||
const int procInfo = kCStackBased
|
const int procInfo = kCStackBased
|
||||||
| STACK_ROUTINE_PARAMETER(1, kFourByteCode);
|
| STACK_ROUTINE_PARAMETER(1, kFourByteCode);
|
||||||
|
|
||||||
int main()
|
int main(int argc, char *argv[], char *envp[])
|
||||||
{
|
{
|
||||||
struct pgminfo2 *pgm = getPgmInfo();
|
struct pgminfo2 *pgm = getPgmInfo();
|
||||||
if(pgm)
|
if(pgm)
|
||||||
|
@ -152,19 +152,20 @@ int main()
|
||||||
|
|
||||||
#if TARGET_CPU_PPC
|
#if TARGET_CPU_PPC
|
||||||
|
|
||||||
void __do_global_dtors();
|
void __do_global_dtors(void);
|
||||||
|
|
||||||
void __start()
|
void __start(void)
|
||||||
{
|
{
|
||||||
if(setjmp(exit_buf))
|
if(setjmp(exit_buf))
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
atexit(&__do_global_dtors);
|
atexit(&__do_global_dtors);
|
||||||
int result;
|
int result;
|
||||||
{
|
{
|
||||||
char *argv[2] = { "./a.out", NULL };
|
char *argv[2] = { "./a.out", NULL };
|
||||||
result = main(1, argv);
|
char *envp[1] = { NULL };
|
||||||
|
result = main(1, argv, envp);
|
||||||
}
|
}
|
||||||
exit(result);
|
exit(result);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +175,7 @@ void *__dso_handle = &__dso_handle;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void _start()
|
void _start(void)
|
||||||
{
|
{
|
||||||
RETRO68_RELOCATE();
|
RETRO68_RELOCATE();
|
||||||
|
|
||||||
|
@ -188,7 +189,8 @@ void _start()
|
||||||
int result;
|
int result;
|
||||||
{
|
{
|
||||||
char *argv[2] = { "./a.out", NULL };
|
char *argv[2] = { "./a.out", NULL };
|
||||||
result = main(1, argv);
|
char *envp[1] = { NULL };
|
||||||
|
result = main(1, argv, envp);
|
||||||
}
|
}
|
||||||
exit(result);
|
exit(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ float ray(int n, float x0, float y0, float z0, float dx, float dy, float dz)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
WindowPtr win;
|
WindowPtr win;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
// wait until computer is turned on ;-)
|
// wait until computer is turned on ;-)
|
||||||
while(!is_computer_on())
|
while(!is_computer_on())
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
#include <Sound.h>
|
#include <Sound.h>
|
||||||
|
|
||||||
void beep()
|
void beep(void)
|
||||||
{
|
{
|
||||||
SysBeep(20);
|
SysBeep(20);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ void beep()
|
||||||
* Note that a function by this name was an actual, documented part
|
* Note that a function by this name was an actual, documented part
|
||||||
* of the BeOS API.
|
* of the BeOS API.
|
||||||
*/
|
*/
|
||||||
Boolean is_computer_on()
|
Boolean is_computer_on(void)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,5 +19,5 @@
|
||||||
|
|
||||||
#include <MacTypes.h>
|
#include <MacTypes.h>
|
||||||
|
|
||||||
void beep();
|
void beep(void);
|
||||||
Boolean is_computer_on();
|
Boolean is_computer_on(void);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "ShowInitIcon.h"
|
#include "ShowInitIcon.h"
|
||||||
#include "Retro68Runtime.h"
|
#include "Retro68Runtime.h"
|
||||||
|
|
||||||
void _start()
|
void _start(void)
|
||||||
{
|
{
|
||||||
RETRO68_RELOCATE();
|
RETRO68_RELOCATE();
|
||||||
Retro68CallConstructors();
|
Retro68CallConstructors();
|
||||||
|
|
|
@ -64,7 +64,7 @@ void MakeNewWindow(ConstStr255Param title, short procID)
|
||||||
OffsetRect(&nextWindowRect, 15, 15);
|
OffsetRect(&nextWindowRect, 15, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitCustomWDEF()
|
void InitCustomWDEF(void)
|
||||||
{
|
{
|
||||||
/* The 10-byte code resource stub trick.
|
/* The 10-byte code resource stub trick.
|
||||||
*
|
*
|
||||||
|
@ -91,7 +91,7 @@ void InitCustomWDEF()
|
||||||
// with custom WDEFs.
|
// with custom WDEFs.
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowAboutBox()
|
void ShowAboutBox(void)
|
||||||
{
|
{
|
||||||
WindowRef w = GetNewWindow(128, NULL, (WindowPtr) - 1);
|
WindowRef w = GetNewWindow(128, NULL, (WindowPtr) - 1);
|
||||||
MoveWindow(w,
|
MoveWindow(w,
|
||||||
|
@ -116,7 +116,7 @@ void ShowAboutBox()
|
||||||
DisposeWindow(w);
|
DisposeWindow(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateMenus()
|
void UpdateMenus(void)
|
||||||
{
|
{
|
||||||
MenuRef m = GetMenu(kMenuFile);
|
MenuRef m = GetMenu(kMenuFile);
|
||||||
WindowRef w = FrontWindow();
|
WindowRef w = FrontWindow();
|
||||||
|
@ -234,7 +234,7 @@ void DoUpdate(WindowRef w)
|
||||||
EndUpdate(w);
|
EndUpdate(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
InitGraf(&qd.thePort);
|
InitGraf(&qd.thePort);
|
||||||
InitFonts();
|
InitFonts();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ jobs:
|
||||||
- checkout: self
|
- checkout: self
|
||||||
submodules: true
|
submodules: true
|
||||||
- script: |
|
- script: |
|
||||||
docker run -i --name nix -v`pwd`:/src nixos/nix:2.3.12 <<EOF
|
docker run -i --name nix -v`pwd`:/src nixos/nix:2.18.1 <<EOF
|
||||||
nix-env -iA cachix -f https://cachix.org/api/v1/install
|
nix-env -iA cachix -f https://cachix.org/api/v1/install
|
||||||
cachix use autc04
|
cachix use autc04
|
||||||
nix-build src -A ${TARGET}.retro68.samples
|
nix-build src -A ${TARGET}.retro68.samples
|
||||||
|
|
|
@ -14,7 +14,7 @@ static UniversalProcPtr OriginalExitToShell;
|
||||||
static UniversalProcPtr OriginalLaunch;
|
static UniversalProcPtr OriginalLaunch;
|
||||||
static UniversalProcPtr OriginalChain;
|
static UniversalProcPtr OriginalChain;
|
||||||
|
|
||||||
extern pascal void PatchedLoadSeg();
|
extern pascal void PatchedLoadSeg(void);
|
||||||
|
|
||||||
typedef union JTEntry
|
typedef union JTEntry
|
||||||
{
|
{
|
||||||
|
@ -171,10 +171,10 @@ static pascal void PatchedUnloadSeg(Ptr ptr)
|
||||||
HPurge(CODE);
|
HPurge(CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InstallPatches();
|
static void InstallPatches(void);
|
||||||
static void UninstallPatches();
|
static void UninstallPatches(void);
|
||||||
|
|
||||||
static pascal void PatchedExitToShell()
|
static pascal void PatchedExitToShell(void)
|
||||||
{
|
{
|
||||||
UninstallPatches();
|
UninstallPatches();
|
||||||
ExitToShell();
|
ExitToShell();
|
||||||
|
@ -204,7 +204,7 @@ static OSErr PatchedChain(void *p)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InstallPatches()
|
static void InstallPatches(void)
|
||||||
{
|
{
|
||||||
SetToolTrapAddress((UniversalProcPtr)&PatchedLoadSeg, _LoadSeg);
|
SetToolTrapAddress((UniversalProcPtr)&PatchedLoadSeg, _LoadSeg);
|
||||||
SetToolTrapAddress((UniversalProcPtr)&PatchedUnloadSeg, _UnLoadSeg);
|
SetToolTrapAddress((UniversalProcPtr)&PatchedUnloadSeg, _UnLoadSeg);
|
||||||
|
@ -213,7 +213,7 @@ static void InstallPatches()
|
||||||
SetToolTrapAddress((UniversalProcPtr)&PatchedChain, _Chain);
|
SetToolTrapAddress((UniversalProcPtr)&PatchedChain, _Chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UninstallPatches()
|
static void UninstallPatches(void)
|
||||||
{
|
{
|
||||||
SetToolTrapAddress((UniversalProcPtr)OriginalLoadSeg, _LoadSeg);
|
SetToolTrapAddress((UniversalProcPtr)OriginalLoadSeg, _LoadSeg);
|
||||||
SetToolTrapAddress((UniversalProcPtr)OriginalUnloadSeg, _UnLoadSeg);
|
SetToolTrapAddress((UniversalProcPtr)OriginalUnloadSeg, _UnLoadSeg);
|
||||||
|
@ -226,7 +226,7 @@ static void UninstallPatches()
|
||||||
// section boundaries
|
// section boundaries
|
||||||
extern uint8_t _stext, _etext, _sdata, _edata, _sbss[], _ebss;
|
extern uint8_t _stext, _etext, _sdata, _edata, _sbss[], _ebss;
|
||||||
|
|
||||||
void Retro68InitMultisegApp()
|
void Retro68InitMultisegApp(void)
|
||||||
{
|
{
|
||||||
uint8_t * a5 = (uint8_t*) StripAddressCompat((void*)SetCurrentA5());
|
uint8_t * a5 = (uint8_t*) StripAddressCompat((void*)SetCurrentA5());
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,11 @@
|
||||||
(*(typeof(&FUN)) ((char*)(&FUN) + displacement)) ARGS; \
|
(*(typeof(&FUN)) ((char*)(&FUN) + displacement)) ARGS; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
void Retro68Relocate();
|
void Retro68Relocate(void);
|
||||||
void Retro68CallConstructors();
|
void Retro68CallConstructors(void);
|
||||||
void Retro68CallDestructors();
|
void Retro68CallDestructors(void);
|
||||||
void Retro68FreeGlobals();
|
void Retro68FreeGlobals(void);
|
||||||
void Retro68InitMultisegApp();
|
void Retro68InitMultisegApp(void);
|
||||||
void Retro68ApplyRelocations(uint8_t *base, uint32_t size, void *relocations, uint32_t displacements[]);
|
void Retro68ApplyRelocations(uint8_t *base, uint32_t size, void *relocations, uint32_t displacements[]);
|
||||||
|
|
||||||
#define RETRO68_RELOCATE() RETRO68_CALL_UNRELOCATED(Retro68Relocate,())
|
#define RETRO68_RELOCATE() RETRO68_CALL_UNRELOCATED(Retro68Relocate,())
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <MacMemory.h>
|
#include <MacMemory.h>
|
||||||
|
|
||||||
void referenceMyMalloc() {}
|
void referenceMyMalloc(void) {}
|
||||||
|
|
||||||
void *_malloc_r(struct _reent *reent_ptr, size_t sz)
|
void *_malloc_r(struct _reent *reent_ptr, size_t sz)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
|
|
||||||
int main(int argc, char* argv[]);
|
int main(int argc, char* argv[]);
|
||||||
|
|
||||||
void __do_global_dtors();
|
void __do_global_dtors(void);
|
||||||
|
|
||||||
void __start()
|
void __start(void)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
int main(int argc, char* argv[]);
|
int main(int argc, char* argv[]);
|
||||||
|
|
||||||
void _start()
|
void _start(void)
|
||||||
{
|
{
|
||||||
RETRO68_RELOCATE();
|
RETRO68_RELOCATE();
|
||||||
atexit(&Retro68CallDestructors);
|
atexit(&Retro68CallDestructors);
|
||||||
|
|
Loading…
Reference in New Issue