install rootless code when opening video driver

This commit is contained in:
Jesús A. Álvarez 2019-11-02 23:56:11 +01:00
parent fef996ed2f
commit fa827b5c2a
3 changed files with 14 additions and 7 deletions

View File

@ -54,19 +54,25 @@ static const uint8 rootless_proc[] = {
static uint32 rootless_proc_ptr = 0;
static uint32 low_mem_map = 0;
void InstallRootlessProc() {
int16 InstallRootlessProc() {
// Rootless mode support
M68kRegisters r;
if (PrefsFindBool("rootless")) {
printf("Installing rootless support\n");
r.d[0] = sizeof(rootless_proc);
Execute68kTrap(0xa71e, &r); // NewPtrSysClear()
if (r.a[0] == 0) {
return memFullErr;
}
rootless_proc_ptr = r.a[0];
printf("Installing rootless support: 0x%x\n", rootless_proc_ptr);
Host2Mac_memcpy(rootless_proc_ptr, rootless_proc, sizeof(rootless_proc));
low_mem_map = 0;
printf("Installed at 0x%x\n", rootless_proc_ptr);
} else {
rootless_proc_ptr = 0;
low_mem_map = 0;
}
return noErr;
}
static struct {

View File

@ -754,11 +754,6 @@ void InstallDrivers(uint32 pb)
r.a[0] = pb;
Execute68kTrap(0xa000, &r); // Open()
}
#ifdef VIDEO_ROOTLESS
extern void InstallRootlessProc(void);
InstallRootlessProc();
#endif
}

View File

@ -482,6 +482,12 @@ int16 monitor_desc::driver_open(void)
// Init color palette (solid gray)
set_gray_palette();
// Enable rootless video
#ifdef VIDEO_ROOTLESS
extern int16 InstallRootlessProc(void);
return InstallRootlessProc();
#endif
return noErr;
}