Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Memory map: |
| 3 | * |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 4 | * CONFIG_RAMBASE : text segment |
| 5 | * : rodata segment |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 6 | * : data segment |
| 7 | * : bss segment |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 8 | * : stack |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 9 | * : heap |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 10 | */ |
| 11 | /* |
| 12 | * Bootstrap code for the STPC Consumer |
| 13 | * Copyright (c) 1999 by Net Insight AB. All Rights Reserved. |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | /* |
| 17 | * Written by Johan Rydberg, based on work by Daniel Kahlin. |
| 18 | * Rewritten by Eric Biederman |
Stefan Reinauer | f8ee180 | 2008-01-18 15:08:58 +0000 | [diff] [blame] | 19 | * 2005.12 yhlu add coreboot_ram cross the vga font buffer handling |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 20 | */ |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 21 | |
| 22 | /* We use ELF as output format. So that we can debug the code in some form. */ |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 23 | INCLUDE ldoptions |
| 24 | |
| 25 | ENTRY(_start) |
| 26 | |
| 27 | SECTIONS |
| 28 | { |
Stefan Reinauer | 0867062 | 2009-06-30 15:17:49 +0000 | [diff] [blame] | 29 | . = CONFIG_RAMBASE; |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 30 | /* First we place the code and read only data (typically const declared). |
| 31 | * This could theoretically be placed in rom. |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 32 | */ |
| 33 | .text : { |
| 34 | _text = .; |
Patrick Georgi | 6999217 | 2012-11-25 17:31:25 +0100 | [diff] [blame] | 35 | *(.textfirst); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 36 | *(.text); |
| 37 | *(.text.*); |
| 38 | . = ALIGN(16); |
| 39 | _etext = .; |
| 40 | } |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 41 | |
Stefan Reinauer | d37ab45 | 2012-12-18 16:23:28 -0800 | [diff] [blame] | 42 | .ctors : { |
| 43 | . = ALIGN(0x100); |
| 44 | __CTOR_LIST__ = .; |
| 45 | *(.ctors); |
| 46 | LONG(0); |
| 47 | __CTOR_END__ = .; |
| 48 | } |
| 49 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 50 | .rodata : { |
| 51 | _rodata = .; |
| 52 | . = ALIGN(4); |
Aaron Durbin | f7c6d48 | 2013-02-06 15:47:31 -0600 | [diff] [blame] | 53 | |
| 54 | /* If any changes are made to the driver start/symbols or the |
| 55 | * section names the equivalent changes need to made to |
| 56 | * rmodule.ld. */ |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 57 | console_drivers = .; |
| 58 | *(.rodata.console_drivers) |
| 59 | econsole_drivers = . ; |
| 60 | . = ALIGN(4); |
| 61 | pci_drivers = . ; |
Eric Biederman | 5899fd8 | 2003-04-24 06:25:08 +0000 | [diff] [blame] | 62 | *(.rodata.pci_driver) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 63 | epci_drivers = . ; |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 64 | cpu_drivers = . ; |
| 65 | *(.rodata.cpu_driver) |
| 66 | ecpu_drivers = . ; |
Aaron Durbin | a4feddf | 2013-04-24 16:12:52 -0500 | [diff] [blame] | 67 | _bs_init_begin = .; |
| 68 | *(.bs_init) |
| 69 | _bs_init_end = .; |
Aaron Durbin | f7c6d48 | 2013-02-06 15:47:31 -0600 | [diff] [blame] | 70 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 71 | *(.rodata) |
| 72 | *(.rodata.*) |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 73 | /* kevinh/Ispiri - Added an align, because the objcopy tool |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 74 | * incorrectly converts sections that are not long word aligned. |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 75 | */ |
| 76 | . = ALIGN(4); |
| 77 | |
| 78 | _erodata = .; |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 79 | } |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 80 | /* After the code we place initialized data (typically initialized |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 81 | * global variables). This gets copied into ram by startup code. |
| 82 | * __data_start and __data_end shows where in ram this should be placed, |
| 83 | * whereas __data_loadstart and __data_loadend shows where in rom to |
| 84 | * copy from. |
| 85 | */ |
| 86 | .data : { |
| 87 | _data = .; |
| 88 | *(.data) |
| 89 | _edata = .; |
| 90 | } |
Stefan Reinauer | b743885 | 2009-03-17 15:15:15 +0000 | [diff] [blame] | 91 | |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 92 | /* bss does not contain data, it is just a space that should be zero |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 93 | * initialized on startup. (typically uninitialized global variables) |
| 94 | * crt0.S fills between _bss and _ebss with zeroes. |
| 95 | */ |
| 96 | _bss = .; |
| 97 | .bss . : { |
| 98 | *(.bss) |
| 99 | *(.sbss) |
| 100 | *(COMMON) |
| 101 | } |
| 102 | _ebss = .; |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 103 | |
Yinghai Lu | 72ee9b0 | 2005-12-14 02:39:33 +0000 | [diff] [blame] | 104 | _heap = .; |
| 105 | .heap . : { |
Stefan Reinauer | 0867062 | 2009-06-30 15:17:49 +0000 | [diff] [blame] | 106 | /* Reserve CONFIG_HEAP_SIZE bytes for the heap */ |
| 107 | . = CONFIG_HEAP_SIZE ; |
Yinghai Lu | 72ee9b0 | 2005-12-14 02:39:33 +0000 | [diff] [blame] | 108 | . = ALIGN(4); |
| 109 | } |
| 110 | _eheap = .; |
Patrick Georgi | 9d24c7f | 2010-03-01 17:16:06 +0000 | [diff] [blame] | 111 | |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 112 | /* The ram segment. This includes all memory used by the memory |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 113 | * resident copy of coreboot, except the tables that are produced on |
| 114 | * the fly, but including stack and heap. |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 115 | */ |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 116 | _ram_seg = _text; |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 117 | _eram_seg = _eheap; |
Yinghai Lu | 72ee9b0 | 2005-12-14 02:39:33 +0000 | [diff] [blame] | 118 | |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 119 | /* CONFIG_RAMTOP is the upper address of cached memory (among other |
| 120 | * things). We must not exceed beyond that address, there be dragons. |
| 121 | */ |
| 122 | _bogus = ASSERT( ( _eram_seg < (CONFIG_RAMTOP)) , "Please increase CONFIG_RAMTOP"); |
Yinghai Lu | 0571a95 | 2006-01-04 20:42:49 +0000 | [diff] [blame] | 123 | |
Stefan Reinauer | 7925384 | 2010-04-13 13:43:35 +0000 | [diff] [blame] | 124 | /* Discard the sections we don't need/want */ |
Yinghai Lu | 0571a95 | 2006-01-04 20:42:49 +0000 | [diff] [blame] | 125 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 126 | /DISCARD/ : { |
| 127 | *(.comment) |
| 128 | *(.note) |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 129 | *(.note.*) |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 130 | } |
| 131 | } |