On 09/04/13 20:49, Artyom Tarasenko wrote:
I've just committed a patch to fix this (on a second attempt as I accidentally caught the NULL dereference patch in there too) so please feel free to test.
But we still don't need ihandle>phandle in (.property-by-name), do we?
Yes, because the properties in /chosen are ihandles (see page 23 of the IEEE1275 specification). So if you are still seeing strange behaviour that could be another bug - if you can post a test case, I'll take a look.
ATB,
Mark.
On 2013-Apr-9 19:08 , Mark Cave-Ayland wrote:
But we still don't need ihandle>phandle in (.property-by-name), do we?
Yes, because the properties in /chosen are ihandles (see page 23 of the IEEE1275 specification). So if you are still seeing strange behaviour that could be another bug - if you can post a test case, I'll take a look.
That shouldn't matter - as far as .properties is concerned, the /chosen properties are ints, and are printed out as such.
The bug seemed to be the sequence:
active-package ( phandle ) ihandle>phandle
You can't feed a phandle into ihandle>phandle.
On 10/04/13 00:43, Tarl Neustaedter wrote:
That shouldn't matter - as far as .properties is concerned, the /chosen properties are ints, and are printed out as such.
The bug seemed to be the sequence:
active-package ( phandle ) ihandle>phandle
You can't feed a phandle into ihandle>phandle.
Hmmm the source looks like this:
" /chosen" find-dev if " mmu" rot get-package-property 0= if decode-int nip nip ihandle>phandle active-package = if ... then then then
AFAICT the code should get the chosen package "mmu" property, decode it, remove the remainder, convert to a phandle and then do the comparison to active-package which should be valid?
ATB,
Mark.
On 2013-Apr-10 04:18 , Mark Cave-Ayland wrote:
[...] Hmmm the source looks like this:
" /chosen" find-dev if " mmu" rot get-package-property 0= if decode-int nip nip ihandle>phandle active-package = if ... then then then
AFAICT the code should get the chosen package "mmu" property, decode it, remove the remainder, convert to a phandle and then do the comparison to active-package which should be valid?
Ah. Sorry, I was mistaken in what was going on in .properties. I thought it was doing an ihandle>phandle on the returned value of active-package. Looking more carefully at the stack trace, it's indeed doing an ihandle>phandle on the result of a get-package-property rather than active-package - the " mmu" property is coming back zero, and you really can't feed that to ihandle>phandle.
Hmmm the source looks like this:
" /chosen" find-dev if " mmu" rot get-package-property 0= if decode-int nip nip ihandle>phandle active-package = if ... then then then
AFAICT the code should get the chosen package "mmu" property, decode it, remove the remainder, convert to a phandle and then do the comparison to active-package which should be valid?
... and 0 is never a valid ihandle; this isn't explicitly stated in the 1275 spec as far as I know, but there are many words that return ( ihandle | 0 ) , so for that to work, 0 cannot be a valid ihandle (many implementations use pointers as ihandles, but not all).
Segher