Changeset 18580 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Mar 31, 2009 3:39:47 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 45477
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/rombios.c
r18574 r18580 1626 1626 } 1627 1627 1628 #ifdef VBOX 1629 void put_str(action, s) 1628 void put_str(action, segment, offset) 1630 1629 Bit16u action; 1631 Bit8u *s; 1630 Bit16u segment; 1631 Bit16u offset; 1632 1632 { 1633 1633 Bit8u c; 1634 if (!s) 1635 s = "<NULL>"; 1636 1637 while (c = read_byte(get_CS(), s)) { 1634 1635 while (c = read_byte(segment, offset)) { 1638 1636 send(action, c); 1639 s++;1637 offset++; 1640 1638 } 1641 1639 } 1642 #endif /* VBOX */ 1640 1643 1641 1644 1642 //-------------------------------------------------------------------------- 1645 1643 // bios_printf() 1646 // A compact variable argument printf function which prints its output via 1647 // an I/O port so that it can be logged by Bochs/Plex. 1648 // Currently, only %x is supported (or %02x, %04x, etc). 1644 // A compact variable argument printf function. 1649 1645 // 1650 // Supports %[format_width][format] 1651 // where format can be d,x,c,s 1646 // Supports %[format_width][length]format 1647 // where format can be x,X,u,d,s,S,c 1648 // and the optional length modifier is l (ell) 1652 1649 //-------------------------------------------------------------------------- 1653 1650 void … … 1660 1657 short i; 1661 1658 Bit16u *arg_ptr; 1662 Bit16u arg_seg, arg, nibble, hibyte, shift_count, format_width ;1659 Bit16u arg_seg, arg, nibble, hibyte, shift_count, format_width, hexadd; 1663 1660 1664 1661 arg_ptr = &s; … … 1687 1684 arg_ptr++; // increment to next arg 1688 1685 arg = read_word(arg_seg, arg_ptr); 1689 if (c == 'x' ) {1686 if (c == 'x' || c == 'X') { 1690 1687 if (format_width == 0) 1691 1688 format_width = 4; 1689 if (c == 'x') 1690 hexadd = 'a'; 1691 else 1692 hexadd = 'A'; 1692 1693 for (i=format_width-1; i>=0; i--) { 1693 1694 nibble = (arg >> (4 * i)) & 0x000f; 1694 send (action, (nibble<=9)? (nibble+'0') : (nibble-10+ 'A'));1695 send (action, (nibble<=9)? (nibble+'0') : (nibble-10+hexadd)); 1695 1696 } 1696 1697 } … … 1700 1701 else if (c == 'l') { 1701 1702 s++; 1703 c = read_byte(get_CS(), s); /* is it ld,lx,lu? */ 1702 1704 arg_ptr++; /* increment to next arg */ 1703 1705 hibyte = read_word(arg_seg, arg_ptr); 1704 put_luint(action, ((Bit32u) hibyte << 16) | arg, format_width, 0); 1706 if (c == 'd') { 1707 if (hibyte & 0x8000) 1708 put_luint(action, 0L-(((Bit32u) hibyte << 16) | arg), format_width-1, 1); 1709 else 1710 put_luint(action, ((Bit32u) hibyte << 16) | arg, format_width, 0); 1711 } 1712 else if (c == 'u') { 1713 put_luint(action, ((Bit32u) hibyte << 16) | arg, format_width, 0); 1714 } 1715 else if (c == 'x' || c == 'X') 1716 { 1717 if (format_width == 0) 1718 format_width = 8; 1719 if (c == 'x') 1720 hexadd = 'a'; 1721 else 1722 hexadd = 'A'; 1723 for (i=format_width-1; i>=0; i--) { 1724 nibble = ((((Bit32u) hibyte <<16) | arg) >> (4 * i)) & 0x000f; 1725 send (action, (nibble<=9)? (nibble+'0') : (nibble-10+hexadd)); 1726 } 1727 } 1705 1728 } 1706 1729 else if (c == 'd') { … … 1711 1734 } 1712 1735 else if (c == 's') { 1713 #ifndef VBOX 1714 bios_printf(action & (~BIOS_PRINTF_HALT), arg); 1715 #else /* VBOX */ 1716 put_str(action, arg); 1717 #endif /* VBOX */ 1736 put_str(action, get_CS(), arg); 1737 } 1738 else if (c == 'S') { 1739 hibyte = arg; 1740 arg_ptr++; 1741 arg = read_word(arg_seg, arg_ptr); 1742 put_str(action, hibyte, arg); 1718 1743 } 1719 1744 else if (c == 'c') {
Note:
See TracChangeset
for help on using the changeset viewer.