1262197Srwatson/*-
2262197Srwatson * Copyright (c) 2011-2014 Robert N. M. Watson
3262197Srwatson * All rights reserved.
4262197Srwatson *
5262197Srwatson * This software was developed by SRI International and the University of
6262197Srwatson * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
7262197Srwatson * ("CTSRD"), as part of the DARPA CRASH research programme.
8262197Srwatson *
9262197Srwatson * Redistribution and use in source and binary forms, with or without
10262197Srwatson * modification, are permitted provided that the following conditions
11262197Srwatson * are met:
12262197Srwatson * 1. Redistributions of source code must retain the above copyright
13262197Srwatson *    notice, this list of conditions and the following disclaimer.
14262197Srwatson * 2. Redistributions in binary form must reproduce the above copyright
15262197Srwatson *    notice, this list of conditions and the following disclaimer in the
16262197Srwatson *    documentation and/or other materials provided with the distribution.
17262197Srwatson *
18262197Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19262197Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20262197Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21262197Srwatson * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22262197Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23262197Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24262197Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25262197Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26262197Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27262197Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28262197Srwatson * SUCH DAMAGE.
29262197Srwatson *
30262197Srwatson * $FreeBSD: stable/11/stand/mips/beri/boot2/flashboot.ldscript 294451 2016-01-20 18:35:43Z emaste $
31262197Srwatson */
32262197Srwatson
33262197SrwatsonINCLUDE ../common/common.ldscript
34262197Srwatson
35262197Srwatson/*
36262197Srwatson * When boot2 is loaded via JTAG, it's dropped at 0x10000, and will not need
37262197Srwatson * to self-relocate, since it will be in DRAM.
38262197Srwatson */
39262197Srwatson__boot2_base__ = 0x100000;
40262197Srwatson__boot2_base_vaddr__ = __mips64_xkphys_cached__ + __boot2_base__;
41262197Srwatson
42262197Srwatson/*
43262197Srwatson * XXXRW: Currently, miniboot interprets the ELF header rather than jumping
44262197Srwatson * straight into the loader.  For now, give the location where we know it will
45262197Srwatson * be.
46262197Srwatson */
47262197SrwatsonENTRY(prerelocate_start)
48262197SrwatsonSECTIONS
49262197Srwatson{
50262197Srwatson	. = __boot2_base_vaddr__;
51262197Srwatson	. += SIZEOF_HEADERS;
52294451Semaste	.text ALIGN(0x10): {
53262197Srwatson		relocate.o(.text)
54262197Srwatson		start.o(.text)
55262197Srwatson		*(EXCLUDE_FILE (relocate.o start.o) .text)
56262197Srwatson	}
57294451Semaste	.data ALIGN(0x10): { *(.data)}
58294451Semaste	.bss ALIGN(0x10): { *(.bss) }
59262197Srwatson
60262197Srwatson	__heap = ALIGN(0x8);	/* 64-bit aligned heap pointer */
61262197Srwatson	__data_end = .;
62262197Srwatson	__boot_loader_len__ = . - __boot2_base_vaddr__;
63262197Srwatson	__bss_start = ADDR(.bss);
64262197Srwatson	__bss_end = ALIGN(__bss_start + SIZEOF(.bss), 0x8);
65262197Srwatson}
66