X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcarthw%2Fsvp%2Fsvp.c;h=d09ebeb2748f9969c0e0470a2e7d6b846ad8c5e9;hb=cff531af94bd9c9c89ae162e80f48ddc26a4e504;hp=d1e7f8f204d8904c8fcd2e534147a320f3563351;hpb=679af8a3f466a2a4a20f58e4181a231fb73e9836;p=picodrive.git diff --git a/pico/carthw/svp/svp.c b/pico/carthw/svp/svp.c index d1e7f8f..d09ebeb 100644 --- a/pico/carthw/svp/svp.c +++ b/pico/carthw/svp/svp.c @@ -1,12 +1,33 @@ -// The SVP chip emulator - -// (c) Copyright 2008, Grazvydas "notaz" Ignotas -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. - +/* + * The SVP chip emulator + * + * Copyright (c) Gražvydas "notaz" Ignotas, 2008 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "../../pico_int.h" +#include "../../cpu/drc/cmn.h" #include "compiler.h" svp_t *svp = NULL; @@ -97,6 +118,11 @@ static int PicoSVPDma(unsigned int source, int len, unsigned short **srcp, unsig void PicoSVPInit(void) { +#ifndef PSP + // this is to unmap tcache and make + // mem available for large ROMs, MCD, etc. + drc_cmn_cleanup(); +#endif } static void PicoSVPExit(void) @@ -109,20 +135,17 @@ static void PicoSVPExit(void) void PicoSVPStartup(void) { - void *tmp; + int ret; elprintf(EL_STATUS, "SVP startup"); - tmp = realloc(Pico.rom, 0x200000 + sizeof(*svp)); - if (tmp == NULL) - { + ret = PicoCartResize(Pico.romsize + sizeof(*svp)); + if (ret != 0) { elprintf(EL_STATUS|EL_SVP, "OOM for SVP data"); return; } - //PicoOpt &= ~0x20000; - Pico.rom = tmp; - svp = (void *) ((char *)tmp + 0x200000); + svp = (void *) ((char *)Pico.rom + Pico.romsize); memset(svp, 0, sizeof(*svp)); // init SVP compiler @@ -150,4 +173,3 @@ void PicoSVPStartup(void) PicoAHW |= PAHW_SVP; } -