Changeset 9581 in vbox
- Timestamp:
- Jun 10, 2008 8:41:24 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 31880
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm.h
r9528 r9581 2155 2155 # if RT_INLINE_ASM_GNU_STYLE 2156 2156 # if defined(PIC) || defined(RT_OS_DARWIN) /* darwin: 4.0.1 compiler option / bug? */ 2157 uint32_t u32 = (uint32_t)u64;2157 uint32_t u32EBX = (uint32_t)u64; 2158 2158 __asm__ __volatile__(/*"xchgl %%esi, %5\n\t"*/ 2159 2159 "xchgl %%ebx, %3\n\t" … … 2161 2161 "lock; cmpxchg8b (%5)\n\t" 2162 2162 "jnz 1b\n\t" 2163 " xchgl %%ebx, %3\n\t"2163 "movl %3, %%ebx\n\t" 2164 2164 /*"xchgl %%esi, %5\n\t"*/ 2165 2165 : "=A" (u64), 2166 2166 "=m" (*pu64) 2167 2167 : "0" (*pu64), 2168 "m" ( u32 ),2168 "m" ( u32EBX ), 2169 2169 "c" ( (uint32_t)(u64 >> 32) ), 2170 2170 "S" (pu64) ); … … 2429 2429 # if RT_INLINE_ASM_GNU_STYLE 2430 2430 # if defined(PIC) || defined(RT_OS_DARWIN) /* darwin: 4.0.1 compiler option / bug? */ 2431 uint32_t u32 = (uint32_t)u64New;2431 uint32_t u32EBX = (uint32_t)u64New; 2432 2432 uint32_t u32Spill; 2433 2433 __asm__ __volatile__("xchgl %%ebx, %4\n\t" 2434 2434 "lock; cmpxchg8b (%6)\n\t" 2435 2435 "setz %%al\n\t" 2436 " xchgl %%ebx, %4\n\t"2436 "movl %4, %%ebx\n\t" 2437 2437 "movzbl %%al, %%eax\n\t" 2438 2438 : "=a" (u32Ret), … … 2440 2440 "=m" (*pu64) 2441 2441 : "A" (u64Old), 2442 "m" ( u32 ),2442 "m" ( u32EBX ), 2443 2443 "c" ( (uint32_t)(u64New >> 32) ), 2444 2444 "S" (pu64) ); … … 3265 3265 __asm__ __volatile__("xchgl %%ebx, %3\n\t" 3266 3266 "lock; cmpxchg8b (%5)\n\t" 3267 " xchgl %%ebx, %3\n\t"3267 "movl %3, %%ebx\n\t" 3268 3268 : "=A" (u64), 3269 3269 "=m" (*pu64) … … 3335 3335 __asm__ __volatile__("xchgl %%ebx, %3\n\t" 3336 3336 "lock; cmpxchg8b (%5)\n\t" 3337 " xchgl %%ebx, %3\n\t"3337 "movl %3, %%ebx\n\t" 3338 3338 : "=A" (u64), 3339 3339 "=m" (*pu64) … … 4847 4847 */ 4848 4848 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 4849 DECLASM(bool) ASMBitTest( volatile void *pvBitmap, int32_t iBit);4850 #else 4851 DECLINLINE(bool) ASMBitTest( volatile void *pvBitmap, int32_t iBit)4849 DECLASM(bool) ASMBitTest(const volatile void *pvBitmap, int32_t iBit); 4850 #else 4851 DECLINLINE(bool) ASMBitTest(const volatile void *pvBitmap, int32_t iBit) 4852 4852 { 4853 4853 union { bool f; uint32_t u32; uint8_t u8; } rc; … … 4859 4859 "setc %b0\n\t" 4860 4860 "andl $1, %0\n\t" 4861 : "=q" (rc.u32) ,4862 "=m" (*(volatile long *)pvBitmap)4863 :"Ir" (iBit)4861 : "=q" (rc.u32) 4862 : "m" (*(const volatile long *)pvBitmap), 4863 "Ir" (iBit) 4864 4864 : "memory"); 4865 4865 # else … … 4975 4975 */ 4976 4976 #if RT_INLINE_ASM_EXTERNAL 4977 DECLASM(int) ASMBitFirstClear( volatile void *pvBitmap, uint32_t cBits);4978 #else 4979 DECLINLINE(int) ASMBitFirstClear( volatile void *pvBitmap, uint32_t cBits)4977 DECLASM(int) ASMBitFirstClear(const volatile void *pvBitmap, uint32_t cBits); 4978 #else 4979 DECLINLINE(int) ASMBitFirstClear(const volatile void *pvBitmap, uint32_t cBits) 4980 4980 { 4981 4981 if (cBits) … … 5061 5061 */ 5062 5062 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 5063 DECLASM(int) ASMBitNextClear( volatile void *pvBitmap, uint32_t cBits, uint32_t iBitPrev);5064 #else 5065 DECLINLINE(int) ASMBitNextClear( volatile void *pvBitmap, uint32_t cBits, uint32_t iBitPrev)5063 DECLASM(int) ASMBitNextClear(const volatile void *pvBitmap, uint32_t cBits, uint32_t iBitPrev); 5064 #else 5065 DECLINLINE(int) ASMBitNextClear(const volatile void *pvBitmap, uint32_t cBits, uint32_t iBitPrev) 5066 5066 { 5067 5067 int iBit = ++iBitPrev & 31; 5068 pvBitmap = ( volatile char *)pvBitmap + ((iBitPrev >> 5) << 2);5068 pvBitmap = (const volatile char *)pvBitmap + ((iBitPrev >> 5) << 2); 5069 5069 cBits -= iBitPrev & ~31; 5070 5070 if (iBit) 5071 5071 { 5072 5072 /* inspect the first dword. */ 5073 uint32_t u32 = (~*( volatile uint32_t *)pvBitmap) >> iBit;5073 uint32_t u32 = (~*(const volatile uint32_t *)pvBitmap) >> iBit; 5074 5074 # if RT_INLINE_ASM_USES_INTRIN 5075 5075 unsigned long ulBit = 0; … … 5102 5102 if (cBits > 32) 5103 5103 { 5104 iBit = ASMBitFirstClear(( volatile char *)pvBitmap + sizeof(uint32_t), cBits - 32);5104 iBit = ASMBitFirstClear((const volatile char *)pvBitmap + sizeof(uint32_t), cBits - 32); 5105 5105 if (iBit >= 0) 5106 5106 return iBit + (iBitPrev & ~31) + 32; … … 5128 5128 */ 5129 5129 #if RT_INLINE_ASM_EXTERNAL 5130 DECLASM(int) ASMBitFirstSet( volatile void *pvBitmap, uint32_t cBits);5131 #else 5132 DECLINLINE(int) ASMBitFirstSet( volatile void *pvBitmap, uint32_t cBits)5130 DECLASM(int) ASMBitFirstSet(const volatile void *pvBitmap, uint32_t cBits); 5131 #else 5132 DECLINLINE(int) ASMBitFirstSet(const volatile void *pvBitmap, uint32_t cBits) 5133 5133 { 5134 5134 if (cBits) … … 5213 5213 */ 5214 5214 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 5215 DECLASM(int) ASMBitNextSet( volatile void *pvBitmap, uint32_t cBits, uint32_t iBitPrev);5216 #else 5217 DECLINLINE(int) ASMBitNextSet( volatile void *pvBitmap, uint32_t cBits, uint32_t iBitPrev)5215 DECLASM(int) ASMBitNextSet(const volatile void *pvBitmap, uint32_t cBits, uint32_t iBitPrev); 5216 #else 5217 DECLINLINE(int) ASMBitNextSet(const volatile void *pvBitmap, uint32_t cBits, uint32_t iBitPrev) 5218 5218 { 5219 5219 int iBit = ++iBitPrev & 31; 5220 pvBitmap = ( volatile char *)pvBitmap + ((iBitPrev >> 5) << 2);5220 pvBitmap = (const volatile char *)pvBitmap + ((iBitPrev >> 5) << 2); 5221 5221 cBits -= iBitPrev & ~31; 5222 5222 if (iBit) 5223 5223 { 5224 5224 /* inspect the first dword. */ 5225 uint32_t u32 = *( volatile uint32_t *)pvBitmap >> iBit;5225 uint32_t u32 = *(const volatile uint32_t *)pvBitmap >> iBit; 5226 5226 # if RT_INLINE_ASM_USES_INTRIN 5227 5227 unsigned long ulBit = 0; … … 5254 5254 if (cBits > 32) 5255 5255 { 5256 iBit = ASMBitFirstSet(( volatile char *)pvBitmap + sizeof(uint32_t), cBits - 32);5256 iBit = ASMBitFirstSet((const volatile char *)pvBitmap + sizeof(uint32_t), cBits - 32); 5257 5257 if (iBit >= 0) 5258 5258 return iBit + (iBitPrev & ~31) + 32;
Note:
See TracChangeset
for help on using the changeset viewer.