Port-sparc64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Custom boot loader stub
On Fri, 24 Oct 2025 14:30:17 +0300
Valery Ushakov <uwe%stderr.spb.ru@localhost> wrote:
> From a quick look I'd venture a guess that you might want to use
> poll-tty first, before calling read to read the data that you now know
> is there.
>
> -uwe
Thanks for the pointers. I've just realised the solution was right
there in front of me in Illumos prom_getchar(). My brain didn't quite
register that it was polling for input in a while loop.
This is what I should have done:
char ofw_read_stdin_char(void)
{
int64_t i64;
char c;
do
{
/* Continually returns -2 while no data is ready on stdin */
i64 = ofw_read_stdin(&c, 1);
} while (i64 == -2);
ASSERT(i64 == 1); /* Catch -1 on read error */
return c;
}
Now everything is working correctly:
Running SPARC-V9 bootblk
ihandle_stdin 0xFEB51F90
ihandle_stdout 0xFEB51D88
Press Enter to exit:
Program terminated
{0} ok
Home |
Main Index |
Thread Index |
Old Index