[e16e8f2] | 1 | ; -*- fundamental -*- |
---|
| 2 | ; ----------------------------------------------------------------------- |
---|
| 3 | ; |
---|
| 4 | ; Copyright 2004-2008 H. Peter Anvin - All Rights Reserved |
---|
| 5 | ; Copyright 2009 Intel Corporation; author: H. Peter Anvin |
---|
| 6 | ; |
---|
| 7 | ; This program is free software; you can redistribute it and/or modify |
---|
| 8 | ; it under the terms of the GNU General Public License as published by |
---|
| 9 | ; the Free Software Foundation, Inc., 53 Temple Place Ste 330, |
---|
| 10 | ; Boston MA 02111-1307, USA; either version 2 of the License, or |
---|
| 11 | ; (at your option) any later version; incorporated herein by reference. |
---|
| 12 | ; |
---|
| 13 | ; ----------------------------------------------------------------------- |
---|
| 14 | |
---|
| 15 | ; |
---|
| 16 | ; init.inc |
---|
| 17 | ; |
---|
| 18 | ; Common initialization code (inline) |
---|
| 19 | ; |
---|
| 20 | |
---|
| 21 | section .text16 |
---|
| 22 | common_init: |
---|
| 23 | ; Initialize PM invocation framework |
---|
| 24 | call pm_init |
---|
| 25 | |
---|
| 26 | %if IS_PXELINUX |
---|
| 27 | ; Save derivative-specific data |
---|
| 28 | pm_call pm_save_data |
---|
| 29 | %endif |
---|
| 30 | |
---|
| 31 | ; Decompress PM code to its target location |
---|
| 32 | pm_call pm_decompress |
---|
| 33 | cmp eax,__pm_code_len |
---|
| 34 | jne kaboom |
---|
| 35 | |
---|
| 36 | extern syslinux_register_bios, init |
---|
| 37 | |
---|
| 38 | pm_call syslinux_register_bios |
---|
| 39 | pm_call init |
---|
| 40 | |
---|
| 41 | ; |
---|
| 42 | ; The code to decompress the PM code and initialize other segments. |
---|
| 43 | ; |
---|
| 44 | extern _lzo1x_decompress_asm_fast_safe |
---|
| 45 | |
---|
| 46 | section .textnr |
---|
| 47 | bits 32 |
---|
| 48 | pm_decompress: |
---|
| 49 | push __pm_code_len + 16 ; Space for decompressed size |
---|
| 50 | push esp ; Pointer to previous word |
---|
| 51 | push __pm_code_start ; Target address |
---|
| 52 | push dword [lzo_data_size] ; Compressed size |
---|
| 53 | push dword __pm_code_lma |
---|
| 54 | call _lzo1x_decompress_asm_fast_safe |
---|
| 55 | add esp,16 |
---|
| 56 | pop RM_EAX ; Decompressed size |
---|
| 57 | |
---|
| 58 | ; Zero bss sections (but not .earlybss, since it may |
---|
| 59 | ; contain already-live data.) |
---|
| 60 | xor eax,eax |
---|
| 61 | mov edi,__bss_start |
---|
| 62 | mov ecx,__bss_dwords |
---|
| 63 | rep stosd |
---|
| 64 | mov edi,__bss16_start |
---|
| 65 | mov ecx,__bss16_dwords |
---|
| 66 | rep stosd |
---|
| 67 | mov edi,__high_clear_start ; .uibss, .lowmem |
---|
| 68 | mov ecx,__high_clear_dwords |
---|
| 69 | rep stosd |
---|
| 70 | |
---|
| 71 | ret |
---|
| 72 | |
---|
| 73 | section .data16 |
---|
| 74 | lzo_data_size dd 0 ; filled in by compressor |
---|
| 75 | |
---|
| 76 | section .text16 |
---|
| 77 | bits 16 |
---|