This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: uninitialized variable


> -----Original Message-----
> From: Trenton D. Adams [mailto:tadams@theone.dnsalias.com]
> Subject: [ECOS] uninitialized variable
> 
> 
> Is memory in eCos initialized to these values before it's 
> used?  When I
> didn't initialize this variable, it ended up being set to this value
> which happened to be in memory at that location.
> 
> (gdb) print slot->attr
> $1 = (unsigned char *) 0xdeadbeef "_\004 Bâ\004 Bä\001 Dä\001 Då\t"
> 
> Is this some sort of joke, or just a !TOTALLY random occurance?

I don't for sure for your special case, but the dead beef value is used a
few times in eCos mostly to detect some uninitialized variable.

See:

Searching for 'deadbeef'...
D:\ecos-cvs-with-e7t\ecos\packages\hal\arm\ebsa285\current\tests\sdram0.cxx(
170):
	cyg_uint32 d = 0xdeadbeef ^ ((cyg_uint32)i * 0x10001);
D:\ecos-cvs-with-e7t\ecos\packages\hal\arm\iq80310\current\src\diag\ether_te
st.c(528):
	if (isr_connect (ENET_INT_ID, (VOIDFUNCPTR)i557IntHandler,
0xdeadbeef) != OK)
D:\ecos-cvs-with-e7t\ecos\packages\hal\arm\iq80310\current\src\diag\ether_te
st.c(542):
	if (pci_isr_connect (unit_intpin, unit_busno, unit_devno,
i557IntHandler, 0xdeadbeef) != OK)
D:\ecos-cvs-with-e7t\ecos\packages\io\eth\current\src\net\eth_drv.c(152):
	s->r_rx_corrupt = (unsigned int)sc ^ 0xdeadbeef;
D:\ecos-cvs-with-e7t\ecos\packages\kernel\current\tests\kcache2.c(140):
	*p++ = 0xdeadbeef;
D:\ecos-cvs-with-e7t\ecos\packages\net\tcpip\current\src\sys\net\if_bridge.c
(1463):
	u_int32_t a = 0x9e3779b9, b = 0x9e3779b9, c = 0xdeadbeef;
6 occurrence(s) have been found.

	

Fabrice



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]