On Wed, Jul 25, 2018 at 05:26:02PM +0000, Dmitry Malkin wrote: > there may be some other reasons which may cause undefined behavior (reboot > for example): > > in arch/x86/boot/compressed/pgtable_64.c in function paging_prepare(): > > 1. structure "paging_config" allocated on stack without setting default > value for flag "l5_required": > >>struct paging_config paging_config = {}; > l5_required is set only if CONFIG_X86_5LEVEL is defined Hm? C99 initializer zeros the structure. > 2. reading from memory which may be reserved in case of EFI systems: > >> ebda_start = *(unsigned short *)0x40e << 4; > >> bios_start = *(unsigned short *)0x413 << 10; > Also, on EFI system without CSM it will results in all zeros. Which will > place trampoline_start to 0x9d000. And it also may be reserved memory. In > fact I have such system and it is causes instant reboot (when code starts > copying to "trampoline_start"). Could you show dmesg from such system? > 3. paging_prepare(void) returns "struct paging_config". Copy by value. Is it > really specified by ABI or GCC itself that the second field (which is flag > "l5_required") will go to RDX register? https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf 3.2.3 Parameter Passing ... Returning of Values The returning of values is done according to the following algorithm: ... 3. If the class is INTEGER, the next available register of the sequence %rax, %rdx is used. -- Kirill A. Shutemov -- To unsubscribe from this list: send the line "unsubscribe linux-x86_64" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html