Skip to content
Snippets Groups Projects
Commit 56996315 authored by Claudio Fontana's avatar Claudio Fontana Committed by Pekka Enberg
Browse files

debug: allow debug_early to work really early again


an effect of commit 9bbbe9dc is that no output is possible
before prio 'console' initializers have been run.
This change allows to have at least one API available
really early (from boot code and premain).
Document the requirements for the early console class
regarding the write() method.

Signed-off-by: default avatarClaudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 8e087635
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <osv/debug.hh> #include <osv/debug.hh>
#include <osv/debug.h> #include <osv/debug.h>
#include "early-console.hh"
using namespace std; using namespace std;
logger* logger::_instance = nullptr; logger* logger::_instance = nullptr;
...@@ -248,9 +250,19 @@ extern "C" { ...@@ -248,9 +250,19 @@ extern "C" {
console::write_ll(msg, strlen(msg)); console::write_ll(msg, strlen(msg));
} }
/* Early Console Output
*
* For early output functionality (from boot code, premain) we need
* to access the write() method of the arch-specific early console
* directly, because cannot wait for the console framework to be
* initialized, not even its "early" functionality.
* Therefore the write() method of the early console needs
* to work without requiring any class construction.
*/
void debug_early(const char *msg) void debug_early(const char *msg)
{ {
console::write_ll(msg, strlen(msg)); console::arch_early_console.write(msg, strlen(msg));
} }
void debug_early_u64(const char *msg, unsigned long long val) void debug_early_u64(const char *msg, unsigned long long val)
...@@ -267,8 +279,8 @@ extern "C" { ...@@ -267,8 +279,8 @@ extern "C" {
val >>= 4; val >>= 4;
} }
console::write_ll(msg, strlen(msg)); console::arch_early_console.write(msg, strlen(msg));
console::write_ll(nr, 16); console::arch_early_console.write(nr, 16);
console::write_ll("\n", 1); console::arch_early_console.write("\n", 1);
} }
} }
...@@ -98,6 +98,8 @@ extern "C" { ...@@ -98,6 +98,8 @@ extern "C" {
void premain() void premain()
{ {
debug_early_entry("early-console test: premain");
arch_init_premain(); arch_init_premain();
auto inittab = elf::get_init(elf_header); auto inittab = elf::get_init(elf_header);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment