diff options
author | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2015-09-16 14:54:51 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2015-09-16 14:54:51 -0300 |
commit | 8e9ce0ee41af432e2ca023e3ff2657b5c07ac529 (patch) | |
tree | 84f1f296fe7dd123cde388cb244a5e7f8475eb7a | |
parent | e3e6c2dbceae6f3ee3afe4471a6a823495d74cd0 (diff) | |
download | abslibre-8e9ce0ee41af432e2ca023e3ff2657b5c07ac529.tar.gz abslibre-8e9ce0ee41af432e2ca023e3ff2657b5c07ac529.tar.bz2 abslibre-8e9ce0ee41af432e2ca023e3ff2657b5c07ac529.zip |
pcr/reicast: add more comments
-rw-r--r-- | pcr/reicast-git/PKGBUILD | 11 | ||||
-rw-r--r-- | pcr/reicast-git/error-mem.txt | 168 |
2 files changed, 177 insertions, 2 deletions
diff --git a/pcr/reicast-git/PKGBUILD b/pcr/reicast-git/PKGBUILD index 9c567f7a1..6f4f6e9e2 100644 --- a/pcr/reicast-git/PKGBUILD +++ b/pcr/reicast-git/PKGBUILD @@ -2,6 +2,9 @@ # Maintainer: André Silva <emulatorman@parabola.nu> # Maintainer: Márcio Silva <coadde@parabola.nu> +# error: in fault_handler -> ../../core/linux/common.cpp : 99 +# read: error-mem.txt + pkgname=reicast-git pkgver=r1651.56f8ffa pkgrel=2 @@ -46,8 +49,12 @@ build () { mkdir -vm 0755 "$srcdir"/pkgbuild-dir if [ $CARCH == x86_64 ]; then make -C reicast/shell/linux platform=x64 PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-dir install -# mkdir -vm 0755 "$srcdir"/pkgbuild-cpp-dir -# make -C reicast/shell/linux platform=lincpp PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-cpp-dir install + # Error in platform=lincpp: + # ../../core/linux-dist/evdev.cpp:287:65: required from here + # /usr/include/c++/5.2.0/tuple:1172:70: error: use of deleted function 'EvdevControllerMapping::EvdevControllerMapping()' + # second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...) + # mkdir -vm 0755 "$srcdir"/pkgbuild-cpp-dir + # make -C reicast/shell/linux platform=lincpp PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-cpp-dir install elif [ $CARCH == i686 ]; then make -C reicast/shell/linux platform=x86 PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-dir install fi diff --git a/pcr/reicast-git/error-mem.txt b/pcr/reicast-git/error-mem.txt new file mode 100644 index 000000000..341d63e54 --- /dev/null +++ b/pcr/reicast-git/error-mem.txt @@ -0,0 +1,168 @@ +in fault_handler -> ../../core/linux/common.cpp : 99 +------------------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------------------- +core/linux/common.cpp +------------------------------------------------------------------------------------------------- +#if !defined(TARGET_NO_EXCEPTIONS) +bool ngen_Rewrite(unat& addr,unat retadr,unat acc); +u32* ngen_readm_fail_v2(u32* ptr,u32* regs,u32 saddr); +bool VramLockedWrite(u8* address); +bool BM_LockedWrite(u8* address); + +#if HOST_OS == OS_DARWIN +void sigill_handler(int sn, siginfo_t * si, void *segfault_ctx) { + + rei_host_context_t ctx; + + context_from_segfault(&ctx, segfault_ctx); + + unat pc = (unat)ctx.pc; + bool dyna_cde = (pc>(unat)CodeCache) && (pc<(unat)(CodeCache + CODE_SIZE)); + + printf("SIGILL @ %08X, fault_handler+0x%08X ... %08X -> was not in vram, %d\n", pc, pc - (unat)sigill_handler, (unat)si->si_addr, dyna_cde); + + printf("Entering infiniloop"); + + for (;;); + printf("PC is used here %08X\n", pc); +} +#endif + +#if !defined(TARGET_NO_EXCEPTIONS) +void fault_handler (int sn, siginfo_t * si, void *segfault_ctx) +{ + rei_host_context_t ctx; + + context_from_segfault(&ctx, segfault_ctx); + + bool dyna_cde = ((unat)ctx.pc>(unat)CodeCache) && ((unat)ctx.pc<(unat)(CodeCache + CODE_SIZE)); + + //ucontext_t* ctx=(ucontext_t*)ctxr; + //printf("mprot hit @ ptr 0x%08X @@ code: %08X, %d\n",si->si_addr,ctx->uc_mcontext.arm_pc,dyna_cde); + + + if (VramLockedWrite((u8*)si->si_addr) || BM_LockedWrite((u8*)si->si_addr)) + return; + #if FEAT_SHREC == DYNAREC_JIT + #if HOST_CPU==CPU_ARM + else if (dyna_cde) + { + ctx.pc = (u32)ngen_readm_fail_v2((u32*)ctx.pc, ctx.r, (unat)si->si_addr); + + context_to_segfault(&ctx, segfault_ctx); + } + #elif HOST_CPU==CPU_X86 + else if (ngen_Rewrite((unat&)ctx.pc, *(unat*)ctx.esp, ctx.eax)) + { + //remove the call from call stack + ctx.esp += 4; + //restore the addr from eax to ecx so it's valid again + ctx.ecx = ctx.eax; + + context_to_segfault(&ctx, segfault_ctx); + } + #elif HOST_CPU == CPU_X64 + //x64 has no rewrite support + #else + #error JIT: Not supported arch + #endif + #endif + else + { + printf("SIGSEGV @ %p (fault_handler+0x%p) ... %p -> was not in vram\n", ctx.pc, ctx.pc - (unat)fault_handler, si->si_addr); + die("segfault"); + signal(SIGSEGV, SIG_DFL); + } +} +#endif +------------------------------------------------------------------------------------------------- +Error on : VramLockedWrite (video-ram - 8MB) || BM_LockedWrite (motherboard-ram - 16MB) +------------------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------------------- +core/hw/mem/_vmem.cpp +------------------------------------------------------------------------------------------------- +bool BM_LockedWrite(u8* address) +{ + if (!_nvmem_enabled()) + return false; + +#if FEAT_SHREC != DYNAREC_NONE + u32 addr=address-(u8*)p_sh4rcb->fpcb; + + address=(u8*)p_sh4rcb->fpcb+ (addr&~PAGE_MASK); + + if (addr<sizeof(p_sh4rcb->fpcb)) + { + //printf("Allocated %d PAGES [%08X]\n",++pagecnt,addr); + +#if HOST_OS==OS_WINDOWS + verify(VirtualAlloc(address,PAGE_SIZE,MEM_COMMIT,PAGE_READWRITE)); +#else + mprotect (address, PAGE_SIZE, PROT_READ | PROT_WRITE); +#endif + + bm_vmem_pagefill((void**)address,PAGE_SIZE); + + return true; + } +#else +die("BM_LockedWrite and NO REC"); +#endif + return false; +} +------------------------------------------------------------------------------------------------- +core/rend/TexCache.cpp +------------------------------------------------------------------------------------------------- +bool VramLockedWrite(u8* address) +{ + size_t offset=address-vram.data; + + if (offset<VRAM_SIZE) + { + + size_t addr_hash = offset/PAGE_SIZE; + vector<vram_block*>* list=&VramLocks[addr_hash]; + + { + vramlist_lock.Lock(); + + for (size_t i=0;i<list->size();i++) + { + if ((*list)[i]) + { + libPvr_LockedBlockWrite((*list)[i],(u32)offset); + + if ((*list)[i]) + { + msgboxf("Error : pvr is supposed to remove lock",MBX_OK); + dbgbreak; + } + + } + } + list->clear(); + + vram.UnLockRegion((u32)offset&(~(PAGE_SIZE-1)),PAGE_SIZE); + + //TODO: Fix this for 32M wrap as well + if (_nvmem_enabled() && VRAM_SIZE == 0x800000) { + vram.UnLockRegion((u32)offset&(~(PAGE_SIZE-1)) + VRAM_SIZE,PAGE_SIZE); + } + + vramlist_lock.Unlock(); + } + + return true; + } + else + return false; +} +------------------------------------------------------------------------------------------------- +core/rend/TexCache.h +------------------------------------------------------------------------------------------------- +void vram_LockedWrite(u32 offset64); +------------------------------------------------------------------------------------------------- +core/stdclass.cpp +------------------------------------------------------------------------------------------------- +bool VramLockedWrite(u8* address); +bool RamLockedWrite(u8* address,u32* sp); |