qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Patch for compiling qemu 0.8.1 on Solaris with older compil


From: John Wehle
Subject: [Qemu-devel] Patch for compiling qemu 0.8.1 on Solaris with older compilers
Date: Wed, 31 May 2006 00:51:02 -0000

In a couple of places qemu attempts to declare variables after specifying
code statements.  This isn't supported by some older compilers.

Changes:

  hw/rtl8139.c Declare variables at the begining of the block.

  hw/es1370.c Likewise.

Lightly tested using Solaris 9 x86 and gcc 2.95.3.

Enjoy!

-- John Wehle (address@hidden)
---------------8<-----------------8<-------------------8<----------------
*** hw/rtl8139.c.ORIGINAL       Wed May  3 16:32:58 2006
--- hw/rtl8139.c        Fri May 26 20:01:14 2006
*************** static void rtl8139_receive(void *opaque
*** 761,766 ****
--- 761,773 ----
      static const uint8_t broadcast_macaddr[6] = 
          { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  
+     int mcast_idx;
+ 
+     uint32_t val, rxdw0,rxdw1,rxbufLO,rxbufHI;
+ 
+     uint32_t rx_space;
+     target_phys_addr_t rx_addr;
+ 
  #if defined(DEBUG_RTL8139)
      printf(">>> RTL8139: received len=%d\n", size);
  #endif
*************** static void rtl8139_receive(void *opaque
*** 817,823 ****
                  return;
              }
  
!             int mcast_idx = compute_mcast_idx(buf);
  
              if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))))
              {
--- 824,830 ----
                  return;
              }
  
!             mcast_idx = compute_mcast_idx(buf);
  
              if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))))
              {
*************** static void rtl8139_receive(void *opaque
*** 902,909 ****
                 descriptor, s->RxRingAddrHI, s->RxRingAddrLO, 
cplus_rx_ring_desc);
  #endif
  
-         uint32_t val, rxdw0,rxdw1,rxbufLO,rxbufHI;
- 
          cpu_physical_memory_read(cplus_rx_ring_desc,    (uint8_t *)&val, 4);
          rxdw0 = le32_to_cpu(val);
          cpu_physical_memory_read(cplus_rx_ring_desc+4,  (uint8_t *)&val, 4);
--- 909,914 ----
*************** static void rtl8139_receive(void *opaque
*** 930,936 ****
              return;
          }
  
!         uint32_t rx_space = rxdw0 & CP_RX_BUFFER_SIZE_MASK;
  
          if (size+4 > rx_space)
          {
--- 935,941 ----
              return;
          }
  
!         rx_space = rxdw0 & CP_RX_BUFFER_SIZE_MASK;
  
          if (size+4 > rx_space)
          {
*************** static void rtl8139_receive(void *opaque
*** 944,950 ****
              return;
          }
  
!         target_phys_addr_t rx_addr = rtl8139_addr64(rxbufLO, rxbufHI);
  
          /* receive/copy to target memory */
          cpu_physical_memory_write( rx_addr, buf, size );
--- 949,955 ----
              return;
          }
  
!         rx_addr = rtl8139_addr64(rxbufLO, rxbufHI);
  
          /* receive/copy to target memory */
          cpu_physical_memory_write( rx_addr, buf, size );
*************** static void rtl8139_receive(void *opaque
*** 1050,1056 ****
          packet_header |= (((size+4) << 16) & 0xffff0000);
  
          /* write header */
!         uint32_t val = cpu_to_le32(packet_header);
  
          rtl8139_write_buffer(s, (uint8_t *)&val, 4);
  
--- 1055,1061 ----
          packet_header |= (((size+4) << 16) & 0xffff0000);
  
          /* write header */
!         val = cpu_to_le32(packet_header);
  
          rtl8139_write_buffer(s, (uint8_t *)&val, 4);
  
*************** int rtl8139_config_writeable(RTL8139Stat
*** 1270,1275 ****
--- 1275,1282 ----
  
  static void rtl8139_BasicModeCtrl_write(RTL8139State *s, uint32_t val)
  {
+     uint32 mask;
+ 
      val &= 0xffff;
  
  #ifdef DEBUG_RTL8139
*************** static void rtl8139_BasicModeCtrl_write(
*** 1277,1283 ****
  #endif
  
      /* mask unwriteable bits */
!     uint32 mask = 0x4cff;
  
      if (1 || !rtl8139_config_writeable(s))
      {
--- 1284,1290 ----
  #endif
  
      /* mask unwriteable bits */
!     mask = 0x4cff;
  
      if (1 || !rtl8139_config_writeable(s))
      {
*************** static uint32_t rtl8139_BasicModeStatus_
*** 1330,1335 ****
--- 1337,1345 ----
  
  static void rtl8139_Cfg9346_write(RTL8139State *s, uint32_t val)
  {
+     uint32_t opmode;
+     uint32_t eeprom_val;
+ 
      val &= 0xff;
  
  #ifdef DEBUG_RTL8139
*************** static void rtl8139_Cfg9346_write(RTL813
*** 1339,1346 ****
      /* mask unwriteable bits */
      val = SET_MASKED(val, 0x31, s->Cfg9346);
  
!     uint32_t opmode = val & 0xc0;
!     uint32_t eeprom_val = val & 0xf;
  
      if (opmode == 0x80) {
          /* eeprom access */
--- 1349,1356 ----
      /* mask unwriteable bits */
      val = SET_MASKED(val, 0x31, s->Cfg9346);
  
!     opmode = val & 0xc0;
!     eeprom_val = val & 0xf;
  
      if (opmode == 0x80) {
          /* eeprom access */
*************** static uint32_t rtl8139_RxConfig_read(RT
*** 1594,1599 ****
--- 1604,1612 ----
  
  static int rtl8139_transmit_one(RTL8139State *s, int descriptor)
  {
+     int txsize;
+     uint8_t txbuffer[0x2000];
+ 
      if (!rtl8139_transmitter_enabled(s))
      {
  #ifdef DEBUG_RTL8139
*************** static int rtl8139_transmit_one(RTL8139S
*** 1614,1621 ****
      printf("RTL8139: +++ transmitting from descriptor %d\n", descriptor);
  #endif
  
!     int txsize = s->TxStatus[descriptor] & 0x1fff;
!     uint8_t txbuffer[0x2000];
  
  #ifdef DEBUG_RTL8139
      printf("RTL8139: +++ transmit reading %d bytes from host memory at 
0x%08x\n", txsize, s->TxAddr[descriptor]);
--- 1627,1633 ----
      printf("RTL8139: +++ transmitting from descriptor %d\n", descriptor);
  #endif
  
!     txsize = s->TxStatus[descriptor] & 0x1fff;
  
  #ifdef DEBUG_RTL8139
      printf("RTL8139: +++ transmit reading %d bytes from host memory at 
0x%08x\n", txsize, s->TxAddr[descriptor]);
*************** static int rtl8139_transmit_one(RTL8139S
*** 1641,1646 ****
--- 1653,1671 ----
  
  static int rtl8139_cplus_transmit_one(RTL8139State *s)
  {
+     int descriptor;
+     target_phys_addr_t cplus_tx_ring_desc;
+     uint32_t val, txdw0,txdw1,txbufLO,txbufHI;
+     int txsize;
+     target_phys_addr_t tx_addr;
+ 
+ /* w0 bits 0...15 : buffer size */
+ #define CP_TX_BUFFER_SIZE (1<<16)
+ #define CP_TX_BUFFER_SIZE_MASK (CP_TX_BUFFER_SIZE - 1)
+ 
+     uint8_t txbuffer[CP_TX_BUFFER_SIZE];
+ 
+ 
      if (!rtl8139_transmitter_enabled(s))
      {
  #ifdef DEBUG_RTL8139
*************** static int rtl8139_cplus_transmit_one(RT
*** 1657,1665 ****
          return 0 ;
      }
  
!     int descriptor = s->currCPlusTxDesc;
  
!     target_phys_addr_t cplus_tx_ring_desc =
          rtl8139_addr64(s->TxAddr[0], s->TxAddr[1]);
  
      /* Normal priority ring */
--- 1682,1690 ----
          return 0 ;
      }
  
!     descriptor = s->currCPlusTxDesc;
  
!     cplus_tx_ring_desc =
          rtl8139_addr64(s->TxAddr[0], s->TxAddr[1]);
  
      /* Normal priority ring */
*************** static int rtl8139_cplus_transmit_one(RT
*** 1670,1677 ****
             descriptor, s->TxAddr[1], s->TxAddr[0], cplus_tx_ring_desc);
  #endif
  
-     uint32_t val, txdw0,txdw1,txbufLO,txbufHI;
- 
      cpu_physical_memory_read(cplus_tx_ring_desc,    (uint8_t *)&val, 4);
      txdw0 = le32_to_cpu(val);
      cpu_physical_memory_read(cplus_tx_ring_desc+4,  (uint8_t *)&val, 4);
--- 1695,1700 ----
*************** static int rtl8139_cplus_transmit_one(RT
*** 1704,1712 ****
  /* TCP checksum offload flag */
  #define CP_TX_TCPCS (1<<16)
  
- /* w0 bits 0...15 : buffer size */
- #define CP_TX_BUFFER_SIZE (1<<16)
- #define CP_TX_BUFFER_SIZE_MASK (CP_TX_BUFFER_SIZE - 1)
  /* w1 tag available flag */
  #define CP_RX_TAGC (1<<17)
  /* w1 bits 0...15 : VLAN tag */
--- 1727,1732 ----
*************** static int rtl8139_cplus_transmit_one(RT
*** 1738,1747 ****
      printf("RTL8139: +++ C+ Tx mode : transmitting from descriptor %d\n", 
descriptor);
  #endif
  
!     int txsize = txdw0 & CP_TX_BUFFER_SIZE_MASK;
!     target_phys_addr_t tx_addr = rtl8139_addr64(txbufLO, txbufHI);
! 
!     uint8_t txbuffer[CP_TX_BUFFER_SIZE];
  
  #ifdef DEBUG_RTL8139
      printf("RTL8139: +++ C+ mode transmit reading %d bytes from host memory 
at 0x%08x\n", txsize, tx_addr);
--- 1758,1765 ----
      printf("RTL8139: +++ C+ Tx mode : transmitting from descriptor %d\n", 
descriptor);
  #endif
  
!     txsize = txdw0 & CP_TX_BUFFER_SIZE_MASK;
!     tx_addr = rtl8139_addr64(txbufLO, txbufHI);
  
  #ifdef DEBUG_RTL8139
      printf("RTL8139: +++ C+ mode transmit reading %d bytes from host memory 
at 0x%08x\n", txsize, tx_addr);
*** hw/es1370.c.ORIGINAL        Wed May  3 16:32:58 2006
--- hw/es1370.c Fri May 26 20:03:18 2006
*************** static inline uint32_t es1370_fixup (ES1
*** 479,487 ****
  IO_WRITE_PROTO (es1370_writeb)
  {
      ES1370State *s = opaque;
-     addr = es1370_fixup (s, addr);
      uint32_t shift, mask;
  
      switch (addr) {
      case ES1370_REG_CONTROL:
      case ES1370_REG_CONTROL + 1:
--- 479,488 ----
  IO_WRITE_PROTO (es1370_writeb)
  {
      ES1370State *s = opaque;
      uint32_t shift, mask;
  
+     addr = es1370_fixup (s, addr);
+ 
      switch (addr) {
      case ES1370_REG_CONTROL:
      case ES1370_REG_CONTROL + 1:
*************** IO_WRITE_PROTO (es1370_writeb)
*** 516,525 ****
  IO_WRITE_PROTO (es1370_writew)
  {
      ES1370State *s = opaque;
-     addr = es1370_fixup (s, addr);
      uint32_t shift, mask;
      struct chan *d = &s->chan[0];
  
      switch (addr) {
      case ES1370_REG_CODEC:
          dolog ("ignored codec write address %#x, data %#x\n",
--- 517,527 ----
  IO_WRITE_PROTO (es1370_writew)
  {
      ES1370State *s = opaque;
      uint32_t shift, mask;
      struct chan *d = &s->chan[0];
  
+     addr = es1370_fixup (s, addr);
+ 
      switch (addr) {
      case ES1370_REG_CODEC:
          dolog ("ignored codec write address %#x, data %#x\n",
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: address@hidden  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]