Re: What is the preferred way of doing a context switch on the ARM?



On Aug 29, 1:05 am, "Boudewijn Dijkstra" <boudew...@xxxxxxxxx> wrote:
Op Fri, 29 Aug 2008 07:45:34 +0200 schreef Michael  
<MichaelDMcDonn...@xxxxxxxxx>:

I’m asking, because I see no clean way to do it. On stack based
machines you simply “pushall” onto the active task’s stack, switch
stacks, and do a “popall”. The ARM makes this difficult because when
it switches to a privileged mode, the active task’s stack becomes
“invisible”, and the CPSR gets saved into the SPSR (as opposed to
being pushed onto the stack).  Thanks!

User-defined task code is only run in User or System mode, which both use  
the 'unaliased' registers.  On an exception, the processor starts using  
alternative registers, but you can go to System mode to access those  
unaliased registers and push them (and the SPSR as well, of course).

--
Gemaakt met Opera's revolutionaire e-mailprogramma:  http://www.opera.com/mail/

Yes, but I was looking for a clean way to do it (no mode changing).
Also there's the question of what register to use for the STM / LDM
instructions. Evidently you need to push a register onto the privilege
mode's stack. I would think that there would be a cleaner way...
.



Relevant Pages

  • Re: Statement on Schildt submitted to wikipedia today
    ... you discover that Schildt was libeled. ... It turns out that, on this particular architecture, some registers are saved ... The problem is, even though indeed this implementation has "a stack", if you ... end up adjacent to one of our newest automatic variables. ...
    (comp.lang.c.moderated)
  • Re: Geriatric Pentium
    ... processor scavenging spare ram cycles to back it up to ram and restore ... Let's say I had hardware for 128 registers. ... Ditto for caching the stack. ... PUSHL P+2;; take parameter #2 and push it ...
    (comp.lang.java.advocacy)
  • Re: [OT] PostLisp, a language experiment
    ... >> that a C compiler generates code to arrange the parameters where it ... > value from the user stack. ... > can be simply passed in registers. ... common for the top stack item to reside in a register, ...
    (comp.lang.lisp)
  • Re: I found a FORTH stack optimzer, but could use a better version.
    ... I'm thinking more of minimal hardware requirement in terms of registers ... only a few require the more "non-portable" x86 CISC instructions. ... "Stack Computers" main index ... then a fast native ROT or ROLL ...
    (comp.lang.forth)
  • Re: my assembler is better than your assembler
    ... pushed onto the stack by EBP will be in memory that is cached. ... but the fish may start smelling with the first PUSH. ... but only registers which are needed. ... your aspect of maintainability] ...
    (alt.lang.asm)