jk-arm | 957cfea | 2021-06-18 15:52:12 +0530 | [diff] [blame^] | 1 | /** @file |
| 2 | * Copyright (c) 2021 Arm Limited or its affiliates. All rights reserved. |
| 3 | * SPDX-License-Identifier : Apache-2.0 |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | **/ |
| 17 | |
| 18 | #ifndef _VAL_DISPATCHER_H_ |
| 19 | #define _VAL_DISPATCHER_H_ |
| 20 | |
| 21 | #include "val.h" |
| 22 | |
| 23 | #define ELF_IDENT 16 |
| 24 | #define VAL_INVALID_TEST_ID 0xffffffff |
| 25 | #define VAL_TEST_START_MARKER 0xfaceface |
| 26 | #define VAL_TEST_END_MARKER 0xc3c3c3c3 |
| 27 | |
| 28 | /* typedef's */ |
| 29 | typedef uint32_t elf32_word; |
| 30 | typedef int32_t elf32_sword; |
| 31 | typedef uint16_t elf32_half; |
| 32 | typedef uint32_t elf32_off; |
| 33 | typedef uint32_t elf32_addr; |
| 34 | |
| 35 | typedef struct { |
| 36 | unsigned char e_ident[ELF_IDENT]; /* ident bytes */ |
| 37 | elf32_half e_type; /* file type */ |
| 38 | elf32_half e_machine; /* target machine */ |
| 39 | elf32_word e_version; /* file version */ |
| 40 | elf32_addr e_entry; /* start address */ |
| 41 | elf32_off e_phoff; /* phdr file offset */ |
| 42 | elf32_off e_shoff; /* shdr file offset */ |
| 43 | elf32_word e_flags; /* file flags */ |
| 44 | elf32_half e_ehsize; /* sizeof ehdr */ |
| 45 | elf32_half e_phentsize; /* sizeof phdr */ |
| 46 | elf32_half e_phnum; /* number phdrs */ |
| 47 | elf32_half e_shentsize; /* sizeof shdr */ |
| 48 | elf32_half e_shnum; /* number shdrs */ |
| 49 | elf32_half e_shstrndx; /* shdr string index */ |
| 50 | } elf_header_t; |
| 51 | |
| 52 | typedef struct { |
| 53 | elf32_word p_type; /* Segment type */ |
| 54 | elf32_off p_offset; /* Segment file offset */ |
| 55 | elf32_addr p_vaddr; /* Segment virtual address */ |
| 56 | elf32_addr p_paddr; /* Segment physical address */ |
| 57 | elf32_word p_filesz; /* Segment size in file */ |
| 58 | elf32_word p_memsz; /* Segment size in memory */ |
| 59 | elf32_word p_flags; /* Segment flags */ |
| 60 | elf32_word p_align; /* Segment alignment */ |
| 61 | } elf_pheader_t; |
| 62 | |
| 63 | typedef struct { |
| 64 | uint32_t start_marker; |
| 65 | test_id_t test_id; |
| 66 | uint32_t elf_size; |
| 67 | } test_header_t; |
| 68 | |
| 69 | int32_t val_dispatcher(test_id_t test_id_prev); |
| 70 | #endif |