Error in NatLib_InstallImmutableStateBlock??
"Jonathan Sharret" <j.sharret-vt2K7lilQm9Wk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
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. 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? 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. Is this true? What about other registers. Thanks, Jonathan Sharret TELEGRID Technologies, Inc. Email: j.sharret-vt2K7lilQm9Wk0Htik3J/[email protected] _______________________________________________ TINI mailing list TINI-6tN4nzCoH/[email protected] To UNSUBSCRIBE, edit your profile, or see list archives: http://lists.dalsemi.com/mailman/listinfo/tini