vbox的更動 36170 路徑 trunk/src/recompiler/cutils.c
- 時間撮記:
- 2011-3-4 下午12:49:02 (14 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/recompiler/cutils.c
r36140 r36170 23 23 */ 24 24 #include "qemu-common.h" 25 #include "host-utils.h" 25 26 26 27 #ifdef VBOX 27 28 #include "osdep.h" 29 28 30 29 31 static inline int toupper(int ch) { … … 565 567 q = val; 566 568 while (*q != '\0') { 567 if ( toupper(*p) !=toupper(*q))569 if (qemu_toupper(*p) != qemu_toupper(*q)) 568 570 return 0; 569 571 p++; … … 589 591 return t; 590 592 } 591 #endif /* VBOX */ 593 #endif /* !VBOX */ 594 595 int qemu_fls(int i) 596 { 597 return 32 - clz32(i); 598 } 599 600 #ifndef VBOX 601 /* io vectors */ 602 603 void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint) 604 { 605 qiov->iov = qemu_malloc(alloc_hint * sizeof(struct iovec)); 606 qiov->niov = 0; 607 qiov->nalloc = alloc_hint; 608 qiov->size = 0; 609 } 610 611 void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len) 612 { 613 if (qiov->niov == qiov->nalloc) { 614 qiov->nalloc = 2 * qiov->nalloc + 1; 615 qiov->iov = qemu_realloc(qiov->iov, qiov->nalloc * sizeof(struct iovec)); 616 } 617 qiov->iov[qiov->niov].iov_base = base; 618 qiov->iov[qiov->niov].iov_len = len; 619 qiov->size += len; 620 ++qiov->niov; 621 } 622 623 void qemu_iovec_destroy(QEMUIOVector *qiov) 624 { 625 qemu_free(qiov->iov); 626 } 627 628 void qemu_iovec_reset(QEMUIOVector *qiov) 629 { 630 qiov->niov = 0; 631 qiov->size = 0; 632 } 633 634 void qemu_iovec_to_buffer(QEMUIOVector *qiov, void *buf) 635 { 636 uint8_t *p = (uint8_t *)buf; 637 int i; 638 639 for (i = 0; i < qiov->niov; ++i) { 640 memcpy(p, qiov->iov[i].iov_base, qiov->iov[i].iov_len); 641 p += qiov->iov[i].iov_len; 642 } 643 } 644 645 void qemu_iovec_from_buffer(QEMUIOVector *qiov, const void *buf, size_t count) 646 { 647 const uint8_t *p = (const uint8_t *)buf; 648 size_t copy; 649 int i; 650 651 for (i = 0; i < qiov->niov && count; ++i) { 652 copy = count; 653 if (copy > qiov->iov[i].iov_len) 654 copy = qiov->iov[i].iov_len; 655 memcpy(qiov->iov[i].iov_base, p, copy); 656 p += copy; 657 count -= copy; 658 } 659 } 660 #endif /* !VBOX */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器