~ubuntu-branches/ubuntu/gutsy/virtualbox-ose/gutsy

« back to all changes in this revision

Viewing changes to src/VBox/Devices/PC/Etherboot-src/arch/i386/core/etherboot.prefix-pe.lds

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-09-08 16:44:58 UTC
  • Revision ID: james.westby@ubuntu.com-20070908164458-wao29470vqtr8ksy
Tags: upstream-1.5.0-dfsg2
ImportĀ upstreamĀ versionĀ 1.5.0-dfsg2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
OUTPUT_FORMAT("pe-i386", "pe-i386", "pe-i386")
 
2
OUTPUT_ARCH(i386)
 
3
 
 
4
ENTRY(__prefix_start)
 
5
SECTIONS {
 
6
        /* Prefix */
 
7
        .prefix : {
 
8
                __verbatim_start = . ;
 
9
                __prefix_start = . ;
 
10
                *(.prefix)
 
11
                . = ALIGN(16);
 
12
                __prefix_end = . ;
 
13
        } = 0x9090
 
14
        __prefix_size = __prefix_end - __prefix_start;
 
15
 
 
16
        .text.nocompress : {
 
17
                *(.prefix.udata)
 
18
        } = 0x9090
 
19
 
 
20
        _decompress_to = . ;
 
21
        .prefix.zdata : {
 
22
                __compressed = . ;
 
23
                *(.prefix.zdata)
 
24
                __compressed_end = . ;
 
25
        }
 
26
        __compressed_size = __compressed_end - __compressed;
 
27
 
 
28
        . = ALIGN(16);
 
29
        __verbatim_end = . ;
 
30
 
 
31
 
 
32
        /* Size of the core of etherboot in memory */
 
33
        __base_size = __end - __text;
 
34
 
 
35
        /* _prefix_size is the length of the non-core etherboot prefix */
 
36
        __prefix_size = __prefix_end - __prefix_start;
 
37
 
 
38
        /* _verbatim_size is the actual amount that has to be copied to base memory */
 
39
        __verbatim_size = __verbatim_end - __verbatim_start;
 
40
 
 
41
        /* _image_size is the amount of base memory needed to run */
 
42
        __image_size = __base_size +  __prefix_size;
 
43
 
 
44
        /* Standard sizes rounded up to paragraphs */
 
45
        __prefix_size_pgh   = (__prefix_size + 15) / 16;
 
46
        __verbatim_size_pgh = (__verbatim_size + 15) / 16;
 
47
        __image_size_pgh    = (__image_size + 15) / 16 ;
 
48
        
 
49
        /* Standard sizes in sectors */
 
50
        __prefix_size_sct   = (__prefix_size + 511) / 512;
 
51
        __verbatim_size_sct = (__verbatim_size + 511) / 512;
 
52
        __image_size_sct    = (__image_size + 511) / 512;
 
53
 
 
54
        /* Symbol offsets and sizes for the exe prefix */
 
55
        __exe_hdr_size   = 32;
 
56
        __exe_size       = __verbatim_size; /* Should this be - 32 to exclude the header? */
 
57
        __exe_size_tail  = (__exe_size) % 512;
 
58
        __exe_size_pages = ((__exe_size) + 511) / 512;
 
59
        __exe_bss_size   = ((__image_size - __verbatim_size) + 15) / 16;
 
60
        __exe_ss_offset  = (__stack_offset + __prefix_size - __exe_hdr_size + 15) / 16 ;
 
61
 
 
62
        /* This is where we copy the compressed image before decompression.
 
63
         * Prepare to decompress in place.  The end mark is about 8.25 bytes long,
 
64
         * and the worst case symbol is about 16.5 bytes long.  Therefore
 
65
         * We need to reserve at least 25 bytes of slack here.  
 
66
         * Currently I reserve 2048 bytes of just slack to be safe :)
 
67
         * 2048 bytes easily falls within the BSS (the defualt stack is 4096 bytes)
 
68
         * so we really are decompressing in place.
 
69
         * 
 
70
         * Hmm. I missed a trick.  In the very worst case (no compression)
 
71
         * the encoded data is 9/8 the size as it started out so to be completely
 
72
         * safe I need to be 1/8 of the uncompressed code size past the end.
 
73
         * This will still fit compfortably into our bss in any conceivable scenario.
 
74
         */
 
75
        __compressed_copy = __edata + __prefix_size  - __compressed_size +
 
76
                /* The amount to overflow _edata */
 
77
                MAX( ((__edata - __text + 7) / 8) , 2016 ) + 32; 
 
78
        __assert = ASSERT( ( __compressed_copy - __prefix_size ) < __ebss , "Cannot decompress in place" ) ; 
 
79
 
 
80
        _decompress = DEFINED(_decompress) ? _decompress : 0;
 
81
        /DISCARD/ : {
 
82
                *(.comment)
 
83
                *(.note)
 
84
        }
 
85
 
 
86
        /* Symbols used by the prefixes whose addresses are inconvinient 
 
87
         * to compute, at runtime in the code.
 
88
         */
 
89
        _image_basemem_size = DEFINED(_image_basemem_size)? _image_basemem_size : 65536;
 
90
        _image_basemem      = DEFINED(_image_basemem)?     _image_basemem : 65536;
 
91
        __prefix_real_to_prot          = __real_to_prot         + __prefix_size ;
 
92
        __prefix_prot_to_real          = __prot_to_real         + __prefix_size ;
 
93
        __prefix_image_basemem_size    = _image_basemem_size    + __prefix_size ;
 
94
        __prefix_image_basemem         = _image_basemem         + __prefix_size ;
 
95
        __prefix_rm_in_call            = __rm_in_call           + __prefix_size ;
 
96
        __prefix_in_call               = __in_call              + __prefix_size ;
 
97
        __prefix_rom                   = _rom                   + __prefix_size ;
 
98
        __prefix_rm_etherboot_location = _rm_etherboot_location + __prefix_size ;
 
99
        __prefix_stack_end             = __stack_end            + __prefix_size ;
 
100
}