summaryrefslogtreecommitdiff
path: root/Kernel/kprintf.cpp
AgeCommit message (Collapse)Author
2021-12-30Kernel: Simplify some if statementsHendiadyoin1
2021-11-24Kernel+UE+LibC: Remove unused dbgputch syscallBen Wiederhake
Everything uses the dbgputstr syscall anyway, so there is no need to keep supporting it.
2021-10-01Kernel: Move x86 IO instructions code into the x86 specific folderLiav A
2021-09-17Kernel/Devices: Use try_create_device helper for ConsoleDeviceLiav A
2021-09-17Kernel/Devices: Move ConsoleDevice into the Devices source directoryLiav A
2021-09-10Kernel: Add kernelearlyputstr and use it in dbgln in very-early bootIdan Horowitz
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-08-22Kernel: Rename ScopedSpinlock => SpinlockLockerAndreas Kling
This matches MutexLocker, and doesn't sound like it's a lock itself.
2021-08-22Kernel: Rename SpinLock => SpinlockAndreas Kling
2021-08-13Kernel: Introduce a StringView overload of dbgputstr(..)Brian Gianforcaro
2021-08-07Kernel: Move SpinLock.h into Locking/Jean-Baptiste Boric
2021-08-06Kernel: Hold the global logging lock in dbgputchIdan Horowitz
This was not an active issue as sys$dbgputch (the only user of this function) is not actually used anywhere.
2021-08-01Kernel: Remove unused header includesBrian Gianforcaro
2021-06-24Kernel: Add dbgputch() to kstdio.hMax Wipfli
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-03Kernel: Support new lines when doing critical printingLiav A
If we are printing strings in the critical path, handling new lines require us to break abstraction a bit to print new lines. Fixes #7562.
2021-05-31Kernel: Rename instances of IO port 0xe9 to BOCHS_DEBUG_PORTNick Miller
2021-05-17Kernel: Implement a PCI Serial Device driverIdan Horowitz
This simple driver simply finds a device in a device definitions list and then sets up a SerialDevice instance based on the definition. The driver currently only supports "WCH CH382 2S" pci serial boards, as that is the only device available for me to test with, but most other pci serial devices should be as easily addable as adding a board_definitions entry.
2021-05-16Kernel/Graphics + SystemServer: Support text mode properlyLiav A
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-16Kernel: Rename Console => ConsoleDeviceLiav A
This change will help to distinguish between the console device and the Console abstraction layer in the Graphics subsystem later.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
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-03-12Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)Andreas Kling
Good-bye LogStream. Long live AK::Format!
2021-02-20Kernel: Don't take debug logging lock in sprintf()Andreas Kling
This function doesn't write to the log, and so doesn't need to acquire the logging lock. (This is only used by GCC's name demangling thingy.)
2021-02-17Kernel: Remove kprintf()Andreas Kling
There are no remaining users of this API.
2021-02-17Kernel: Remove dbgprintf() from kernelAndreas Kling
There are no remaining users of this API in the kernel.
2021-01-09Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2020-08-22Kernel: Stop supporting sprintfBen Wiederhake
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-22AK+Kernel: Support snprintfBen Wiederhake
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-12Kernel: Mark compilation-unit-only functions as staticBen Wiederhake
This enables a nice warning in case a function becomes dead code. Also, in case of signal_trampoline_dummy, marking it external (non-static) prevents it from being 'optimized away', which would lead to surprising and weird linker errors. I found these places by using -Wmissing-declarations. The Kernel still shows these issues, which I think are false-positives, but don't want to touch: - Kernel/Arch/i386/CPU.cpp:1081:17: void Kernel::enter_thread_context(Kernel::Thread*, Kernel::Thread*) - Kernel/Arch/i386/CPU.cpp:1170:17: void Kernel::context_first_init(Kernel::Thread*, Kernel::Thread*, Kernel::TrapFrame*) - Kernel/Arch/i386/CPU.cpp:1304:16: u32 Kernel::do_init_context(Kernel::Thread*, u32) - Kernel/Arch/i386/CPU.cpp:1347:17: void Kernel::pre_init_finished() - Kernel/Arch/i386/CPU.cpp:1360:17: void Kernel::post_init_finished() No idea, not gonna touch it. - Kernel/init.cpp:104:30: void Kernel::init() - Kernel/init.cpp:167:30: void Kernel::init_ap(u32, Kernel::Processor*) - Kernel/init.cpp:184:17: void Kernel::init_finished(u32) Called by boot.S. - Kernel/init.cpp:383:16: int Kernel::__cxa_atexit(void (*)(void*), void*, void*) - Kernel/StdLib.cpp:285:19: void __cxa_pure_virtual() - Kernel/StdLib.cpp:300:19: void __stack_chk_fail() - Kernel/StdLib.cpp:305:19: void __stack_chk_fail_local() Not sure how to tell the compiler that the compiler is already using them. Also, maybe __cxa_atexit should go into StdLib.cpp? - Kernel/Modules/TestModule.cpp:31:17: void module_init() - Kernel/Modules/TestModule.cpp:40:17: void module_fini() Could maybe go into a new header. This would also provide type-checking for new modules.
2020-08-06AK+Kernel+LibC: Add vdbgprintf()Andreas Kling
This is like dbgprintf() except it takes a va_list instead of ...
2020-07-03Kernel: Allow recursion when writing to the debug logTom
This allows printing in the case e.g. a page fault happens during a log statement
2020-07-01Kernel: Serialize debug outputTom
2020-05-16Kernel: Absorb LibBareMetal back into the kernelAndreas Kling
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-02-09Kernel: Apply changes to use LibBareMetal definitionsLiav A
2020-01-18Meta: Add license header to source filesAndreas Kling
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.
2019-11-27Kernel: Demangle userspace ELF symbols in backtracesAndreas Kling
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-03Kernel: Prevent kprintf() from asserting in Console::the() (#718)Nicolas Van Bossuyt
This triggered a stack overflow because ubsan can call kprintf() at any time, even before Console is initialized.
2019-09-09Kernel: Write logs into dmesg from the start of the boot processConrad Pankoff
2019-08-11Kernel: Add serial_debug cmdline parameterConrad Pankoff
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-07-21Kernel+LibC: Add a dbgputstr() syscall for sending strings to debug output.Andreas Kling
This is very handy for the DebugLogStream implementation, among others. :^)
2019-06-22Kernel: Colorize debugger output from the kernel.Andreas Kling
This makes it easy to distinguish kernel/userspace dbgprintf()'s. :^)
2019-06-07AK: Rename printf.cpp to PrintfImplementation.h.Andreas Kling
2019-04-29Kernel: Have File virtuals take a FileDescriptor& rather than a Process&.Andreas Kling
This will allow us to implement different behaviors depending on the role of the descriptor a File is being accessed through.
2019-04-10Kernel: Remove two unneeded headers.Andreas Kling
2019-03-23Kernel: Introduce threads, and refactor everything in support of it.Andreas Kling
The scheduler now operates on threads, rather than on processes. Each process has a main thread, and can have any number of additional threads. The process exits when the main thread exits. This patch doesn't actually spawn any additional threads, it merely does all the plumbing needed to make it possible. :^)
2019-01-31Big, possibly complete sweep of naming changes.Andreas Kling
2019-01-23Kernel: Get rid of Unix namespace.Andreas Kling
This is no longer needed as the Kernel can stand on its own legs now and there won't be any conflict with host system data types.
2019-01-16Pass the process to CharacterDevice::read/write.Andreas Kling
This is much nicer than grabbing directly at 'current' inside a read().
2019-01-14Build Painter & friends into LibC. Use it in the GUI test app.Andreas Kling
2018-10-29Fix broken SpinLock.Andreas Kling
The SpinLock was all backwards and didn't actually work. Fixing it exposed how wrong most of the locking here is. I need to come up with a better granularity here.
2018-10-27Add some basic field width support to printf().Andreas Kling
Use it to make "ls" output a bit better. Also sys$spawn now fails with EACCES if the path is not a file that's executable by the current uid/gid.
2018-10-25Add gettimeofday() syscall and LibC wrappers gettimeofday() and time().Andreas Kling
This only has second accuracy right now, I'll work out subseconds later.