Changeset 18521 in vbox for trunk/include/iprt
- Timestamp:
- Mar 30, 2009 11:26:14 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm.h
r18368 r18521 53 53 # pragma intrinsic(__writemsr) 54 54 # pragma intrinsic(__outbyte) 55 # pragma intrinsic(__outbytestring) 55 56 # pragma intrinsic(__outword) 57 # pragma intrinsic(__outwordstring) 56 58 # pragma intrinsic(__outdword) 59 # pragma intrinsic(__outdwordstring) 57 60 # pragma intrinsic(__inbyte) 61 # pragma intrinsic(__inbytestring) 58 62 # pragma intrinsic(__inword) 63 # pragma intrinsic(__inwordstring) 59 64 # pragma intrinsic(__indword) 65 # pragma intrinsic(__indwordstring) 60 66 # pragma intrinsic(__invlpg) 61 67 # pragma intrinsic(__stosd) … … 2114 2120 * Writes a 8-bit unsigned integer to an I/O port, ordered. 2115 2121 * 2116 * @param Port I/O port to read from.2122 * @param Port I/O port to write to. 2117 2123 * @param u8 8-bit integer to write. 2118 2124 */ … … 2143 2149 2144 2150 /** 2145 * Gets a 8-bit unsigned integer from an I/O port, ordered.2151 * Reads a 8-bit unsigned integer from an I/O port, ordered. 2146 2152 * 2147 2153 * @returns 8-bit integer. … … 2178 2184 * Writes a 16-bit unsigned integer to an I/O port, ordered. 2179 2185 * 2180 * @param Port I/O port to read from.2186 * @param Port I/O port to write to. 2181 2187 * @param u16 16-bit integer to write. 2182 2188 */ … … 2207 2213 2208 2214 /** 2209 * Gets a 16-bit unsigned integer from an I/O port, ordered.2215 * Reads a 16-bit unsigned integer from an I/O port, ordered. 2210 2216 * 2211 2217 * @returns 16-bit integer. … … 2242 2248 * Writes a 32-bit unsigned integer to an I/O port, ordered. 2243 2249 * 2244 * @param Port I/O port to read from.2250 * @param Port I/O port to write to. 2245 2251 * @param u32 32-bit integer to write. 2246 2252 */ … … 2271 2277 2272 2278 /** 2273 * Gets a 32-bit unsigned integer from an I/O port, ordered.2279 * Reads a 32-bit unsigned integer from an I/O port, ordered. 2274 2280 * 2275 2281 * @returns 32-bit integer. … … 2302 2308 #endif 2303 2309 2304 /** @todo string i/o */ 2310 2311 /** 2312 * Writes a string of 8-bit unsigned integer items to an I/O port, ordered. 2313 * 2314 * @param Port I/O port to write to. 2315 * @param pau8 Pointer to the string buffer. 2316 * @param c The number of items to write. 2317 */ 2318 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 2319 DECLASM(void) ASMOutStrU8(RTIOPORT Port, uint8_t const *pau8, size_t c); 2320 #else 2321 DECLINLINE(void) ASMOutStrU8(RTIOPORT Port, uint8_t const *pau8, size_t c) 2322 { 2323 # if RT_INLINE_ASM_GNU_STYLE 2324 __asm__ __volatile__("rep; outsb\n\t" 2325 : "+S" (pau8), 2326 "+c" (c) 2327 : "d" (Port)); 2328 2329 # elif RT_INLINE_ASM_USES_INTRIN 2330 __outbytestring(Port, (unsigned char *)pau8, (unsigned long)c); 2331 2332 # else 2333 __asm 2334 { 2335 mov dx, [Port] 2336 mov ecx, [c] 2337 mov eax, [pau8] 2338 xchg esi, eax 2339 rep outsb 2340 xchg esi, eax 2341 } 2342 # endif 2343 } 2344 #endif 2345 2346 2347 /** 2348 * Reads a string of 8-bit unsigned integer items from an I/O port, ordered. 2349 * 2350 * @param Port I/O port to read from. 2351 * @param pau8 Pointer to the string buffer (output). 2352 * @param c The number of items to read. 2353 */ 2354 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 2355 DECLASM(void) ASMInStrU8(RTIOPORT Port, uint8_t *pau8, size_t c); 2356 #else 2357 DECLINLINE(void) ASMInStrU8(RTIOPORT Port, uint8_t *pau8, size_t c) 2358 { 2359 # if RT_INLINE_ASM_GNU_STYLE 2360 __asm__ __volatile__("rep; insb\n\t" 2361 : "+D" (pau8), 2362 "+c" (c) 2363 : "d" (Port)); 2364 2365 # elif RT_INLINE_ASM_USES_INTRIN 2366 __inbytestring(Port, pau8, (unsigned long)c); 2367 2368 # else 2369 __asm 2370 { 2371 mov dx, [Port] 2372 mov ecx, [c] 2373 mov eax, [pau8] 2374 xchg edi, eax 2375 rep insb 2376 xchg edi, eax 2377 } 2378 # endif 2379 } 2380 #endif 2381 2382 2383 /** 2384 * Writes a string of 16-bit unsigned integer items to an I/O port, ordered. 2385 * 2386 * @param Port I/O port to write to. 2387 * @param pau16 Pointer to the string buffer. 2388 * @param c The number of items to write. 2389 */ 2390 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 2391 DECLASM(void) ASMOutStrU16(RTIOPORT Port, uint16_t const *pau16, size_t c); 2392 #else 2393 DECLINLINE(void) ASMOutStrU16(RTIOPORT Port, uint16_t const *pau16, size_t c) 2394 { 2395 # if RT_INLINE_ASM_GNU_STYLE 2396 __asm__ __volatile__("rep; outsw\n\t" 2397 : "+S" (pau16), 2398 "+c" (c) 2399 : "d" (Port)); 2400 2401 # elif RT_INLINE_ASM_USES_INTRIN 2402 __outwordstring(Port, (unsigned short *)pau16, (unsigned long)c); 2403 2404 # else 2405 __asm 2406 { 2407 mov dx, [Port] 2408 mov ecx, [c] 2409 mov eax, [pau16] 2410 xchg esi, eax 2411 rep outsw 2412 xchg esi, eax 2413 } 2414 # endif 2415 } 2416 #endif 2417 2418 2419 /** 2420 * Reads a string of 16-bit unsigned integer items from an I/O port, ordered. 2421 * 2422 * @param Port I/O port to read from. 2423 * @param pau16 Pointer to the string buffer (output). 2424 * @param c The number of items to read. 2425 */ 2426 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 2427 DECLASM(void) ASMInStrU16(RTIOPORT Port, uint16_t *pau16, size_t c); 2428 #else 2429 DECLINLINE(void) ASMInStrU16(RTIOPORT Port, uint16_t *pau16, size_t c) 2430 { 2431 # if RT_INLINE_ASM_GNU_STYLE 2432 __asm__ __volatile__("rep; insw\n\t" 2433 : "+D" (pau16), 2434 "+c" (c) 2435 : "d" (Port)); 2436 2437 # elif RT_INLINE_ASM_USES_INTRIN 2438 __inwordstring(Port, pau16, (unsigned long)c); 2439 2440 # else 2441 __asm 2442 { 2443 mov dx, [Port] 2444 mov ecx, [c] 2445 mov eax, [pau16] 2446 xchg edi, eax 2447 rep insw 2448 xchg edi, eax 2449 } 2450 # endif 2451 } 2452 #endif 2453 2454 2455 /** 2456 * Writes a string of 32-bit unsigned integer items to an I/O port, ordered. 2457 * 2458 * @param Port I/O port to write to. 2459 * @param pau32 Pointer to the string buffer. 2460 * @param c The number of items to write. 2461 */ 2462 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 2463 DECLASM(void) ASMOutStrU32(RTIOPORT Port, uint32_t const *pau32, size_t c); 2464 #else 2465 DECLINLINE(void) ASMOutStrU32(RTIOPORT Port, uint32_t const *pau32, size_t c) 2466 { 2467 # if RT_INLINE_ASM_GNU_STYLE 2468 __asm__ __volatile__("rep; outsl\n\t" 2469 : "+S" (pau32), 2470 "+c" (c) 2471 : "d" (Port)); 2472 2473 # elif RT_INLINE_ASM_USES_INTRIN 2474 __outdwordstring(Port, (unsigned long *)pau32, (unsigned long)c); 2475 2476 # else 2477 __asm 2478 { 2479 mov dx, [Port] 2480 mov ecx, [c] 2481 mov eax, [pau32] 2482 xchg esi, eax 2483 rep outsd 2484 xchg esi, eax 2485 } 2486 # endif 2487 } 2488 #endif 2489 2490 2491 /** 2492 * Reads a string of 32-bit unsigned integer items from an I/O port, ordered. 2493 * 2494 * @param Port I/O port to read from. 2495 * @param pau32 Pointer to the string buffer (output). 2496 * @param c The number of items to read. 2497 */ 2498 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN 2499 DECLASM(void) ASMInStrU32(RTIOPORT Port, uint32_t *pau32, size_t c); 2500 #else 2501 DECLINLINE(void) ASMInStrU32(RTIOPORT Port, uint32_t *pau32, size_t c) 2502 { 2503 # if RT_INLINE_ASM_GNU_STYLE 2504 __asm__ __volatile__("rep; insl\n\t" 2505 : "+D" (pau32), 2506 "+c" (c) 2507 : "d" (Port)); 2508 2509 # elif RT_INLINE_ASM_USES_INTRIN 2510 __indwordstring(Port, (unsigned long *)pau32, (unsigned long)c); 2511 2512 # else 2513 __asm 2514 { 2515 mov dx, [Port] 2516 mov ecx, [c] 2517 mov eax, [pau32] 2518 xchg edi, eax 2519 rep insd 2520 xchg edi, eax 2521 } 2522 # endif 2523 } 2524 #endif 2305 2525 2306 2526
Note:
See TracChangeset
for help on using the changeset viewer.