Re: Custom boot loader stub
Valery Ushakov <[email protected]> Fri, 24 Oct 2025 20:13:28 +0300
| Newsgroups | gmane.os.netbsd.ports.sparc64 |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Oct 24, 2025 at 17:49:30 +0100, Sad Clouds wrote: > On Fri, 24 Oct 2025 14:30:17 +0300 Valery Ushakov <[email protected]> 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. > > 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); poll-tty seems nicer, as it handles e.g. abort on break. -uwe