Esempio n. 1
0
        public static void Setup()
        {
            KernelMessage.WriteLine("Setup ELF Headers");
            //KernelMessage.WriteLine("Image Header:");
            //KernelMemory.DumpToConsoleLine(Address.KernelElfSection, 124);

            Main   = FromAddress(Address.KernelElfSectionVirt);
            Native = FromSectionName("native");
        }
Esempio n. 2
0
        public static unsafe ElfSections FromAddress(Addr elfStart)
        {
            var elfHeader = (ElfHeader *)elfStart;

            var helper = new ElfSections
            {
                PhyOffset                     = elfStart,
                SectionHeaderArray            = (ElfSectionHeader *)(elfStart + elfHeader->ShOff),
                SectionHeaderCount            = elfHeader->ShNum,
                StringTableSectionHeaderIndex = elfHeader->ShStrNdx,
            };

            helper.Init();
            return(helper);
        }
Esempio n. 3
0
        public static unsafe ElfSections FromAddress(Addr elfStart)
        {
            var elfHeader = (ElfHeader *)elfStart;

            if (elfHeader->Ident1 != ElfHeader.Magic1)
            {
                KernelMessage.WriteLine("No valid ELF found at {0:X8}", elfStart);
                // TODO: Throw Exception
            }

            if (KConfig.Log.ELF)
            {
                KernelMessage.WriteLine("Found ELF at {0:X8}", elfStart);
            }

            return(ElfSections.FromAddress(elfStart));
        }