[LinuxBIOS] patch for making system run past disable_car

Marc Jones marc.jones at amd.com
Thu Dec 13 06:49:21 CET 2007

ron minnich wrote:
> On Dec 12, 2007 6:00 PM, Marc Jones <marc.jones at amd.com> wrote:
>> There are a couple ways to address this.
>> 1. copy the stack to a new location.
>> 2. Set the tags dirty with by writing the way MSRs.
>> 3. enable the cache and copy the stack back on it's self to dirty the tags.
>> I am least sure about number three.
> Here is one idea.
> Copy the stack to "somewhere" in real memory, not "CAR memory".
> Disable CAR. Enable the cache. Copy the stack  back.
> in fact, we could define disable_car as follows:
> void disable_car(void *savestack)
> {
>   memcpy(savestack, &savestack, 4096);  /* copy stack to "savestack"
> in real memory */
>   /* turn off car */
>   /* enable cache */
>   /* problem: how do we invd without losing savestack variable? */
>   /* one option is to ALWAYS save the stack to page 0 */
>   memcopy(&savestack, savestack, 4096);
> Something like this might work. We're saving the stack to memory,
> enabling cache, and copying it back. What do you think?

I don't think that moving the stack should be a problem. All access 
should be push/pop or ss/esp/ebp relative. I also don't think you need 
to copy the stack back (like K8) and I would only copy the amount of 
stack that is being used. Not the entire space.

The savestack variable won't be a problem. It will either be in a 
register or on the stack. Once the stack is move to real memory and the 
registers adjusted the invd won't change anything. The register 
adjustment will have to be inline asm with no push, pops, or stack 
accesses. For and example, look in cpu/amd/car/post_cache_as_ram.c for %esp.


Marc Jones
Senior Firmware Engineer
(970) 226-9684 Office
mailto:Marc.Jones at amd.com

More information about the coreboot mailing list