Diff markup
001 /* Copyright (C) 2004, David Decotigny 001 /* Copyright (C) 2004, David Decotigny
002 002
003 This program is free software; you can redi 003 This program is free software; you can redistribute it and/or
004 modify it under the terms of the GNU Genera 004 modify it under the terms of the GNU General Public License
005 as published by the Free Software Foundatio 005 as published by the Free Software Foundation; either version 2
006 of the License, or (at your option) any lat 006 of the License, or (at your option) any later version.
007 007
008 This program is distributed in the hope tha 008 This program is distributed in the hope that it will be useful,
009 but WITHOUT ANY WARRANTY; without even the 009 but WITHOUT ANY WARRANTY; without even the implied warranty of
010 MERCHANTABILITY or FITNESS FOR A PARTICULAR 010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011 GNU General Public License for more details 011 GNU General Public License for more details.
012 012
013 You should have received a copy of the GNU 013 You should have received a copy of the GNU General Public License
014 along with this program; if not, write to t 014 along with this program; if not, write to the Free Software
015 Foundation, Inc., 59 Temple Place - Suite 3 015 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
016 USA. 016 USA.
017 */ 017 */
018 018
019 SECTIONS 019 SECTIONS
020 { 020 {
021 /* *************************************** 021 /* ***********************************************
022 * The bootsector is here. We link it agai 022 * The bootsector is here. We link it against the remaining of the kernel
023 * in order to automatically figure out it 023 * in order to automatically figure out its size that must be loaded
024 * from file to memory (see the load_size 024 * from file to memory (see the load_size definition below)
025 */ 025 */
026 026
027 /* If we use one, we put the boot sector h 027 /* If we use one, we put the boot sector here. We don't set its
028 * address to 0x7c000 (aka 0x7c00:0), sinc 028 * address to 0x7c000 (aka 0x7c00:0), since it reloads itself to
029 * 0x9f000, causing the 0x7c000 address to 029 * 0x9f000, causing the 0x7c000 address to be meaningless too. So we
030 * chose to pretend that the address is 0x 030 * chose to pretend that the address is 0x0, and to make a little
031 * address arithmetic in bootsect.S */ 031 * address arithmetic in bootsect.S */
032 .bootsect 0x0 : 032 .bootsect 0x0 :
033 { 033 {
034 /* The code for the boot sector goes her 034 /* The code for the boot sector goes here */
035 *(.bootsect); 035 *(.bootsect);
036 036
037 /* The load_size symbol contains the siz 037 /* The load_size symbol contains the size of the area (in
038 * sectors, aka 512 Bytes) that the boot 038 * sectors, aka 512 Bytes) that the boot sector should copy from
039 * the disk. The bss section is not incl 039 * the disk. The bss section is not included since it uses 0
040 * bytes on disk */ !! 040 * bytes on disk. This variable is short (16b) because it is used
>> 041 * by the bootsector in real mode, and this is enough because
>> 042 * our boot sector cannot transfer more than 1264 sectors (see
>> 043 * bootsector sources) */
041 load_size = .; 044 load_size = .;
042 LONG((__e_load - __b_load + 511) >> 9); !! 045 SHORT((__e_load - __b_load + 511) >> 9);
043 /* ---> This is equivalent to ceil( (__e 046 /* ---> This is equivalent to ceil( (__e_load - __b_load) / 512 ) */
044 047
045 /* At offsets 511 and 512, we set the bo 048 /* At offsets 511 and 512, we set the boot sector signature (AA55h) */
046 . = 0x1fe; 049 . = 0x1fe;
047 SHORT(0xAA55); 050 SHORT(0xAA55);
048 } 051 }
049 } 052 }
050 053
051 054
052 /* This is to avoid a cut/paste here. Please n 055 /* This is to avoid a cut/paste here. Please notice that a multiboot
053 * section WILL be inserted, which is NOT mand 056 * section WILL be inserted, which is NOT mandatory (we could have
054 * removed it without getting into trouble). P 057 * removed it without getting into trouble). Please note however that
055 * the *.bin files will NOT be multiboot compa 058 * the *.bin files will NOT be multiboot compatible (they are not in ELF
056 * format): they are expected to be directly b 059 * format): they are expected to be directly booted by the BIOS (or
057 * by the "chainloader" command of Grub). */ 060 * by the "chainloader" command of Grub). */
058 INCLUDE ../support/sos.lds 061 INCLUDE ../support/sos.lds
059 062
060 /* We overload the entry set in sos.lds, just 063 /* We overload the entry set in sos.lds, just to avoid an ld warning */
061 ENTRY(sos_main); 064 ENTRY(sos_main);