revert between 56095 -> 55830 in arch
[AROS.git] / arch / i386-pc / kernel / kernel_debug.c
bloba4a3131a60e6936c0e8b03ffd6fd88046dc0afcd
1 /*
2 Copyright © 1995-2018, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <bootconsole.h>
7 #include <string.h>
9 #include "kernel_base.h"
10 #include "kernel_debug.h"
11 #include "kernel_intern.h"
13 __attribute__((section(".data"))) static unsigned int debug_y_resolution = 0;
14 __attribute__((section(".data"))) static void *debug_framebuffer = NULL;
16 int krnPutC(int c, struct KernelBase *KernelBase)
18 unsigned long flags;
20 __save_flags(flags);
23 * Don't use Disable/Enable, because we want the interrupt enabled flag
24 * to stay the same as it was before the Disable() call
26 __cli();
29 * If we got 0x03, this means graphics driver wants to take over the screen.
30 * If VESA hack is activated, it will use only upper half of the screen
31 * because y resolution was adjusted.
32 * In our turn, we need to switch over to lower half.
33 * VESA hack is supported only on graphical console of course. And do not
34 * expect it to work with native mode video driver. :)
36 if ((c == 0x03) && (scr_Type == SCR_GFX) && debug_framebuffer)
38 /* Reinitialize boot console with decreased height */
39 scr_FrameBuffer = debug_framebuffer;
40 fb_Resize(debug_y_resolution);
42 else
43 con_Putc(c);
46 * Interrupt flag is stored in flags - if it was enabled before,
47 * it will be re-enabled when the flags are restored
49 __restore_flags(flags);
51 return 1;
54 void vesahack_Init(char *cmdline, struct vbe_mode *vmode)
56 if (cmdline && vmode && vmode->phys_base && strstr(cmdline, "vesahack"))
58 bug("[Kernel] VESA debugging hack activated\n");
61 * VESA hack.
62 * It divides screen height by 2 and increments framebuffer pointer.
63 * This allows VESA driver to use only upper half of the screen, while
64 * lower half will still be used for debug output.
66 vmode->y_resolution >>= 1;
68 debug_y_resolution = vmode->y_resolution;
69 debug_framebuffer = (void *)(unsigned long)vmode->phys_base + vmode->y_resolution * vmode->bytes_per_scanline;