File Index
Files and directories
Sign in
FILE

image.h

File preview with syntax highlighting.

linux-6.19.14/arch/loongarch/include/asm/image.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * LoongArch binary image header for EFI(PE/COFF) format.
 4 *
 5 * Author: Youling Tang <tangyouling@kylinos.cn>
 6 * Copyright (C) 2025 KylinSoft Corporation.
 7 */
 8
 9#ifndef __ASM_IMAGE_H
10#define __ASM_IMAGE_H
11
12#ifndef __ASSEMBLER__
13
14/**
15 * struct loongarch_image_header
16 *
17 * @dos_sig: Optional PE format 'MZ' signature.
18 * @padding_1: Reserved.
19 * @kernel_entry: Kernel image entry pointer.
20 * @kernel_asize: An estimated size of the memory image size in LSB byte order.
21 * @text_offset: The image load offset in LSB byte order.
22 * @padding_2: Reserved.
23 * @pe_header: Optional offset to a PE format header.
24 **/
25
26struct loongarch_image_header {
27	uint8_t dos_sig[2];
28	uint16_t padding_1[3];
29	uint64_t kernel_entry;
30	uint64_t kernel_asize;
31	uint64_t text_offset;
32	uint32_t padding_2[7];
33	uint32_t pe_header;
34};
35
36/*
37 * loongarch_header_check_dos_sig - Helper to check the header
38 *
39 * Returns true (non-zero) if 'MZ' signature is found.
40 */
41
42static inline int loongarch_header_check_dos_sig(const struct loongarch_image_header *h)
43{
44	if (!h)
45		return 0;
46
47	return (h->dos_sig[0] == 'M' && h->dos_sig[1] == 'Z');
48}
49
50#endif /* __ASSEMBLER__ */
51
52#endif /* __ASM_IMAGE_H */
~/ Read-only file preview.