From ea7c12cee87abd981e5fb0af7c2dda549d30a72b Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 10 Mar 2017 07:25:55 -0600 Subject: [PATCH] delete some old libsnes libco junk --- .../Release/libco_msvc_win32.dll | Bin 7168 -> 0 bytes .../Release/libco_msvc_win32.lib | Bin 2446 -> 0 bytes libsnes/libco_msvc_win32/libco_msvc_win32.c | 178 ------------------ libsnes/libco_msvc_win32/libco_msvc_win32.sln | 20 -- .../libco_msvc_win32/libco_msvc_win32.vcxproj | 111 ----------- libsnes/libco_msvc_win32/readme.txt | 12 -- .../trying-to-port-to-mingw-win32.c | 178 ------------------ 7 files changed, 499 deletions(-) delete mode 100644 libsnes/libco_msvc_win32/Release/libco_msvc_win32.dll delete mode 100644 libsnes/libco_msvc_win32/Release/libco_msvc_win32.lib delete mode 100644 libsnes/libco_msvc_win32/libco_msvc_win32.c delete mode 100644 libsnes/libco_msvc_win32/libco_msvc_win32.sln delete mode 100644 libsnes/libco_msvc_win32/libco_msvc_win32.vcxproj delete mode 100644 libsnes/libco_msvc_win32/readme.txt delete mode 100644 libsnes/libco_msvc_win32/trying-to-port-to-mingw-win32.c diff --git a/libsnes/libco_msvc_win32/Release/libco_msvc_win32.dll b/libsnes/libco_msvc_win32/Release/libco_msvc_win32.dll deleted file mode 100644 index 6bd497731e7bc98fb88ab3bd2635344b0526dcdc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7168 zcmeHLdvIITnLn~6A{&_~ZA488gJPUEvr8OF*H=h>fJA(Q!&<5Qh#ZrLkfm!&wjSo{ z-o!~u>maw zZbWW>=Sp&%Ks$Z>)9!G_-+6rR^PTTI=UTo;j*xOfh#sJ-gdD?2n@8(^bGHccZFj$R z8+oPT?D}K6wzKQIqOr7fNJ#Yyp@cOYN+wgHwU@UFQqmerT3bHXX-%Xed|g#lWo=RQ z=D{z0Vz6?Jw**7ajd`P34?XvccR(ADd;7KVHE#@KukeI64py4I4{P`nMZTwt<6&*= zh=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t%NVb-1ZT8{HsUk+q=_4 z$RkMpxq<*`3Z>J0qBnlPI-H0n)6F%KkZeeYqkJNi-js-ig;YA#CvL(G)(}c3>h{@d ztf=K!AD%!__xrtmZ%fOz?GNqTS)BYKYx3-f9-h5al$d>_@3jx9Y1wkc9b&}jG6f?vx)ICJmKUx2?dMBG?MfM;&!u}pj;8t~KsD_vhUs?&sXE zxu@MfbieKXANRZN>IQ4Wy$y~ASHt}cEe#Jh_#2SmR_%{GZ_C=IYhslHr^1)nlx&A!T(~K7(#1J#8OHqylh>* zS+&-vb!)avl8(%5*D69LNk>*OyVgn1PLOlwF4fPSkCJz-0P7y$$P0v)fO9{PrhZ96 zN-SJZ;DZ+)JaA?=MR}Jj_H!iTaRMBRcq}~wX_eNLY-vZNwCG>K^jnLJq;V<&9b}f( zQAmWVjRw?+1gk*mv>o+?G$^Y%mm7b7d?|!ngj~7V9ttyeHzDT!=Y? zz*g9*R=SndxD>4raYg-)V7O_{AbKJ6Qi6>qMEJ>{)MI`I+6BP_K@c#gtxO8_1(pL0 zB;J^tN@r_m?J35uwY97<^ zgJ<7yb0ZzIEjK=|0-1#jU`J4w96Mh2=$4!$>ktEuj^5`me~kyxcz0k+tawsTrSWd> zVFr9kaLkCNxW3_3$ec^D(e%?kEuVQZnmCTZHh`vtT!?w#H72Eq^?u34fZqM*d6wKhrxV;i zM)kOWsK&oIzvP^YtDa`Z>$g8gQQ;>Rg1IZ~E&g0oXZfQR-^jxKDZ-!ls}}ChE&Pek HbE3b0Wxn_U diff --git a/libsnes/libco_msvc_win32/libco_msvc_win32.c b/libsnes/libco_msvc_win32/libco_msvc_win32.c deleted file mode 100644 index 98da435090..0000000000 --- a/libsnes/libco_msvc_win32/libco_msvc_win32.c +++ /dev/null @@ -1,178 +0,0 @@ -/* -libco.sjlj (2008-01-28) -author: Nach -license: public domain -*/ - -/* -* Note this was designed for UNIX systems. Based on ideas expressed in a paper -* by Ralf Engelschall. -* For SJLJ on other systems, one would want to rewrite springboard() and -* co_create() and hack the jmb_buf stack pointer. -*/ - -#define LIBCO_C -#define LIBCO_EXPORT -#include "../bsnes/libco/libco.h" -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - jmp_buf context; - coentry_t coentry; - void *stack; - unsigned long seh_frame, stack_top, stack_bottom; - cothread_t caller; -} cothread_struct; - -static thread_local cothread_struct co_primary; -static thread_local cothread_struct *co_running = 0; - - -//links of interest -//http://connect.microsoft.com/VisualStudio/feedback/details/100319/really-wierd-behaviour-in-crt-io-coupled-with-some-inline-assembly -//http://en.wikipedia.org/wiki/Thread_Information_Block -//http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/72093e46-4524-4f54-9f36-c7e8a309d1db/ //FS warning - - -#define WINVER 0x0400 -#define _WIN32_WINNT 0x0400 -#define WIN32_LEAN_AND_MEAN -#include - -#pragma warning(disable:4733) -#pragma warning(disable:4311) - -static void capture_fs(cothread_struct* rec) -{ - int temp; - __asm mov eax, dword ptr fs:[0]; - __asm mov temp, eax; - rec->seh_frame = temp; - __asm mov eax, dword ptr fs:[4]; - __asm mov temp, eax; - rec->stack_top = temp; - __asm mov eax, dword ptr fs:[8]; - __asm mov temp, eax; - rec->stack_bottom = temp; -} - -static void restore_fs(cothread_struct* rec) -{ - int temp; - temp = rec->seh_frame; - __asm mov eax, temp; - __asm mov dword ptr fs:[0], eax - temp = rec->stack_top; - __asm mov eax, temp; - __asm mov dword ptr fs:[4], eax - temp = rec->stack_bottom; - __asm mov eax, temp; - __asm mov dword ptr fs:[8], eax -} - -static void os_co_wrapper() -{ - cothread_struct* rec = (cothread_struct*)co_active(); - //__try - //{ - rec->coentry(); - //} - //__except(EXCEPTION_EXECUTE_HANDLER) - //{ - // //unhandled win32 exception in coroutine. - // //this coroutine will now be suspended permanently and control will be yielded to caller, for lack of anything better to do. - // //perhaps the process should just terminate. - // for(;;) - // { - // //dead coroutine - // co_switch(rec->caller); - // } - //} -} - -static void os_co_create(cothread_struct* rec, unsigned int size, coentry_t coentry) -{ - _JUMP_BUFFER* jb = (_JUMP_BUFFER*)&rec->context; - cothread_struct temp; - - jb->Esp = (unsigned long)rec->stack + size - 4; - jb->Eip = (unsigned long)os_co_wrapper; - - rec->stack_top = jb->Esp + 4; - rec->stack_bottom = (unsigned long)rec->stack; - - //wild assumption about SEH frame.. seems to work - capture_fs(&temp); - rec->seh_frame = temp.seh_frame; -} - -static void os_pre_setjmp(cothread_t target) -{ - cothread_struct* rec = (cothread_struct*)target; - capture_fs(co_running); - rec->caller = co_running; -} - -static void os_pre_longjmp(cothread_struct* rec) -{ - restore_fs(rec); -} - -__declspec(dllexport) cothread_t co_active() -{ - if(!co_running) co_running = &co_primary; - return (cothread_t)co_running; -} - -__declspec(dllexport) cothread_t co_create(unsigned int size, void (*coentry)(void)) -{ - cothread_struct *thread; - - if(!co_running) co_running = &co_primary; - - thread = (cothread_struct*)malloc(sizeof(cothread_struct)); - if(thread) - { - thread->coentry = coentry; - thread->stack = malloc(size); - { - setjmp(thread->context); - os_co_create(thread,size,coentry); - } - } - - return (cothread_t)thread; -} - -__declspec(dllexport) void co_delete(cothread_t cothread) -{ - if(cothread) - { - if(((cothread_struct*)cothread)->stack) - { - free(((cothread_struct*)cothread)->stack); - } - free(cothread); - } -} - -__declspec(dllexport) void co_switch(cothread_t cothread) -{ - os_pre_setjmp(cothread); - if(!setjmp(co_running->context)) - { - co_running = (cothread_struct*)cothread; - os_pre_longjmp(co_running); - longjmp(co_running->context,0); - } -} - -#ifdef __cplusplus -} -#endif diff --git a/libsnes/libco_msvc_win32/libco_msvc_win32.sln b/libsnes/libco_msvc_win32/libco_msvc_win32.sln deleted file mode 100644 index 54d91a63f0..0000000000 --- a/libsnes/libco_msvc_win32/libco_msvc_win32.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libco_msvc_win32", "libco_msvc_win32.vcxproj", "{C5D03072-BBF9-4DED-8CE6-5467736251BF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C5D03072-BBF9-4DED-8CE6-5467736251BF}.Debug|Win32.ActiveCfg = Debug|Win32 - {C5D03072-BBF9-4DED-8CE6-5467736251BF}.Debug|Win32.Build.0 = Debug|Win32 - {C5D03072-BBF9-4DED-8CE6-5467736251BF}.Release|Win32.ActiveCfg = Release|Win32 - {C5D03072-BBF9-4DED-8CE6-5467736251BF}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libsnes/libco_msvc_win32/libco_msvc_win32.vcxproj b/libsnes/libco_msvc_win32/libco_msvc_win32.vcxproj deleted file mode 100644 index 949f2d3d81..0000000000 --- a/libsnes/libco_msvc_win32/libco_msvc_win32.vcxproj +++ /dev/null @@ -1,111 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C5D03072-BBF9-4DED-8CE6-5467736251BF} - libco_msvc_win32 - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - - - - - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBCO_MSVC_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - - - true - Windows - MachineX86 - - - copy $(TargetPath) ..\..\BizHawk.MultiClient\output\dll - - - - - - - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBCO_MSVC_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - true - Windows - true - true - MachineX86 - - - copy $(TargetPath) ..\..\BizHawk.MultiClient\output\dll - - - - - - - - - - - - \ No newline at end of file diff --git a/libsnes/libco_msvc_win32/readme.txt b/libsnes/libco_msvc_win32/readme.txt deleted file mode 100644 index b060d289ee..0000000000 --- a/libsnes/libco_msvc_win32/readme.txt +++ /dev/null @@ -1,12 +0,0 @@ -* Why does this exist? - -Because zeromus can't figure out how to successfully compile this code in mingw32. -My efforts are in trying-to-port-to-mingw-win32.c; I don't know why it isn't working. - -* Why do we need this code? - -Because libco needs to be a bit more properly win32 in order for it to get used from .net code. -.net throws exceptions in each thread when it needs to suspend them for GC. -Those exceptions get garbled without more proper win32 stack frame setup, and the process terminates. -Additionally, you wont be able to debug very well from callbacks out of a coroutine into c# without this. - * Note: you can't debug very well anyway due to mingw code having no debug symbols in the callstack. \ No newline at end of file diff --git a/libsnes/libco_msvc_win32/trying-to-port-to-mingw-win32.c b/libsnes/libco_msvc_win32/trying-to-port-to-mingw-win32.c deleted file mode 100644 index 8d7f43da3d..0000000000 --- a/libsnes/libco_msvc_win32/trying-to-port-to-mingw-win32.c +++ /dev/null @@ -1,178 +0,0 @@ -//links of interest -//http://connect.microsoft.com/VisualStudio/feedback/details/100319/really-wierd-behaviour-in-crt-io-coupled-with-some-inline-assembly -//http://en.wikipedia.org/wiki/Thread_Information_Block -//http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/72093e46-4524-4f54-9f36-c7e8a309d1db/ //FS warning - -#define LIBCO_C -#define LIBCO_EXPORT -#include "../bsnes/libco/libco.h" -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (*coentry_t)(void); - -typedef struct -{ - jmp_buf context; - coentry_t coentry; - void *stack; - unsigned long seh_frame, stack_top, stack_bottom; - cothread_t caller; -} cothread_struct; - -static thread_local cothread_struct co_primary; -static thread_local cothread_struct *co_running = 0; - -#define WINVER 0x0400 -#define _WIN32_WINNT 0x0400 -#define WIN32_LEAN_AND_MEAN -#include - -#ifndef _MSC_VER -typedef struct __JUMP_BUFFER { - unsigned long Ebp; - unsigned long Ebx; - unsigned long Edi; - unsigned long Esi; - unsigned long Esp; - unsigned long Eip; - unsigned long Registration; - unsigned long TryLevel; - unsigned long Cookie; - unsigned long UnwindFunc; - unsigned long UnwindData[6]; -} _JUMP_BUFFER; -#endif - -#pragma warning(disable:4733) -#pragma warning(disable:4311) - -static void capture_fs(cothread_struct* rec) -{ - asm( - "mov %0, dword ptr fs:[0];" - "mov %1, dword ptr fs:[4];" - "mov %2, dword ptr fs:[8];" - :"=r"(rec->seh_frame), "=r"(rec->stack_top), "=r"(rec->stack_bottom) - : - : - ); -} - -static void restore_fs(cothread_struct* rec) -{ - asm( - "mov dword ptr fs:[0], %0;" - "mov dword ptr fs:[4], %1;" - "mov dword ptr fs:[8], %2;" - : - :"r"(rec->seh_frame), "r"(rec->stack_top), "r"(rec->stack_bottom) - : - ); -} - -static void os_co_wrapper() -{ - cothread_struct* rec = (cothread_struct*)co_active(); - //__try - //{ - rec->coentry(); - //} - //__except(EXCEPTION_EXECUTE_HANDLER) - //{ - // //unhandled win32 exception in coroutine. - // //this coroutine will now be suspended permanently and control will be yielded to caller, for lack of anything better to do. - // //perhaps the process should just terminate. - // for(;;) - // { - // //dead coroutine - // co_switch(rec->caller); - // } - //} -} - -static void os_co_create(cothread_struct* rec, unsigned int size, coentry_t coentry) -{ - _JUMP_BUFFER* jb = (_JUMP_BUFFER*)&rec->context; - cothread_struct temp; - - jb->Esp = (unsigned long)rec->stack + size - 4; - jb->Eip = (unsigned long)os_co_wrapper; - - rec->stack_top = jb->Esp + 4; - rec->stack_bottom = (unsigned long)rec->stack; - - //wild assumption about SEH frame.. seems to work - capture_fs(&temp); - rec->seh_frame = temp.seh_frame; -} - -static void os_pre_setjmp(cothread_t target) -{ - cothread_struct* rec = (cothread_struct*)target; - capture_fs(co_running); - rec->caller = co_running; -} - -static void os_pre_longjmp(cothread_struct* rec) -{ - restore_fs(rec); -} - -cothread_t co_active() -{ - if(!co_running) co_running = &co_primary; - return (cothread_t)co_running; -} - - -cothread_t co_create(unsigned int size, void (*coentry)(void)) -{ - cothread_struct *thread; - - if(!co_running) co_running = &co_primary; - - thread = (cothread_struct*)malloc(sizeof(cothread_struct)); - if(thread) - { - thread->coentry = coentry; - thread->stack = malloc(size); - { - setjmp(thread->context); - os_co_create(thread,size,coentry); - } - } - - return (cothread_t)thread; -} - -void co_delete(cothread_t cothread) -{ - if(cothread) - { - if(((cothread_struct*)cothread)->stack) - { - free(((cothread_struct*)cothread)->stack); - } - free(cothread); - } -} - -void co_switch(cothread_t cothread) -{ - os_pre_setjmp(cothread); - if(!setjmp(co_running->context)) - { - co_running = (cothread_struct*)cothread; - os_pre_longjmp(co_running); - longjmp(co_running->context,0); - } -} - -#ifdef __cplusplus -} -#endif