Hi,<br><br>The cpsr thats saved out to r2 is 0x800000df, but is restored back to 0x13. Thanks for pointing out that no cpsr change must happen, i will check how the rtl22xx_t bsp sets up the cpsr.<br><br><br><div class="gmail_quote">
On 25 February 2013 16:52, Sebastian Huber <span dir="ltr"><<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 02/25/2013 05:47 PM, Matthew J Fletcher wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
r2 is 0x13 before the msr, so I guess new_level must have been 0.<br>
<br>
On 25 Feb 2013 15:02, "Sebastian Huber" <<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-<u></u>brains.de</a><br>
<mailto:<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@<u></u>embedded-brains.de</a>>> wrote:<br>
<br>
    On 02/25/2013 03:15 PM, Matthew J Fletcher wrote:<br>
<br>
        Sebastian,<br>
<br>
        The _Thread_Heir->Registers are ok into the _Context_Switch() call, sp<br>
        and lr<br>
        both sensible.<br>
<br>
        At the 'mrs r2, cpsr' line sp is 0x40001b2c (rubbish) and pc sensible.<br>
<br>
        In _restore, after the 'ldmia r1, ...' instruction the sp and lr are loaded<br>
        with the correct values from _Thread_Heir->Registers.<br>
<br>
        Its the 'msr cpsr, r2' messes up the sp and lr<br>
<br>
<br>
    Ok, if you load undefined values into the CPSR, then a lot of things may<br>
    happen.  What is the value of r2 before the msr?  It should be 0x13.<br>
</blockquote>
<br>
Ok, then maybe the mode in the BSP execution context is wrong.  During _Context_Switch() no mode change must happen.  What is the CPSR before the msr?<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Sebastian Huber, embedded brains GmbH<br>
<br>
Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>
Phone   : <a href="tel:%2B49%2089%20189%2047%2041-16" value="+4989189474116" target="_blank">+49 89 189 47 41-16</a><br>
Fax     : <a href="tel:%2B49%2089%20189%2047%2041-09" value="+4989189474109" target="_blank">+49 89 189 47 41-09</a><br>
E-Mail  : <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-<u></u>brains.de</a><br>
PGP     : Public key available on request.<br>
<br>
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div><br>regards</div><div>---</div><div>Matthew J Fletcher</div><br>