VirtualBox

Changeset 74613 in vbox for trunk


Ignore:
Timestamp:
Oct 4, 2018 1:44:55 PM (6 years ago)
Author:
vboxsync
Message:

BIOS: Inlined write_word, read_word and friends. Saves over 600 bytes of code.

Location:
trunk/src/VBox/Devices/PC/BIOS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/bios.c

    r69501 r74613  
    6262
    6363static  const char  bios_cvs_version_string[] = "VirtualBox " VBOX_VERSION_STRING;
    64 
    65 uint8_t read_byte(uint16_t seg, uint16_t offset)
    66 {
    67     return( *(seg:>(uint8_t *)offset) );
    68 }
    69 
    70 void write_byte(uint16_t seg, uint16_t offset, uint8_t data)
    71 {
    72     *(seg:>(uint8_t *)offset) = data;
    73 }
    74 
    75 uint16_t read_word(uint16_t seg, uint16_t offset)
    76 {
    77     return( *(seg:>(uint16_t *)offset) );
    78 }
    79 
    80 void write_word(uint16_t seg, uint16_t offset, uint16_t data)
    81 {
    82     *(seg:>(uint16_t *)offset) = data;
    83 }
    84 
    85 uint32_t read_dword(uint16_t seg, uint16_t offset)
    86 {
    87     return( *(seg:>(uint32_t *)offset) );
    88 }
    89 
    90 void write_dword(uint16_t seg, uint16_t offset, uint32_t data)
    91 {
    92     *(seg:>(uint32_t *)offset) = data;
    93 }
    9464
    9565uint8_t inb_cmos(uint8_t cmos_reg)
  • trunk/src/VBox/Devices/PC/BIOS/floppy.c

    r69501 r74613  
    5959
    6060extern uint16_t get_floppy_dpt(uint8_t drive_type);
    61 
    62 // Local copies to slihgtly reduce stack usage.
    63 inline uint8_t read_byte(uint16_t seg, uint16_t offset)
    64 {
    65     return( *(seg:>(uint8_t *)offset) );
    66 }
    67 
    68 inline void write_byte(uint16_t seg, uint16_t offset, uint8_t data)
    69 {
    70     *(seg:>(uint8_t *)offset) = data;
    71 }
    72 
    7361
    7462//////////////////////
  • trunk/src/VBox/Devices/PC/BIOS/inlines.h

    r69501 r74613  
    2727#define outw(p, v)  outpw(p, v)
    2828
    29 extern  uint8_t     read_byte(uint16_t seg, uint16_t offset);
    30 extern  uint16_t    read_word(uint16_t seg, uint16_t offset);
    31 extern  uint32_t    read_dword(uint16_t seg, uint16_t offset);
    32 extern  void        write_byte(uint16_t seg, uint16_t offset, uint8_t data);
    33 extern  void        write_word(uint16_t seg, uint16_t offset, uint16_t data);
    34 extern  void        write_dword(uint16_t seg, uint16_t offset, uint32_t data);
     29/* Far byte/word/dword access routines. */
     30
     31inline uint8_t read_byte(uint16_t seg, uint16_t offset)
     32{
     33    return( *(seg:>(uint8_t *)offset) );
     34}
     35
     36inline void write_byte(uint16_t seg, uint16_t offset, uint8_t data)
     37{
     38    *(seg:>(uint8_t *)offset) = data;
     39}
     40
     41inline uint16_t read_word(uint16_t seg, uint16_t offset)
     42{
     43    return( *(seg:>(uint16_t *)offset) );
     44}
     45
     46inline void write_word(uint16_t seg, uint16_t offset, uint16_t data)
     47{
     48    *(seg:>(uint16_t *)offset) = data;
     49}
     50
     51inline uint32_t read_dword(uint16_t seg, uint16_t offset)
     52{
     53    return( *(seg:>(uint32_t *)offset) );
     54}
     55
     56inline void write_dword(uint16_t seg, uint16_t offset, uint32_t data)
     57{
     58    *(seg:>(uint32_t *)offset) = data;
     59}
     60
    3561
    3662void int_enable(void);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette