(PSP) Add PSP target

This commit is contained in:
twinaphex 2014-03-04 05:26:59 +01:00
parent fd90b67a30
commit f18d0e083c
3 changed files with 47 additions and 0 deletions

View File

@ -176,7 +176,11 @@ clean:
$(RM) -r .opk_data
$(TARGET): $(OBJS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJS)
else
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS)
endif
pprof: platform/linux/pprof.c
$(CC) -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@

View File

@ -75,6 +75,19 @@ else ifeq ($(platform), psp1)
CC = psp-gcc$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
CFLAGS += -DPSP -G0
STATIC_LINKING = 1
asm_memory = 0
asm_render = 0
asm_ym2612 = 0
asm_misc = 0
asm_cdpico = 0
asm_cdmemory = 0
asm_mix = 0
use_cyclone = 0
use_fame = 1
use_drz80 = 0
use_cz80 = 1
else ifeq ($(platform), xenon)
TARGET := $(TARGET_NAME)_libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT)

View File

@ -6,12 +6,18 @@
* See COPYING file in the top-level directory.
*/
#ifdef PSP
#define NO_MMAP
#endif
#define _GNU_SOURCE 1 // mremap
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#ifndef _WIN32
#ifndef NO_MMAP
#include <sys/mman.h>
#endif
#else
#include <io.h>
#include <windows.h>
@ -161,6 +167,30 @@ static void munmap(void *addr, size_t length)
UnmapViewOfFile(addr);
/* ruh-ro, we leaked handle from CreateFileMapping() ... */
}
#elif defined(NO_MMAP)
#define PROT_EXEC 0x04
#define MAP_FAILED 0
#define PROT_READ 0
#define PROT_WRITE 0
#define MAP_PRIVATE 0
#define MAP_ANONYMOUS 0
void* mmap(void *desired_addr, size_t len, int mmap_prot, int mmap_flags, int fildes, size_t off)
{
return malloc(len);
}
void munmap(void *base_addr, size_t len)
{
free(base_addr);
}
int mprotect(void *addr, size_t len, int prot)
{
/* stub - not really needed at this point since this codepath has no dynarecs */
return 0;
}
#endif
#ifndef MAP_ANONYMOUS