2 Copyright © 1995-2018, The AROS Development Team. All rights reserved.
11 #include <kernel_base.h>
12 #include <kernel_debug.h>
14 #if defined(__AROSEXEC_SMP__)
15 #include <aros/atomic.h>
17 extern volatile ULONG safedebug
;
20 #include <proto/exec.h>
22 static int UniPutC(int c
, struct KernelBase
*KernelBase
);
25 * This is internal version of KrnBug(), to be called directly by bug() macro.
26 * If you want to reimplement it, override this file.
27 * However, generally you won't want to do this, because __vcformat() supports
28 * AROS-specific extensions, like %b, which are unlikely supported by your host OS.
30 int krnBug(const char *format
, va_list args
, APTR kernelBase
)
34 #if defined(__AROSEXEC_SMP__)
37 while (bit_test_and_set_long((ULONG
*)&safedebug
, 1)) { asm volatile("pause"); };
41 retval
= __vcformat(kernelBase
, (int (*)(int, void *))UniPutC
, format
, args
);
43 #if defined(__AROSEXEC_SMP__)
46 __AROS_ATOMIC_AND_L(safedebug
, ~(1 << 1));
54 * This is yet another character stuffing callback for debug output. This one unifies the output
55 * with debug output from outside the kernel where possible, allowing kernel debug output to be
56 * redirected alongside that other output (e.g. with Sashimi or Bifteck).
58 static int UniPutC(int c
, struct KernelBase
*KernelBase
)
68 result
= krnPutC(c
, KernelBase
);