felf.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright : (C) 2022 Phytium Information Technology, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is OPEN SOURCE software: you can redistribute it and/or modify it
  6. * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
  7. * either version 1.0 of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
  10. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. * See the Phytium Public License for more details.
  12. *
  13. *
  14. * FilePath: felf.h
  15. * Date: 2021-08-31 11:16:49
  16. * LastEditTime: 2022-02-17 18:05:22
  17. * Description:  This file is for showing elf api.
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. * 1.0 zhugengyu 2022/10/27 rename file name
  23. */
  24. #ifndef FELF_H
  25. #define FELF_H
  26. #include "ftypes.h"
  27. #include "ferror_code.h"
  28. #ifdef __cplusplus
  29. extern "C"
  30. {
  31. #endif
  32. #define FELF_SUCCESS FT_SUCCESS /* SUCCESS */
  33. #define FELF_SECTION_NO_STRTAB FT_MAKE_ERRCODE(ErrorModGeneral, ErrElf, 1) /* There is no string table */
  34. #define FELF_SECTION_NO_SPACE FT_MAKE_ERRCODE(ErrorModGeneral, ErrElf, 2) /* There is no space section */
  35. #define FELF_SECTION_NOT_FIT FT_MAKE_ERRCODE(ErrorModGeneral, ErrElf, 3) /* No corresponding section was matched */
  36. #define FELF_SECTION_GET_ERROR FT_MAKE_ERRCODE(ErrorModGeneral, ErrElf, 3)
  37. unsigned long ElfLoadElfImagePhdr(unsigned long addr);
  38. unsigned long ElfLoadElfImageShdr(unsigned long addr);
  39. int ElfIsImageValid(unsigned long addr);
  40. unsigned long ElfExecBootElf(unsigned long (*entry)(int, char *const[]),
  41. int argc, char *const argv[]);
  42. FError ElfGetSection(unsigned long addr, char *section_name, u8 *data_get, u32 *length_p);
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif // !