diff --git a/src/kernel/apic.cpp b/src/kernel/apic.cpp index 9965647..d897b1d 100644 --- a/src/kernel/apic.cpp +++ b/src/kernel/apic.cpp @@ -1,5 +1,5 @@ -#include "kutil/assert.h" #include "apic.h" +#include "assert.h" #include "clock.h" #include "interrupts.h" #include "io.h" diff --git a/src/kernel/assert.cpp b/src/kernel/assert.cpp new file mode 100644 index 0000000..97a1756 --- /dev/null +++ b/src/kernel/assert.cpp @@ -0,0 +1,13 @@ +#include "assert.h" + +namespace panic { + +uint32_t *apic_icr = reinterpret_cast(0xffffc000fee00300); +uintptr_t symbol_table = 0; + +} // namespace panic + +extern "C" +void _PDCLIB_assert(const char *message, const char *function, const char *file, unsigned line) { + panic::panic(message, function, file, line); +} diff --git a/src/kernel/assert.h b/src/kernel/assert.h new file mode 100644 index 0000000..e71921b --- /dev/null +++ b/src/kernel/assert.h @@ -0,0 +1,61 @@ +#pragma once + +#include + +namespace panic { + +constexpr uint32_t send_nmi_command = + (4 << 8) | // Delivery mode NMI + (1 << 14) | // assert level high + (1 << 18); // destination self + +extern uint32_t *apic_icr; +extern uintptr_t symbol_table; + +__attribute__ ((always_inline)) +inline void panic( + const char *message = nullptr, + const char *function = __builtin_FUNCTION(), + const char *file = __builtin_FILE(), + uint64_t line = __builtin_LINE()) +{ + register uintptr_t syms asm("rdi"); + register const char *m asm("rsi"); + register const char *fn asm("rdx"); + register const char *fi asm("rcx"); + register uint64_t l asm("r8"); + + asm volatile ("mov %1, %0" : "=r"(syms) : "r"(symbol_table)); + asm volatile ("mov %1, %0" : "=r"(m) : "r"(message)); + asm volatile ("mov %1, %0" : "=r"(fn) : "r"(function)); + asm volatile ("mov %1, %0" : "=r"(fi) : "r"(file)); + asm volatile ("mov %1, %0" : "=r"(l) : "r"(line)); + + *apic_icr = send_nmi_command; + while (1) asm ("hlt"); +} + +} // namespace panic + +#ifndef NDEBUG + +__attribute__ ((always_inline)) +inline void kassert( + bool check, + const char *message = nullptr, + const char *function = __builtin_FUNCTION(), + const char *file = __builtin_FILE(), + uint64_t line = __builtin_LINE()) +{ + if (!check) + panic::panic(message, function, file, line); +} + +#define assert(x) kassert((x)) + +#else // NDEBUG + +#define kassert(...) ((void)0) +#define assert(x) ((void)0) + +#endif // NDEBUG diff --git a/src/kernel/cpprt.cpp b/src/kernel/cpprt.cpp index 1efbfb4..415d1b5 100644 --- a/src/kernel/cpprt.cpp +++ b/src/kernel/cpprt.cpp @@ -1,4 +1,4 @@ -#include "kutil/assert.h" +#include "assert.h" using __exit_func = void (*)(void *); diff --git a/src/kernel/cpu.cpp b/src/kernel/cpu.cpp index 24d3c84..6f0fc07 100644 --- a/src/kernel/cpu.cpp +++ b/src/kernel/cpu.cpp @@ -1,6 +1,6 @@ #include -#include "kutil/assert.h" +#include "assert.h" #include "cpu.h" #include "cpu/cpu_id.h" #include "device_manager.h" diff --git a/src/kernel/device_manager.cpp b/src/kernel/device_manager.cpp index 96cfdb5..049453b 100644 --- a/src/kernel/device_manager.cpp +++ b/src/kernel/device_manager.cpp @@ -1,8 +1,7 @@ #include #include -#include "kutil/assert.h" - +#include "assert.h" #include "acpi_tables.h" #include "apic.h" #include "clock.h" diff --git a/src/kernel/frame_allocator.cpp b/src/kernel/frame_allocator.cpp index c4698ea..b117ea0 100644 --- a/src/kernel/frame_allocator.cpp +++ b/src/kernel/frame_allocator.cpp @@ -1,5 +1,4 @@ -#include "kutil/assert.h" - +#include "assert.h" #include "frame_allocator.h" #include "kernel_args.h" #include "kernel_memory.h" diff --git a/src/kernel/gdt.cpp b/src/kernel/gdt.cpp index 9ec7e6a..39beaf6 100644 --- a/src/kernel/gdt.cpp +++ b/src/kernel/gdt.cpp @@ -1,9 +1,9 @@ #include #include -#include "kutil/assert.h" #include "kutil/no_construct.h" +#include "assert.h" #include "console.h" #include "cpu.h" #include "gdt.h" diff --git a/src/kernel/heap_allocator.cpp b/src/kernel/heap_allocator.cpp index 4ffa717..1cc4bd0 100644 --- a/src/kernel/heap_allocator.cpp +++ b/src/kernel/heap_allocator.cpp @@ -1,8 +1,8 @@ #include #include -#include "kutil/assert.h" #include "kutil/util.h" +#include "assert.h" #include "heap_allocator.h" #include "memory.h" diff --git a/src/kernel/hpet.cpp b/src/kernel/hpet.cpp index 99e68a0..8250b77 100644 --- a/src/kernel/hpet.cpp +++ b/src/kernel/hpet.cpp @@ -1,5 +1,6 @@ #include "kernel_memory.h" -#include "kutil/assert.h" + +#include "assert.h" #include "device_manager.h" #include "hpet.h" #include "io.h" diff --git a/src/kernel/interrupts.cpp b/src/kernel/interrupts.cpp index 98f5ede..de661de 100644 --- a/src/kernel/interrupts.cpp +++ b/src/kernel/interrupts.cpp @@ -3,6 +3,7 @@ #include "kernel_memory.h" #include "printf/printf.h" +#include "assert.h" #include "cpu.h" #include "device_manager.h" #include "idt.h" diff --git a/src/kernel/kernel.module b/src/kernel/kernel.module index e34dee7..da01947 100644 --- a/src/kernel/kernel.module +++ b/src/kernel/kernel.module @@ -10,6 +10,7 @@ kernel = module("kernel", sources = [ "apic.cpp", "ap_startup.s", + "assert.cpp", "boot.s", "clock.cpp", "console.cpp", diff --git a/src/kernel/log.cpp b/src/kernel/log.cpp index 3c1347c..34b3960 100644 --- a/src/kernel/log.cpp +++ b/src/kernel/log.cpp @@ -1,6 +1,7 @@ #include "j6/signals.h" #include "kutil/no_construct.h" +#include "assert.h" #include "console.h" #include "log.h" #include "memory.h" diff --git a/src/kernel/logger.cpp b/src/kernel/logger.cpp index 23ac5ac..3cf2a7d 100644 --- a/src/kernel/logger.cpp +++ b/src/kernel/logger.cpp @@ -1,9 +1,9 @@ #include -#include "kutil/assert.h" #include "kutil/constexpr_hash.h" #include "printf/printf.h" +#include "assert.h" #include "logger.h" namespace logs { diff --git a/src/kernel/main.cpp b/src/kernel/main.cpp index 12a36ab..65d5b77 100644 --- a/src/kernel/main.cpp +++ b/src/kernel/main.cpp @@ -5,9 +5,9 @@ #include "j6/signals.h" #include "kernel_args.h" #include "kernel_memory.h" -#include "kutil/assert.h" #include "apic.h" +#include "assert.h" #include "block_device.h" #include "clock.h" #include "console.h" @@ -83,7 +83,7 @@ kernel_main(init::args *args) { if (args->panic) { IDT::set_nmi_handler(args->panic->entrypoint); - kutil::assert::symbol_table = args->symbol_table | memory::page_offset; + panic::symbol_table = args->symbol_table | memory::page_offset; } init_console(); diff --git a/src/kernel/memory_bootstrap.cpp b/src/kernel/memory_bootstrap.cpp index 99e2aeb..f613b2c 100644 --- a/src/kernel/memory_bootstrap.cpp +++ b/src/kernel/memory_bootstrap.cpp @@ -4,9 +4,9 @@ #include "j6/init.h" #include "enum_bitfields.h" -#include "kutil/assert.h" #include "kutil/no_construct.h" +#include "assert.h" #include "device_manager.h" #include "frame_allocator.h" #include "gdt.h" diff --git a/src/kernel/objects/channel.cpp b/src/kernel/objects/channel.cpp index e67b696..eec967f 100644 --- a/src/kernel/objects/channel.cpp +++ b/src/kernel/objects/channel.cpp @@ -1,6 +1,6 @@ #include -#include "kutil/assert.h" +#include "assert.h" #include "kernel_memory.h" #include "objects/channel.h" #include "objects/vm_area.h" diff --git a/src/kernel/objects/kobject.cpp b/src/kernel/objects/kobject.cpp index af47df2..d9ee5c6 100644 --- a/src/kernel/objects/kobject.cpp +++ b/src/kernel/objects/kobject.cpp @@ -1,6 +1,8 @@ #include "j6/errors.h" #include "j6/signals.h" #include "j6/types.h" + +#include "assert.h" #include "objects/kobject.h" #include "objects/thread.h" diff --git a/src/kernel/objects/process.cpp b/src/kernel/objects/process.cpp index e908091..37660a4 100644 --- a/src/kernel/objects/process.cpp +++ b/src/kernel/objects/process.cpp @@ -1,5 +1,6 @@ -#include "kutil/assert.h" #include "kutil/no_construct.h" + +#include "assert.h" #include "cpu.h" #include "objects/process.h" #include "objects/thread.h" diff --git a/src/kernel/objects/vm_area.cpp b/src/kernel/objects/vm_area.cpp index 32b76e3..c38f3da 100644 --- a/src/kernel/objects/vm_area.cpp +++ b/src/kernel/objects/vm_area.cpp @@ -1,5 +1,7 @@ -#include "frame_allocator.h" #include "kernel_memory.h" + +#include "assert.h" +#include "frame_allocator.h" #include "objects/vm_area.h" #include "page_tree.h" #include "vm_space.h" diff --git a/src/kernel/page_table.cpp b/src/kernel/page_table.cpp index 0050843..34c4825 100644 --- a/src/kernel/page_table.cpp +++ b/src/kernel/page_table.cpp @@ -1,7 +1,6 @@ #include -#include "kutil/assert.h" - +#include "assert.h" #include "console.h" #include "frame_allocator.h" #include "kernel_memory.h" diff --git a/src/kernel/page_tree.cpp b/src/kernel/page_tree.cpp index 84d1fa9..b2e0cd6 100644 --- a/src/kernel/page_tree.cpp +++ b/src/kernel/page_tree.cpp @@ -1,7 +1,6 @@ #include -#include "kutil/assert.h" - +#include "assert.h" #include "frame_allocator.h" #include "kernel_memory.h" #include "page_tree.h" diff --git a/src/kernel/panic.serial/display.cpp b/src/kernel/panic.serial/display.cpp index e0d60c4..a53b537 100644 --- a/src/kernel/panic.serial/display.cpp +++ b/src/kernel/panic.serial/display.cpp @@ -5,7 +5,7 @@ #include "serial.h" #include "symbol_table.h" -namespace panic { +namespace panicking { void print_header( @@ -102,7 +102,7 @@ print_cpu_state(serial_port &out, const cpu_state ®s) out.write("\e[0m\n"); } -} // namespace panic +} // namespace panicking // For printf.c extern "C" void putchar_(char c) {} diff --git a/src/kernel/panic.serial/display.h b/src/kernel/panic.serial/display.h index 3ac06f1..02f0fcc 100644 --- a/src/kernel/panic.serial/display.h +++ b/src/kernel/panic.serial/display.h @@ -6,7 +6,7 @@ struct cpu_state; -namespace panic { +namespace panicking { class serial_port; class symbol_table; @@ -27,4 +27,4 @@ void print_header( void print_callstack(serial_port &out, symbol_table &syms, frame const *fp); void print_cpu_state(serial_port &out, const cpu_state ®s); -} +} // namespace panicking diff --git a/src/kernel/panic.serial/main.cpp b/src/kernel/panic.serial/main.cpp index a4693b2..45c7181 100644 --- a/src/kernel/panic.serial/main.cpp +++ b/src/kernel/panic.serial/main.cpp @@ -1,3 +1,6 @@ +#include "kutil/spinlock.h" + +#include "assert.h" #include "display.h" #include "serial.h" #include "symbol_table.h" @@ -13,10 +16,10 @@ void panic_handler( uint64_t line, const cpu_state *regs) { - panic::serial_port com1(panic::COM1); - panic::symbol_table syms(symbol_data); + panicking::serial_port com1(panicking::COM1); + panicking::symbol_table syms(symbol_data); - panic::frame const *fp = nullptr; + panicking::frame const *fp = nullptr; asm ( "mov %%rbp, %0" : "=r" (fp) ); print_header(com1, message, function, file, line); diff --git a/src/kernel/panic.serial/serial.cpp b/src/kernel/panic.serial/serial.cpp index 34a2579..617fc62 100644 --- a/src/kernel/panic.serial/serial.cpp +++ b/src/kernel/panic.serial/serial.cpp @@ -1,6 +1,6 @@ #include "serial.h" -namespace panic { +namespace panicking { // register offsets constexpr uint16_t THR = 0; // Write @@ -52,4 +52,4 @@ serial_port::write(const char *s) } } -} // namespace panic +} // namespace panicking diff --git a/src/kernel/panic.serial/serial.h b/src/kernel/panic.serial/serial.h index 9aa1a6b..8f84027 100644 --- a/src/kernel/panic.serial/serial.h +++ b/src/kernel/panic.serial/serial.h @@ -3,7 +3,7 @@ /// Non-interrupt-driven serial 'driver' for panic handling #include -namespace panic { +namespace panicking { class serial_port { @@ -20,4 +20,4 @@ private: constexpr uint16_t COM1 = 0x03f8; -} // namespace panic +} // namespace panicking diff --git a/src/kernel/panic.serial/symbol_table.cpp b/src/kernel/panic.serial/symbol_table.cpp index 89d2f38..ff22abe 100644 --- a/src/kernel/panic.serial/symbol_table.cpp +++ b/src/kernel/panic.serial/symbol_table.cpp @@ -1,7 +1,7 @@ #include "pointer_manipulation.h" #include "symbol_table.h" -namespace panic { +namespace panicking { symbol_table::symbol_table(const void *data) : m_data(data) @@ -25,4 +25,4 @@ symbol_table::find_symbol(uintptr_t addr) const return nullptr; } -} // namespace panic +} // namespace panicking diff --git a/src/kernel/panic.serial/symbol_table.h b/src/kernel/panic.serial/symbol_table.h index 3188237..98d8b58 100644 --- a/src/kernel/panic.serial/symbol_table.h +++ b/src/kernel/panic.serial/symbol_table.h @@ -3,7 +3,7 @@ #include #include "counted.h" -namespace panic { +namespace panicking { class symbol_table { @@ -29,4 +29,4 @@ private: counted m_entries; }; -} // namespace panic +} // namespace panicking diff --git a/src/kernel/pci.cpp b/src/kernel/pci.cpp index 21aacdc..ab37c38 100644 --- a/src/kernel/pci.cpp +++ b/src/kernel/pci.cpp @@ -1,4 +1,4 @@ -#include "kutil/assert.h" +#include "assert.h" #include "console.h" #include "log.h" #include "interrupts.h" diff --git a/src/kernel/scheduler.cpp b/src/kernel/scheduler.cpp index d273794..46b032f 100644 --- a/src/kernel/scheduler.cpp +++ b/src/kernel/scheduler.cpp @@ -1,9 +1,9 @@ #include #include -#include "kutil/assert.h" #include "apic.h" +#include "assert.h" #include "clock.h" #include "console.h" #include "cpu.h" diff --git a/src/kernel/serial.cpp b/src/kernel/serial.cpp index cdd50a2..2cf24ca 100644 --- a/src/kernel/serial.cpp +++ b/src/kernel/serial.cpp @@ -1,7 +1,7 @@ #include -#include "kutil/assert.h" #include "kutil/no_construct.h" +#include "assert.h" #include "interrupts.h" #include "io.h" #include "serial.h" diff --git a/src/kernel/syscalls/object.cpp b/src/kernel/syscalls/object.cpp index f079f69..bfe51fe 100644 --- a/src/kernel/syscalls/object.cpp +++ b/src/kernel/syscalls/object.cpp @@ -2,6 +2,7 @@ #include "j6/signals.h" #include "j6/types.h" +#include "assert.h" #include "log.h" #include "objects/thread.h" #include "syscalls/helpers.h" diff --git a/src/kernel/tss.cpp b/src/kernel/tss.cpp index 9fc82bc..45e0897 100644 --- a/src/kernel/tss.cpp +++ b/src/kernel/tss.cpp @@ -1,7 +1,7 @@ #include -#include "kutil/assert.h" #include "kutil/no_construct.h" +#include "assert.h" #include "cpu.h" #include "kernel_memory.h" #include "log.h" diff --git a/src/kernel/vm_space.cpp b/src/kernel/vm_space.cpp index 9621d28..e9166f4 100644 --- a/src/kernel/vm_space.cpp +++ b/src/kernel/vm_space.cpp @@ -1,7 +1,9 @@ #include -#include "frame_allocator.h" #include "kernel_memory.h" + +#include "assert.h" +#include "frame_allocator.h" #include "log.h" #include "objects/process.h" #include "objects/thread.h" diff --git a/src/libraries/kutil/assert.cpp b/src/libraries/kutil/assert.cpp deleted file mode 100644 index 2e6a890..0000000 --- a/src/libraries/kutil/assert.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "kutil/assert.h" - -namespace kutil { -namespace assert { - -uint32_t *apic_icr = reinterpret_cast(0xffffc000fee00300); -uintptr_t symbol_table = 0; - -} // namespace assert -} // namespace kutil diff --git a/src/libraries/kutil/bip_buffer.cpp b/src/libraries/kutil/bip_buffer.cpp index 0433771..7e09d9c 100644 --- a/src/libraries/kutil/bip_buffer.cpp +++ b/src/libraries/kutil/bip_buffer.cpp @@ -1,4 +1,9 @@ -#include "kutil/assert.h" +#if __has_include() +#include +#else +#define assert(x) ((void)0) +#endif + #include "kutil/bip_buffer.h" namespace kutil { @@ -61,14 +66,14 @@ size_t bip_buffer::reserve(size_t size, void **area) void bip_buffer::commit(size_t size) { - kassert(size <= m_size_r, "Tried to commit more than reserved"); + assert(size <= m_size_r && "Tried to commit more than reserved"); if (m_start_r == m_start_a + m_size_a) { // We were adding to A m_size_a += size; } else { // We were adding to B - kassert(m_start_r == m_start_b + m_size_b, "Bad m_start_r!"); + assert(m_start_r == m_start_b + m_size_b && "Bad m_start_r!"); m_size_b += size; } @@ -83,7 +88,7 @@ size_t bip_buffer::get_block(void **area) const void bip_buffer::consume(size_t size) { - kassert(size <= m_size_a, "Consumed more bytes than exist in A"); + assert(size <= m_size_a && "Consumed more bytes than exist in A"); if (size >= m_size_a) { m_size_a = m_size_b; m_start_a = m_start_b; diff --git a/src/libraries/kutil/include/kutil/assert.h b/src/libraries/kutil/include/kutil/assert.h deleted file mode 100644 index c9c31c6..0000000 --- a/src/libraries/kutil/include/kutil/assert.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include - -namespace kutil { -namespace assert { - -constexpr uint32_t send_nmi_command = - (4 << 8) | // Delivery mode NMI - (1 << 14) | // assert level high - (1 << 18); // destination self - -extern uint32_t *apic_icr; -extern uintptr_t symbol_table; - -} // namespace assert -} // namespace kutil - -__attribute__ ((always_inline)) -inline void kassert( - bool check, - const char *message = nullptr, - const char *function = __builtin_FUNCTION(), - const char *file = __builtin_FILE(), - uint64_t line = __builtin_LINE()) -{ - if (!check) { - register uintptr_t syms asm("rdi"); - register const char *m asm("rsi"); - register const char *fn asm("rdx"); - register const char *fi asm("rcx"); - register uint64_t l asm("r8"); - - asm volatile ("mov %1, %0" : "=r"(syms) : "r"(kutil::assert::symbol_table)); - asm volatile ("mov %1, %0" : "=r"(m) : "r"(message)); - asm volatile ("mov %1, %0" : "=r"(fn) : "r"(function)); - asm volatile ("mov %1, %0" : "=r"(fi) : "r"(file)); - asm volatile ("mov %1, %0" : "=r"(l) : "r"(line)); - - *kutil::assert::apic_icr = kutil::assert::send_nmi_command; - - while (1) asm ("hlt"); - } -} diff --git a/src/libraries/kutil/include/kutil/map.h b/src/libraries/kutil/include/kutil/map.h index b290881..170db54 100644 --- a/src/libraries/kutil/include/kutil/map.h +++ b/src/libraries/kutil/include/kutil/map.h @@ -11,6 +11,7 @@ /// http://codecapsule.com/2013/11/17/robin-hood-hashing-backward-shift-deletion/ #include +#include #include #include #include "kutil/hash.h" @@ -145,7 +146,7 @@ protected: } void set_capacity(size_t capacity) { - kassert((capacity & (capacity - 1)) == 0, + assert((capacity & (capacity - 1)) == 0 && "Map capacity must be a power of two"); m_capacity = capacity; diff --git a/src/libraries/kutil/include/kutil/vector.h b/src/libraries/kutil/include/kutil/vector.h index ebd67b5..866516e 100644 --- a/src/libraries/kutil/include/kutil/vector.h +++ b/src/libraries/kutil/include/kutil/vector.h @@ -2,9 +2,9 @@ /// \file vector.h /// Definition of a simple dynamic vector collection for use in kernel space +#include #include #include -#include "kutil/assert.h" #include "kutil/util.h" namespace kutil { @@ -158,7 +158,7 @@ public: /// Remove an item from the end of the array. void remove() { - kassert(m_size, "Called remove() on an empty array"); + assert(m_size && "Called remove() on an empty array"); m_size -= 1; m_elements[m_size].~T(); @@ -167,14 +167,14 @@ public: /// Remove an item from the front of the array, preserving order. void remove_front() { - kassert(m_size, "Called remove_front() on an empty array"); + assert(m_size && "Called remove_front() on an empty array"); remove_at(0); } /// Remove an item from the array. void remove(const T &item) { - kassert(m_size, "Called remove() on an empty array"); + assert(m_size && "Called remove() on an empty array"); for (count_t i = 0; i < m_size; ++i) { if (m_elements[i] == item) { remove_at(i); @@ -224,7 +224,7 @@ public: /// Remove an item from the end of the array and return it. T pop() { - kassert(m_size, "Called pop() on an empty array"); + assert(m_size && "Called pop() on an empty array"); T temp = m_elements[m_size - 1]; remove(); @@ -234,7 +234,7 @@ public: /// Remove an item from the beginning of the array and return it. T pop_front() { - kassert(m_size, "Called pop_front() on an empty array"); + assert(m_size && "Called pop_front() on an empty array"); T temp = m_elements[0]; remove_front(); diff --git a/src/libraries/kutil/kutil.module b/src/libraries/kutil/kutil.module index 7ed24c3..67d816f 100644 --- a/src/libraries/kutil/kutil.module +++ b/src/libraries/kutil/kutil.module @@ -4,7 +4,6 @@ module("kutil", kind = "lib", includes = [ "include" ], sources = [ - "assert.cpp", "bip_buffer.cpp", "spinlock.cpp", ]) diff --git a/src/libraries/libc/include/assert.h b/src/libraries/libc/include/assert.h index 22eac10..6a58880 100644 --- a/src/libraries/libc/include/assert.h +++ b/src/libraries/libc/include/assert.h @@ -10,7 +10,7 @@ CPP_CHECK_BEGIN -void _PDCLIB_assert( const char * const, const char * const, const char * const ); +void _PDCLIB_assert( const char * const, const char * const, const char * const, unsigned ); /* If NDEBUG is set, assert() is a null operation. */ #undef assert @@ -19,11 +19,7 @@ void _PDCLIB_assert( const char * const, const char * const, const char * const #define assert( ignore ) ( (void) 0 ) #else #define assert( expression ) ( ( expression ) ? (void) 0 \ - : _PDCLIB_assert( "Assertion failed: " #expression \ - ", function ", __func__, \ - ", file " __FILE__ \ - ", line " _PDCLIB_symbol2string( __LINE__ ) \ - "." _PDCLIB_endl ) ) + : _PDCLIB_assert( #expression, __func__, __FILE__, __LINE__ ) ) #endif CPP_CHECK_END diff --git a/src/libraries/libc/j6libc/assert.c b/src/libraries/libc/j6libc/assert.c index 8c751ac..2aa8c94 100644 --- a/src/libraries/libc/j6libc/assert.c +++ b/src/libraries/libc/j6libc/assert.c @@ -10,10 +10,9 @@ #include "j6libc/aux.h" -void _PDCLIB_assert( const char * const message1, const char * const function, const char * const message2 ) +void _PDCLIB_assert( const char * const message, const char * const function, const char * const file, unsigned line ) { - fputs( message1, stderr ); - fputs( function, stderr ); - fputs( message2, stderr ); + fprintf( stderr, "Assertion failed: %s, function %s, file %s, line %d.%s", + message, function, file, line, _PDCLIB_endl ); abort(); }