32 bits sparc, flags, and IDE

Pete Zaitcev (zaitcev@metabyte.com)
Sun, 11 Jul 1999 23:08:07 -0700 (PDT)


Fellow hackers,

I tried to bring up an IDE disk on 32 bits sparc and expirienced
some difficulties. The code often saves flags in one procedure
and restores them in other procedure. On sparc flags include
a so called Current Window Pointer (CWP) and when you restore flags
saved in other procedure, you screw your stack instanteniously.

We need to resolve this somehow and I see two ways:
a) outlaw what IDE code was doing (IDE maintained won't
like that :).
-or-
b) change sparc asm in such way that it restores everything
but CWP (hmm... got to mask interrupts first... also need
to fix code which *expects* CWP to be updated).

Neither seems desirable so I cannot commit ot any one.
David Miller is on vacation I think... Jakub?

Currently I "solved" the problem with a patch to IDE code
and I can live with that. However I would appreciate if other
developers never did this:

foo () {
unsigned long flags;
save_flags(flags); cli();
bar(flags);
}

bar (unsigned long flags) {
some_other_proc_which_makes_bar_nonleaf();
restore_flags(flags); // barfs on sparc
}

But did this instead:

foo () {
unsigned long flags;
save_flags(flags); cli();
bar();
restore_flags(flags);
}

bar () {
unsigned long flags;
save_flags(flags); cli();
some_other_proc_which_makes_bar_nonleaf();
restore_flags(flags);
}

Please.

--Pete

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/