Subject: feasible to return from the kernel to OpenFirmware?
To: None <firstname.lastname@example.org>
From: Derek Peschel <email@example.com>
Date: 01/09/2002 13:50:52
This may be a silly question (I haven't done any kernel programming)
so I realize it may get shot down, though I hope it won't.
I have OpenFirmware on my machine (PowerMacintosh G4). As I see it,
the bootloader (and the kernel, which it chains to) are just gigantic
subroutines called by OF. Therefore, the kernel ought to be able to
return to OF as the result of some flavor of cpu_reboot, with things
set up so that I could continue using OF (all CLAIMed memory freed,
The problem is that the kernel was never designed to return. Is it
practical to make the kernel return, either by changing the scheduler
or by some tricks with the stack (in the machine-dependent part
of cpu_reboot)? The present machine-dependent cpu_reboot code calls
the OF "exit" routine (which signals that the client program
has finished) but then sits in an endless loop.
The other problem is that the bootloader appears to exit gracefully --
it has code like this:
get boot strings
chain to kernel
call OF "exit" routine
(end of function -- return to caller)
and commenting out the "chain" call gets me an OF prompt -- but I know
from experience that OF can often get in weird states, so I would need
to make sure the machine state really was unchanged. And if I actually
ran the kernel, it would do all its CPU initialization, so I'd need to
make sure that was undone as well.
Thanks for your advice,