[LinuxBIOS] FILO with the USB
stepan at coresystems.de
Fri Nov 16 10:35:51 CET 2007
* Fridel Fainshtein <fainshf at gmail.com> [071114 20:03]:
> Hello all,
> It seams that the USB code was taken from the previous version of FILO
> but never have been tested.
> Some symptoms are
> malloc_diag: alloc: 4208 bytes (8 blocks), free: 61320 bytes (1 blocks)
> malloc_check: sizes mismatch: 0xa1 vs 0x0 at 00132670
> dma_to_td: can not find td
> Trying to debug it, I discovered the following piece of code:
> void *allot2(size_t size, unsigned int alignment)
> void *addr;
> unsigned long addrval;
> addrval=(unsigned long)addr;
> addrval+=alignment+1; // 0x12345600 + 0xff + 1
> addrval&=~alignment; // 0x12345700
> *(void * *)(addrval-sizeof(unsigned long))=addr;
> return (void *)addrval;
> void forget2(void *mem)
> unsigned long addr=(unsigned long)mem;
> addr-=sizeof(unsigned long);
> free((void *)(*(unsigned long *)addr));
> I have 2 questions:
> if size = 8 and alignment=256, it writes outside malloc allocation, isn't it?
Oh yes! I added those two functions as a quick hack to get things
compile. I think it never worked with them. Since the rest of the code
is very similar to filo+etherboot this is likely to be the problem.
Does the code try to allocate blocks with size = 8 and alignment=256?
> What was the meaning of the code?
FILO had no memory alloc function that would allow you to give an
alignment. That's the only purpose they're good for.
If you can come up with a better/working solution, we'll happily
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.de • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
More information about the coreboot