1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * linux/arch/unicore32/kernel/elf.c 4 * 5 * Code specific to PKUnity SoC and UniCore ISA 6 * 7 * Copyright (C) 2001-2010 GUAN Xue-tao 8 */ 9 #include <linux/module.h> 10 #include <linux/sched.h> 11 #include <linux/personality.h> 12 #include <linux/binfmts.h> 13 #include <linux/elf.h> 14 elf_check_arch(const struct elf32_hdr * x)15int elf_check_arch(const struct elf32_hdr *x) 16 { 17 /* Make sure it's an UniCore executable */ 18 if (x->e_machine != EM_UNICORE) 19 return 0; 20 21 /* Make sure the entry address is reasonable */ 22 if (x->e_entry & 3) 23 return 0; 24 25 return 1; 26 } 27 EXPORT_SYMBOL(elf_check_arch); 28 elf_set_personality(const struct elf32_hdr * x)29void elf_set_personality(const struct elf32_hdr *x) 30 { 31 unsigned int personality = PER_LINUX; 32 33 set_personality(personality); 34 } 35 EXPORT_SYMBOL(elf_set_personality); 36