Re: [buildd] Etch?
On Fri, 4 Aug 2006, Wouter Verhelst wrote:
> On Fri, Aug 04, 2006 at 02:37:03PM +0200, Geert Uytterhoeven wrote:
> > On Fri, 4 Aug 2006, Wouter Verhelst wrote:
> > > * Using address register indirect with predecrement or postincrement mode
> > > on the stack pointer (A7) in byte context will increment resp.
> > > decrement the stack pointer with 2 bytes on classic 68k, but with 1
> > > byte on the ColdFire. Both still need to be aligned on two bytes,
> > > however. As a result, this addressing mode should be avoided; but I do
> > > not think that it is used very often.
> > Hmm... So what happens if you push 1 byte on the stack, and an
> > interrupt comes in?
> Interrupts happen in kernel mode, not in user mode (unless I missed
> something? I'm fairly new to all this). ColdFire is way different from
Interrupts can happen at any time.
> 68k in supervisor mode to the point that it doesn't even remotely seem
> possible to extend the hybrid mode to the supervisor programming model,
> so I'm not even trying. Shipping different kernels for classic 68k and
> ColdFire isn't exactly hard at all, anyway.
Well, there are quite some differences between '020/030, '040, and '060, too.
> Moreover, isn't one of the first thing the kernel will do on a context
> switch (which an interrupt is, right?) to save the registers off to some
> place and load register state for some other process? So then the
> original process that got interrupted can align its stack pointer later
> (when the context is switched back), and the process or interrupt
> handler which we're loading now will presumably have an aligned stack
> pointer already. No?
The interrupt handler will save them to the stack. And before that, the CPU has
already stored the PC and some other bits on the stack, too.
> That being said, if interrupts can indeed interfere in that way, then
> Stuff Breaks. This difference certainly is /much/ more of a problem than
> the above one. Especially since, if you indeed do push one byte on the
> stack, you have to verify whether the stack pointer is aligned, and
> align it if it hasn't, which takes a fair amount of opcodes and thus
> processing time. This sucker should be avoided at all costs; I'd think
> it'd be better to just push a word on the stack instead of a byte, and
> only use the first byte if you only need a byte anyway. In that
> scenario, both processors act exactly the same way; and I don't think
> that pushing a word on the stack (as opposed to pushing a byte) will
> take a hell of a lot more processing time.
Exactly my thoughts: if you push a byte on the stack with interrupts enabled,
you're playing russian roulette.
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- firstname.lastname@example.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds