diff options
author | 2010-01-21 22:54:49 +0000 | |
---|---|---|
committer | 2010-01-21 22:54:49 +0000 | |
commit | 10bee5ce7812d7faaecf238cf9570b802e02d56e (patch) | |
tree | cf71fbbc9cb1fb53efefef35bb916df2860fad15 /src/osd/sdl/sdlmisc_unix.c | |
parent | a63d3b5de485918abd8bca4079ac221fe62f1d15 (diff) |
The return of the "misc"
- Added sdlmisc_<targetos>.c again. This was necessary since
certain tools create stubs for e.g. osd_break_into_debugger.
If we do not have this in a separate file, the link stage may
break.
- Applied OS/2 patch [Credit: KO Myung-Hun]
- Cleaned up #includes. Removed stdlib.h were possible.
- More malloc to osd_malloc rename.
- SDL monitor modes are read now when they are needed. This is now consistent across platforms.
Diffstat (limited to 'src/osd/sdl/sdlmisc_unix.c')
-rw-r--r-- | src/osd/sdl/sdlmisc_unix.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/osd/sdl/sdlmisc_unix.c b/src/osd/sdl/sdlmisc_unix.c new file mode 100644 index 00000000000..efd2d27d4a1 --- /dev/null +++ b/src/osd/sdl/sdlmisc_unix.c @@ -0,0 +1,63 @@ +//============================================================ +// +// sdlos_*.c - OS specific low level code +// +// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team. +// Visit http://mamedev.org for licensing and usage restrictions. +// +// SDLMAME by Olivier Galibert and R. Belmont +// +//============================================================ + +#include <sys/mman.h> +#include <signal.h> + +// MAME headers +#include "osdcore.h" + + +//============================================================ +// osd_alloc_executable +// +// allocates "size" bytes of executable memory. this must take +// things like NX support into account. +//============================================================ + +void *osd_alloc_executable(size_t size) +{ +#if defined(SDLMAME_BSD) + return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0); +#elif defined(SDLMAME_UNIX) + return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0); +#endif +} + +//============================================================ +// osd_free_executable +// +// frees memory allocated with osd_alloc_executable +//============================================================ + +void osd_free_executable(void *ptr, size_t size) +{ +#ifdef SDLMAME_SOLARIS + munmap((char *)ptr, size); +#else + munmap(ptr, size); +#endif +} + +//============================================================ +// osd_break_into_debugger +//============================================================ + +void osd_break_into_debugger(const char *message) +{ + #ifdef MAME_DEBUG + printf("MAME exception: %s\n", message); + printf("Attempting to fall into debugger\n"); + kill(getpid(), SIGTRAP); + #else + printf("Ignoring MAME exception: %s\n", message); + #endif +} |