aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Loaders/Elf
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-11-28 20:18:09 -0200
committerGitHub <noreply@github.com>2018-11-28 20:18:09 -0200
commit00579927e43bf55ee06ae02933c1e755fb4120eb (patch)
tree0fd06db7b28e0accf87b465ec6f4dc74691febab /Ryujinx.HLE/Loaders/Elf
parente7fe7d724778535f8eff390abef54274a343c0b7 (diff)
Better process implementation (#491)
* Initial implementation of KProcess * Some improvements to the memory manager, implement back guest stack trace printing * Better GetInfo implementation, improve checking in some places with information from process capabilities * Allow the cpu to read/write from the correct memory locations for accesses crossing a page boundary * Change long -> ulong for address/size on memory related methods to avoid unnecessary casts * Attempt at implementing ldr:ro with new KProcess * Allow BSS with size 0 on ldr:ro * Add checking for memory block slab heap usage, return errors if full, exit gracefully * Use KMemoryBlockSize const from KMemoryManager * Allow all methods to read from non-contiguous locations * Fix for TransactParcelAuto * Address PR feedback, additionally fix some small issues related to the KIP loader and implement SVCs GetProcessId, GetProcessList, GetSystemInfo, CreatePort and ManageNamedPort * Fix wrong check for source pages count from page list on MapPhysicalMemory * Fix some issues with UnloadNro on ldr:ro
Diffstat (limited to 'Ryujinx.HLE/Loaders/Elf')
-rw-r--r--Ryujinx.HLE/Loaders/Elf/ElfDynamic.cs15
-rw-r--r--Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs72
-rw-r--r--Ryujinx.HLE/Loaders/Elf/ElfSymbol.cs40
-rw-r--r--Ryujinx.HLE/Loaders/Elf/ElfSymbolBinding.cs9
-rw-r--r--Ryujinx.HLE/Loaders/Elf/ElfSymbolType.cs13
-rw-r--r--Ryujinx.HLE/Loaders/Elf/ElfSymbolVisibility.cs10
6 files changed, 159 insertions, 0 deletions
diff --git a/Ryujinx.HLE/Loaders/Elf/ElfDynamic.cs b/Ryujinx.HLE/Loaders/Elf/ElfDynamic.cs
new file mode 100644
index 00000000..fb0ea53e
--- /dev/null
+++ b/Ryujinx.HLE/Loaders/Elf/ElfDynamic.cs
@@ -0,0 +1,15 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ struct ElfDynamic
+ {
+ public ElfDynamicTag Tag { get; private set; }
+
+ public long Value { get; private set; }
+
+ public ElfDynamic(ElfDynamicTag Tag, long Value)
+ {
+ this.Tag = Tag;
+ this.Value = Value;
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs b/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs
new file mode 100644
index 00000000..9d7ad72e
--- /dev/null
+++ b/Ryujinx.HLE/Loaders/Elf/ElfDynamicTag.cs
@@ -0,0 +1,72 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ enum ElfDynamicTag
+ {
+ DT_NULL = 0,
+ DT_NEEDED = 1,
+ DT_PLTRELSZ = 2,
+ DT_PLTGOT = 3,
+ DT_HASH = 4,
+ DT_STRTAB = 5,
+ DT_SYMTAB = 6,
+ DT_RELA = 7,
+ DT_RELASZ = 8,
+ DT_RELAENT = 9,
+ DT_STRSZ = 10,
+ DT_SYMENT = 11,
+ DT_INIT = 12,
+ DT_FINI = 13,
+ DT_SONAME = 14,
+ DT_RPATH = 15,
+ DT_SYMBOLIC = 16,
+ DT_REL = 17,
+ DT_RELSZ = 18,
+ DT_RELENT = 19,
+ DT_PLTREL = 20,
+ DT_DEBUG = 21,
+ DT_TEXTREL = 22,
+ DT_JMPREL = 23,
+ DT_BIND_NOW = 24,
+ DT_INIT_ARRAY = 25,
+ DT_FINI_ARRAY = 26,
+ DT_INIT_ARRAYSZ = 27,
+ DT_FINI_ARRAYSZ = 28,
+ DT_RUNPATH = 29,
+ DT_FLAGS = 30,
+ DT_ENCODING = 32,
+ DT_PREINIT_ARRAY = 32,
+ DT_PREINIT_ARRAYSZ = 33,
+ DT_GNU_PRELINKED = 0x6ffffdf5,
+ DT_GNU_CONFLICTSZ = 0x6ffffdf6,
+ DT_GNU_LIBLISTSZ = 0x6ffffdf7,
+ DT_CHECKSUM = 0x6ffffdf8,
+ DT_PLTPADSZ = 0x6ffffdf9,
+ DT_MOVEENT = 0x6ffffdfa,
+ DT_MOVESZ = 0x6ffffdfb,
+ DT_FEATURE_1 = 0x6ffffdfc,
+ DT_POSFLAG_1 = 0x6ffffdfd,
+ DT_SYMINSZ = 0x6ffffdfe,
+ DT_SYMINENT = 0x6ffffdff,
+ DT_GNU_HASH = 0x6ffffef5,
+ DT_TLSDESC_PLT = 0x6ffffef6,
+ DT_TLSDESC_GOT = 0x6ffffef7,
+ DT_GNU_CONFLICT = 0x6ffffef8,
+ DT_GNU_LIBLIST = 0x6ffffef9,
+ DT_CONFIG = 0x6ffffefa,
+ DT_DEPAUDIT = 0x6ffffefb,
+ DT_AUDIT = 0x6ffffefc,
+ DT_PLTPAD = 0x6ffffefd,
+ DT_MOVETAB = 0x6ffffefe,
+ DT_SYMINFO = 0x6ffffeff,
+ DT_VERSYM = 0x6ffffff0,
+ DT_RELACOUNT = 0x6ffffff9,
+ DT_RELCOUNT = 0x6ffffffa,
+ DT_FLAGS_1 = 0x6ffffffb,
+ DT_VERDEF = 0x6ffffffc,
+ DT_VERDEFNUM = 0x6ffffffd,
+ DT_VERNEED = 0x6ffffffe,
+ DT_VERNEEDNUM = 0x6fffffff,
+ DT_AUXILIARY = 0x7ffffffd,
+ DT_FILTER = 0x7fffffff
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/Loaders/Elf/ElfSymbol.cs b/Ryujinx.HLE/Loaders/Elf/ElfSymbol.cs
new file mode 100644
index 00000000..3f3a2a79
--- /dev/null
+++ b/Ryujinx.HLE/Loaders/Elf/ElfSymbol.cs
@@ -0,0 +1,40 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ struct ElfSymbol
+ {
+ public string Name { get; private set; }
+
+ public ElfSymbolType Type { get; private set; }
+ public ElfSymbolBinding Binding { get; private set; }
+ public ElfSymbolVisibility Visibility { get; private set; }
+
+ public bool IsFuncOrObject =>
+ Type == ElfSymbolType.STT_FUNC ||
+ Type == ElfSymbolType.STT_OBJECT;
+
+ public bool IsGlobalOrWeak =>
+ Binding == ElfSymbolBinding.STB_GLOBAL ||
+ Binding == ElfSymbolBinding.STB_WEAK;
+
+ public int SHIdx { get; private set; }
+ public long Value { get; private set; }
+ public long Size { get; private set; }
+
+ public ElfSymbol(
+ string Name,
+ int Info,
+ int Other,
+ int SHIdx,
+ long Value,
+ long Size)
+ {
+ this.Name = Name;
+ this.Type = (ElfSymbolType)(Info & 0xf);
+ this.Binding = (ElfSymbolBinding)(Info >> 4);
+ this.Visibility = (ElfSymbolVisibility)Other;
+ this.SHIdx = SHIdx;
+ this.Value = Value;
+ this.Size = Size;
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/Loaders/Elf/ElfSymbolBinding.cs b/Ryujinx.HLE/Loaders/Elf/ElfSymbolBinding.cs
new file mode 100644
index 00000000..3c915311
--- /dev/null
+++ b/Ryujinx.HLE/Loaders/Elf/ElfSymbolBinding.cs
@@ -0,0 +1,9 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ enum ElfSymbolBinding
+ {
+ STB_LOCAL = 0,
+ STB_GLOBAL = 1,
+ STB_WEAK = 2
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/Loaders/Elf/ElfSymbolType.cs b/Ryujinx.HLE/Loaders/Elf/ElfSymbolType.cs
new file mode 100644
index 00000000..f22e6c45
--- /dev/null
+++ b/Ryujinx.HLE/Loaders/Elf/ElfSymbolType.cs
@@ -0,0 +1,13 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ enum ElfSymbolType
+ {
+ STT_NOTYPE = 0,
+ STT_OBJECT = 1,
+ STT_FUNC = 2,
+ STT_SECTION = 3,
+ STT_FILE = 4,
+ STT_COMMON = 5,
+ STT_TLS = 6
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/Loaders/Elf/ElfSymbolVisibility.cs b/Ryujinx.HLE/Loaders/Elf/ElfSymbolVisibility.cs
new file mode 100644
index 00000000..4bec50a3
--- /dev/null
+++ b/Ryujinx.HLE/Loaders/Elf/ElfSymbolVisibility.cs
@@ -0,0 +1,10 @@
+namespace Ryujinx.HLE.Loaders.Elf
+{
+ enum ElfSymbolVisibility
+ {
+ STV_DEFAULT = 0,
+ STV_INTERNAL = 1,
+ STV_HIDDEN = 2,
+ STV_PROTECTED = 3
+ }
+} \ No newline at end of file