Tyson D Sawyer wrote:
> 
> This morning while in the shower it came to me what the +1 was for in
> Ollie's mtrr code.  It is a rounding issue and my proposed changes will
> fail for anything that needs more than 1 mtrr.
> 
> I think that the correct version is:
> 
>                 range_wb = 1 << (fms(ramsizeK - 1) + 1);
>                 range_uc = range_wb - ramsizeK;
> 
>                 if ((range_uc==0) || ((ramsizeK % range_uc) == 0)) {
> 
> Note that instead of removing the +1 I have added a -1 to the fms()
> arguement.  The (range_uc==0) part of the if statement is still needed
> to prevent doing a (ramsizeK % 0) as this seem to cause an exception or
> otherwise lock up the computer.
> 

Yea, I think this would be the correct answer. The mtrr is "programmed"
this way to cope with ramsizeK != 2^N cases. With this complexity, most
SiS mainboard is doom, since they use 4MB SMA by default.

Ollie

Reply via email to