Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console: Create a console abstraction #10

Open
d4ilyrun opened this issue Apr 27, 2024 · 1 comment
Open

console: Create a console abstraction #10

d4ilyrun opened this issue Apr 27, 2024 · 1 comment
Labels
arch: none Not architecture specific target: kernel Kernel related features type: refacto Refactor an existing piece of code

Comments

@d4ilyrun
Copy link
Owner

Issue

The way we log currently is we hardcoded the logger to output through the UART so we can read it in color from qemu's console.

This, although working for now, has the downside of not being versatile. What if we want to print some information to the uart and some onto the user's screen? What if we want to print onto both at the same time? What if we want to print it into a file?

Solution

We could create a console structure, containing the necessary information to interact with a console.

This includes:

  • write
  • putc
  • close
  • open/init

We would initialize the logger with the apporpriate struct, and just have it forward the actual hardware interaction to underlying "driver" (uart, terminal, file?, ...).

@d4ilyrun d4ilyrun added target: kernel Kernel related features arch: none Not architecture specific type: refacto Refactor an existing piece of code labels Apr 27, 2024
@d4ilyrun
Copy link
Owner Author

d4ilyrun commented May 17, 2024

After seeing more example implementations, this is usually generalized through the VFS.
The console should be nothing more than an open file descriptor to the underlying driver (be it UART or FB, or even a regular file).

I think I'll be using this as a POC for my VFS when adding support for it (which is the next thing I'm planning to work on).

Prerequisites

  • Implement VFS
  • Add device API
  • Add devtmpfs

@d4ilyrun d4ilyrun changed the title Console: Create a console abstraction console: Create a console abstraction May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch: none Not architecture specific target: kernel Kernel related features type: refacto Refactor an existing piece of code
Projects
None yet
Development

No branches or pull requests

1 participant