2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <bootconsole.h>
9 #include "kernel_base.h"
10 #include "kernel_debug.h"
11 #include "kernel_intern.h"
13 #define __save_flags(x) __asm__ __volatile__("pushf ; pop %0":"=g" (x): /* no input */)
14 #define __restore_flags(x) __asm__ __volatile__("push %0 ; popf": /* no output */ :"g" (x):"memory", "cc")
15 #define __cli() __asm__ __volatile__("cli": : :"memory")
16 #define __sti() __asm__ __volatile__("sti": : :"memory")
18 __attribute__((section(".data"))) static unsigned int debug_y_resolution
= 0;
19 __attribute__((section(".data"))) static void *debug_framebuffer
= NULL
;
21 int krnPutC(int c
, struct KernelBase
*KernelBase
)
28 * stegerg: Don't use Disable/Enable, because we want interrupt enabled flag
29 * to stay the same as it was before the Disable() call
34 * If we got 0x03, this means graphics driver wants to take over the screen.
35 * If VESA hack is activated, it will use only upper half of the screen
36 * because y resolution was adjusted.
37 * In our turn, we need to switch over to lower half.
38 * VESA hack is supported only on graphical console of course. And do not
39 * expect it to work with native mode video driver. :)
41 if ((c
== 0x03) && (scr_Type
== SCR_GFX
) && debug_framebuffer
)
43 /* Reinitialize boot console with decreased height */
44 scr_FrameBuffer
= debug_framebuffer
;
45 fb_Resize(debug_y_resolution
);
51 * Interrupt flag is stored in flags - if it was enabled before,
52 * it will be renabled when the flags are restored
54 __restore_flags(flags
);
59 void vesahack_Init(char *cmdline
, struct vbe_mode
*vmode
)
61 if (cmdline
&& vmode
&& vmode
->phys_base
&& strstr(cmdline
, "vesahack"))
63 bug("[Kernel] VESA debugging hack activated\n");
67 * It divides screen height by 2 and increments framebuffer pointer.
68 * This allows VESA driver to use only upper half of the screen, while
69 * lower half will still be used for debug output.
71 vmode
->y_resolution
>>= 1;
73 debug_y_resolution
= vmode
->y_resolution
;
74 debug_framebuffer
= (void *)(unsigned long)vmode
->phys_base
+ vmode
->y_resolution
* vmode
->bytes_per_scanline
;