From patchwork Mon Jan 3 19:46:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 77314 X-Patchwork-Delegate: graeme.russ@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id C7CD8B70EA for ; Tue, 4 Jan 2011 06:48:44 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8CB1328290; Mon, 3 Jan 2011 20:48:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id F5wCnY77S8fK; Mon, 3 Jan 2011 20:48:00 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 579A928287; Mon, 3 Jan 2011 20:47:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0998C28199 for ; Mon, 3 Jan 2011 20:47:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Di2OC8XrPcmR for ; Mon, 3 Jan 2011 20:47:46 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by theia.denx.de (Postfix) with ESMTP id 12BB328284 for ; Mon, 3 Jan 2011 20:47:37 +0100 (CET) Received: by mail-fx0-f44.google.com with SMTP id 9so12889169fxm.3 for ; Mon, 03 Jan 2011 11:47:37 -0800 (PST) Received: by 10.103.215.12 with SMTP id s12mr1690136muq.47.1294084057277; Mon, 03 Jan 2011 11:47:37 -0800 (PST) Received: from helios.localdomain6 (d122-104-38-246.sbr6.nsw.optusnet.com.au [122.104.38.246]) by mx.google.com with ESMTPS id a6sm3124092fak.1.2011.01.03.11.47.33 (version=SSLv3 cipher=RC4-MD5); Mon, 03 Jan 2011 11:47:36 -0800 (PST) From: Graeme Russ To: u-boot@lists.denx.de Date: Tue, 4 Jan 2011 06:46:27 +1100 Message-Id: <1294084016-2674-8-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.1.422.g049e9 In-Reply-To: <1294084016-2674-1-git-send-email-graeme.russ@gmail.com> References: <1294084016-2674-1-git-send-email-graeme.russ@gmail.com> Subject: [U-Boot] [RFC][PATCH 07/36] x86 - Parametize location of Real Mode code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de --- arch/i386/config.mk | 1 + arch/i386/cpu/u-boot.lds | 2 +- arch/i386/lib/realmode.c | 7 +++---- 3 files changed, 5 insertions(+), 5 deletions(-) --- 1.7.1.422.g049e9 diff --git a/arch/i386/config.mk b/arch/i386/config.mk index f4689ec..7d1281b 100644 --- a/arch/i386/config.mk +++ b/arch/i386/config.mk @@ -32,6 +32,7 @@ PLATFORM_CPPFLAGS += $(call cc-option, -fno-toplevel-reorder, $(call cc-option, PLATFORM_CPPFLAGS += $(call cc-option, -fno-stack-protector) PLATFORM_CPPFLAGS += $(call cc-option, -mpreferred-stack-boundary=2) PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm +PLATFORM_CPPFLAGS += -DREALMODE_BASE=0x7c0 PLATFORM_RELFLAGS += -ffunction-sections PLATFORM_RELFLAGS += -fvisibility=hidden diff --git a/arch/i386/cpu/u-boot.lds b/arch/i386/cpu/u-boot.lds index e712d26..98a548d 100644 --- a/arch/i386/cpu/u-boot.lds +++ b/arch/i386/cpu/u-boot.lds @@ -73,7 +73,7 @@ SECTIONS /DISCARD/ : { *(.gnu*) } /* 16bit realmode trampoline code */ - .realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) } + .realmode REALMODE_BASE : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) } __realmode_start = LOADADDR(.realmode); __realmode_size = SIZEOF(.realmode); diff --git a/arch/i386/lib/realmode.c b/arch/i386/lib/realmode.c index 60fe181..3b56170 100644 --- a/arch/i386/lib/realmode.c +++ b/arch/i386/lib/realmode.c @@ -27,7 +27,6 @@ #include -#define REALMODE_BASE ((char*)0x7c0) #define REALMODE_MAILBOX ((char*)0xe00) @@ -41,13 +40,13 @@ int realmode_setup(void) ulong realmode_size = (ulong)&__realmode_size; /* copy the realmode switch code */ - if (realmode_size > (REALMODE_MAILBOX-REALMODE_BASE)) { + if (realmode_size > (REALMODE_MAILBOX-(char*)REALMODE_BASE)) { printf("realmode switch too large (%ld bytes, max is %d)\n", - realmode_size, (REALMODE_MAILBOX-REALMODE_BASE)); + realmode_size, (REALMODE_MAILBOX-(char*)REALMODE_BASE)); return -1; } - memcpy(REALMODE_BASE, (void*)realmode_start, realmode_size); + memcpy((char*)REALMODE_BASE, (void*)realmode_start, realmode_size); asm("wbinvd\n"); return 0;