DRY out PIT and make one that fires only once, get nsectors from linker script

This commit is contained in:
Ciro Santilli
2015-11-09 12:15:15 +01:00
parent b16e42ffe3
commit d1f11492c2
11 changed files with 147 additions and 75 deletions

View File

@@ -8,6 +8,8 @@ SECTIONS
. = 0x7c00;
.text :
{
__start = .;
/*
We are going to stuff everything
into a text segment for now, including data.
@@ -31,18 +33,20 @@ SECTIONS
*(.stage2)
/*
TODO get this working.
Number of sectors in stage 2. Used by the `int 13`.
Number of sectors in stage 2. Used by the `int 13` to load it from disk.
The value gets put into memory as the very last thing
in the `.stage` section if it exists.
We must put it *before* the final `. = ALIGN(512)`,
or else it would fall out of the loaded memory.
This must be absolute, or else it would get converted
to the actual address relative to this section (7c00 + ...)
and linking would fail with "Relocation truncated to fit"
because we are trying to put that into al for the int 13.
*/
__stage2_size = .;
/*BYTE((ALIGN(.) / 512) - 1);*/
__stage2_nsectors = ABSOLUTE((. - __start) / 512);
/* Ensure that the generated image is a multiple of 512 bytes long. */
. = ALIGN(512);