Skip to content

Commit ba7d283

Browse files
committed
os: Disable boot output by default, add boot_logger driver, remove silent_start driver, update VGA output
1 parent dc08e73 commit ba7d283

5 files changed

Lines changed: 14 additions & 26 deletions

File tree

api/kernel/os.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff 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

src/drivers/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ add_dependencies(vmxnet3 PrecompiledLibraries)
1616
add_library(heap_debugging STATIC heap_debugging.cpp)
1717
add_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

2222
add_library(vga_output STATIC vgaout.cpp)
2323
add_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

3232
if(WITH_SOLO5)
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,5 @@
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;

src/drivers/vgaout.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
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
2121
void default_stdout_handlers()
2222
{
23+
OS::add_stdout(&OS::default_stdout);
2324
OS::add_stdout(TextmodeVGA::get().get_print_handler());
2425
}

src/kernel/os.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,16 @@ void OS::add_stdout(OS::print_func func)
139139
__attribute__ ((weak))
140140
void 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;
144146
void 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

150154
void OS::legacy_boot() {

0 commit comments

Comments
 (0)