File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,12 +137,6 @@ class OS {
137137 * Add handler for standard output.
138138 */
139139 static void add_stdout (print_func func);
140- /* *
141- * Add stdout handler that simply calls OS::default_stdout
142- **/
143- static void add_default_stdout () {
144- add_stdout (OS::default_stdout);
145- }
146140
147141 /* *
148142 * The default output method preferred by each platform
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ add_dependencies(vmxnet3 PrecompiledLibraries)
1616add_library (heap_debugging STATIC heap_debugging.cpp )
1717add_dependencies (heap_debugging PrecompiledLibraries )
1818
19- add_library (silent_start STATIC silent .cpp )
20- add_dependencies (silent_start PrecompiledLibraries )
19+ add_library (boot_logger STATIC bootlog .cpp )
20+ add_dependencies (boot_logger PrecompiledLibraries )
2121
2222add_library (vga_output STATIC vgaout.cpp )
2323add_dependencies (vga_output PrecompiledLibraries )
@@ -26,7 +26,7 @@ install(TARGETS
2626 virtionet virtioblk
2727 vmxnet3
2828 heap_debugging
29- silent_start vga_output
29+ boot_logger vga_output
3030 DESTINATION includeos/${ARCH} /drivers)
3131
3232if (WITH_SOLO5)
Original file line number Diff line number Diff line change 1515// See the License for the specific language governing permissions and
1616// limitations under the License.
1717
18- #include < os>
19- #include < kprint>
20-
21- // prevent default serial out
22- void default_stdout_handlers ()
23- {
24- OS::add_stdout (
25- [] (const char * str, size_t len)
26- {
27- if (OS::is_booted () || OS::is_panicking ())
28- OS::default_stdout (str, len);
29- });
30- }
18+ // enable logging during boot
19+ bool os_enable_boot_logging = true ;
Original file line number Diff line number Diff line change 1515// See the License for the specific language governing permissions and
1616// limitations under the License.
1717
18- // use VGA as default output instead of serial
1918#include < vga>
2019
20+ // output to VGA as well as the default stdout
2121void default_stdout_handlers ()
2222{
23+ OS::add_stdout (&OS::default_stdout);
2324 OS::add_stdout (TextmodeVGA::get ().get_print_handler ());
2425}
Original file line number Diff line number Diff line change @@ -139,12 +139,16 @@ void OS::add_stdout(OS::print_func func)
139139__attribute__ ((weak))
140140void default_stdout_handlers()
141141{
142- OS::add_default_stdout ( );
142+ OS::add_stdout (&OS::default_stdout );
143143}
144+ __attribute__ ((weak))
145+ bool os_enable_boot_logging = false;
144146void OS::print (const char * str, const size_t len)
145147{
146- for (auto & func : os_print_handlers)
147- func (str, len);
148+ for (auto & callback : os_print_handlers) {
149+ if (os_enable_boot_logging || OS::is_booted () || OS::is_panicking ())
150+ callback (str, len);
151+ }
148152}
149153
150154void OS::legacy_boot () {
You can’t perform that action at this time.
0 commit comments