Re: Etherboot 5.5
Georg Baum <[email protected]>
| Newsgroups | gmane.network.etherboot.devel |
|---|---|
| Message-ID | <[email protected]> |
Am Samstag, 21. Mai 2005 01:48 schrieb Michael Brown:
> Your gcc versions > 3.2.3 are suffering from the same problem with
unnamed
> struct elements as Tim; I will fix these in the morning, and then look
at
> the pre-3.2.3 builds.
Meanwhile I have a fix for gcc 3.3, 3.4 and 4.0, it is attached. It is
ready to be applied IMO, with one exception:
gcc 4.0 does not allow casts on lvalues. Therefore I got rid of them at
several places. The change in src/proto/http.c leads to cleaner code
actually, but the other changes are not optimal: I am not sure whether
the changes in src/drivers/net/natsemi.c and src/drivers/net/sis900.c are
correct, and the change in src/proto/nmb.c should work but is pretty
ugly.
Unfortunately I get now an internal linker error:
$ make bin/e1000.dsk
ld -N -T arch/i386/scripts/i386.lds -u obj_dskprefix --defsym
check_obj_dskprefix=obj_dskprefix -u obj_e1000 --defsym
check_obj_e1000=obj_e1000 -u obj_config --defsym
check_obj_config=obj_config bin/blib.a -o bin/e1000.dsk.tmp \
-Map bin/e1000.dsk.tmp.map
ld: internal error ../../ld/ldlang.c 1974
make: *** [bin/e1000.dsk.tmp] Error 1
$ ld -v
GNU ld version 2.15
Do I need a newer version?
Georg
compilefix.diff
(text/x-diff, 8.5 KB)
Index: src/arch/i386/firmware/pcbios/basemem.c
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/arch/i386/firmware/pcbios/basemem.c,v
retrieving revision 1.6
diff -u -p -r1.6 basemem.c
--- src/arch/i386/firmware/pcbios/basemem.c 18 Apr 2005 09:17:29 -0000 1.6
+++ src/arch/i386/firmware/pcbios/basemem.c 21 May 2005 14:08:42 -0000
@@ -130,8 +130,8 @@ void free_base_memory ( void *ptr, size_
*/
for ( ; size_kb > 0 ; free_block++, size_kb-- ) {
/* Mark this block as unused */
- free_block->magic = FREE_BLOCK_MAGIC;
- free_block->size_kb = size_kb;
+ free_block->header.magic = FREE_BLOCK_MAGIC;
+ free_block->header.size_kb = size_kb;
}
/* Free up unused base memory */
@@ -161,12 +161,12 @@ static void free_unused_base_memory ( vo
* if this is not a free block
*/
if ( ( fbms == FBMS_MAX ) ||
- ( free_block->magic != FREE_BLOCK_MAGIC ) ) {
+ ( free_block->header.magic != FREE_BLOCK_MAGIC ) ) {
break;
}
/* Return memory to BIOS */
- fbms += free_block->size_kb;
+ fbms += free_block->header.size_kb;
DBG ( "Freed %d kB of base memory at [%hx:0000,%hx:0000), "
"%d kB now free\n",
Index: src/arch/i386/include/basemem.h
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/arch/i386/include/basemem.h,v
retrieving revision 1.3
diff -u -p -r1.3 basemem.h
--- src/arch/i386/include/basemem.h 18 Apr 2005 09:17:27 -0000 1.3
+++ src/arch/i386/include/basemem.h 21 May 2005 14:08:42 -0000
@@ -19,7 +19,7 @@ struct free_base_memory_header {
};
union free_base_memory_block {
- struct free_base_memory_header;
+ struct free_base_memory_header header;
char bytes[1024];
};
Index: src/arch/i386/include/librm.h
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/arch/i386/include/librm.h,v
retrieving revision 1.3
diff -u -p -r1.3 librm.h
--- src/arch/i386/include/librm.h 10 Apr 2005 16:44:49 -0000 1.3
+++ src/arch/i386/include/librm.h 21 May 2005 14:08:42 -0000
@@ -17,8 +17,8 @@
/* Real-mode call parameter block, as passed to real_call */
struct real_call_params {
- struct i386_seg_regs;
- struct i386_regs;
+ struct i386_seg_regs seg_regs;
+ struct i386_regs regs;
segoff_t rm_code;
segoff_t reserved;
} PACKED;
Index: src/core/pxe.c
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/core/pxe.c,v
retrieving revision 1.1
diff -u -p -r1.1 pxe.c
--- src/core/pxe.c 20 May 2005 15:32:41 -0000 1.1
+++ src/core/pxe.c 21 May 2005 14:08:52 -0000
@@ -34,6 +34,7 @@
#include "pci.h"
#include "cpu.h"
#include "timer.h"
+#include "basemem.h"
#undef DBG
#if TRACE_PXE
Index: src/drivers/net/natsemi.c
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/drivers/net/natsemi.c,v
retrieving revision 1.16
diff -u -p -r1.16 natsemi.c
--- src/drivers/net/natsemi.c 19 May 2005 16:48:24 -0000 1.16
+++ src/drivers/net/natsemi.c 21 May 2005 14:08:57 -0000
@@ -604,7 +604,7 @@ natsemi_transmit(struct nic *nic,
const char *p) /* Packet */
{
u32 to, nstype;
- u32 tx_status;
+ volatile u32 tx_status;
/* Stop the transmitter */
outl(TxOff, ioaddr + ChipCmd);
@@ -643,7 +643,7 @@ natsemi_transmit(struct nic *nic,
to = currticks() + TX_TIMEOUT;
- while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to))
+ while (((tx_status=txd.cmdsts) & OWN) && (currticks() < to))
/* wait */ ;
if (currticks() >= to) {
Index: src/drivers/net/sis900.c
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/drivers/net/sis900.c,v
retrieving revision 1.13
diff -u -p -r1.13 sis900.c
--- src/drivers/net/sis900.c 3 May 2005 11:29:34 -0000 1.13
+++ src/drivers/net/sis900.c 21 May 2005 14:09:00 -0000
@@ -1097,7 +1097,7 @@ sis900_transmit(struct nic *nic,
const char *p) /* Packet */
{
u32 to, nstype;
- u32 tx_status;
+ volatile u32 tx_status;
/* Stop the transmitter */
outl(TxDIS | inl(ioaddr + cr), ioaddr + cr);
@@ -1136,7 +1136,7 @@ sis900_transmit(struct nic *nic,
to = currticks() + TX_TIMEOUT;
- while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to))
+ while (((tx_status=txd.cmdsts) & OWN) && (currticks() < to))
/* wait */ ;
if (currticks() >= to) {
Index: src/include/dns.h
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/include/dns.h,v
retrieving revision 1.3
diff -u -p -r1.3 dns.h
--- src/include/dns.h 1 May 2005 11:30:26 -0000 1.3
+++ src/include/dns.h 21 May 2005 14:09:02 -0000
@@ -70,12 +70,12 @@ struct dns_rr_info {
} __attribute__ (( packed ));
struct dns_rr_info_a {
- struct dns_rr_info;
+ struct dns_rr_info info;
struct in_addr in_addr;
} __attribute__ (( packed ));
struct dns_rr_info_cname {
- struct dns_rr_info;
+ struct dns_rr_info info;
char cname[0];
} __attribute__ (( packed ));
Index: src/include/nmb.h
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/include/nmb.h,v
retrieving revision 1.1
diff -u -p -r1.1 nmb.h
--- src/include/nmb.h 1 May 2005 11:10:17 -0000 1.1
+++ src/include/nmb.h 21 May 2005 14:09:02 -0000
@@ -14,7 +14,7 @@
#define NBNS_UDP_PORT 137
struct dns_rr_info_nb {
- struct dns_rr_info;
+ struct dns_rr_info info;
uint16_t nb_flags;
struct in_addr nb_address;
} __attribute__ (( packed ));
Index: src/proto/http.c
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/proto/http.c,v
retrieving revision 1.3
diff -u -p -r1.3 http.c
--- src/proto/http.c 17 May 2005 14:35:20 -0000 1.3
+++ src/proto/http.c 21 May 2005 14:09:02 -0000
@@ -40,7 +40,7 @@ static int send_tcp_request(int length,
/**************************************************************************
RECV_TCP_CALLBACK - Receive data using TCP
**************************************************************************/
-static int recv_tcp_request(int length, const void *buffer, void *ptr) {
+static int recv_tcp_request(int length, const char *buffer, void *ptr) {
struct send_recv_state *state = (struct send_recv_state *)ptr;
/* Assume that the lines in an HTTP header do not straddle a packet */
@@ -48,10 +48,10 @@ static int recv_tcp_request(int length,
if (state->recv_state == RESULT_CODE) {
while (length > 0) {
/* Find HTTP result code */
- if (*(const char *)buffer == ' ') {
- const char *ptr = ((const char *)buffer) + 1;
+ if (*buffer == ' ') {
+ const char *ptr = buffer + 1;
int rc = strtoul(ptr, &ptr, 10);
- if (ptr >= (const char *)buffer + length) {
+ if (ptr >= buffer + length) {
state->recv_state = ERROR;
DBG ( "HTTP got bad result code\n" );
return 0;
@@ -61,7 +61,7 @@ static int recv_tcp_request(int length,
DBG ( "HTTP got result code %d\n", rc );
goto header;
}
- ++(const char *)buffer;
+ ++buffer;
length--;
}
state->recv_state = ERROR;
@@ -88,7 +88,7 @@ static int recv_tcp_request(int length,
/* Find beginning of line */
while (length > 0) {
length--;
- if (*((const char *)buffer)++ == '\n')
+ if (*buffer++ == '\n')
break;
}
/* Check for end of header */
@@ -140,7 +140,7 @@ static int http ( char *url, struct sock
tcp_transaction ( server->sin_addr.s_addr,
server->sin_port, &state,
- send_tcp_request, recv_tcp_request );
+ send_tcp_request, (int (*)(int, const void *, void *))recv_tcp_request );
}
if ( state.recv_state == MOVED ) {
Index: src/proto/nmb.c
===================================================================
RCS file: /cvsroot/etherboot/etherboot/etherboot-5.5/src/proto/nmb.c,v
retrieving revision 1.1
diff -u -p -r1.1 nmb.c
--- src/proto/nmb.c 1 May 2005 11:10:18 -0000 1.1
+++ src/proto/nmb.c 21 May 2005 14:09:02 -0000
@@ -27,9 +27,11 @@ static inline char * nbns_make_name ( ch
nb_name[15] = '\0';
memcpy ( nb_name, name, strlen ( name ) ); /* Do not copy NUL */
for ( i = 0 ; i < 16 ; i++ ) {
+ uint16_t * d = dest;
c = nb_name[i];
- *( ( ( uint16_t * ) dest ) ++ ) =
+ *( d++ ) =
htons ( ( ( c | ( c << 4 ) ) & 0x0f0f ) + 0x4141 );
+ dest = d;
}
*(dest++) = 0; /* Terminating 0-length name component */