Commit graph

33 commits

Author SHA1 Message Date
Liav A 77486a0d08 Kernel: Remove includes to LibC stdarg definitions
We don't actually need the va_list and other stdarg definitions in the
kernel, because we actually don't use the "pure" printf interface in any
kernel code at all, but we retain the snprintf declaration because the
libstdc++ library still need it to be declared and extern'ed.
2023-03-01 19:36:53 -07:00
Liav A 5576151e68 Kernel: Don't blindly compile Bochs debug output code in ConsoleDevice
Only use the Bochs debug output if we compile a x86 build since bochs
debug output relies on x86 specific instructions.

We also remove the CONSOLE_OUT_TO_BOCHS_DEBUG_PORT flag as we always
compile bochs debug output for x86 builds and we always want to include
the bochs debug output capability as it is very handy and doesn't hurt
bare metal hardware or do any other problem besides taking a small
amount of CPU cycles.
2022-09-20 18:43:05 +01:00
Skye Sprung eca85f2050 Kernel: Changed serial debug functions and variables for readability
Change the name of set_serial_debug(bool on_or_off) to
set_serial_debug_enabled(bool desired_state). This is to make the names
more expressive and less unclear as to what the function does, as it
only sets the enabled state.
Likewise, change the name of get_serial_debug() to
is_serial_debug_enabled() in order to make clear from the name that
this is simply the state of s_serial_debug_enabled.
Change the name of serial_debug to s_serial_debug_enabled since this is
a static bool describing this state.
Finally, change the signature of set_serial_debug_enabled to return a
bool, as this is more logical and understandable.
2022-08-27 19:42:52 +01:00
Idan Horowitz 086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Ben Wiederhake 33079c8ab9 Kernel+UE+LibC: Remove unused dbgputch syscall
Everything uses the dbgputstr syscall anyway, so there is no need to
keep supporting it.
2021-11-24 22:56:39 +01:00
Idan Horowitz 6348b63476 Kernel: Add kernelearlyputstr and use it in dbgln in very-early boot
This variant of dbgputstr does not lock the global log lock, as it is
called before the current or any other processor was initialized,
meaning that:
A) The $gs base was not setup yet, so we cannot enter into critical
   sections, and as a result we cannot use SpinLocks
B) No other processors may try to print at the same time anyway
2021-09-10 22:58:08 +03:00
Brian Gianforcaro 1ee1ef5103 Kernel: Introduce a StringView overload of dbgputstr(..) 2021-08-13 11:08:11 +02:00
Max Wipfli 67067904f5 Kernel: Add dbgputch() to kstdio.h
This adds a dbgputch() alongside dbgputstr() in kstdio.h. The function
already existed as the static function debugger_out(). It has now been
exposed to users of kstdio.h.
2021-06-24 10:29:09 +02:00
Liav A 20743e8aed Kernel/Graphics + SystemServer: Support text mode properly
As we removed the support of VBE modesetting that was done by GRUB early
on boot, we need to determine if we can modeset the resolution with our
drivers, and if not, we should enable text mode and ensure that
SystemServer knows about it too.

Also, SystemServer should first check if there's a framebuffer device
node, which is an indication that text mode was not even if it was
requested. Then, if it doesn't find it, it should check what boot_mode
argument the user specified (in case it's self-test). This way if we
try to use bochs-display device (which is not VGA compatible) and
request a text mode, it will not honor the request and will continue
with graphical mode.

Also try to print critical messages with mininum memory allocations
possible.

In LibVT, We make the implementation flexible for kernel-specific
methods that are implemented in ConsoleImpl class.
2021-05-16 19:58:33 +02:00
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling ef1e5db1d0 Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)
Good-bye LogStream. Long live AK::Format!
2021-03-12 17:29:37 +01:00
Andreas Kling 5f610417d0 Kernel: Remove kprintf()
There are no remaining users of this API.
2021-02-17 16:33:43 +01:00
Andreas Kling e4d84b5e79 Kernel: Remove dbgprintf() from kernel
There are no remaining users of this API in the kernel.
2021-02-17 16:22:34 +01:00
Sahan Fernando 6b01d1cf14 LibC: Enable compiler warnings for printf format strings 2020-12-26 10:05:50 +01:00
Ben Wiederhake 1aad0f8b16 Kernel: Stop supporting sprintf
The kernel no longer needs sprintf (which might, in theory, overflow),
so we can hide the C++ declaration and make the function uncallable
from within the kernel.

However, libstdc++ still links against it, as libstdc++ uses it for
demangling, from AK::demangle().
2020-08-22 20:55:10 +02:00
Ben Wiederhake 0240baa42d AK+Kernel: Support snprintf
In contrast to sprintf, which might overflow the given buffer.

I feel bad about the code duplication, but that is a pre-existing issue.
2020-08-22 20:55:10 +02:00
Nico Weber 0586924bbd LibELF+Lagom: Work towards getting LibELF in Lagom
Mostly -Wformat fixes, some of which pointed out real (if benign) bugs.
2020-08-09 21:12:54 +02:00
Andreas Kling c9e38c5255 Kernel: Remove awkward "#define printf dbgprintf" 2020-05-16 12:03:25 +02:00
Andreas Kling 21d5f4ada1 Kernel: Absorb LibBareMetal back into the kernel
This was supposed to be the foundation for some kind of pre-kernel
environment, but nobody is working on it right now, so let's move
everything back into the kernel and remove all the confusion.
2020-05-16 12:00:04 +02:00
Liav A e559af2008 Kernel: Apply changes to use LibBareMetal definitions 2020-02-09 19:38:17 +01:00
Andreas Kling 94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Andrew Kaster fe0eb04a22 Kernel: Overload dbgputstr for char array literals in C++
This just seems like something we should be able to do. The compiler
knows how long my "string literal" is, passing it along manually seems
siilly.
2020-01-13 13:03:30 +01:00
Andreas Kling 44bc4008b7 Build: Get rid of the USERLAND define
Let's simplify things. There is now only KERNEL.
To see if you're on Serenity, check if __serenity__ is defined.
2019-12-20 22:59:11 +01:00
Andreas Kling 0adbacf59e Kernel: Demangle userspace ELF symbols in backtraces
Turns out we can use abi::__cxa_demangle() for this, and all we need to
provide is sprintf(), realloc() and free(), so this patch exposes them.

We now have fully demangled C++ backtraces :^)
2019-11-27 14:06:24 +01:00
Conrad Pankoff 3026c37d5d Kernel: Add serial_debug cmdline parameter
serial_debug will output all the kprintf and dbgprintf data to COM1 at
8-N-1 57600 baud. this is particularly useful for debugging the boot
process on live hardware.

Note: it must be the first parameter in the boot cmdline.
2019-08-11 08:22:42 +02:00
Andreas Kling af81645a2a Kernel+LibC: Add a dbgputstr() syscall for sending strings to debug output.
This is very handy for the DebugLogStream implementation, among others. :^)
2019-07-21 21:43:37 +02:00
Andreas Kling 7e1cb86da7 LibHTML: Make it possible to build LibHTML on the host.
- "make" builds the normal Serenity libhtml.a
- "make -f Makefile.host" builds a test program for the host machine.
2019-06-22 21:21:57 +02:00
Robin Burchell 0dc9af5f7e Add clang-format file
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
2019-05-28 17:31:20 +02:00
Andreas Kling 0bc72551f4 Kernel: Remove two unneeded headers. 2019-04-10 22:49:11 +02:00
Andreas Kling 17c7bf01a5 Fix Userland build. 2019-01-13 04:31:16 +01:00
Andreas Kling 8626e95509 Make Widgets/ build inside the kernel. 2019-01-10 22:52:14 +01:00
Andreas Kling bae59609e3 Move kprintf to its own file. It has nothing to do with VGA anymore. 2018-10-22 13:20:35 +02:00
Andreas Kling aec8ab0a60 Add the basic character devices to kernel. 2018-10-16 14:33:16 +02:00