Re: Error in NatLib_InstallImmutableStateBlock??

Thomas Chenot <tom.chenot-6tN4nzCoH/[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Jonathan Sharret wrote:

>Hi,
>
>I think I found an error, or at least misleading information in the
>description for NatLib_InstallImmutableStateBlock.  In Native_API it
>states that the method simply outputs a 0 in the accumulator if there
>was no error.  It makes no mention of changing anything.  However, I
>found that the 2 data pointers used as input are not preserved across
>the method call.  
>
These pointers should probably be preserved. We will either document 
this behavior better or preserve these pointers for the next TINI SDK 
release.

>I wrote code that writes into an immutable state block
>with a LibraryID supplied by the user as input to the native method.  If
>the state block doesn't already exist, the method is supposed to malloc
>it, install it and then write into it.  I couldn't understand why the
>1st time I would write it wouldn't work but the second and all
>subsequent times did work until I noticed that
>NatLib_InstallImmutableStateBlock is screwing with the data pointers.
>Here is the debug information I got out of the diagnostic port.
>
>Data pointers into the NatLib_InstallImmutableStateBlock method:
>
>DPTR1:1C9A4A
>DPTR2:1C9A67
>
>Data pointers after the NatLib_InstallImmutableStateBlock method:
>DPTR1:1C9A52
>DPTR2:1CCA7C
>
>In order to get the program to work properly, I had to preserve DPTR1
>across the method call myself since otherwise I'd be writing into the
>wrong memory location.
>
>Is this an error?  Or am I just supposed to know to preserve things
>myself?
>
>Another question, is there a list of registers that are safe and those
>that are unsafe to manipulate in a native method?
>
See Native_Methods.txt

>  I tried copying into
>DPTR3 as slack space instead of pushing and popping off the stack and
>got very bizarre results which leads me to think DPTR3 is off limits.
>  
>
 From Native_Methods.txt:
    The contents of the additional pair of DPTRs on the DS80C400
    must be preserved.

>Is this true?  What about other registers.
>
>Thanks,
>Jonathan Sharret
>
>TELEGRID Technologies, Inc.
>Email: j.sharret-vt2K7lilQm9Wk0Htik3J/[email protected]
>
>  
>


-- 
Thomas Chenot

_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.