Re: [CFT] kexec syscall for 2.5.43 (linux booting linux)

Eric W. Biederman
2002-10-28T08:20:00Z

Kasper Dupont <kasperd@daimi.au.dk> writes:

> "Eric W. Biederman" wrote:
> >
> > +static void i8259A_remove(struct device *dev)
> > +{
> > + /* Restore the i8259A to it's legacy dos setup.
> > + * The kernel won't be using it any more, and it
> > + * just might make reboots, and kexec type applications
> > + * more stable.
> > + */
> > + outb(0xff, 0x21); /* mask all of 8259A-1 */
> > + outb(0xff, 0xA1); /* mask all of 8259A-1 */
> > +
> > + outb_p(0x11, 0x20); /* ICW1: select 8259A-1 init */
> > + outb_p(0x08, 0x21); /* ICW2: 8259A-1 IR0-7 mappend to 0x8-0xf */
> > + outb_p(0x01, 0x21); /* Normal 8086 auto EOI mode */
> > +
> > + outb_p(0x11, 0xA0); /* ICW1: select 8259A-2 init */
> > + outb_p(0x08, 0xA1); /* ICW2: 8259A-2 IR0-7 mappend to 0x70-0x77 */
>
> ^^^^ ^^^^
>
> This looks wrong to me.

Thanks that was a clear cut and paste bug.

I am in the process of moving the i8259A setup code into my kexec user
space program. I believe it is inappropriate to assume the interrupt
controller is going to be used by dos when it is shut down. So my
latest version (just published) simply masks all interrupts through
the pic.

The pic setup code I am in the process of moving into kexec-tools, and
since the pic is well know I will do this piece of setup work
there.

Another bug worth noting in this code, is that as of 2.5.44 only the
->shutdown methods are called on reboot and not the ->remove methods
so I actually hooked the wrong routine. Just in case someone else is
trying to hook that moving target.

Eric