[752cd8f] | 1 | /* |
---|
| 2 | * This file contains directives for the GNU linker which are specific |
---|
| 3 | * to the Intel 386ex evaluation board. |
---|
| 4 | * |
---|
[60b791ad] | 5 | * COPYRIGHT (c) 1989-1998. |
---|
[752cd8f] | 6 | * On-Line Applications Research Corporation (OAR). |
---|
[03f2154e] | 7 | * Copyright assigned to U.S. Government, 1994. |
---|
[752cd8f] | 8 | * |
---|
[98e4ebf5] | 9 | * The license and distribution terms for this file may be |
---|
| 10 | * found in the file LICENSE in this distribution or at |
---|
[03f2154e] | 11 | * http://www.OARcorp.com/rtems/license.html. |
---|
[752cd8f] | 12 | * |
---|
[6f9c75c3] | 13 | * $Id$ |
---|
[752cd8f] | 14 | */ |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | ENTRY(reset) ; |
---|
| 18 | SECTIONS |
---|
| 19 | { |
---|
[33442772] | 20 | |
---|
| 21 | /******************************************************************************* |
---|
| 22 | * Interrupts section: |
---|
| 23 | * |
---|
| 24 | * This section defines the layout of the interrupts in ROM ( VMA ) as well as their |
---|
| 25 | * location in RAM (LMA). The _rom_ and _ram_ variables are used in start.s |
---|
| 26 | * in order for the code to move the interrupt vector tables from ROM to RAM |
---|
| 27 | * while still running in real-mode. The tables are moved from ROM, as the IDT |
---|
| 28 | * is initialized with only 16-bit offsets for the interrupt handlers. |
---|
| 29 | * This is purely an implementation issue. If you prefer the interrupt handlers |
---|
| 30 | * to be resident in flash, then you must provide the code to create the interrupt |
---|
| 31 | * gates with full 32bit offsets. The code in the current start.s does NOT support |
---|
| 32 | * interrupts in ROM by merely redefining their location. |
---|
| 33 | ******************************************************************************/ |
---|
| 34 | _rom_ints = 0x3ff0000; /* was 0x3fb0000 */ |
---|
| 35 | _rom_ints_segment = 0xF000 ; |
---|
| 36 | _rom_ints_offset = 0x0000 ; |
---|
| 37 | |
---|
| 38 | _ram_ints_segment = 0x0000 ; |
---|
| 39 | _ram_ints_offset = 0x0100 ; |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | .ints _ram_ints_offset : |
---|
| 43 | AT ( _rom_ints ) |
---|
[752cd8f] | 44 | { |
---|
| 45 | _sints = .; |
---|
| 46 | *(.ints); |
---|
| 47 | _eints = ALIGN (0x010); |
---|
| 48 | } |
---|
[33442772] | 49 | |
---|
| 50 | _ints_size = _eints - _sints ; |
---|
| 51 | /************************************************************************************** |
---|
| 52 | * GDT section: |
---|
| 53 | * |
---|
| 54 | * This section defines the locations of the GDT in ROM as well as in RAM. The _rom_ and |
---|
| 55 | * _ram_ variables are used by start.s to copy the GDT from ROM to RAM when still in |
---|
| 56 | * real-mode. The move from ROM to RAM is made as a writeable GDT is required for the |
---|
| 57 | * jump to protected mode to be successful. |
---|
| 58 | **************************************************************************************/ |
---|
| 59 | |
---|
| 60 | _rom_gdt = _rom_ints + _ints_size; |
---|
| 61 | _rom_gdt_segment = 0xF000; |
---|
| 62 | _rom_gdt_offset = _rom_ints_offset + _ints_size; |
---|
| 63 | |
---|
| 64 | _ram_gdt_segment = 0x0000 ; |
---|
| 65 | _ram_gdt_offset = _ram_ints_offset + _ints_size; |
---|
| 66 | |
---|
| 67 | .gdt _ram_gdt_offset : |
---|
[752cd8f] | 68 | AT ( _rom_gdt ) |
---|
| 69 | { |
---|
| 70 | _sgdt = .; |
---|
| 71 | *(.gdt); |
---|
| 72 | _egdt = ALIGN (0x10); |
---|
| 73 | } |
---|
[33442772] | 74 | _gdt_size = _egdt - _sgdt; |
---|
| 75 | |
---|
| 76 | /***************************************************************************************** |
---|
| 77 | * IDT section: |
---|
| 78 | * |
---|
| 79 | * This section defines the locations of the IDT in ROM as well as in RAM. The _rom_ and |
---|
| 80 | * _ram_ variables are used by start.s to copy the IDT from ROM to RAM when still in real-mode. |
---|
| 81 | * The move from ROM to RAM is required to enable RTEMS to hook the interrupts, however, |
---|
| 82 | * this move could be made when in protected mode. |
---|
| 83 | ****************************************************************************************/ |
---|
| 84 | |
---|
| 85 | _rom_idt = _rom_gdt + _gdt_size ; |
---|
| 86 | _rom_idt_segment = 0xF000 ; |
---|
| 87 | _rom_idt_offset = _rom_gdt_offset + _gdt_size ; |
---|
| 88 | |
---|
| 89 | _ram_idt_segment = 0x0000 ; |
---|
| 90 | _ram_idt_offset = _ram_gdt_offset + _gdt_size ; |
---|
| 91 | |
---|
| 92 | .idt _ram_idt_offset : |
---|
[752cd8f] | 93 | AT ( _rom_idt ) |
---|
| 94 | { |
---|
| 95 | _sidt = .; |
---|
| 96 | *(.idt); |
---|
| 97 | _eidt = ALIGN (0x10); |
---|
| 98 | } |
---|
[33442772] | 99 | _idt_size = _eidt - _sidt; |
---|
| 100 | |
---|
| 101 | /**************************************************************************************** |
---|
| 102 | * data section: |
---|
| 103 | * |
---|
| 104 | * This section defines the locations of the data section in ROM as well as in RAM. |
---|
| 105 | * start.s copies the data section to RAM when in protected mode. |
---|
| 106 | ***********************************************************************************/ |
---|
| 107 | |
---|
| 108 | _rom_data_start = _rom_idt + _idt_size ; |
---|
| 109 | |
---|
| 110 | .data : |
---|
| 111 | AT ( _rom_data_start ) |
---|
[752cd8f] | 112 | { |
---|
| 113 | _sdata = .; |
---|
| 114 | *(.data); |
---|
| 115 | _edata = ALIGN( 0x10 ) ; |
---|
| 116 | } |
---|
| 117 | _data_start = ADDR(.data) ; |
---|
[33442772] | 118 | data_start = _data_start ; |
---|
[752cd8f] | 119 | _data_size = _edata - _sdata ; |
---|
| 120 | |
---|
[33442772] | 121 | /************************************************************************************** |
---|
| 122 | * bss section: |
---|
| 123 | * |
---|
| 124 | * The bss section is the last section in RAM. |
---|
| 125 | *************************************************************************************/ |
---|
[752cd8f] | 126 | .bss : |
---|
| 127 | { |
---|
| 128 | _bss_start = .; |
---|
| 129 | *(.bss); |
---|
| 130 | *(COMMON); |
---|
| 131 | _ebss = ALIGN(0x10); |
---|
| 132 | end = _ebss; |
---|
| 133 | _end = end; |
---|
| 134 | __end = end; |
---|
| 135 | } |
---|
[33442772] | 136 | _bss_size = _ebss - _bss_start ; |
---|
[752cd8f] | 137 | |
---|
[33442772] | 138 | /************************************************************************************** |
---|
| 139 | * General variables: |
---|
| 140 | * |
---|
| 141 | * The stack_size variable is customizable here. The heap is located directly after |
---|
| 142 | * The stack in RAM. A routine within bspstart.c uses these variables to ensure that |
---|
| 143 | * the heap used by RTEMS is as large as the RAM remaining after all workspace configurations |
---|
| 144 | * are complete. |
---|
| 145 | *************************************************************************************/ |
---|
| 146 | stack_size = 0x1000 ; |
---|
| 147 | stack_origin = end + stack_size ; |
---|
| 148 | heap_bottom = stack_origin + 4 ; |
---|
| 149 | |
---|
| 150 | /*************************************************************************************** |
---|
| 151 | * text section: |
---|
| 152 | * |
---|
| 153 | * This section is NOT copied into RAM. It is left in ROM, as the flash ROM is quick enough. |
---|
| 154 | ***************************************************************************************/ |
---|
[752cd8f] | 155 | .text ( 0x3f80000 ): |
---|
| 156 | { |
---|
[33442772] | 157 | CREATE_OBJECT_SYMBOLS |
---|
| 158 | text_start = . ; |
---|
[752cd8f] | 159 | _text_start = . ; |
---|
| 160 | *(.text ) ; |
---|
[f86ec42] | 161 | . = ALIGN (16); |
---|
| 162 | |
---|
| 163 | *(.eh_fram) |
---|
| 164 | . = ALIGN (16); |
---|
| 165 | |
---|
| 166 | /* |
---|
| 167 | * C++ constructors |
---|
| 168 | */ |
---|
| 169 | __CTOR_LIST__ = .; |
---|
| 170 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) |
---|
| 171 | *(.ctors) |
---|
| 172 | LONG(0) |
---|
| 173 | __CTOR_END__ = .; |
---|
[33442772] | 174 | . = ALIGN (4) ; |
---|
[f86ec42] | 175 | __DTOR_LIST__ = .; |
---|
| 176 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) |
---|
| 177 | *(.dtors) |
---|
| 178 | LONG(0) |
---|
| 179 | __DTOR_END__ = .; |
---|
[33442772] | 180 | _etext = ALIGN( 0x10 ); |
---|
| 181 | _endtext = . ; |
---|
[752cd8f] | 182 | } |
---|
| 183 | |
---|
[33442772] | 184 | /******************************************************************************************* |
---|
| 185 | * initial section: |
---|
| 186 | * |
---|
| 187 | * This section is defined after the data section. It must be in the top 64K of memory |
---|
| 188 | * to enable the initial short jmp from the reset section while still in real-mode. It |
---|
| 189 | * contains ALL initialization and data movement directives. |
---|
| 190 | ******************************************************************************************/ |
---|
| 191 | |
---|
| 192 | .initial _rom_data_start + _data_size : |
---|
[752cd8f] | 193 | { |
---|
| 194 | *(.initial); |
---|
| 195 | } |
---|
| 196 | |
---|
[33442772] | 197 | /******************************************************************************************* |
---|
| 198 | * reset section: |
---|
| 199 | * |
---|
| 200 | * This section contains the short jmp from the reset section to the initial section. It is |
---|
| 201 | * the first code executed on reset/power on. |
---|
| 202 | ******************************************************************************************/ |
---|
| 203 | |
---|
| 204 | .reset 0x3fffff0: |
---|
[752cd8f] | 205 | { |
---|
| 206 | *(.reset); |
---|
| 207 | } |
---|
[33442772] | 208 | } |
---|