All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* A few bugfixes
@ 2000-11-02 14:02 epicom
  0 siblings, 0 replies; 3+ messages in thread
From: epicom @ 2000-11-02 14:02 UTC (permalink / raw
  To: linuxppc-embedded


 I have found several bugs in versions 2.4.0-test*, I don't know if they
exist
in 2.2.* versions, but it is posible.



1- file arch/ppc/mm/fault.c, function va_to_phys:

>>  return(((unsigned long)(pte_val(*pte)) & PAGE_MASK) | (address &
~(PAGE_MASK-1)));

^^^^^^^^^^^^^

(PAGE_MASK-1) is buggy, it must be only PAGE_MASK to works correctly:
Perhaps the autor of this line was thinking in: (PAGE_SIZE-1)

>>  return(((unsigned long)(pte_val(*pte)) & PAGE_MASK) | (address &
~PAGE_MASK));

^^^^^^^^^



2- file arch/ppc/8xx_io/commproc.c, function m8xx_cpm_setbrg:

The formula to calculate the value for registers BRGC (Baud Rate Generators)
is incorrect:
>>  *bp = ((BRG_UART_CLK / rate) << 1) | CPM_BRG_EN;
                           ^^^^

reading motorola data books we can found that that formula must be:
>>  *bp = ((BRG_UART_CLK / rate - 1) << 1) | CPM_BRG_EN;
                           ^^^^^^^^

At low baudrates the differential is not significant, but I must use an
UART at 220.300Hz

You can read the chapter 20.4.3 in the MPC850 user's manual, chapter 21.4.3
in MPC860 user's manual, or chapter 16.3 in MPC8260 user's manual.



3- file arch/ppc/mm/init.c, function free_initrd_mem:

the code for that funcion is:

>>  for (; start < end; start += PAGE_SIZE) {
>>      ClearPageReserved(virt_to_page(start));
>>      set_page_count(virt_to_page(start), 1);
>>      free_page(start);
>>      totalram_pages++;
>>  }
>>  printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);


The problem is tha when the prink function is executed, the value for
'start' variable has been changed in the for-loop. The printk must be
executed before of the loop, or, to do the next one:

>>  unsigned long initrd_size= 0;
>>  for (; start < end; start += PAGE_SIZE) {
>>      ClearPageReserved(virt_to_page(start));
>>      set_page_count(virt_to_page(start), 1);
>>      free_page(start);
>>      totalram_pages++;
>>      initrd_size+= PAGE_SIZE;
>>  }
>>  printk ("Freeing initrd memory: %ldk freed\n", initrd_size >> 10);

The result, store in 'initrd_size' is more real that (end-start).




In the wish to have been useful to improve the PPC port of the linux kernel:


Luis Recuerda,


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: A few bugfixes
@ 2000-11-02 18:24 Ian Abbott
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Abbott @ 2000-11-02 18:24 UTC (permalink / raw
  To: linuxppc-embedded


"epicom" wrote:

>  I have found several bugs in versions 2.4.0-test*, I don't
> know if they
> exist
> in 2.2.* versions, but it is posible.

The first two (of three) do.

The first one:
> >>  return(((unsigned long)(pte_val(*pte)) & PAGE_MASK) | (address &
> ~(PAGE_MASK-1)));

is logically wrong but I think it is a harmless bug.

> In the wish to have been useful to improve the PPC port of
> the linux kernel:
>
>
> Luis Recuerda,

Thanks, Luis!

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>             )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587              )=-

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: A few bugfixes
@ 2000-11-03 10:20 Ian Abbott
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Abbott @ 2000-11-03 10:20 UTC (permalink / raw
  To: 'linuxppc-embedded@lists.linuxppc.org'


I wrote:

> "epicom" wrote:
>
> >  I have found several bugs in versions 2.4.0-test*, I don't
> > know if they
> > exist
> > in 2.2.* versions, but it is posible.
>
> The first two (of three) do.
>
> The first one:
> > >>  return(((unsigned long)(pte_val(*pte)) & PAGE_MASK) | (address &
> > ~(PAGE_MASK-1)));
>
> is logically wrong but I think it is a harmless bug.

Actually, please ignore the bit about it being a harmless bug. I'll
leave that for others to decide. (I don't want to delve into the
virtual memory implementation to work it out for myself, but I'm still
wondering why the function appears to be mostly preserving the upper
bits of the virtual address, rather than the lower bits.)

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>             )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587              )=-

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-11-03 10:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-03 10:20 A few bugfixes Ian Abbott
  -- strict thread matches above, loose matches on Subject: below --
2000-11-02 18:24 Ian Abbott
2000-11-02 14:02 epicom

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.