Index: kernel/arch/amd64/src/boot/multiboot.S
===================================================================
--- kernel/arch/amd64/src/boot/multiboot.S	(revision ec18e45485def102b3bea20e4497792935997f77)
+++ kernel/arch/amd64/src/boot/multiboot.S	(revision ca21f1e2563262ce9dfca34baebb191c134e3037)
@@ -38,6 +38,4 @@
 #include <arch/cpu.h>
 
-// TODO: most of this file can be rewritten in C
-
 #define START_STACK  (BOOT_OFFSET - BOOT_STACK_SIZE)
 
@@ -52,5 +50,5 @@
 
 .macro pm_status msg
-#if defined(CONFIG_EGA) && !defined(CONFIG_FB)
+#ifdef CONFIG_EGA
 	pushl %esi
 	movl \msg, %esi
@@ -69,11 +67,6 @@
 multiboot_header:
 	.long MULTIBOOT_HEADER_MAGIC
-#ifdef CONFIG_FB
 	.long MULTIBOOT_HEADER_FLAGS
 	.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)  /* checksum */
-#else
-	.long MULTIBOOT_HEADER_FLAGS_NOFB
-	.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS_NOFB)  /* checksum */
-#endif
 	.long multiboot_header
 	.long unmapped_start
@@ -81,10 +74,4 @@
 	.long 0
 	.long multiboot_image_start
-#ifdef CONFIG_FB
-	.long 0
-	.long CONFIG_BFB_WIDTH
-	.long CONFIG_BFB_HEIGHT
-	.long CONFIG_BFB_BPP
-#endif
 
 SYMBOL(multiboot_image_start)
@@ -171,4 +158,6 @@
 	sse2_supported:
 
+#include "vesa_prot.inc"
+
 	pm2_status $status_prot2
 
@@ -579,4 +568,6 @@
 
 	ret
+
+#include "vesa_real.inc"
 
 .section K_INI_PTLS, "aw", @progbits
@@ -717,6 +708,10 @@
 status_prot:
 	.asciz "[prot] "
+status_vesa_copy:
+	.asciz "[vesa_copy] "
 status_multiboot_cmdline:
 	.asciz "[multiboot_cmdline] "
+status_vesa_real:
+	.asciz "[vesa_real] "
 status_prot2:
 	.asciz "[prot2] "
Index: kernel/arch/amd64/src/boot/vesa_prot.inc
===================================================================
--- kernel/arch/amd64/src/boot/vesa_prot.inc	(revision ca21f1e2563262ce9dfca34baebb191c134e3037)
+++ kernel/arch/amd64/src/boot/vesa_prot.inc	(revision ca21f1e2563262ce9dfca34baebb191c134e3037)
@@ -0,0 +1,1 @@
+../../../ia32/src/boot/vesa_prot.inc
Index: kernel/arch/amd64/src/boot/vesa_real.inc
===================================================================
--- kernel/arch/amd64/src/boot/vesa_real.inc	(revision ca21f1e2563262ce9dfca34baebb191c134e3037)
+++ kernel/arch/amd64/src/boot/vesa_real.inc	(revision ca21f1e2563262ce9dfca34baebb191c134e3037)
@@ -0,0 +1,1 @@
+../../../ia32/src/boot/vesa_real.inc
Index: kernel/arch/amd64/src/boot/vesa_ret.inc
===================================================================
--- kernel/arch/amd64/src/boot/vesa_ret.inc	(revision ca21f1e2563262ce9dfca34baebb191c134e3037)
+++ kernel/arch/amd64/src/boot/vesa_ret.inc	(revision ca21f1e2563262ce9dfca34baebb191c134e3037)
@@ -0,0 +1,24 @@
+.code32
+vesa_init_protected:
+	cli
+	cld
+
+	/* Initialize stack pointer */
+	movl $START_STACK, %esp
+
+	/* Kernel data + stack */
+	movw $GDT_SELECTOR(KDATA_DES), %cx
+	movw %cx, %es
+	movw %cx, %ds
+	movw %cx, %ss
+
+	/*
+	 * Simics seems to remove hidden part of GS on entering user mode
+	 * when _visible_ part of GS does not point to user-mode segment.
+	 */
+
+	movw $GDT_SELECTOR(UDATA_DES), %cx
+	movw %cx, %fs
+	movw %cx, %gs
+
+	jmpl $GDT_SELECTOR(KTEXT32_DES), $vesa_meeting_point
Index: kernel/arch/amd64/src/boot/vga323.pal
===================================================================
--- kernel/arch/amd64/src/boot/vga323.pal	(revision ca21f1e2563262ce9dfca34baebb191c134e3037)
+++ kernel/arch/amd64/src/boot/vga323.pal	(revision ca21f1e2563262ce9dfca34baebb191c134e3037)
@@ -0,0 +1,1 @@
+../../../ia32/src/boot/vga323.pal
