Removed deprecated code from macOS SDL backend

This commit is contained in:
alexey.lysiuk 2016-12-27 12:56:21 +02:00
parent a37db1c4d7
commit 2f9d5e285d

View file

@ -41,10 +41,6 @@
#include <new> #include <new>
#include <sys/param.h> #include <sys/param.h>
#include <locale.h> #include <locale.h>
#if defined(__MACH__) && !defined(NOASM)
#include <sys/types.h>
#include <sys/mman.h>
#endif
#include "doomerrors.h" #include "doomerrors.h"
#include "m_argv.h" #include "m_argv.h"
@ -185,46 +181,6 @@ static int DoomSpecificInfo (char *buffer, char *end)
return p; return p;
} }
#if defined(__MACH__) && !defined(NOASM)
// NASM won't let us create custom sections for Mach-O. Whether that's a limitation of NASM
// or of Mach-O, I don't know, but since we're using NASM for the assembly, it doesn't much
// matter.
extern "C"
{
extern void *rtext_a_start, *rtext_a_end;
extern void *rtext_tmap_start, *rtext_tmap_end;
extern void *rtext_tmap2_start, *rtext_tmap2_end;
extern void *rtext_tmap3_start, *rtext_tmap3_end;
};
static void unprotect_pages(long pagesize, void *start, void *end)
{
char *page = (char *)((intptr_t)start & ~(pagesize - 1));
size_t len = (char *)end - (char *)start;
if (mprotect(page, len, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
{
fprintf(stderr, "mprotect failed\n");
exit(1);
}
}
static void unprotect_rtext()
{
static void *const pages[] =
{
rtext_a_start, rtext_a_end,
rtext_tmap_start, rtext_tmap_end,
rtext_tmap2_start, rtext_tmap2_end,
rtext_tmap3_start, rtext_tmap3_end
};
long pagesize = sysconf(_SC_PAGESIZE);
for (void *const *p = pages; p < &pages[countof(pages)]; p += 2)
{
unprotect_pages(pagesize, p[0], p[1]);
}
}
#endif
void I_StartupJoysticks(); void I_StartupJoysticks();
void I_ShutdownJoysticks(); void I_ShutdownJoysticks();
@ -243,10 +199,6 @@ int main (int argc, char **argv)
seteuid (getuid ()); seteuid (getuid ());
std::set_new_handler (NewFailure); std::set_new_handler (NewFailure);
#if defined(__MACH__) && !defined(NOASM)
unprotect_rtext();
#endif
// Set LC_NUMERIC environment variable in case some library decides to // Set LC_NUMERIC environment variable in case some library decides to
// clear the setlocale call at least this will be correct. // clear the setlocale call at least this will be correct.
// Note that the LANG environment variable is overridden by LC_* // Note that the LANG environment variable is overridden by LC_*