diff options
author | Roy Franz <roy.franz@linaro.org> | 2013-08-14 19:10:00 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2013-08-22 06:45:04 -0400 |
commit | 4370eec05a887b0cd4392cd5dc5b2713174745c0 (patch) | |
tree | f4d125163eef7b312ae2fcae8fa2b60e562d75c8 | |
parent | 360b35a874f130305715b1b854b67dc40826fc91 (diff) |
arm64: Expand arm64 image header
Expand the arm64 image header to allow for co-existance with
PE/COFF header required by the EFI stub. The PE/COFF format
requires the "MZ" header to be at offset 0, and the offset
to the PE/COFF header to be at offset 0x3c. The image
header is expanded to allow 2 instructions at the beginning
to accommodate a benign intruction at offset 0 that includes
the "MZ" header, a magic number, and the offset to the PE/COFF
header.
Signed-off-by: Roy Franz <roy.franz@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | Documentation/arm64/booting.txt | 16 | ||||
-rw-r--r-- | arch/arm64/kernel/head.S | 8 |
2 files changed, 21 insertions, 3 deletions
diff --git a/Documentation/arm64/booting.txt b/Documentation/arm64/booting.txt index 9c4d388daddc..5273c4d60e65 100644 --- a/Documentation/arm64/booting.txt +++ b/Documentation/arm64/booting.txt | |||
@@ -68,13 +68,23 @@ Image target is available instead. | |||
68 | 68 | ||
69 | Requirement: MANDATORY | 69 | Requirement: MANDATORY |
70 | 70 | ||
71 | The decompressed kernel image contains a 32-byte header as follows: | 71 | The decompressed kernel image contains a 64-byte header as follows: |
72 | 72 | ||
73 | u32 magic = 0x14000008; /* branch to stext, little-endian */ | 73 | u32 code0; /* Executable code */ |
74 | u32 res0 = 0; /* reserved */ | 74 | u32 code1; /* Executable code */ |
75 | u64 text_offset; /* Image load offset */ | 75 | u64 text_offset; /* Image load offset */ |
76 | u64 res0 = 0; /* reserved */ | ||
76 | u64 res1 = 0; /* reserved */ | 77 | u64 res1 = 0; /* reserved */ |
77 | u64 res2 = 0; /* reserved */ | 78 | u64 res2 = 0; /* reserved */ |
79 | u64 res3 = 0; /* reserved */ | ||
80 | u64 res4 = 0; /* reserved */ | ||
81 | u32 magic = 0x644d5241; /* Magic number, little endian, "ARM\x64" */ | ||
82 | u32 res5 = 0; /* reserved */ | ||
83 | |||
84 | |||
85 | Header notes: | ||
86 | |||
87 | - code0/code1 are responsible for branching to stext. | ||
78 | 88 | ||
79 | The image must be placed at the specified offset (currently 0x80000) | 89 | The image must be placed at the specified offset (currently 0x80000) |
80 | from the start of the system RAM and called there. The start of the | 90 | from the start of the system RAM and called there. The start of the |
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 53dcae49e729..7090c126797c 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S | |||
@@ -112,6 +112,14 @@ | |||
112 | .quad TEXT_OFFSET // Image load offset from start of RAM | 112 | .quad TEXT_OFFSET // Image load offset from start of RAM |
113 | .quad 0 // reserved | 113 | .quad 0 // reserved |
114 | .quad 0 // reserved | 114 | .quad 0 // reserved |
115 | .quad 0 // reserved | ||
116 | .quad 0 // reserved | ||
117 | .quad 0 // reserved | ||
118 | .byte 0x41 // Magic number, "ARM\x64" | ||
119 | .byte 0x52 | ||
120 | .byte 0x4d | ||
121 | .byte 0x64 | ||
122 | .word 0 // reserved | ||
115 | 123 | ||
116 | ENTRY(stext) | 124 | ENTRY(stext) |
117 | mov x21, x0 // x21=FDT | 125 | mov x21, x0 // x21=FDT |