[PATCH] powerpc: change rheap functions to use long integers instead of pointers

Timur Tabi timur at freescale.com
Thu Apr 5 03:42:50 EST 2007

Kumar Gala wrote:

> I'm concerned the error handling isn't correctly.  What happens if  
> the rheap I'm managing has addresses at 0xf0000000.  When I compare  
> offset to 0, its going to report as an error, even if the offset  
> returned is valid.

The return value is an offset INTO the actual buffer.  Unless you have buffer larger than 
2GB, the return value will never be negative unless it's an error.  So technically, the 
maximum size of the remote heap is 2GB.  It doesn't matter where it was located.

Please keep in mind that I'm not changing the actual numeric values that are being 
returned.  I'm only changing the types, because they were wrong.  rh_alloc() was returning 
a void pointer, but it was NEVER a pointer.  It was always a simple offset.  The first 
time you call rh_alloc(), you will get back a value of 0, because that's the beginning of 
the heap.  This patch doesn't change that.  It changes the types.

Having said that, the code used to support heaps as large as 4GB - 4096, and now it 
supports heaps as large as 2GB.  I don't think that's a problem, but I can add a comment 
to that effect in the changelog.

Timur Tabi
Linux Kernel Developer @ Freescale

More information about the Linuxppc-dev mailing list