AnsweredAssumed Answered

Stack overflow and 21469

Question asked by PeterBakker on Sep 11, 2009
Latest reply on Sep 11, 2009 by PeterBakker

Because we have an algorithm running that uses more than 6 loop levels deep (4 threads, 3 loop levels each) we have our context saving routine set up to save the current loop stack, both count and address and empty it. Context restore puts it all back. This works nicely on a 21369, but on the 21469 we wind up with garbage in the loop address and count stacks. Is this the proper way to do this ?

 

The method used is this:

.var     loopstacksave[12];

.var     loopstackcount = 0;

 

//     save

      r1 = 0;
      b1 = loopstacksave;
      m1 = 1;
      l1 = 0;
      startStackSave:    bit tst STKYx LSEM;
      if tf jump foundLoopStackEmpty;
          dm(i1, m1) = LADDR;
          dm(i1, m1) = CURLCNTR;
          pop loop;
          r1 = r1 + 1;
          nop;
          jump startStackSave;
      foundLoopStackEmpty:
      dm(loopstackcount ) = r1;

 

//     restore

            r2 = dm(loopstackcount);
            b0 = loopstacksave;
            m0 = r2;
            modify(i0, m0);     //     modify twice with count, once with -1 to read the stack in reverse order
            modify(i0, m0);
            m0 = -1;
            modify(i0, m0);
            r2 = pass r2;          //     if count  == 0, don't restore a thing
            if le jump noMoreRestore;
            startStackRestore:
                push loop;
                CURLCNTR = dm(i0, m0);
                LADDR = dm(i0, m0);
                r2 = r2 - 1;
                if eq jump noMoreRestore;
                jump startStackRestore;
            noMoreRestore:          

Outcomes