Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
e32.h
Go to the documentation of this file.
1#ifndef SYMBIAN_E32_E32_H_
2#define SYMBIAN_E32_E32_H_
3
4#include <cstdint>
5#include <string>
6#include <string_view>
7#include <vector>
8
9#include <absl/status/statusor.h>
10
11namespace symbian::e32 {
12
13struct ImportSlot {
14 uint32_t code_offset = 0;
15 uint32_t ordinal = 0;
16 uint32_t addend = 0;
17};
18
20 std::string dll;
21 std::vector<ImportSlot> slots;
22};
23
24struct ExportSlot {
25 uint32_t ordinal = 0;
26 uint32_t address = 0;
27 bool absent = false;
28};
29
30// Metadata for the narrow, uncompressed experimental profiles.
31// Successful inspection does not prove acceptance by a device loader.
32struct ImageInfo {
33 std::string kernel = "eka2";
34 uint32_t uid3 = 0;
35 uint32_t header_crc = 0;
36 uint32_t flags = 0;
37 std::string architecture;
38 uint32_t code_size = 0;
39 uint32_t code_base = 0;
40 uint32_t data_size = 0;
41 uint32_t bss_size = 0;
42 uint32_t data_base = 0;
43 uint32_t entry_offset = 0;
44 uint32_t secure_id = 0;
45 uint32_t capabilities = 0;
46 bool dll = false;
47 uint32_t header_size = 0;
48 // Code-relative offset of the verified Symbian EHABI descriptor, or zero.
50 std::vector<ImportBlock> imports;
51 std::vector<ExportSlot> exports;
52 std::vector<uint32_t> code_relocations;
53 std::vector<uint32_t> code_data_relocations;
54 std::vector<uint32_t> data_relocations;
55 std::vector<uint32_t> data_data_relocations;
56};
57
58// Accepts ARM EABI5 ET_EXEC linked with --emit-relocs: one RX PT_LOAD,
59// one optional bounded RW mapping with initialized data and zero-filled BSS,
60// internal relative references and resolved ABS32 pointers into code/data,
61// EKA2 ARM entry, no imports/exports/TLS. Bounded constructor arrays require
62// an SDK startup that calls the guest runtime after thread-heap setup.
63// Named .data.rel.ro tables are placed in the read-only code mapping.
64// One .got table (at most 1024 words) supports retained R_ARM_GOT_PREL to
65// defined code/constant/data/BSS symbols. Every slot matches a referenced symbol;
66// slot addresses receive typed text/data fixups, preserving Thumb state.
67// Code and data mappings relocate independently. Direct PC-relative references
68// across them are rejected. Writable EXE storage is capped at 1 MiB.
69// Input must come from a trusted link retaining ALL relocations. This cannot
70// detect stripped relocations or absolute addresses hand-written in code.
71// UID3 must be in the experimental unprotected 0xe0000000..0xefffffff range.
72absl::StatusOr<std::string> ConvertPicExecutable(std::string_view elf,
73 uint32_t uid3,
74 uint32_t capabilities = 0);
75
76// Opt-in EKA1 no-UI process profile: ARMv5T EABI input, an ARM callable
77// entry that returns an integer, one read-only PIC mapping, no writable
78// data/BSS, pointer fixups, lifecycle or unwinding. Optional proxies enable
79// one EUSER DLL with a final contiguous PE IAT, not EKA2 ELF imports.
80// The legacy E32 header has no security/CRC fields. EABI input does not
81// establish compatibility with the general EKA1 C++ ABI.
82// Execution currently depends on EKA2L1's existing EKA1 bootstrap.
83absl::StatusOr<std::string> ConvertEka1Executable(
84 std::string_view elf, uint32_t uid3,
85 const std::vector<std::string>& proxies = {});
86
87// Eager function imports from validated ordinal proxies, retained call relocs,
88// one RX load containing GOT/PLT and dynamic metadata; optional bounded RW
89// data/BSS as above. Bounded constructor arrays require the SDK startup;
90// TLS and general DLL unload/lifetime are not established by conversion.
91// Link with --emit-relocs and the import layout; all imports have zero addends.
92absl::StatusOr<std::string> ConvertImportedExecutable(
93 std::string_view elf, const std::vector<std::string>& proxies,
94 uint32_t uid3, uint32_t capabilities = 0);
95
96// Frozen function exports from a trusted retained-relocation EKA2 PIC image.
97// Emits count word, complete ordinal table, absence bitmap and code relocations
98// for every slot.
99// Optional eager function imports use the same profile as the executable path.
100absl::StatusOr<std::string> ConvertDll(std::string_view elf,
101 std::string_view definition,
102 const std::vector<std::string>& proxies,
103 uint32_t uid3,
104 uint32_t capabilities = 0);
105
106// Checks bounds, UID checksum, header CRC and this supported profile only.
107// Other E32 profiles return Unimplemented, not a general validity verdict.
108absl::StatusOr<ImageInfo> InspectImage(std::string_view bytes);
109
110} // namespace symbian::e32
111
112#endif // SYMBIAN_E32_E32_H_
Definition e32.cc:23
absl::StatusOr< std::string > ConvertPicExecutable(std::string_view elf, uint32_t uid3, uint32_t capabilities)
Definition e32.cc:996
absl::StatusOr< std::string > ConvertDll(std::string_view elf, std::string_view definition, const std::vector< std::string > &proxies, uint32_t uid3, uint32_t capabilities)
Definition e32.cc:1103
absl::StatusOr< std::string > ConvertImportedExecutable(std::string_view elf, const std::vector< std::string > &proxies, uint32_t uid3, uint32_t capabilities)
Definition e32.cc:1097
absl::StatusOr< std::string > ConvertEka1Executable(std::string_view elf, uint32_t uid3, const std::vector< std::string > &proxies)
Definition e32.cc:1002
absl::StatusOr< ImageInfo > InspectImage(std::string_view bytes)
Definition e32.cc:1111
std::string_view bytes
Definition exports.cc:76
Definition e32.h:24
uint32_t ordinal
Definition e32.h:25
uint32_t address
Definition e32.h:26
bool absent
Definition e32.h:27
Definition e32.h:32
uint32_t code_size
Definition e32.h:38
uint32_t data_base
Definition e32.h:42
uint32_t header_crc
Definition e32.h:35
uint32_t secure_id
Definition e32.h:44
uint32_t flags
Definition e32.h:36
std::string architecture
Definition e32.h:37
std::vector< uint32_t > code_relocations
Definition e32.h:52
uint32_t code_base
Definition e32.h:39
uint32_t exception_descriptor_offset
Definition e32.h:49
std::vector< ExportSlot > exports
Definition e32.h:51
uint32_t data_size
Definition e32.h:40
uint32_t bss_size
Definition e32.h:41
std::vector< uint32_t > code_data_relocations
Definition e32.h:53
uint32_t capabilities
Definition e32.h:45
std::vector< ImportBlock > imports
Definition e32.h:50
uint32_t entry_offset
Definition e32.h:43
bool dll
Definition e32.h:46
uint32_t header_size
Definition e32.h:47
std::vector< uint32_t > data_data_relocations
Definition e32.h:55
uint32_t uid3
Definition e32.h:34
std::string kernel
Definition e32.h:33
std::vector< uint32_t > data_relocations
Definition e32.h:54
Definition e32.h:19
std::string dll
Definition e32.h:20
std::vector< ImportSlot > slots
Definition e32.h:21
Definition e32.h:13
uint32_t ordinal
Definition e32.h:15
uint32_t code_offset
Definition e32.h:14
uint32_t addend
Definition e32.h:16