Commit 29b9a3456fdb98a33f48360437d8826415f7c40b

Authored by bellard
1 parent a8e5ac33

win32 compilation fixes


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2052 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 27 additions and 25 deletions
hw/pcnet.c
... ... @@ -60,8 +60,10 @@ struct PCNetState_st {
60 60 int tx_busy;
61 61 };
62 62  
  63 +/* XXX: using bitfields for target memory structures is almost surely
  64 + not portable, so it should be suppressed ASAP */
63 65 #ifdef __GNUC__
64   -#define PACKED(A) A __attribute__ ((packed))
  66 +#define PACKED_FIELD(A) A __attribute__ ((packed))
65 67 #else
66 68 #error FixMe
67 69 #endif
... ... @@ -152,20 +154,20 @@ struct pcnet_initblk16 {
152 154 uint16_t ladrf2;
153 155 uint16_t ladrf3;
154 156 uint16_t ladrf4;
155   - unsigned PACKED(rdra:24);
156   - unsigned PACKED(res1:5);
157   - unsigned PACKED(rlen:3);
158   - unsigned PACKED(tdra:24);
159   - unsigned PACKED(res2:5);
160   - unsigned PACKED(tlen:3);
  157 + unsigned PACKED_FIELD(rdra:24);
  158 + unsigned PACKED_FIELD(res1:5);
  159 + unsigned PACKED_FIELD(rlen:3);
  160 + unsigned PACKED_FIELD(tdra:24);
  161 + unsigned PACKED_FIELD(res2:5);
  162 + unsigned PACKED_FIELD(tlen:3);
161 163 };
162 164  
163 165 struct pcnet_initblk32 {
164 166 uint16_t mode;
165   - unsigned PACKED(res1:4);
166   - unsigned PACKED(rlen:4);
167   - unsigned PACKED(res2:4);
168   - unsigned PACKED(tlen:4);
  167 + unsigned PACKED_FIELD(res1:4);
  168 + unsigned PACKED_FIELD(rlen:4);
  169 + unsigned PACKED_FIELD(res2:4);
  170 + unsigned PACKED_FIELD(tlen:4);
169 171 uint16_t padr1;
170 172 uint16_t padr2;
171 173 uint16_t padr3;
... ... @@ -183,14 +185,14 @@ struct pcnet_TMD {
183 185 unsigned tbadr:32;
184 186 } tmd0;
185 187 struct {
186   - unsigned PACKED(bcnt:12), PACKED(ones:4), PACKED(res:7), PACKED(bpe:1);
187   - unsigned PACKED(enp:1), PACKED(stp:1), PACKED(def:1), PACKED(one:1);
188   - unsigned PACKED(ltint:1), PACKED(nofcs:1), PACKED(err:1), PACKED(own:1);
  188 + unsigned PACKED_FIELD(bcnt:12), PACKED_FIELD(ones:4), PACKED_FIELD(res:7), PACKED_FIELD(bpe:1);
  189 + unsigned PACKED_FIELD(enp:1), PACKED_FIELD(stp:1), PACKED_FIELD(def:1), PACKED_FIELD(one:1);
  190 + unsigned PACKED_FIELD(ltint:1), PACKED_FIELD(nofcs:1), PACKED_FIELD(err:1), PACKED_FIELD(own:1);
189 191 } tmd1;
190 192 struct {
191   - unsigned PACKED(trc:4), PACKED(res:12);
192   - unsigned PACKED(tdr:10), PACKED(rtry:1), PACKED(lcar:1);
193   - unsigned PACKED(lcol:1), PACKED(exdef:1), PACKED(uflo:1), PACKED(buff:1);
  193 + unsigned PACKED_FIELD(trc:4), PACKED_FIELD(res:12);
  194 + unsigned PACKED_FIELD(tdr:10), PACKED_FIELD(rtry:1), PACKED_FIELD(lcar:1);
  195 + unsigned PACKED_FIELD(lcol:1), PACKED_FIELD(exdef:1), PACKED_FIELD(uflo:1), PACKED_FIELD(buff:1);
194 196 } tmd2;
195 197 struct {
196 198 unsigned res:32;
... ... @@ -202,14 +204,14 @@ struct pcnet_RMD {
202 204 unsigned rbadr:32;
203 205 } rmd0;
204 206 struct {
205   - unsigned PACKED(bcnt:12), PACKED(ones:4), PACKED(res:4);
206   - unsigned PACKED(bam:1), PACKED(lafm:1), PACKED(pam:1), PACKED(bpe:1);
207   - unsigned PACKED(enp:1), PACKED(stp:1), PACKED(buff:1), PACKED(crc:1);
208   - unsigned PACKED(oflo:1), PACKED(fram:1), PACKED(err:1), PACKED(own:1);
  207 + unsigned PACKED_FIELD(bcnt:12), PACKED_FIELD(ones:4), PACKED_FIELD(res:4);
  208 + unsigned PACKED_FIELD(bam:1), PACKED_FIELD(lafm:1), PACKED_FIELD(pam:1), PACKED_FIELD(bpe:1);
  209 + unsigned PACKED_FIELD(enp:1), PACKED_FIELD(stp:1), PACKED_FIELD(buff:1), PACKED_FIELD(crc:1);
  210 + unsigned PACKED_FIELD(oflo:1), PACKED_FIELD(fram:1), PACKED_FIELD(err:1), PACKED_FIELD(own:1);
209 211 } rmd1;
210 212 struct {
211   - unsigned PACKED(mcnt:12), PACKED(zeros:4);
212   - unsigned PACKED(rpc:8), PACKED(rcc:8);
  213 + unsigned PACKED_FIELD(mcnt:12), PACKED_FIELD(zeros:4);
  214 + unsigned PACKED_FIELD(rpc:8), PACKED_FIELD(rcc:8);
213 215 } rmd2;
214 216 struct {
215 217 unsigned res:32;
... ... @@ -555,7 +557,7 @@ static inline int padr_match(PCNetState *s, const uint8_t *buf, int size)
555 557 s->csr[13] & 0xff, s->csr[13] >> 8,
556 558 s->csr[14] & 0xff, s->csr[14] >> 8
557 559 };
558   - int result = (!CSR_DRCVPA(s)) && !bcmp(hdr->ether_dhost, padr, 6);
  560 + int result = (!CSR_DRCVPA(s)) && !memcmp(hdr->ether_dhost, padr, 6);
559 561 #ifdef PCNET_DEBUG_MATCH
560 562 printf("packet dhost=%02x:%02x:%02x:%02x:%02x:%02x, "
561 563 "padr=%02x:%02x:%02x:%02x:%02x:%02x\n",
... ... @@ -571,7 +573,7 @@ static inline int padr_bcast(PCNetState *s, const uint8_t *buf, int size)
571 573 {
572 574 static uint8_t BCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
573 575 struct qemu_ether_header *hdr = (void *)buf;
574   - int result = !CSR_DRCVBC(s) && !bcmp(hdr->ether_dhost, BCAST, 6);
  576 + int result = !CSR_DRCVBC(s) && !memcmp(hdr->ether_dhost, BCAST, 6);
575 577 #ifdef PCNET_DEBUG_MATCH
576 578 printf("padr_bcast result=%d\n", result);
577 579 #endif
... ...