[coreboot-gerrit] Patch set updated for coreboot: WIP: cpu/qemu-x86: Run a C environment in the bootblock

Alexandru Gagniuc (mr.nuke.me@gmail.com) gerrit at coreboot.org
Mon Oct 12 06:43:25 CEST 2015


Alexandru Gagniuc (mr.nuke.me at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11858

-gerrit

commit 808fb27b6b900d9d1ca6ac439917e7abc6dc7ccd
Author: Alexandru Gagniuc <mr.nuke.me at gmail.com>
Date:   Sat Oct 10 16:35:58 2015 -0700

    WIP: cpu/qemu-x86: Run a C environment in the bootblock
    
    Change-Id: Idf161d363d2daf3c55454d376ca42d492463971a
    Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
---
 src/cpu/qemu-x86/Kconfig      |  1 +
 src/cpu/qemu-x86/Makefile.inc |  1 +
 src/cpu/qemu-x86/bootblock.S  | 57 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+)

diff --git a/src/cpu/qemu-x86/Kconfig b/src/cpu/qemu-x86/Kconfig
index 67c9ce7..2237f34 100644
--- a/src/cpu/qemu-x86/Kconfig
+++ b/src/cpu/qemu-x86/Kconfig
@@ -23,3 +23,4 @@ config CPU_QEMU_X86
 	select ARCH_VERSTAGE_X86_32
 	select ARCH_ROMSTAGE_X86_32
 	select ARCH_RAMSTAGE_X86_32
+	select C_ENVIRONMENT_BOOTBLOCK
diff --git a/src/cpu/qemu-x86/Makefile.inc b/src/cpu/qemu-x86/Makefile.inc
index 143f4fe..b02718a 100644
--- a/src/cpu/qemu-x86/Makefile.inc
+++ b/src/cpu/qemu-x86/Makefile.inc
@@ -16,6 +16,7 @@
 ## Foundation, Inc.
 ##
 
+bootblock-y += bootblock.S
 ramstage-y += qemu.c
 subdirs-y += ../x86/mtrr
 subdirs-y += ../x86/lapic
diff --git a/src/cpu/qemu-x86/bootblock.S b/src/cpu/qemu-x86/bootblock.S
new file mode 100644
index 0000000..72ce5f6
--- /dev/null
+++ b/src/cpu/qemu-x86/bootblock.S
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2000,2007 Ronald G. Minnich <rminnich at gmail.com>
+ * Copyright (C) 2007-2008 coresystems GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#include <console/post_codes.h>
+
+#define STACK_SIZE 0x10000
+#define STACK_BASE 0xd0000
+
+.intel_syntax noprefix
+
+#define post_code(code) \
+	mov	eax, code; \
+	out	0x80, eax
+
+.global bootblock_pre_c_entry
+
+.section .text
+bootblock_pre_c_entry:
+
+	/* Set up a stack */
+	mov	esp, (STACK_BASE + STACK_SIZE - 4)
+
+	/*
+	 * We have the following goodies saved:
+	 * mm0: BIST result
+	 * mm1: TSC timestamp low 32 bits
+	 * mm2: TSC timestamp high 32 bits
+	 */
+	movd	eax, mm2
+	push	eax
+	movd	eax, mm1
+	push	eax
+	movd	eax, mm0
+	push	eax
+	call	bootblock_main
+
+.halt_forever:
+	post_code(POST_DEAD_CODE)
+	hlt
+	jmp	.halt_forever



More information about the coreboot-gerrit mailing list