Page MenuHomeFreeBSD

kboot: move to generic syscall interface

Authored by imp on Dec 16 2021, 5:00 PM.



Just have the MD code provide syscall and have generic code for the

Sponsored by: Netflix

Test Plan

This commit is the one I'm most worried about

Diff Detail

rG FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

imp requested review of this revision.Dec 16 2021, 5:00 PM

'so' flag is used by the syscall interface, on FreeBSD too, to denote error. Examining uses of host_open(), I'm guessing that 0 is already a taken file descriptor (stdin?), so returning 0 on error is acceptable. Not sure why host_read() would return 0 on error. I would expect -1 instead.

imp marked an inline comment as done.Dec 22 2021, 5:20 AM
imp added inline comments.

Yea. It's weird. And these are Linux calls, so a negative errno is expected...

And looking at how it's used, an error in open would translate to reading stdin given how open is used. So I'm guessing there were no such errors.

Likewise for reads.... But why is that code even there...

I was able to build kboot for powerpc64, with diffs D33511 - D33515.
In the machines that I have access to, Petitboot can't run BE loader.kboot, but I was able to build and run a LE loader.kboot.
However, as mentioned in D33511, it can just run some loader commands, but can't list files or load a kernel. But the older version, without these changes, also can't.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 30 2021, 11:32 PM
This revision was automatically updated to reflect the committed changes.
imp marked an inline comment as done.