From: Benjamin H. <be...@ke...> - 2004-04-26 01:13:35
|
> I've been looking at the libmad code, and an awful lot of the > calculation seems to take place on the stack... Your idea seems very > good to me. How does one go about putting the stack somewhere else? I > tried hacking an ld script but I must confess I'm a bit stuck... Either > I don't understand the scripts at all, or arm-elf-ld doesn't like being > told what to do. > > The same goes for moving some code: after profiling on an i386, I tried > using __attribute__ to put some code on the on-board memory, to no > avail. > > On the up-side, I've managed to reduce the audio buffer in my kernel > to 16k, and have noticed a bit of speed-up from 'allocating' the > libmad data structures after 0x4000800C. I guess playback is around 95% > speed now. Well, there are 2 things. One is to allocate the memory in the SRAM, and the other is to call routines with the stack there. Normally, Linus has one stack per process/thread, so you need to chose carefuly where/when to switch stack there. Then, what I'd do is to create a small asm trampoline that switches the stack, store the old stack pointer on the new stack (for the exit path), and jump to the routine that has to be executed on the internal stack. You could do that on a thread entry point for a whole thread to use that SDRAM stack for example. Ben |