|
From: SourceForge.net <no...@so...> - 2004-06-14 00:02:26
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2616449 By: diepeveen Hello, Please excuse me my ignorance of not knowing the diff between mingw and msys. I just downloaded it, installed every file i had and pray it works. Perhaps it would help if there was some icon i could click to install a file X The question is the only few lines of assembly i have in my program. Locking of course. Here is possible defines i have. My question is: "how do i get something to work with gcc for mingw". This is what i use currently for the different systems. What will work for x86 for mingw/msys + gcc ? Many thanks in advance, Vincent Diepeveen diep xs4all.nl #if IRIX /* IRIX */ #if (_MIPS_SZLONG == 32) #define Lock(v) {volatile unsigned long *tmpvar = &((v).abi_lock); while (*tmpvar); spin_lock(&(v));} #endif #if (_MIPS_SZLONG == 64) #define Lock(v) {volatile unsigned int *tmpvar = &((v).abi_lock); while (*tmpvar); spin_lock(&(v));} #endif #define SlowLock(v) spin_lock(&v) #define LockInit(v) init_lock(&v) #define Unlock(v) release_lock(&v) #define lockvar abilock_t #elif MSVC /* windows NT */ #define lockvar volatile int #define LockInit(v) ((v)=0) #define Unlock(v) ((v)=0) /* voor non-defined compilers onder windows: */ #if NOASSEMBLY # define Lock(v) do { while(InterlockedExchange((LPLONG)&(v),1) != 0); } while (0) #else __inline void LockA (volatile int *hPtr) { __asm { mov ecx, hPtr la: mov eax, 1 xchg eax, [ecx] test eax, eax jz end lb: mov eax, [ecx] test eax, eax jz la jmp lb end: } } #define Lock(v) LockA(&(v)) #endif #define SlowLock(v) Lock(&(v)) //#define Lock(v) {if(v){printf("was already locked\n");StatusSMP();}else{v=1;}} #elif IA64 #define Lock(v) spin_lock(&v) #define SlowLock(v) spin_lock(&v) #define LockInit(v) spin_lock_init(&v) #define Unlock(v) spin_unlock(&v) #define lockvar spinlock_t #else /* linux P6/PII/P3/K7 */ #define lockvar volatile int #define exchange(adr,reg) ({volatile int _ret;asm volatile ("xchg %0,%1":"=q"(_ret),"=m"(*(adr)):"m"(*(adr)),"0"(reg));_ret;}) #define LockInit(p) (p=0) #define Unlock(p) (exchange(&p,0)) #define SlowLock(p) while(exchange(&p,1)) while(p) #define Lock(p) while(exchange(&p,1)) while(p) #endif ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=286529 |