aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.gitignore4
-rw-r--r--LICENSE.md13
-rw-r--r--Makefile26
-rw-r--r--OVMF.fdbin0 -> 4194304 bytes
-rw-r--r--OVMF.fd.backupbin0 -> 1048576 bytes
-rw-r--r--README.md17
-rw-r--r--bootloader/.gitignore1
-rw-r--r--bootloader/ELF.c78
-rw-r--r--bootloader/ELF.h56
-rw-r--r--bootloader/Makefile49
-rw-r--r--bootloader/README.md27
-rw-r--r--bootloader/bootloader.pro30
-rw-r--r--bootloader/bootloader.pro.user274
-rw-r--r--bootloader/deployment.pri191
-rw-r--r--bootloader/disk.c98
-rw-r--r--bootloader/disk.h9
-rw-r--r--bootloader/main.c396
-rw-r--r--bootloader/memory.c29
-rw-r--r--bootloader/memory.h14
-rw-r--r--bootloader/memorytypes.h12
-rw-r--r--bootloader/misc.s10
-rw-r--r--bootloader/other.c42
-rw-r--r--bootloader/other.h12
-rw-r--r--bootloader/paging.c295
-rw-r--r--bootloader/paging.h17
-rw-r--r--bootloader/paging_struct.h189
-rw-r--r--bootloader/vga.c108
-rw-r--r--bootloader/vga.h16
-rw-r--r--bootloader/vmmem.c25
-rw-r--r--bootloader/vmmem.h9
-rw-r--r--hda-image/NvVarsbin0 -> 2433 bytes
-rwxr-xr-xhda-image/kernel.binbin0 -> 13456 bytes
-rw-r--r--hello-efi/Makefile12
-rw-r--r--hello-efi/main.c11
-rw-r--r--idt.py6
-rw-r--r--kernel/.gitignore1
-rw-r--r--kernel/acpi.c169
-rw-r--r--kernel/acpi.h125
-rw-r--r--kernel/asm_inline.h207
-rw-r--r--kernel/cpu_info.c98
-rw-r--r--kernel/cpu_info.h23
-rw-r--r--kernel/gdt.c285
-rw-r--r--kernel/gdt.h93
-rw-r--r--kernel/generate_vectors.py19
-rw-r--r--kernel/idt.c131
-rw-r--r--kernel/idt.h287
-rw-r--r--kernel/interrupts/common.s94
-rw-r--r--kernel/interrupts/generic.c95
-rw-r--r--kernel/interrupts/generic.h33
-rw-r--r--kernel/interrupts/vectors.s1543
-rw-r--r--kernel/kernel.c131
-rw-r--r--kernel/kprintf.c259
-rw-r--r--kernel/kprintf.h3
-rw-r--r--kernel/linker.ld51
-rw-r--r--kernel/loader.s32
-rw-r--r--kernel/makefile25
-rw-r--r--kernel/memops.c36
-rw-r--r--kernel/memops.h8
-rw-r--r--kernel/segments.s21
-rw-r--r--kernel/uefi.h104
-rw-r--r--misc-host/ELF/ELF-loader-test/.gitignore1
-rw-r--r--misc-host/ELF/ELF-loader-test/ELF-loader-test.pro19
-rw-r--r--misc-host/ELF/ELF-loader-test/ELF-loader-test.pro.user472
-rw-r--r--misc-host/ELF/ELF-loader-test/bootloader_compat.cpp18
-rw-r--r--misc-host/ELF/ELF-loader-test/bootloader_compat.h35
-rw-r--r--misc-host/ELF/ELF-loader-test/datatypes.h16
-rw-r--r--misc-host/ELF/ELF-loader-test/deployment.pri191
-rw-r--r--misc-host/ELF/ELF-loader-test/elf64header.h97
-rw-r--r--misc-host/ELF/ELF-loader-test/elfinfoprint.cpp74
-rw-r--r--misc-host/ELF/ELF-loader-test/elfinfoprint.h12
-rw-r--r--misc-host/ELF/ELF-loader-test/main.cpp12
-rw-r--r--misc-host/ELF/build-ELF-loader-test-Clang-Debug/.gitignore2
-rw-r--r--misc-host/ELF/build-ELF-loader-test-Clang-Debug/Makefile590
-rw-r--r--misc-host/ELF/build-ELF-loader-test-GCC-Debug/Makefile593
-rw-r--r--misc-host/paging-debug/build-paging-debug-GCC-Debug/Makefile595
-rw-r--r--misc-host/paging-debug/paging-debug/.gitignore73
-rw-r--r--misc-host/paging-debug/paging-debug/bootloader_compat.cpp20
-rw-r--r--misc-host/paging-debug/paging-debug/bootloader_compat.h40
-rw-r--r--misc-host/paging-debug/paging-debug/main.c25
-rw-r--r--misc-host/paging-debug/paging-debug/paging-debug.pro14
-rw-r--r--misc-host/paging-debug/paging-debug/paging.c310
-rw-r--r--misc-host/paging-debug/paging-debug/paging.h17
-rw-r--r--misc-host/paging-debug/paging-debug/paging_struct.h189
-rw-r--r--misc-host/test-vaddr/vaddr.cpp50
84 files changed, 9414 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..55462fc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.o
+*.so
+*.autosave
+*.efi
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..27dd293
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,13 @@
+Copyright (c) 2015, Imanol Celaya <imanol@celaya.me>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..173ebfc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+.PHONY: all build clean build-bootloader build-kernel clean-bootloader clean-kernel
+
+all: build
+
+build: build-bootloader build-kernel
+
+image:
+ cp kernel/kernel.bin hda-image
+ cp bootloader/hello.efi hda-image/EFI/Boot/bootx64.efi
+
+run: image
+ qemu-system-x86_64 -display gtk,show-tabs=on -bios ./OVMF.fd -drive file=fat:rw:hda-image -m 512M -d in_asm,int -no-reboot -no-shutdown -D ./qemu-debug.log
+
+clean: clean-bootloader clean-kernel
+
+build-bootloader:
+ $(MAKE) -C bootloader/ MAKEFLAGS=
+
+build-kernel:
+ $(MAKE) -C kernel/ MAKEFLAGS=
+
+clean-bootloader:
+ $(MAKE) -C bootloader/ MAKEFLAGS= clean
+
+clean-kernel:
+ $(MAKE) -C kernel/ MAKEFLAGS= clean
diff --git a/OVMF.fd b/OVMF.fd
new file mode 100644
index 0000000..4f6463e
--- /dev/null
+++ b/OVMF.fd
Binary files differ
diff --git a/OVMF.fd.backup b/OVMF.fd.backup
new file mode 100644
index 0000000..c6abd59
--- /dev/null
+++ b/OVMF.fd.backup
Binary files differ
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4622183
--- /dev/null
+++ b/README.md
@@ -0,0 +1,17 @@
+# README #
+
+Repository For the OS
+
+## Components ##
+
+### Bootloader ###
+
+It uses a custom bootloader, which is an efi application so it can be loaded by any efi boot manager.
+
+### Kernel ###
+
+The kernel has almost no work done, but it goes in tandem with the bootloader and both are of the AMD64 architecture
+
+## Toolchain ##
+
+Right now it's GCC, but I hope to migrate everything to clang \ No newline at end of file
diff --git a/bootloader/.gitignore b/bootloader/.gitignore
new file mode 100644
index 0000000..335ec95
--- /dev/null
+++ b/bootloader/.gitignore
@@ -0,0 +1 @@
+*.tar.gz
diff --git a/bootloader/ELF.c b/bootloader/ELF.c
new file mode 100644
index 0000000..dd2bc62
--- /dev/null
+++ b/bootloader/ELF.c
@@ -0,0 +1,78 @@
+#include "ELF.h"
+#include "memorytypes.h"
+
+#include <efi.h>
+#include <efilib.h>
+#include <efidef.h>
+
+UINTN EFIAPI elf_ceil2(float x)
+{
+ UINTN ret = x;
+ if (x - (int)x > 0) {
+ x += 1;
+ ret = (int)x;
+ }
+
+ return ret;
+}
+
+void EFIAPI PrintELFInfo(ELF * file)
+{
+ Print(L"LoadAddress: 0x%x\n", file);
+
+ Print(L"Kernel Entry Point: 0x%llx\n", file->e_entry);
+
+ Print(L"program Header offset: %d\n", file->e_phoff);
+ Print(L"Program Header Size: %d\n", file->e_phentsize);
+ Print(L"Program Header number: %d\n", file->e_phnum);
+ Print(L"== FILE PH START: 0x%llx ==\n", (uint64_t)file + file->e_phoff);
+
+ for(uint64_t i = 0; i < file->e_phnum; i++)
+ {
+ Print(L"====== PH %d\n", (uint64_t)(i+1));
+ PH* ph = (PH*)(((uint64_t)file) + file->e_phoff+i*file->e_phentsize);
+ Print(L"TOTAL LOAD offset: 0x%llx\n", (uint64_t)(file) + ph->p_offset);
+ Print(L"UNCAST LOAD offset: 0x%llx\n", (uint64_t)(file + ph->p_offset));
+ Print(L"LOAD offset: 0x%llx\n", ph->p_offset);
+ Print(L"LOAD vaddr: 0x%llx\n", ph->p_vaddr);
+ Print(L"LOAD paddr: 0x%llx\n", ph->p_paddr);
+ Print(L"LOAD size in file: 0x%llx\n", ph->p_filesz);
+ Print(L"LOAD size in memory: 0x%llx\n", ph->p_memsz);
+ }
+}
+
+Loaded_ELF* EFIAPI LoadELF(ELF* file)
+{
+ Print(L"Loading ELF file into memory\n");
+ Loaded_ELF* loaded_elf;
+
+ uefi_call_wrapper(BS->AllocatePool, 3, EfiLoaderData, sizeof(Loaded_ELF), (void**)&loaded_elf);
+
+ loaded_elf->ph_num = file->e_phnum;
+ loaded_elf->entry = file->e_entry;
+ uefi_call_wrapper(BS->AllocatePool, 3, EfiLoaderData, file->e_phnum*sizeof(Loaded_PH), (void**)&(loaded_elf->ph));
+
+ Print(L"Loading Program Segments...\n");
+ for(uint32_t i = 0; i < file->e_phnum; i++)
+ {
+ PH* ph = (PH*)(((uint64_t)file) + file->e_phoff+i*file->e_phentsize);
+ loaded_elf->ph[i].mem_size = ph->p_memsz;
+ loaded_elf->ph[i].vaddr = ph->p_vaddr;
+
+ uint64_t pages = (ph->p_memsz/1024)/4;
+
+ // uefi_call_wrapper(BS->AllocatePool, 3, EfiLoaderData, ph->p_memsz, (void**)&(loaded_elf->ph[i].data)); // <- wrong, need to allocate aligned pages
+ UINTN ipages = elf_ceil2(pages);
+ EFI_PHYSICAL_ADDRESS tmp;
+
+ /*EFI_STATUS allocstatus = */uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, MEM_KERNEL, ipages, &tmp);
+ loaded_elf->ph[i].data = (void*)tmp;
+
+ // Print(L"PH: %d Addr: 0x%llX\n", i, file + ph->p_offset);
+ Print(L"LOADED PH: %d Addr: 0x%llX\n", i, loaded_elf->ph[i].data);
+ uefi_call_wrapper(BS->CopyMem, 3, loaded_elf->ph[i].data, (void*)((uint64_t)(file) + ph->p_offset), ph->p_filesz);
+ }
+ Print(L"\nFinished Loading ELF file into memory\n\n");
+
+ return loaded_elf;
+}
diff --git a/bootloader/ELF.h b/bootloader/ELF.h
new file mode 100644
index 0000000..c379a91
--- /dev/null
+++ b/bootloader/ELF.h
@@ -0,0 +1,56 @@
+#ifndef ELF_H
+#define ELF_H
+
+#include <efi.h>
+
+#define ELFMAGIC 0x464C457F
+
+// Elf header struct
+typedef struct ELF
+{
+ UINT8 e_ident[16];
+ UINT16 e_type;
+ UINT16 e_machine;
+ UINT32 e_version;
+ UINT64 e_entry;
+ UINT64 e_phoff;
+ UINT64 e_shoff;
+ UINT32 e_flags;
+ UINT16 e_ehsize;
+ UINT16 e_phentsize;
+ UINT16 e_phnum;
+ UINT16 e_shentsize;
+ UINT16 e_shnum;
+ UINT16 e_shstrndx;
+} ELF;
+
+typedef struct PH
+{
+ UINT32 p_type;
+ UINT32 p_flags;
+ UINT64 p_offset;
+ UINT64 p_vaddr;
+ UINT64 p_paddr;
+ UINT64 p_filesz;
+ UINT64 p_memsz;
+ UINT64 p_align;
+} PH;
+
+typedef struct Loaded_PH
+{
+ UINT64 mem_size;
+ UINT64 vaddr;
+ void* data;
+} Loaded_PH;
+
+typedef struct Loaded_ELF
+{
+ UINT64 ph_num;
+ UINT64 entry;
+ Loaded_PH* ph;
+} Loaded_ELF;
+
+void EFIAPI PrintELFInfo(ELF * file);
+Loaded_ELF* EFIAPI LoadELF(ELF* file);
+
+#endif
diff --git a/bootloader/Makefile b/bootloader/Makefile
new file mode 100644
index 0000000..cd7cbba
--- /dev/null
+++ b/bootloader/Makefile
@@ -0,0 +1,49 @@
+#CC = gcc-4.8.3
+
+#ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
+EFI_ARCH = x86_64
+ARCH = x86-64
+
+OBJS = main.o misc.o ELF.o disk.o vga.o vmmem.o paging.o memory.o other.o
+TARGET = hello.efi
+
+EFIINC = /usr/include/efi
+EFIINCS = -I$(EFIINC) -I$(EFIINC)/$(EFI_ARCH) -I$(EFIINC)/protocol
+LIB = /usr/lib
+EFILIB = /usr/lib
+EFI_CRT_OBJS = $(EFILIB)/crt0-efi-$(EFI_ARCH).o
+EFI_LDS = $(EFILIB)/elf_$(EFI_ARCH)_efi.lds
+
+CFLAGS = $(EFIINCS) -fno-stack-protector -fpic \
+ -fshort-wchar -mno-red-zone -Wall -ggdb3 -O0 -fpic -ffreestanding -fno-stack-protector -fno-stack-check -fshort-wchar -mno-red-zone -maccumulate-outgoing-args -mno-avx -mno-sse
+ifeq ($(ARCH),x86-64)
+ CFLAGS += -DEFI_FUNCTION_WRAPPER
+endif
+
+LDFLAGS = -T $(EFI_LDS) -shared \
+ -Bsymbolic -L $(EFILIB) -L $(LIB) $(EFI_CRT_OBJS)
+# -nostdlib -znocombreloc -T $(EFI_LDS) -shared \
+
+.PHONY: all debug clean
+
+all: $(TARGET)
+
+hello.so: $(OBJS)
+ ld $(LDFLAGS) $(OBJS) -o $@ -lefi -lgnuefi
+
+%.efi: %.so
+ objcopy -v -j .text -j .sdata -j .data -j .rodata -j .dynamic \
+ -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc \
+ --output-target=efi-app-x86_64 --subsystem=10 $^ $@
+# --target=efi-app-$(ARCH) $^ $@
+
+debug: all
+ objcopy -j .text -j .sdata -j .data -j .dynamic \
+ -j .dynsym -j .rel -j .rela -j .reloc \
+ -j .debug_info -j .debug_abbrev -j .debug_loc \
+ -j .debug_aranges -j .debug_line -j .debug_macinfo -j .debug_str\
+ --target=pei-$(ARCH) hello.so hello-debug.so
+# --target=efi-app-$(ARCH) hello.so hello-debug.so
+
+clean:
+ rm *.so *.efi *.o
diff --git a/bootloader/README.md b/bootloader/README.md
new file mode 100644
index 0000000..4251b2f
--- /dev/null
+++ b/bootloader/README.md
@@ -0,0 +1,27 @@
+
+UEFI Bootloader
+---------------
+
+UEFI is a replacement to the BIOS, not only as the system firmware but also changes how the computer boots.
+previously the computer would start in 16 bits mode, then jump to 32 and then to 64, all that process being the responsibility of the bootloader.
+If the system is of 64 bits and the uefi firmware is also of 64 bits the system boot directly into 64 bits, meaning the bootloader binary
+must be a 64 bits executable.
+
+It also removes old interfaces like VGA and VESA when dealing with the gpu, but in turn provides alternate ways of talking with the hardware
+all those new interfaces are defined as protocols, which you need to ask for to the firmware, as such to load a file instead of parsing the disk and
+reading the filesystem directly, you ask for the appropiate protocol that is able of understandding the disk and the filesystem, and then you use the API
+of that protocol to load the file.
+
+
+Steps
+-----
+
+* firmware load the bootloader and starts executin the entry point, at this stage the bootloader is a regular program.
+* clean up the screen and setup a more appropiate video mode
+* allocate memory for the arguments that will be passed to the kernel
+* load the kernel file form disk
+* parse the ELF header of the kernel
+* obtain the system memory map(is needed to exit the boot services)
+* exit boot services, this destroys the uefi environment and we can no longer use anything that requires the boot services(and we can no longer return to the firmware)
+* fill the the struct that will be passed to the kernel
+* jump into the kernel with the information extracted from the ELF header
diff --git a/bootloader/bootloader.pro b/bootloader/bootloader.pro
new file mode 100644
index 0000000..0a3c1f6
--- /dev/null
+++ b/bootloader/bootloader.pro
@@ -0,0 +1,30 @@
+TEMPLATE = app
+CONFIG += console
+CONFIG -= app_bundle
+CONFIG -= qt
+
+INCLUDEPATH += /usr/include/efi
+
+SOURCES += main.c misc.s \
+ disk.c \
+ ELF.c \
+ vga.c \
+ vmmem.c \
+ memory.c \
+ paging.c \
+ other.c
+
+include(deployment.pri)
+qtcAddDeployment()
+
+HEADERS += \
+ ELF.h \
+ disk.h \
+ vga.h \
+ vmmem.h \
+ memory.h \
+ memorytypes.h \
+ paging_struct.h \
+ paging.h \
+ other.h
+
diff --git a/bootloader/bootloader.pro.user b/bootloader/bootloader.pro.user
new file mode 100644
index 0000000..082affd
--- /dev/null
+++ b/bootloader/bootloader.pro.user
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE QtCreatorProject>
+<!-- Written by QtCreator 3.6.0, 2016-02-15T01:15:17. -->
+<qtcreator>
+ <data>
+ <variable>EnvironmentId</variable>
+ <value type="QByteArray">{2c3e9189-5d42-4938-9849-c0bb2ac935ae}</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.ActiveTarget</variable>
+ <value type="int">0</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.EditorSettings</variable>
+ <valuemap type="QVariantMap">
+ <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
+ <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
+ <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
+ <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
+ <value type="QString" key="language">Cpp</value>
+ <valuemap type="QVariantMap" key="value">
+ <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
+ </valuemap>
+ </valuemap>
+ <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
+ <value type="QString" key="language">QmlJS</value>
+ <valuemap type="QVariantMap" key="value">
+ <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
+ </valuemap>
+ </valuemap>
+ <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
+ <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
+ <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
+ <value type="int" key="EditorConfiguration.IndentSize">4</value>
+ <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
+ <value type="int" key="EditorConfiguration.MarginColumn">80</value>
+ <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
+ <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
+ <value type="int" key="EditorConfiguration.PaddingMode">1</value>
+ <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
+ <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
+ <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
+ <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
+ <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
+ <value type="int" key="EditorConfiguration.TabSize">8</value>
+ <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
+ <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
+ <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
+ <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
+ <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
+ <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.PluginSettings</variable>
+ <valuemap type="QVariantMap"/>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Target.0</variable>
+ <valuemap type="QVariantMap">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">GCC</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">GCC</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{d432c706-8e6f-4f4f-92f1-4099cda2d690}</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ornitorrincos/os/build-bootloader-GCC-Debug</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ornitorrincos/os/build-bootloader-GCC-Release</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
+ <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
+ <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">0</value>
+ <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
+ <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+ <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+ <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+ <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">bootloader</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">bootloader2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/ornitorrincos/OS-github/bootloader/bootloader.pro</value>
+ <value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">bootloader.pro</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
+ <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+ <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+ <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.TargetCount</variable>
+ <value type="int">1</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+ <value type="int">18</value>
+ </data>
+ <data>
+ <variable>Version</variable>
+ <value type="int">18</value>
+ </data>
+</qtcreator>
diff --git a/bootloader/deployment.pri b/bootloader/deployment.pri
new file mode 100644
index 0000000..5f1749f
--- /dev/null
+++ b/bootloader/deployment.pri
@@ -0,0 +1,191 @@
+# This file was generated by an application wizard of Qt Creator.
+# The code below handles deployment to Android and Maemo, aswell as copying
+# of the application data to shadow build directories on desktop.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+defineTest(qtcAddDeployment) {
+for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ greaterThan(QT_MAJOR_VERSION, 4) {
+ itemsources = $${item}.files
+ } else {
+ itemsources = $${item}.sources
+ }
+ $$itemsources = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath= $$eval($${deploymentfolder}.target)
+ export($$itemsources)
+ export($$itempath)
+ DEPLOYMENT += $$item
+}
+
+MAINPROFILEPWD = $$PWD
+
+android-no-sdk {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ target.path = /data/user/qt
+
+ export(target.path)
+ INSTALLS += target
+} else:android {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /assets/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ x86 {
+ target.path = /libs/x86
+ } else: armeabi-v7a {
+ target.path = /libs/armeabi-v7a
+ } else {
+ target.path = /libs/armeabi
+ }
+
+ export(target.path)
+ INSTALLS += target
+} else:win32 {
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, /, \\)
+ sourcePathSegments = $$split(source, \\)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
+ target = $$replace(target, /, \\)
+ target ~= s,\\\\\\.?\\\\,\\,
+ !isEqual(source,$$target) {
+ !isEmpty(copyCommand):copyCommand += &&
+ isEqual(QMAKE_DIR_SEP, \\) {
+ copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
+ } else {
+ source = $$replace(source, \\\\, /)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ target = $$replace(target, \\\\, /)
+ copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
+ }
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+} else:ios {
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, \\\\, /)
+ target = $CODESIGNING_FOLDER_PATH/$$eval($${deploymentfolder}.target)
+ target = $$replace(target, \\\\, /)
+ sourcePathSegments = $$split(source, /)
+ targetFullPath = $$target/$$last(sourcePathSegments)
+ targetFullPath ~= s,/\\.?/,/,
+ !isEqual(source,$$targetFullPath) {
+ !isEmpty(copyCommand):copyCommand += &&
+ copyCommand += mkdir -p \"$$target\"
+ copyCommand += && cp -r \"$$source\" \"$$target\"
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = echo Copying application data... && $$copyCommand
+ !isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";"
+ QMAKE_POST_LINK += "$$copyCommand"
+ export(QMAKE_POST_LINK)
+ }
+} else:unix {
+ maemo5 {
+ desktopfile.files = $${TARGET}.desktop
+ desktopfile.path = /usr/share/applications/hildon
+ icon.files = $${TARGET}64.png
+ icon.path = /usr/share/icons/hicolor/64x64/apps
+ } else:!isEmpty(MEEGO_VERSION_MAJOR) {
+ desktopfile.files = $${TARGET}_harmattan.desktop
+ desktopfile.path = /usr/share/applications
+ icon.files = $${TARGET}80.png
+ icon.path = /usr/share/icons/hicolor/80x80/apps
+ } else { # Assumed to be a Desktop Unix
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, \\\\, /)
+ macx {
+ target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
+ } else {
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ }
+ target = $$replace(target, \\\\, /)
+ sourcePathSegments = $$split(source, /)
+ targetFullPath = $$target/$$last(sourcePathSegments)
+ targetFullPath ~= s,/\\.?/,/,
+ !isEqual(source,$$targetFullPath) {
+ !isEmpty(copyCommand):copyCommand += &&
+ copyCommand += $(MKDIR) \"$$target\"
+ copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+ }
+ !isEmpty(target.path) {
+ installPrefix = $${target.path}
+ } else {
+ installPrefix = /opt/$${TARGET}
+ }
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ !isEmpty(desktopfile.path) {
+ export(icon.files)
+ export(icon.path)
+ export(desktopfile.files)
+ export(desktopfile.path)
+ INSTALLS += icon desktopfile
+ }
+
+ isEmpty(target.path) {
+ target.path = $${installPrefix}/bin
+ export(target.path)
+ }
+ INSTALLS += target
+}
+
+export (ICON)
+export (INSTALLS)
+export (DEPLOYMENT)
+export (LIBS)
+export (QMAKE_EXTRA_TARGETS)
+}
+
diff --git a/bootloader/disk.c b/bootloader/disk.c
new file mode 100644
index 0000000..646448e
--- /dev/null
+++ b/bootloader/disk.c
@@ -0,0 +1,98 @@
+#include <efi.h>
+#include <efilib.h>
+
+#include "disk.h"
+#include "memory.h"
+
+UINTN EFIAPI ceil2(float x)
+{
+ UINTN ret = x;
+ if (x - (int)x > 0) {
+ x += 1;
+ ret = (int)x;
+ }
+
+ return ret;
+}
+
+void * EFIAPI LoadFile(CHAR16 * name, UINTN memtype, int32_t* filesize)
+{
+ // ask for the protocol to handle the filesystem
+ EFI_GUID EfiSimpleFileSystemGuid = SIMPLE_FILE_SYSTEM_PROTOCOL;
+ EFI_FILE_IO_INTERFACE * FSInterface = NULL;
+ struct _EFI_FILE_HANDLE * fsroot = NULL;
+
+ EFI_STATUS localteprotocolstat = uefi_call_wrapper(BS->LocateProtocol, 3, &EfiSimpleFileSystemGuid, NULL, &FSInterface);
+
+ if(localteprotocolstat != EFI_SUCCESS)
+ {
+ Print(L"Failed to locate protocol\n");
+ }
+
+ EFI_STATUS openvolumestat = uefi_call_wrapper(FSInterface->OpenVolume, 2, FSInterface, &fsroot);
+
+ if(openvolumestat != EFI_SUCCESS)
+ {
+ Print(L"FAiled to open the volume\n");
+ }
+
+ struct _EFI_FILE_HANDLE * fp = NULL;
+
+ EFI_STATUS openstat = uefi_call_wrapper(fsroot->Open, 5, fsroot, &fp, name, (UINT64)1, (UINT64)1);
+
+
+
+ if(openstat != EFI_SUCCESS)
+ {
+ Print(L"Failed opening the file\n");
+ }
+
+
+ // even if the specification says that asking to open the file with insuficient memory
+ // reports the full file size, qemu and virtualbox implementations don't do that
+ // as such we need to get manually the file info
+ UINTN infosize = 1024;
+ EFI_FILE_INFO * info = AllocatePool(infosize);
+ EFI_GUID infoguid = EFI_FILE_INFO_ID;
+
+ EFI_STATUS infostatus = uefi_call_wrapper(fp->GetInfo, 4, fp, &infoguid, &infosize, info);
+
+ if(infostatus != EFI_SUCCESS)
+ {
+ Print(L"Failed to get FileInfo\n");
+ }
+
+ *filesize = info->FileSize;
+
+ UINTN size = info->FileSize;
+ void * data = NULL;
+
+ //data = AllocatePool(size);
+ //EFI_STATUS allocstatus = uefi_call_wrapper(BS->AllocatePool, 3, EfiLoaderData, size, (void**)&data);
+ float pages = (size/1024)/4;
+
+ UINTN ipages = ceil2(pages);
+ EFI_PHYSICAL_ADDRESS tmp;
+
+ EFI_STATUS allocstatus = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, memtype, ipages, &tmp);
+
+ data = (void*)tmp;
+
+ //data = AllocatePages2(size);
+
+ //if(data == NULL)
+ if(allocstatus != EFI_SUCCESS)
+ {
+ Print(L"Failed to get Kernel memory\n");
+ }
+
+ // phoenix lies, must specify the size myself
+ uefi_call_wrapper(fp->Read, 3, fp, &size, data);
+
+ // Print(L"Read Size: %d\n", size);
+
+ uefi_call_wrapper(fp->Close, 1, fp);
+
+ return data;
+}
+
diff --git a/bootloader/disk.h b/bootloader/disk.h
new file mode 100644
index 0000000..e291861
--- /dev/null
+++ b/bootloader/disk.h
@@ -0,0 +1,9 @@
+#ifndef DISK_H
+#define DISK_H
+
+#include <efidef.h>
+#include <stdint.h>
+
+void * EFIAPI LoadFile(CHAR16 * name, UINTN memtype, int32_t* filesize);
+
+#endif // DISK_H
diff --git a/bootloader/main.c b/bootloader/main.c
new file mode 100644
index 0000000..e196777
--- /dev/null
+++ b/bootloader/main.c
@@ -0,0 +1,396 @@
+#include <efi.h>
+#include <efilib.h>
+#include <efidef.h>
+#include <string.h>
+
+#include "disk.h"
+#include "vga.h"
+#include "vmmem.h"
+#include "ELF.h"
+#include "memorytypes.h"
+#include "paging_struct.h"
+#include "paging.h"
+#include "other.h"
+
+// pixel struct information(hardcoded to what qemu exposes)
+typedef struct _Pixel
+{
+ UINT8 B;
+ UINT8 G;
+ UINT8 R;
+ UINT8 Z;
+} Pixel;
+
+// struct that is going to be passed to the kernel about general system information
+typedef struct _OSDATA
+{
+ UINT32 Magic; // magic number to check
+
+ UINT32 FBWidth; // with of the framebuffer
+ UINT32 FBHeight; // height
+ UINT32 PixelSize; // size of each pixel(an rgb pixel might have a bigger size)
+ void * FBAddr; // address of the linear framebuffer
+
+ void * MEMMap; // pointer to the system memory map
+
+ void * RAMDisk; // pointer to a ramdisk loaded from the hdd
+
+ void* RSDP;
+} OSDATA;
+
+extern void BootDisableInterrupts(void); // asm code is not correct(callee doesn't set the stack correctly)
+typedef void (*kfn)(OSDATA *); // typedef to setup the entry point of the kernel and do a "jump" into it
+
+
+
+void
+EFIAPI
+efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
+{
+ __asm__("hlt");
+
+ // Memory Map
+ UINTN mapsize = 0;
+ UINTN allocsize = 0;
+ EFI_MEMORY_DESCRIPTOR * map = NULL;
+ UINTN mapkey = 0;
+ UINTN descriptorsize = 0;
+ UINT32 version = 0;
+
+
+ InitializeLib(ImageHandle, SystemTable);
+ uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut); // clear the screen
+ //Pixel * fb = SetVideoMode(1024, 768, 32);
+ Pixel * fb = SetVideoMode(800, 600, 24);
+
+ PrintImageAddr(ImageHandle);
+
+ // Print(L"Number of tables: %d\n", SystemTable->NumberOfTableEntries);
+
+ EFI_GUID acpi_10 = ACPI_TABLE_GUID;
+ EFI_GUID acpi_20 = ACPI_20_TABLE_GUID;
+ void* acpi20table = NULL;
+
+
+ for(int i = 0; i < SystemTable->NumberOfTableEntries; i++)
+ {
+ if(AreEqual(&(SystemTable->ConfigurationTable[i].VendorGuid), &acpi_10, sizeof(EFI_GUID)))
+ {
+ // Print(L"ACPI 1.0 Found\n");
+ }
+ if(AreEqual(&(SystemTable->ConfigurationTable[i].VendorGuid), &acpi_20, sizeof(EFI_GUID)))
+ {
+ // Print(L"ACPI 2.0 Found\n");
+ acpi20table = SystemTable->ConfigurationTable[i].VendorTable; // <- this should be the RSDP
+ }
+ }
+
+ // some uefi implementations time out with their default setting, disable the timer
+ BS->SetWatchdogTimer(0, 0, 0, NULL);
+
+
+ //Print(L"Firmware Vendor: %s Rev: 0x%08x\n", ST->FirmwareVendor, ST->FirmwareRevision);
+
+ //while(1){};
+
+ // allocate the datat for the kernel(need to specify memory time not to be a generic loader data type)
+ OSDATA * osdata = AllocatePool(sizeof(OSDATA));
+
+ if(osdata == NULL)
+ {
+ Print(L"Os Data allocation failed\n");
+ }
+
+ int32_t kernel_size;
+
+ ELF * kernel = LoadFile(L"kernel.bin", MEM_KERNEL, &kernel_size); // we set the memory type to the one from the kernel
+
+ {
+ PH* ph = (PH*)(((uint64_t)kernel) + kernel->e_phoff); // use this to know how much and what pages to map
+ uint64_t phcount = (((uint64_t)kernel) + kernel->e_phnum);
+
+ //kernel_size = ph->p_filesz;
+ uint64_t size = (uint64_t)(kernel_size = ph->p_memsz);
+ uint64_t entry = (uint64_t)(kernel + ph->p_offset);
+
+ /*
+ Print(L"Kernel Size: 0x%llX\n", size);
+ Print(L"Kernel Entry: 0x%llX\n", entry);
+ Print(L"Program Header Count: 0x%llX\n", phcount);
+ */
+ }
+
+ // print general information about the kernel elf header
+ //PrintELFInfo(kernel);
+ Loaded_ELF* loaded_kernel = LoadELF(kernel);
+
+
+ // attempt to allocate the memory map, first try is going to be too small
+ // as such the firmware will return the correct size
+ EFI_STATUS memret = EFI_SUCCESS;
+ EFI_STATUS bootstatus = EFI_SUCCESS;
+
+ uefi_call_wrapper(BS->GetMemoryMap, 5, &mapsize, map, &mapkey, &descriptorsize, &version);
+
+
+ // as the allocation will probably modify the memory map allocate 4kb more(one page)
+ // so that the new memory map probably fits
+ allocsize = mapsize + 10*4098;
+
+ mapsize = allocsize;
+
+ uefi_call_wrapper(BS->AllocatePool, 3, EfiLoaderData, allocsize, (void**)&map);
+
+ uefi_call_wrapper(BS->GetMemoryMap, 5, &mapsize, map, &mapkey, &descriptorsize, &version);
+
+ // set virtual addresses in here
+ // try some paging
+ initCR3();
+
+ //uint64_t address = 0;
+ //uint64_t max = 0x400000000ull;//0x20000000;
+ // EFI_MEMORY_DESCRIPTOR * mapiterator = map;
+
+ uint64_t elements = mapsize/descriptorsize;
+
+ printCR3();
+
+ //Print(L"elements: %d\n", elements);
+
+
+
+ for(int entry = 0; entry < elements; ++entry)
+ {
+ // mapiterator = (EFI_MEMORY_DESCRIPTOR*)(((EFI_PHYSICAL_ADDRESS)mapiterator + descriptorsize));
+
+ EFI_MEMORY_DESCRIPTOR* mapiterator = (EFI_MEMORY_DESCRIPTOR*)(((uint8_t*)map) + entry*descriptorsize);
+
+ // EFI_MEMORY_DESCRIPTOR* mapiterator = &(map[entry]);
+ uint64_t page = mapiterator->PhysicalStart;
+
+ uint64_t Pstart = mapiterator->PhysicalStart;
+ uint64_t Vstart = mapiterator->VirtualStart;
+ uint64_t Npages = mapiterator->NumberOfPages;
+ uint64_t Tpage = mapiterator->Type;
+ uint64_t Att = mapiterator->Attribute;
+
+ //if(Pstart != Vstart)
+ /*
+ if(Vstart != 0)
+ {
+ Print(L"\n");
+ Print(L"---------------------------------------\n");
+ Print(L"NON MATCHING PHYSICAL AND VIRTUAL PAGES\n");
+ Print(L"Physical Start: 0x%llX\n", Pstart);
+ Print(L"Virtual Start: 0x%llX\n", Vstart);
+ Print(L"Number of Pages: 0x%llX\n", Npages);
+ Print(L"Type of Page: 0x%llX\n", Tpage);
+ Print(L"---------------------------------------\n");
+ Print(L"\n");
+ }
+ */
+
+ // if((Npages > 0) && (Vstart != 0))
+ // if(Vstart != 0)
+ // if((Pstart == 0) && (Vstart == 0))
+ // if(Pstart == Vstart)
+ if(Tpage == EfiConventionalMemory) // free pages
+ {
+ Print(L"\n");
+ Print(L"---------------------------------------\n");
+ Print(L"MAPPED MEMORY\n");
+ Print(L"Physical Start: 0x%llX\n", Pstart);
+ Print(L"Virtual Start: 0x%llX\n", Vstart);
+ Print(L"Number of Pages: 0x%llX\n", Npages);
+ Print(L"Type of Page: 0x%llX\n", Tpage);
+ Print(L"Attribute of Page: 0x%llX\n", Att);
+ Print(L"---------------------------------------\n");
+ Print(L"\n");
+ }
+
+ //Print(L"page: 0x%llX\n", page);
+ /* for(int pageentry = 0; pageentry < mapiterator->NumberOfPages; pageentry++)
+ {
+ //Print(L"SetAddr\n");
+ SetVirtualAddress(page, page);
+ page += 0x1000;
+ } */
+ }
+
+ while(1) {};
+
+ uint64_t maxaddr = 0x0000001000000000ull;
+ for(uint64_t page = 0x0; page < maxaddr; page += 0x1000)
+ {
+ SetVirtualAddress(page, page); // <- This is chanigng the memorymap 100%
+ }
+
+ // need to map the physical address the kernel is in to -2GB virtual
+ //uint64_t startvm = 0xffffffff7fffffffull;
+ //uint64_t startvm = kernel->e_entry;
+ //uint64_t currentvm = 0;
+
+ //PH* ph = (PH*)(((uint64_t)kernel) + kernel->e_phoff); // use this to know how much and what pages to map
+
+ //kernel_size = ph->p_filesz;
+ //kernel_size = ph->p_memsz;
+
+ /*
+ while(currentvm < kernel_size)
+ {
+ SetVirtualAddress((uint64_t)kernel + ph->p_offset + currentvm, startvm + currentvm);
+
+ currentvm += 0x1000;
+ }
+ */
+
+ Print(L"BEFORE MAPPING KERNEL ENTRY: 0x%llX\n", loaded_kernel->entry);
+
+ for(int i = 0; i < loaded_kernel->ph_num; i++)
+ {
+ Loaded_PH* ph = &(loaded_kernel->ph[i]);
+ Print(L"MAPPING PH: 0x%llX\n", (uint64_t)ph->vaddr);
+ uint64_t mapsize = ph->mem_size;
+ uint64_t mapped = 0;
+ while(mapped < mapsize)
+ {
+ SetVirtualAddress((uint64_t)ph->data + mapped, (uint64_t)ph->vaddr + mapped);
+ mapped += 0x1000;
+ }
+ }
+
+ // now map already allocated 8KB for the Kernel Stack
+
+
+ //printCR3();
+
+ //Print(L"kernel: 0x%llx\n", kernel);
+
+ // the call to exit boot services tells the firmware we are ready to take control of the system
+
+ // never ever call Print after the next line
+ // after the first call boot services can be partially disabled
+ // loop until the firmware reports a successful exit, the specification allows for partial shutdowns
+ // so more than one call might be necessary(on qemu with OVMF it is)
+ while((bootstatus = uefi_call_wrapper(BS->ExitBootServices, 2, ImageHandle, mapkey)) != EFI_SUCCESS) // <- actually we need an up to date mapkey, so maybe we could actually get a memorymap before, create a OS liked memory map and exit services?
+ {
+
+ mapsize = allocsize;
+
+ while((memret = uefi_call_wrapper(BS->GetMemoryMap, 5, &mapsize, map, &mapkey, &descriptorsize, &version)) == EFI_BUFFER_TOO_SMALL)
+ {
+
+ allocsize = allocsize + 2*4096; // add 8kb(2 pages)
+
+ uefi_call_wrapper(BS->FreePool, 1, map);
+
+ uefi_call_wrapper(BS->AllocatePool, 3, EfiLoaderData, allocsize, (void**)&map);
+
+ mapsize = allocsize;
+ }
+ }
+
+ SetCrc(&(SystemTable->Hdr)); // As we exited boot services we need to set the CRC32 again
+
+ // as we can't print to the screen the way of showing the return status of this function
+ // is to write a red or green square on the top left corner of the screen
+ if(SetVM(mapsize, descriptorsize, version, map, kernel) != EFI_SUCCESS)
+ {
+ int i = 0;
+ int j = 0;
+
+ for(i = 0; i < 256; ++i)
+ {
+ for(j = 0; j < 256; ++j)
+ {
+ Pixel p;
+ p.R = 255;
+ p.G = 0;
+ p.B = 0;
+ //p.Z = 255;
+ fb[j + 800*i] = p;
+ }
+ }
+ } else
+ {
+ int i = 0;
+ int j = 0;
+
+ for(i = 0; i < 64; ++i)
+ {
+ for(j = 0; j < 64; ++j)
+ {
+ Pixel p;
+ p.R = 0;
+ p.G = 255;
+ p.B = 0;
+ //p.Z = 255;
+ fb[j + 800*i] = p;
+ }
+ }
+ }
+
+ // we should now set s Print(L"Calling ExitBootServices\n");oe virtual mapping
+ //BootDisableInterrupts();
+
+
+ //OSDATA * osdata = (OSDATA*)(640*1024);
+
+
+
+ osdata->Magic = 0xDDEE;
+ osdata->FBWidth = 1024;
+ osdata->FBHeight = 768;
+ osdata->FBAddr = fb;
+ osdata->PixelSize = 24;
+ osdata->MEMMap = map;
+ osdata->RAMDisk = NULL;
+ osdata->RSDP = acpi20table;
+
+ // this while only serves not to call the kernel for now
+ // after calling exit boot services we can't return to the uefi environment because it's been destroyed
+ //
+
+ //kernel = (ELF*)0x280000000; // correct virtual pointer to 10GB (Sign: 0 PML4: 0 PDP:10 PD:0 Page:0)
+
+ // kfn kernel_jump = (void*)kernel->e_entry;//(void*)((EFI_PHYSICAL_ADDRESS)kernel + kernel->EntryPoint);
+ kfn kernel_jump = (void*)loaded_kernel->entry;//(void*)((EFI_PHYSICAL_ADDRESS)kernel + kernel->EntryPoint);
+
+
+ writeCR3();
+ //while(1){}
+ {
+ int i = 0;
+ int j = 0;
+
+ for(i = 0; i < 256; ++i)
+ {
+ for(j = 0; j < 256; ++j)
+ {
+ Pixel p;
+ p.R = 255;
+ p.G = 255;
+ p.B = 255;
+ p.Z = 255;
+ fb[j + 800*i] = p;
+ }
+ }
+ }
+
+ // disable interrupts
+ __asm__("cli");
+
+ //writeCR3();
+
+
+ //__asm__("hlt");
+
+ kernel_jump(osdata);
+
+ while(1){}
+
+ __asm__("hlt"); // sanity in case the kernel exists, should throw an error somehow
+ // not as if the kernel shouldn't have this same code at the end of the main though
+
+ // we should never ever reach this point(if kernel exists, it should shutdown the computer)
+}
diff --git a/bootloader/memory.c b/bootloader/memory.c
new file mode 100644
index 0000000..1e310ae
--- /dev/null
+++ b/bootloader/memory.c
@@ -0,0 +1,29 @@
+#include "memory.h"
+
+
+void * EFIAPI AllocatePagesType(IN UINTN size, IN UINTN type)
+{
+
+ void * ret = NULL;
+
+ Print(L"About to allocate\n");
+ EFI_STATUS status = uefi_call_wrapper(BS->AllocatePool, 3, type, size, &ret);
+
+ if(status == EFI_SUCCESS)
+ {
+ Print(L"Pool Allocated\n");
+ return ret;
+ }
+
+ Print(L"Allocation Failed\n");
+ return NULL;
+}
+
+void bootloader_memset(void * in, uint64_t size, uint8_t value)
+{
+ uint8_t * tmpin = in;
+ for(int i = 0; i < size; i++)
+ {
+ tmpin[i] = value;
+ }
+}
diff --git a/bootloader/memory.h b/bootloader/memory.h
new file mode 100644
index 0000000..1d42960
--- /dev/null
+++ b/bootloader/memory.h
@@ -0,0 +1,14 @@
+#ifndef MEMORY_H
+#define MEMORY_H
+
+#include <efi.h>
+#include <efilib.h>
+
+#include <stdint.h>
+
+#include "memorytypes.h"
+
+void * EFIAPI AllocatePagesType(IN UINTN size, IN UINTN type);
+void bootloader_memset(void *, uint64_t size, uint8_t value);
+
+#endif
diff --git a/bootloader/memorytypes.h b/bootloader/memorytypes.h
new file mode 100644
index 0000000..53ba8fb
--- /dev/null
+++ b/bootloader/memorytypes.h
@@ -0,0 +1,12 @@
+#ifndef MEMORYTYPES_H
+#define MEMORYTYPES_H
+
+// memory types to mark the pages as of specific types
+// the specification allows custom types that are bigger than 0x80000000
+
+#define MEM_KERNEL 0x80000010
+#define MEM_RAMDISK 0x80000020
+#define MEM_ARGS 0x80000030
+#define MEM_PAGING 0x80000040
+
+#endif // MEMORYTYPES_H
diff --git a/bootloader/misc.s b/bootloader/misc.s
new file mode 100644
index 0000000..c228607
--- /dev/null
+++ b/bootloader/misc.s
@@ -0,0 +1,10 @@
+.text
+.global BootDisableInterrupts
+
+BootDisableInterrupts:
+ pushq %rbp
+ movq %rsp, %rbp
+ cli
+ popq %rbp
+ ret
+
diff --git a/bootloader/other.c b/bootloader/other.c
new file mode 100644
index 0000000..9286dac
--- /dev/null
+++ b/bootloader/other.c
@@ -0,0 +1,42 @@
+#include <efi.h>
+#include <efilib.h>
+#include <efidef.h>
+
+#include "other.h"
+
+void PrintImageAddr(EFI_HANDLE image)
+{
+ EFI_LOADED_IMAGE *loaded_image = NULL;
+ EFI_STATUS status;
+
+ status = uefi_call_wrapper(BS->HandleProtocol,
+ 3,
+ image,
+ &LoadedImageProtocol,
+ (void **)&loaded_image);
+
+ if (EFI_ERROR(status))
+ {
+ Print(L"handleprotocol: %r\n", status);
+ }
+
+ Print(L"Image base: 0x%lx\n", loaded_image->ImageBase);
+}
+
+bool AreEqual(void* lhs, void* rhs, uint64_t size)
+{
+ char* clhs = (char*)lhs;
+ char* crhs = (char*)rhs;
+
+ bool equal = true;
+
+ for(int i = 0; i < size; i++)
+ {
+ if(clhs[i] != crhs[i])
+ {
+ equal = false;
+ }
+ }
+
+ return equal;
+}
diff --git a/bootloader/other.h b/bootloader/other.h
new file mode 100644
index 0000000..a602956
--- /dev/null
+++ b/bootloader/other.h
@@ -0,0 +1,12 @@
+#ifndef OTHER_H
+#define OTHER_H
+
+#include <efi.h>
+#include <efilib.h>
+#include <efidef.h>
+
+void PrintImageAddr(EFI_HANDLE image);
+bool AreEqual(void* lhs, void* rhs, uint64_t size);
+
+#endif // OTHER_H
+
diff --git a/bootloader/paging.c b/bootloader/paging.c
new file mode 100644
index 0000000..d3d6dba
--- /dev/null
+++ b/bootloader/paging.c
@@ -0,0 +1,295 @@
+#include <efi.h>
+#include <efilib.h>
+#include <stdint.h>
+
+#include "memorytypes.h"
+#include "paging_struct.h"
+#include "memory.h"
+
+uint64_t size;
+uint64_t baseaddr;
+uint64_t current;
+
+uint64_t count;
+
+EFI_PHYSICAL_ADDRESS pages;
+uint64_t * CR3;
+
+uint64_t virtualmemory;
+uint64_t maxneg;
+//uint64_t base_memory;
+
+uint64_t GetNextEntry()
+{
+ uint64_t ret = current + 0x1000;//1024*4;
+
+ count++;
+
+ if(count > 1023)
+ {
+ // need to allocate new page
+ // 1024 pages for 4MB
+ EFI_STATUS allocstatus = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, MEM_PAGING, size, &pages);
+ if(allocstatus != EFI_SUCCESS)
+ {
+ Print(L"Paging space allocation failed\n");
+ Print(L"Current: 0x%llX \n", current);
+ return -1;
+ }
+ bootloader_memset((void*)pages, size*0x1000, 0x0);
+ baseaddr = (uint64_t)pages;
+ ret = baseaddr;
+
+ //Print(L"New Chunk: 0x%llX\n", baseaddr);
+ count = 0;
+
+ current = ret;
+
+ if(ret % 0x1000 != 0)
+ {
+ Print(L"WARNING Memory not aligned\n");
+ }
+
+ return ret;
+ }
+
+ //Print(L"New Entry: 0x%llX\n", ret);
+ current = ret;
+
+ if(ret % 0x1000 != 0)
+ {
+ Print(L"WARNING Memory not aligned\n");
+ }
+
+ return ret;
+}
+
+uint8_t NeedAllocation(uint64_t in)
+{
+ if(in == -1)
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+UINT64 EFIAPI GetVMCPUID()
+{
+ long out = 0;
+ long id = 0x80000008;
+
+ __asm__ __volatile__ ("movq %1, %%rax;"
+ "cpuid;"
+ "movq %%rax, %0;"
+ :"=r"(out)
+ :"r"(id)
+ );
+
+ return out;
+}
+
+uint64_t powerTwo(uint64_t power)
+{
+ uint64_t ret = 1;
+
+ while(power > 0)
+ {
+ ret *= 2;
+
+ power--;
+ }
+
+ return ret;
+}
+
+void initCR3()
+{
+ UINT64 cpu = GetVMCPUID();
+
+ CPUIDsizes * sizes = (CPUIDsizes*)&cpu;
+
+ // Print(L"raw: %x\n", cpu);
+ // Print(L"Physical: %d\n", sizes->PhysicalAddress);
+ // Print(L"Virtual: %d\n", sizes->VirtualAddress);
+ virtualmemory = sizes->PhysicalAddress;
+
+ maxneg = powerTwo(virtualmemory) - 1;
+
+ size = 1024;
+
+ Print(L"Started CR3\n");
+
+ // 1024 pages for 4MB
+ EFI_STATUS allocstatus = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, MEM_PAGING, size, &pages);
+ if(allocstatus != EFI_SUCCESS)
+ {
+ Print(L"Paging space allocation failed\n");
+ return;
+ }
+
+ count = 1;
+
+ // 1024 pages at 4kb each
+ bootloader_memset((void*)pages, size*4*1024, 0x0);
+
+ baseaddr = (uint64_t)pages;
+ current = baseaddr;
+
+ CR3 = (uint64_t*)current;
+ *CR3 = 0;
+
+ *CR3 |= CR3_PCD;
+ *CR3 |= CR3_PWT;
+ //*CR3 |=(maxneg << CR3_ADDR_SHIFT);
+
+ //((s_CR3*)CR3)->PCD = 1;
+ //((s_CR3*)CR3)->PWT = 1;
+ //((s_CR3*)CR3)->base_addr = GetNextEntry();
+
+
+ //int32_t pml4es = sizeof(s_PML4E);
+
+
+ //((s_CR3*)CR3)->base_addr = maxneg;
+
+}
+
+void printCR3()
+{
+ Print(L"CR3 value: 0x%llX\n", *((uint64_t*)CR3));
+}
+
+void writeCR3()
+{
+ __asm__ __volatile__("movq %0, %%cr3;"
+ :
+ :"r"(*CR3));
+}
+
+void SetVirtualAddress(uint64_t phy, uint64_t virt)
+{
+ uint64_t* pml4 = (uint64_t*)MaskPhyAddr(*CR3);
+
+ // Get the offsets to each page table
+ uint64_t pml4offset = GetPML4Offset(virt);
+ uint64_t pdpoffset = GetPDPOffset(virt);
+ uint64_t pdoffset = GetPDOffset(virt);
+ uint64_t ptoffset = GetPTOffset(virt);
+
+
+ uint64_t pml4e = pml4[pml4offset];
+
+ // if not present, allocate the page
+ if((pml4e & PE_P) == 0x0ull)
+ {
+ //assign the physical addr, and clear all to zero
+ uint64_t tmpaddr = GetNextEntry();
+ pml4e |= MaskPhyAddr(tmpaddr);
+
+ // initialize the page
+ pml4e |= PE_P;
+ pml4e |= PE_RW;
+ pml4e |= PE_US;
+ pml4e |= PE_PWT;
+ pml4e |= PE_PCD;
+ }
+ // assign the values to the array
+ pml4[pml4offset] = pml4e;
+
+
+ uint64_t pdpe = ((uint64_t*)MaskPhyAddr(pml4e))[pdpoffset];
+ if((pdpe & PE_P) == 0x0ull)
+ {
+ // page not present
+ uint64_t tmpaddr = GetNextEntry();
+ pdpe |= MaskPhyAddr(tmpaddr);
+
+ pdpe |= PE_P;
+ pdpe |= PE_RW;
+ pdpe |= PE_US;
+ pdpe |= PE_PWT;
+ pdpe |= PE_PCD;
+ }
+ ((uint64_t*)MaskPhyAddr(pml4e))[pdpoffset] = pdpe;
+
+ uint64_t pde = ((uint64_t*)MaskPhyAddr(pdpe))[pdoffset];
+
+ if((pde & PE_P) == 0x0ull)
+ {
+ uint64_t tmpaddr = GetNextEntry();
+
+ pde |= MaskPhyAddr(tmpaddr);
+
+ pde |= PE_P;
+ pde |= PE_RW;
+ pde |= PE_US;
+ pde |= PE_PWT;
+ pde |= PE_PCD;
+ }
+ ((uint64_t*)MaskPhyAddr(pdpe))[pdoffset] = pde;
+
+ uint64_t pte = ((uint64_t*)MaskPhyAddr(pde))[ptoffset];
+
+ // need to make the pt entry
+
+ if((pte & PE_P) == 0x0ull)
+ {
+ pte |= PE_P;
+ pte |= PE_RW;
+ pte |= PE_US;
+ pte |= PE_PWT;
+ pte |= PE_PCD;
+ pte |= MaskPhyAddr(phy);
+ }
+ ((uint64_t*)MaskPhyAddr(pde))[ptoffset] = pte;
+}
+
+uint8_t checkIdentity(uint64_t phy)
+{
+ //uint8_t phyvalue = (uint8_t)(*(uint64_t*)phy);
+ uint8_t phyvalue = *(uint64_t*)phy;
+ uint8_t virtvalue;
+ uint64_t pml4e = CR3GetAddr(*CR3);// + GetPML4Offset(phy);
+ pml4e = *(((uint64_t*)pml4e) + GetPML4Offset(phy));
+ uint64_t pdpe = *(((uint64_t*)GetAddr(pml4e)) + GetPDPOffset(phy));
+ uint64_t pde = *(((uint64_t*)GetAddr(pdpe)) + GetPDOffset(phy));
+ uint64_t pte = *(((uint64_t*)GetAddr(pde)) + GetPTOffset(phy));
+ uint64_t pteptr = ((GetAddr(pte)) + GetPhyOffset(phy));
+ virtvalue = *(uint64_t*)((GetAddr(pte)) + GetPhyOffset(phy));
+
+ //s_PDPE * pdpe = ((s_PDPE*)(pml4e->PDPBA + 8*virt->PDP));
+ //s_PDE * pde = ((s_PDE*)(pdpe->PDBA + 8*virt->PD));
+ //s_PTE * pte = ((s_PTE*)(pde->PTBA + 8*virt->PT));
+ //virtvalue = *(uint8_t*)(pte->PPBA + virt->offset);
+
+ // get the correct virtual value
+
+ Print(L"ADDR: 0x%llx\n", phy);
+
+ Print(L"PML4E 0x%llx\n", pml4e);
+ Print(L"PDPE 0x%llx\n", pdpe);
+ Print(L"PDE 0x%llx\n", pde);
+ Print(L"PTE 0x%llx\n", pte);
+ Print(L"pageentry: 0x%llx\n", pteptr);
+ Print(L"PPBA 0x%llx\n", GetAddr(pte));
+
+ Print(L"PML4 %d\n", GetPML4Offset(phy));
+ Print(L"PDP %d\n", GetPDPOffset(phy));
+ Print(L"PD %d\n", GetPDOffset(phy));
+ Print(L"PT %d\n", GetPTOffset(phy));
+ Print(L"PHY 0x%llx\n", GetPhyOffset(phy));
+
+
+ Print(L"PHYSICAL: 0x%x\n", phyvalue);
+ Print(L"VIRTUAL: 0x%x\n", virtvalue);
+
+ if(phyvalue != virtvalue)
+ {
+ Print(L"Incorrect physical virtual value\n");
+ return 0;
+ }
+
+ Print(L"Correct physical virtual value\n");
+ return 1;
+}
diff --git a/bootloader/paging.h b/bootloader/paging.h
new file mode 100644
index 0000000..59eef1e
--- /dev/null
+++ b/bootloader/paging.h
@@ -0,0 +1,17 @@
+#ifndef PAGING_H
+#define PAGING_H
+
+#include <stdint.h>
+
+uint64_t GetNextEntry();
+void initCR3();
+void printCR3();
+void writeCR3();
+void SetVirtualAddress(uint64_t phy, uint64_t virt);
+uint8_t checkIdentity(uint64_t phy);
+
+
+//void * SetPagingStructs();
+
+#endif // PAGING_H
+
diff --git a/bootloader/paging_struct.h b/bootloader/paging_struct.h
new file mode 100644
index 0000000..2c3781f
--- /dev/null
+++ b/bootloader/paging_struct.h
@@ -0,0 +1,189 @@
+#ifndef PAGING_STRUCT_H
+#define PAGING_STRUCT_H
+
+#include <efi.h>
+#include <efilib.h>
+#include <stdint.h>
+
+typedef UINT64 uchar; // need to replace this for other more sensible thing or location
+
+UINT64 GetVMCPUID(); // implemented in misc.s
+
+extern uint64_t maxneg;
+
+typedef struct _CPUIDsizes
+{
+ UINT64 PhysicalAddress:8;
+ UINT64 VirtualAddress:8;
+ UINT64 Padding:48;
+} CPUIDsizes;
+
+// these entries are for 4KB pages
+
+
+// Virtual pointer bits breakdown (4KB pages)
+// +---------------+-------------+------------+-----------+-----------+-----------------------+
+// | 63 - 48 | 47 - 39 | 38 - 30 | 29 - 21 | 20 - 12 | 11 - 0 |
+// +---------------+-------------+------------+-----------+-----------+-----------------------+
+// | sign extend | PML4 offset | PDP offset | PD offset | PT offset | physical page offset |
+// +---------------+-------------+------------+-----------+-----------+-----------------------+
+
+// Virtual pointer bits breakdown (2MB pages)
+// +---------------+-------------+------------+-----------+-----------------------------------+
+// | 63 - 48 | 47 - 39 | 38 - 30 | 29 - 21 | 20 - 0 |
+// +---------------+-------------+------------+-----------+-----------------------------------+
+// | sign extend | PML4 offset | PDP offset | PD offset | physical page offset |
+// +---------------+-------------+------------+-----------+-----------------------------------+
+
+
+// paging structure:
+
+// CR3
+// the contents of this struct go into CR3
+typedef struct __attribute__((packed))
+{
+ uint64_t reserved1:3;
+ uint64_t PWT:1; // page level writethough
+ uint64_t PCD:1; // page level cache disable
+ uint64_t reserved2:7;
+ uint64_t base_addr:40; // base address to the table of PML4 entries
+ uint64_t reserved3:13;
+} s_CR3;
+
+// Virtual Pointer
+#define VP_OFF_PHY 0ull
+#define VP_OFF_PT 12ull
+#define VP_OFF_PD 21ull
+#define VP_OFF_PDP 30ull
+#define VP_OFF_PML4 39ull
+#define VP_OFF_SIGN 48ull
+
+#define GetPhyOffset(x) (x & 0xFFFull)
+#define GetPTOffset(x) ((x >> VP_OFF_PT) & 0x1FFull)
+#define GetPDOffset(x) ((x >> VP_OFF_PD) & 0x1FFull)
+#define GetPDPOffset(x) ((x >> VP_OFF_PDP) & 0x1FFull)
+#define GetPML4Offset(x) ((x >> VP_OFF_PML4) & 0x1FFull)
+#define GetSignOffset(x) ((x >> VP_OFF_SIGN) & 0xFFFFull)
+
+
+// CR3
+#define CR3_PWT (1ull << 3ull)
+#define CR3_PCD (1ull << 4ull)
+#define CR3_ADDR_SHIFT 12ull
+#define CR3_ERASE (~(maxneg << CR3_ADDR_SHIFT))
+
+#define CR3GetAddr(x) ((x >> CR3_ADDR_SHIFT) & maxneg)
+#define CR3SetAddr(x) ((x & maxneg) << CR3_ADDR_SHIFT)
+
+// Page Entry
+#define PE_P (1ull << 0ull)
+#define PE_RW (1ull << 1ull)
+#define PE_US (1ull << 2ull)
+#define PE_PWT (1ull << 3ull)
+#define PE_PCD (1ull << 4ull)
+#define PE_A (1ull << 5ull)
+#define PE_D (1ull << 6ull)
+#define PE_PS (1ull << 7ull)
+#define PE_G (1ull << 8ull)
+#define PE_BA (1ull << 12ull)
+#define PE_NX (1ull << 63ull)
+#define PE_ADDR_SHIFT 12ull
+#define PE_ERASE (~(maxneg << PE_ADDR_SHIFT))
+
+#define MaskTable(x) (x & maxneg)
+#define MaskPhyAddr(x) (x & 0xFFFFFFF000ull)
+#define SetAddr(x) (x << PE_ADDR_SHIFT)
+#define GetAddr(x) (x >> PE_ADDR_SHIFT)
+//#define GetAddr(x) (x & ~0xFFFull)
+
+
+
+// PML4E
+
+typedef struct __attribute__((packed))
+{
+ uint64_t P:1; // present bit
+ uint64_t RW:1; // read write (if 0 write protected)
+ uint64_t US:1; // user/supervisor if 0 no user mode access
+ uint64_t PWT:1; // page level write though
+ uint64_t PCD:1; // page level cache disable
+ uint64_t A:1; // accesed
+ uint64_t PS:1; // value must be 1 for 1GB pages
+ uint64_t MBZ:2;
+ uint64_t AVL:3;
+ uint64_t PDPBA:40; // physical address of the table pointed by this entry
+ uint64_t available:11; // need to look into what values go here
+ uint64_t NX:1; // execute disable
+} s_PML4E;
+
+
+
+// PDPE
+
+typedef struct __attribute__((packed))
+{
+ uint64_t P:1;
+ uint64_t RW:1;
+ uint64_t US:1;
+ uint64_t PWT:1;
+ uint64_t PCD:1;
+ uint64_t A:1;
+ uint64_t PS:1; // value must be 1 for 2MB pages
+ uint64_t zero:1; // zero
+ uint64_t MBZ:1;
+ uint64_t AVL:3;
+ uint64_t PDBA:40;
+ uint64_t available:11;
+ uint64_t NX:1;
+} s_PDPE;
+
+// PDE
+
+typedef struct __attribute__((packed))
+{
+ uint64_t P:1;
+ uint64_t RW:1;
+ uint64_t US:1;
+ uint64_t PWT:1;
+ uint64_t PCD:1;
+ uint64_t A:1;
+ uint64_t ignored1:1;
+ uint64_t zero:1;
+ uint64_t ignored2:1;
+ uint64_t AVL:3;
+ uint64_t PTBA:40;
+ uint64_t available:11;
+ uint64_t NX:1;
+} s_PDE;
+
+// PTE
+
+typedef struct __attribute__((packed))
+{
+ uint64_t P:1;
+ uint64_t RW:1;
+ uint64_t US:1;
+ uint64_t PWT:1;
+ uint64_t PCD:1;
+ uint64_t A:1;
+ uint64_t D:1;
+ uint64_t PAT:1;
+ uint64_t G:1;
+ uint64_t AVL:3;
+ uint64_t PPBA:40;
+ uint64_t available:11;
+ uint64_t NX:1;
+} s_PTE;
+
+typedef struct __attribute__((packed))
+{
+ uint64_t offset:12;
+ uint64_t PT:9;
+ uint64_t PD:9;
+ uint64_t PDP:9;
+ uint64_t PML4:9;
+ uint64_t sign:16;
+} s_VPTR;
+
+#endif // PAGING_STRUCT_H
+
diff --git a/bootloader/vga.c b/bootloader/vga.c
new file mode 100644
index 0000000..355c17f
--- /dev/null
+++ b/bootloader/vga.c
@@ -0,0 +1,108 @@
+#include <efi.h>
+#include <efilib.h>
+
+#include "vga.h"
+
+void * EFIAPI SetVideoMode(int width, int height, int bitdepth)
+{
+ // find the location of the Graphics Output protocol to aquire a linear framebuffer
+ EFI_GUID EfiGOPGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
+
+ struct _EFI_GRAPHICS_OUTPUT_PROTOCOL * Graphics = NULL;
+
+ Print(L"Searching for GOP\n");
+
+ EFI_STATUS localteprotocolstat = uefi_call_wrapper(BS->LocateProtocol, 3, &EfiGOPGuid, NULL, &Graphics);
+
+ if(localteprotocolstat != EFI_SUCCESS)
+ {
+ Print(L"Failed to locate GOP\n");
+ }
+
+ // we now search for a 1024x768 mode with a bit depth of 32bits
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * GOPMode;
+
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * GOPInfo = NULL;
+
+ GOPMode = Graphics->Mode;
+
+ UINT32 MaxModes = GOPMode->MaxMode;
+
+ UINTN infosize = 0;
+
+ uefi_call_wrapper(Graphics->QueryMode, 4, Graphics, 0, &infosize, &GOPMode);
+
+ Print(L"Size of GOP Info: %d\n", infosize);
+
+ // print information about the available modes
+ UINT32 i;
+ uint64_t foundmode = 0;
+
+ for(i = 0; i < MaxModes; ++i)
+ {
+ uefi_call_wrapper(Graphics->QueryMode, 4, Graphics, i, &infosize, &GOPInfo);
+
+ /*
+ switch(GOPInfo->PixelFormat)
+ {
+ case PixelRedGreenBlueReserved8BitPerColor:
+ Print(L"RGBZ\n");
+ break;
+ case PixelBlueGreenRedReserved8BitPerColor:
+ Print(L"BGRZ\n");
+ break;
+ case PixelBitMask:
+ Print(L"By Mask\n");
+ break;
+ case PixelBltOnly:
+ Print(L"Only Blt\n"); // this mode doesn't expose a linear framebuffer
+ default:
+ Print(L"Unknown\n");
+ break;
+ }
+ */
+ if(GOPInfo->HorizontalResolution == width && GOPInfo->VerticalResolution == height)
+ {
+ foundmode = i;
+ }
+
+ // Print(L"Mode %d: Width: %d Height: %d\n", i, GOPInfo->HorizontalResolution, GOPInfo->VerticalResolution);
+ }
+
+ uefi_call_wrapper(Graphics->SetMode, 2, Graphics, foundmode); // hardcoded to mode 2(1024x768), this is only tue for the cirrus vga that qemu exposes
+ uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut); // clear the screen
+ //uefi_call_wrapper(Graphics->QueryMode, 4, Graphics, i, &infosize, &GOPInfo);
+ Print(L"Width: %d Height: %d Format: ", Graphics->Mode->Info->HorizontalResolution, Graphics->Mode->Info->VerticalResolution);
+ switch(Graphics->Mode->Info->PixelFormat)
+ {
+ case PixelRedGreenBlueReserved8BitPerColor:
+ Print(L"RGBZ\n");
+ break;
+ case PixelBlueGreenRedReserved8BitPerColor:
+ Print(L"BGRZ\n");
+ break;
+ case PixelBitMask:
+ Print(L"By Mask\n");
+ break;
+ case PixelBltOnly:
+ Print(L"Only Blt\n");
+ default:
+ Print(L"Unknown\n");
+ break;
+ }
+
+ Print(L"RedBitmask: %d\n", Graphics->Mode->Info->PixelInformation.RedMask);
+ Print(L"GreenBitmask: %d\n", Graphics->Mode->Info->PixelInformation.GreenMask);
+ Print(L"BlueBitmask: %d\n", Graphics->Mode->Info->PixelInformation.BlueMask);
+ Print(L"ReservedBitmask: %d\n", Graphics->Mode->Info->PixelInformation.ReservedMask);
+ Print(L"Pixels Per ScanLine: %d\n", Graphics->Mode->Info->PixelsPerScanLine);
+
+ // pixels seem to be 4 bytes wide(32bits)
+ // format seems to be RGB Reserved
+
+ //Print(L"FrameBuffer Size: %d\n", Graphics->Mode->FrameBufferSize);
+ //Print(L"FrameBuffer Addr: %d\n", Graphics->Mode->FrameBufferBase);
+
+ return (void*)Graphics->Mode->FrameBufferBase;
+}
+
diff --git a/bootloader/vga.h b/bootloader/vga.h
new file mode 100644
index 0000000..ba0843c
--- /dev/null
+++ b/bootloader/vga.h
@@ -0,0 +1,16 @@
+#ifndef VGA_H
+#define VGA_H
+
+#include <efi.h>
+#include <efilib.h>
+
+typedef struct _FBinfo
+{
+ int width;
+ int height;
+
+} FBinfo;
+
+void * EFIAPI SetVideoMode(int width, int height, int bitdepth);
+
+#endif // VGA_H
diff --git a/bootloader/vmmem.c b/bootloader/vmmem.c
new file mode 100644
index 0000000..f15c9ac
--- /dev/null
+++ b/bootloader/vmmem.c
@@ -0,0 +1,25 @@
+#include "vmmem.h"
+
+//#include "paging_struct.h"
+
+
+EFI_STATUS EFIAPI SetVM(IN UINTN size, IN UINTN descriptorsize, IN UINTN descriptorversion, EFI_MEMORY_DESCRIPTOR * map, void * kernel)
+{
+
+ // the code for setting up paging should go here
+
+ // edit the memory mapping so that the uefi runtime knows about it
+
+ EFI_MEMORY_DESCRIPTOR * tmp = map;
+
+ UINTN elements = size/descriptorsize;
+ UINTN i;
+ for(i = 0; i < elements; ++i)
+ {
+ tmp = (EFI_MEMORY_DESCRIPTOR*)(((EFI_PHYSICAL_ADDRESS)tmp + descriptorsize));
+ tmp->VirtualStart = tmp->PhysicalStart;
+ }
+
+ return uefi_call_wrapper(RT->SetVirtualAddressMap, 4, size, descriptorsize, descriptorversion, map);
+}
+
diff --git a/bootloader/vmmem.h b/bootloader/vmmem.h
new file mode 100644
index 0000000..97252ed
--- /dev/null
+++ b/bootloader/vmmem.h
@@ -0,0 +1,9 @@
+#ifndef VMMEM_H
+#define VMMEM_H
+
+#include <efi.h>
+#include <efilib.h>
+
+EFI_STATUS EFIAPI SetVM(IN UINTN size, IN UINTN descriptorsize, IN UINTN descriptorversion, EFI_MEMORY_DESCRIPTOR * map, void * kernel);
+
+#endif // VMMEM_H
diff --git a/hda-image/NvVars b/hda-image/NvVars
new file mode 100644
index 0000000..94189c5
--- /dev/null
+++ b/hda-image/NvVars
Binary files differ
diff --git a/hda-image/kernel.bin b/hda-image/kernel.bin
new file mode 100755
index 0000000..0150d27
--- /dev/null
+++ b/hda-image/kernel.bin
Binary files differ
diff --git a/hello-efi/Makefile b/hello-efi/Makefile
new file mode 100644
index 0000000..e509176
--- /dev/null
+++ b/hello-efi/Makefile
@@ -0,0 +1,12 @@
+EFI_ARCH = x86_64
+EFIINC = /usr/include/efi
+EFIINCS = -I$(EFIINC) -I$(EFIINC)/$(EFI_ARCH) -I$(EFIINC)/protocol
+LIB = /usr/lib
+EFILIB = /usr/lib
+EFI_CRT_OBJS = $(EFILIB)/crt0-efi-$(EFI_ARCH).o
+EFI_LDS = $(EFILIB)/elf_$(EFI_ARCH)_efi.lds
+
+all:
+ gcc $(EFIINCS) -fpic -ffreestanding -fno-stack-protector -fno-stack-check -fshort-wchar -mno-red-zone -maccumulate-outgoing-args -c main.c -o main.o
+ ld -shared -Bsymbolic -T $(EFI_LDS) -L $(EFILIB) $(EFI_CRT_OBJS) main.o -o main.so -lefi -lgnuefi
+ objcopy -j .text -j .sdata -j .data -j .rodata -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc --output-target efi-app-x86_64 --subsystem=10 main.so main.efi \ No newline at end of file
diff --git a/hello-efi/main.c b/hello-efi/main.c
new file mode 100644
index 0000000..46ae5c7
--- /dev/null
+++ b/hello-efi/main.c
@@ -0,0 +1,11 @@
+#include <efi.h>
+#include <efilib.h>
+
+EFI_STATUS
+EFIAPI
+efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
+{
+ InitializeLib(ImageHandle, SystemTable);
+ Print(L"Hello, world!\n");
+ return EFI_SUCCESS;
+}
diff --git a/idt.py b/idt.py
new file mode 100644
index 0000000..ae5e6de
--- /dev/null
+++ b/idt.py
@@ -0,0 +1,6 @@
+if __name__ == "__main__":
+ for i in range(256):
+ #print("extern void vector" + '{}'.format(i) +"();")
+ print("MKI(" + '{}'.format(i) + "); ", end="")
+ if ((i+1) % 16) == 0:
+ print("") \ No newline at end of file
diff --git a/kernel/.gitignore b/kernel/.gitignore
new file mode 100644
index 0000000..a8a0dce
--- /dev/null
+++ b/kernel/.gitignore
@@ -0,0 +1 @@
+*.bin
diff --git a/kernel/acpi.c b/kernel/acpi.c
new file mode 100644
index 0000000..5879d05
--- /dev/null
+++ b/kernel/acpi.c
@@ -0,0 +1,169 @@
+#include "acpi.h"
+#include "memops.h"
+#include "kprintf.h"
+#include "asm_inline.h"
+
+#include <stddef.h>
+
+void* getPointerToOtherSDT(ACPISDTHeader* header)
+{
+ uint8_t* base = (uint8_t*)header;
+ return &(base[36]);
+}
+
+void* getACPITablesPointer(APICHeader* header)
+{
+ uint8_t* base = (uint8_t*)header;
+ return &(base[44]);
+}
+
+#define IS_TABLE(x, header) kmemcmp(x, header->signature, 4*sizeof(uint8_t))
+
+enum ACPI_TABLES getTableType(ACPISDTHeader* header)
+{
+ if(IS_TABLE("APIC", header)) return APIC;
+ if(IS_TABLE("BGRT", header)) return BGRT;
+ if(IS_TABLE("BERT", header)) return BERT;
+ if(IS_TABLE("CPEP", header)) return CPEP;
+ if(IS_TABLE("DSDT", header)) return DSDT;
+ if(IS_TABLE("ECDT", header)) return ECDT;
+ if(IS_TABLE("EINJ", header)) return EINJ;
+ if(IS_TABLE("ERST", header)) return ERST;
+ if(IS_TABLE("FACP", header)) return FACP;
+ if(IS_TABLE("FACS", header)) return FACS;
+ if(IS_TABLE("HEST", header)) return HEST;
+ if(IS_TABLE("MSCT", header)) return MSCT;
+ if(IS_TABLE("MPST", header)) return MPST;
+ if(IS_TABLE("OEMx", header)) return OEMx;
+ if(IS_TABLE("PMTT", header)) return PMTT;
+ if(IS_TABLE("PSDT", header)) return PSDT;
+ if(IS_TABLE("RASF", header)) return RASF;
+ if(IS_TABLE("RSDT", header)) return RSDT;
+ if(IS_TABLE("SBST", header)) return SBST;
+ if(IS_TABLE("SLIT", header)) return SLIT;
+ if(IS_TABLE("SRAT", header)) return SRAT;
+ if(IS_TABLE("SSDT", header)) return SSDT;
+ if(IS_TABLE("XSDT", header)) return XSDT;
+ if(IS_TABLE("HPET", header)) return HPET;
+
+ return NONE;
+}
+
+void* getTable(void* xsdt, enum ACPI_TABLES table)
+{
+ ACPISDTHeader* header = (ACPISDTHeader*)xsdt;
+ uint64_t* tables = (uint64_t*)getPointerToOtherSDT(xsdt);
+ uint64_t entries = (header->length - sizeof(ACPISDTHeader)) / 8;
+
+ for(int i = 0; i < entries; i++)
+ {
+ uint64_t table_ptr = tables[i];
+
+ if(getTableType((ACPISDTHeader*)table_ptr) == table)
+ {
+ return (ACPISDTHeader*)table_ptr;
+ }
+ }
+
+ return NULL;
+}
+
+void* getAPIC(APICHeader* header, enum APIC_TYPE apic)
+{
+ header->length;
+ uint8_t* apic_tables = (uint8_t*)getACPITablesPointer(header);
+ APICEntry* entry = (APICEntry*)apic_tables;
+ uint8_t offset = 0;
+
+ while(offset < (header->length - sizeof(APICHeader)))
+ {
+ APICEntry* entry = (APICEntry*)&(apic_tables[offset]);
+ if(entry->type == apic)
+ {
+ return entry;
+ }
+
+ offset += entry->length;
+ }
+
+ return NULL;
+}
+
+uint64_t numberTables(APICHeader* header)
+{
+ header->length;
+ uint8_t* apic_tables = (uint8_t*)getACPITablesPointer(header);
+ APICEntry* entry = (APICEntry*)apic_tables;
+ uint8_t offset = 0;
+ uint64_t tables = 0;
+
+ while(offset < (header->length - sizeof(APICHeader)))
+ {
+ /*
+ APICEntry* entry = (APICEntry*)&(apic_tables[offset]);
+ if(entry->type == apic)
+ {
+ return entry;
+ }
+ */
+
+ tables++;
+ offset += entry->length;
+ }
+
+ return tables;
+}
+
+void init_acpi(XSDP* xsdp)
+{
+ kprintf("=> Initializing ACPI\n");
+
+ uint64_t pic_master = inb(0x21);
+ uint64_t pic_slave = inb(0xA1);
+
+ if((pic_master == 0xFF) && (pic_slave == 0xFF))
+ {
+ kprintf("==> PIC disabled\n");
+ }
+
+ if(xsdp != NULL)
+ {
+ kprintf("==> ACPI 2.0 Found\n");
+ }
+ else
+ {
+ kprintf("==X No ACPI 2.0 Found\n");
+ return;
+ }
+
+ ACPISDTHeader* xsdt = (ACPISDTHeader*)xsdp->xsdtaddress;
+
+ APICHeader* apic_table = (APICHeader*)getTable(xsdt, APIC);
+ if(apic_table == NULL)
+ {
+ kprintf("==X Failed To Find APIC Table\n");
+ return;
+ }
+
+ kprintf("==> Found APIC Table\n");
+ if(apic_table->flags >= 0)
+ {
+ kprintf("==> Dual 8259 PIC Found\n");
+ }
+
+ IOAPICTable* ioapic = getAPIC(apic_table, IOAPIC);
+ if(ioapic == NULL)
+ {
+ kprintf("==X Failed to find a valid IOAPIC\n");
+ return;
+ }
+
+ uint64_t n_tables = numberTables(apic_table);
+
+ kprintf("Number of Tables: %ld\n", n_tables);
+
+ kprintf("==> IOAPIC Found\n");
+
+
+ // kprintf("=> ACPI Initialized\n");
+}
diff --git a/kernel/acpi.h b/kernel/acpi.h
new file mode 100644
index 0000000..ec9eeaa
--- /dev/null
+++ b/kernel/acpi.h
@@ -0,0 +1,125 @@
+#pragma once
+
+#include <stdint.h>
+
+typedef struct __attribute__((packed))
+{
+ uint8_t signature[8];
+ uint8_t checksum;
+ uint8_t OEMID[6];
+ uint8_t revision;
+ uint32_t deprecated;
+ uint32_t length;
+ uint64_t xsdtaddress;
+ uint8_t extendedchecksum;
+ uint8_t reserved[3];
+} XSDP;
+
+typedef struct __attribute__((packed))
+{
+ uint8_t signature[4];
+ uint32_t length;
+ uint8_t revision;
+ uint8_t checksum;
+ uint8_t OEMID[6];
+ uint8_t OEMTableId[8];
+ uint32_t OEMRevision;
+ uint32_t creatorID;
+ uint32_t creatorrevision;
+} ACPISDTHeader;
+
+typedef struct __attribute__((packed))
+{
+ uint8_t siganture[4];
+ uint32_t length;
+ uint8_t revision;
+ uint8_t checksum;
+ uint8_t OEMID[6];
+ uint8_t OEMTableId[8];
+ uint32_t OEMRevision;
+ uint32_t creatorID;
+ uint32_t creatorrevision;
+
+ // APIC Fields
+ uint32_t l_ic_addr;
+ uint32_t flags;
+} APICHeader; // At 44 byte starts the variable part;
+
+typedef struct __attribute__((packed))
+{
+ uint8_t type;
+ uint8_t length;
+} APICEntry;
+
+typedef struct __attribute__((packed))
+{
+ uint8_t type;
+ uint8_t length;
+ uint8_t id;
+ uint8_t rsv;
+ uint32_t addr;
+ uint32_t si_base;
+} IOAPICTable;
+
+enum ACPI_TABLES
+{
+ APIC, // <- MADT
+ BGRT,
+ BERT,
+ CPEP,
+ DSDT,
+ ECDT,
+ EINJ,
+ ERST,
+ FACP, // <- FADT
+ FACS,
+ HEST,
+ MSCT,
+ MPST,
+ OEMx,
+ PMTT,
+ PSDT,
+ RASF,
+ RSDT,
+ SBST,
+ SLIT,
+ SRAT,
+ SSDT,
+ XSDT,
+ HPET,
+ NONE
+};
+
+enum APIC_TYPE
+{
+ LAPIC = 0,
+ IOAPIC = 1,
+ ISO = 2,
+ NMI_S = 3,
+ LAPIC_NMI = 4,
+ LAPIC_AO = 5,
+ IOSAPIC = 6,
+ LSAPIC = 7,
+ PIS = 8,
+ PLX2APIC = 9,
+ LX2APIC_NMI = 0xA,
+ GICC = 0xB,
+ GICD = 0xC,
+ GIC_MSI_FRAME = 0xD,
+ GICR = 0xE,
+ GIC_ITS = 0xF,
+ MP_WAKEUP = 0x10,
+ CORE_PIC = 0x11,
+ LIO_PIC = 0x12,
+ HT_PIC = 0x13,
+ EIO_PIC = 0x14,
+ MSI_PIC = 0x15,
+ BIO_PIC = 0x16,
+ LPC_PIC = 0x17,
+ RINTC = 0x18,
+ IMSIC = 0x19,
+ APLIC = 0x20,
+ PLIC = 0x21
+};
+
+void init_acpi(XSDP* xsdp);
diff --git a/kernel/asm_inline.h b/kernel/asm_inline.h
new file mode 100644
index 0000000..7107618
--- /dev/null
+++ b/kernel/asm_inline.h
@@ -0,0 +1,207 @@
+#pragma once
+
+#include <stdint.h>
+
+// intel:
+// mov dst, src
+// mov eax, 16
+// mov eax, 0ffh
+//
+// move whats pointed by ebx into eax
+// mov eax, [ebx]
+//
+// no need to use movb
+// this already moves a byte
+// mov al, 5
+
+// registers
+// +----------------+-----------------+-----------------+
+// | 8 Bit - No REX | 16 Bit - No REX | 32 Bit - No REX |
+// +-------+--------+-----------------+-----------------|
+// | AL | AH | AX | EAX |
+// | BL | BH | BX | EBX |
+// | CL | CH | CX | ECX |
+// | DL | DH | DX | EDX |
+// +-------+--------+ DI | EDI |
+// +////////////////+ SI | EDI |
+// +////////////////+ BP | EBP |
+// +////////////////+ SP | ESP |
+// +----------------+-----------------+-----------------+------------+
+// | 8 Bit - REX | 16 Bit - REX | 32 Bit - REX | 64 Bit |
+// +----------------+-----------------+-----------------+------------+
+// | AL | AX | EAX | RAX |
+// | BL | BX | EBX | RBX |
+// | CL | CX | ECX | RCX |
+// | DL | DX | EDX | RDX |
+// | DIL | DI | EDI | RDI |
+// | SIL | SI | ESI | RSI |
+// | BPL | BP | EBP | RBP |
+// | SPL | SP | ESP | RSP |
+// | R8B | R8W | R8D | R8 |
+// | R9B | R9W | R9D | R9 |
+// | R10B | R10W | R10D | R10 |
+// | R11B | R11W | R11D | R11 |
+// | R12B | R12W | R12D | R12 |
+// | R13B | R13W | R13D | R13 |
+// | R14B | R14W | R14D | R14 |
+// | R15B | R15W | R15D | R15 |
+// +----------------+-----------------+-----------------+------------+
+//
+// Special
+// RFLAGS <- lower 32 bits used, upper reserved
+
+#define COM1 0x3f8
+
+static inline void cli()
+{
+ asm volatile ("cli");
+}
+
+static inline void sti()
+{
+ asm volatile ("sti");
+}
+
+static inline void hlt()
+{
+ asm volatile("hlt");
+}
+
+static inline void cpuid_vendor(char* str)
+{
+ int* casted = (int*)str;
+
+ asm volatile ("mov rax, 0; cpuid;"
+ : "=b" (casted[0]), "=d" (casted[1]), "=c" (casted[2])
+ : // input in empty
+ : "eax"); // touched registers
+}
+
+
+static inline void cpuid(uint64_t leaf, uint64_t subleaf, uint32_t* a, uint32_t* b, uint32_t* c, uint32_t* d)
+{
+ uint32_t la, lb, lc, ld;
+
+ asm volatile("cpuid;"
+ : "=a" (la), "=b" (lb), "=c" (lc), "=d" (ld)
+ : "a" (leaf), "c" (subleaf)
+ :
+ );
+
+ *a = la;
+ *b = lb;
+ *c = lc;
+ *d = ld;
+}
+
+static inline uint64_t xchg(volatile uint64_t *addr, uint64_t newval)
+{
+ uint64_t result;
+
+ // might need to reorder
+ asm volatile ("lock; xchgl %0, %1" :
+ "+m" (*addr), "=a" (result) :
+ "1" (newval) :
+ "cc");
+
+ return result;
+}
+
+static inline void lcr3(uint64_t value)
+{
+ asm volatile ("mov cr3, %0"
+ :
+ : "r" (value)
+ : );
+}
+
+static inline void lgdt(void* ptr)
+{
+ asm volatile ("lgdt [%0];" : : "r" (ptr) );
+}
+
+static inline void lidt(void* ptr)
+{
+ asm volatile ("lidt [%0];" : : "r" (ptr));
+}
+
+static inline void ltr(unsigned short sel)
+{
+ asm volatile ("ltr %0" : : "r" (sel));
+}
+
+static inline uint64_t rrsp()
+{
+ uint64_t r;
+
+ asm volatile ("mov %0, rsp" : "=r" (r) : );
+
+ return r;
+}
+
+static inline void rdmsr(uint32_t msr, uint64_t* d, uint64_t* a)
+{
+ uint64_t ld;
+ uint64_t la;
+
+ asm volatile("rdmsr"
+ : "=d" (ld), "=a" (la)
+ : "c" (msr)
+ );
+
+ *d = ld;
+ *a = la;
+}
+
+static inline void fldcw(const uint16_t control)
+{
+ asm volatile("fldcw %0;"::"m"(control));
+}
+
+static inline void outb(uint16_t port, uint8_t val)
+{
+ asm volatile ( "outb %1, %0"
+ :
+ : "a"(val), "Nd"(port) );
+}
+
+static inline void outw(uint16_t port, uint16_t val)
+{
+ asm volatile ("outw %1, %0"
+ :
+ : "a"(val), "Nd"(port) );
+}
+
+static inline void outl(uint16_t port, uint32_t val)
+{
+ asm volatile ("outl %1, %0"
+ :
+ : "a"(val), "Nd"(port) );
+}
+
+static inline uint8_t inb(uint16_t port)
+{
+ uint8_t ret;
+ asm volatile ( "inb %0, %1"
+ : "=a"(ret)
+ : "Nd"(port) );
+ return ret;
+}
+
+static inline uint16_t inw(uint16_t port)
+{
+ uint16_t ret;
+ asm volatile ( "inb %0, %1"
+ : "=a"(ret)
+ : "Nd"(port) );
+ return ret;
+}
+
+static inline uint32_t inl(uint16_t port)
+{
+ uint32_t ret;
+ asm volatile ( "inb %0, %1"
+ : "=a"(ret)
+ : "Nd"(port) );
+ return ret;
+}
diff --git a/kernel/cpu_info.c b/kernel/cpu_info.c
new file mode 100644
index 0000000..aeb5a60
--- /dev/null
+++ b/kernel/cpu_info.c
@@ -0,0 +1,98 @@
+#include "cpu_info.h"
+#include "asm_inline.h"
+
+enum LEAF1_ECX {
+ SSE3 = 1<<0,
+ PCLMULQDQ = 1<<1,
+ DTES64 = 1<<2,
+ MONITOR = 1<<3,
+ DS_CPL = 1<<4,
+ VMX = 1<<5,
+ SMX = 1<<6,
+ EIST = 1<<7, // Intel ?
+ TM2 = 1<<8,
+ SSSE3 = 1<<9,
+ L1_CONTEXT_ID = 1<<10,
+ DEBUG_INTERFACE = 1<<11,
+ FMA = 1<<12,
+ CMPXCHG16B = 1<<13,
+ XTPR_UPDATE_CONTROL = 1<<14,
+ PERF_CAPABILITIES = 1<<15,
+ // Reserved
+ PCID = 1<<17,
+ DCA = 1<<18,
+ SSE4_1 = 1<<19,
+ SSE4_2 = 1<<20,
+ X2APIC = 1<<21,
+ MOVBE = 1<<22,
+ POPCNT = 1<<23,
+ TSC_DEADLINE = 1<<24,
+ AESNI = 1<<25,
+ XSAVE = 1<<26,
+ OSXSAVE = 1<<27,
+ AVX = 1<<28,
+ F16C = 1<<29,
+ RDRAND = 1<<30
+};
+
+enum LEAF1_EDX {
+ FPU = 1<<0,
+ VME = 1<<1,
+ DE = 1<<2,
+ PSE = 1<<3,
+ TSC = 1<<4,
+ MSR = 1<<5,
+ PAE = 1<<6,
+ MCE = 1<<7,
+ CMPXCHG8B = 1<<8,
+ APIC = 1<<9,
+ // Reserved
+ SEP = 1<<11,
+ MTRR = 1<<12,
+ PGE = 1<<13,
+ MCA = 1<<14,
+ CMOV = 1<<15,
+ PAT = 1<<16,
+ PSE_36 = 1<<17,
+ PSN = 1<<18,
+ CLFLUSH = 1<<19,
+ // Reserved
+ DS = 1<<21,
+ ACPI = 1<<22,
+ MMX = 1<<23,
+ FXSR = 1<<24,
+ SSE = 1<<25,
+ SSE2 = 1<<26,
+ SELF_SNOOP = 1<<27,
+ HTT = 1<<28,
+ TM = 1<<29,
+ // Reserved
+ PBE = 1<<31,
+};
+
+cpu_info info;
+
+void init_cpu_info()
+{
+ uint32_t rax, rbx, rcx, rdx;
+ cpuid(1, 0, &rax, &rbx, &rcx, &rdx);
+
+ info.FPU = (rcx & FPU) == 1;
+ info.ACPI = (rcx & ACPI) == 1;
+ info.MMX = (rcx & MMX) == 1;
+ info.SSE = (rcx & SSE) == 1;
+ info.SSE2 = (rcx & SSE2) == 1;
+
+ info.SSE3 = (rdx & SSE3) == 1;
+ info.SSSE3 = (rdx & SSSE3) == 1;
+ info.SSE41 = (rdx & SSE4_1) == 1;
+ info.SSE42 = (rdx & SSE4_2) == 1;
+ info.VMX = (rdx & VMX) == 1;
+ info.FMA = (rdx & FMA) == 1;
+ info.AVX = (rdx & AVX) == 1;
+}
+
+const cpu_info* get_cpu_info()
+{
+ return &info;
+}
diff --git a/kernel/cpu_info.h b/kernel/cpu_info.h
new file mode 100644
index 0000000..d2c1a5d
--- /dev/null
+++ b/kernel/cpu_info.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <stdbool.h>
+
+typedef struct {
+ bool FPU;
+ bool MMX;
+ bool SSE;
+ bool SSE2;
+ bool SSE3;
+ bool SSSE3;
+ bool SSE41;
+ bool SSE42;
+ bool AVX;
+ bool VMX;
+ bool FMA;
+ bool ACPI;
+ bool APIC;
+} cpu_info;
+
+void init_cpu_info();
+const cpu_info* get_cpu_info();
+
diff --git a/kernel/gdt.c b/kernel/gdt.c
new file mode 100644
index 0000000..b6d2c3a
--- /dev/null
+++ b/kernel/gdt.c
@@ -0,0 +1,285 @@
+
+#include "gdt.h"
+#include "kprintf.h"
+
+#include "asm_inline.h"
+#include "memops.h"
+
+#define NULL_DESCRIPTOR 0
+#define KERNEL_CODE 1
+#define KERNEL_DATA 2
+#define USER_CODE 3
+#define USER_DATA 4
+#define TASK_STATE_SEGMENT_LOW 5
+#define TASK_STATE_SEGMENT_HIGH 6
+
+__attribute__((aligned(0x08)))
+uint64_t gdt[7];
+
+gdt_load gdt_l;
+tss tss_g;
+
+// #define KDEBUG
+
+extern void asm_reload_segments();
+
+int init_gdt()
+{
+ /*
+ create_descriptor(NULL_DESCRIPTOR, 0, 0, 0, 0);
+ create_descriptor(KERNEL_CODE, 0, 0xFFFF, 0x9A, 0xA);
+ create_descriptor(KERNEL_DATA, 0, 0xFFFF, 0x92, 0xC);
+ create_descriptor(USER_CODE, 0, 0xFFFF, 0xFA, 0xA);
+ create_descriptor(USER_DATA, 0, 0xFFFF, 0xF2, 0xC);
+ */
+
+
+ gdt[NULL_DESCRIPTOR] = 0x0000000000000000;
+ /*
+ gdt[KERNEL_CODE] = 0x0020980000000000; // Code, DPL=0, R/X
+ gdt[KERNEL_DATA] = 0x0000920000000000; // Data, DPL=0, W
+ gdt[USER_CODE] = 0x0020F80000000000; // Code, DPL=3, R/X
+ gdt[USER_DATA] = 0x0000F20000000000; // Data, DPL=3, W
+ */
+
+ code_segment kernel_code = {
+ .limit = 0xFFFF,
+ .base_low = 0x0,
+ .base_mid = 0x0,
+ .A = 0x0,
+ .R = 0x1,
+ .C = 0x0, // conforming, used for privilege changes, leave it for now
+ .one0 = 0x1,
+ .one1 = 0x1,
+ .DPL = 0x0, // 0 -> kernel code
+ .P = 0x1,
+ .limit_high = 0xF,
+ .AVL = 0x0,
+ .L = 0x1,
+ .D = 0x0,
+ .G = 0x1,
+ .base_high = 0x0
+ };
+
+ data_segment kernel_data = {
+ .limit = 0xFFFF,
+ .base_low = 0x0,
+ .base_mid = 0x0,
+ .A = 0x0,
+ .W = 0x1,
+ .E = 0x0,
+ .zero = 0,
+ .one = 1,
+ .DPL = 0x0,
+ .P = 0x1,
+ .limit_high = 0xF,
+ .AVL = 0x0,
+ .L = 0x1,
+ .D = 0x0,
+ .G = 0x1,
+ .base_high = 0x0
+ };
+
+ code_segment user_code = {
+ .limit = 0xFFFF,
+ .base_low = 0x0,
+ .base_mid = 0x0,
+ .A = 0x0,
+ .R = 0x1, // ?
+ .C = 0x0, // conforming, used for privilege changes, leave it for now
+ .one0 = 0x1,
+ .one1 = 0x1,
+ .DPL = 0x3, // 0 -> user code
+ .P = 0x1,
+ .limit_high = 0xF,
+ .AVL = 0x0,
+ .L = 0x1,
+ .D = 0x0,
+ .G = 0x1,
+ .base_high = 0x0
+ };
+ data_segment user_data = {
+ .limit = 0xFFFF,
+ .base_low = 0x0,
+ .base_mid = 0x0,
+ .A = 0x0,
+ .W = 0x1,
+ .E = 0x0,
+ .zero = 0,
+ .one = 1,
+ .DPL = 0x3,
+ .P = 0x1,
+ .limit_high = 0xF,
+ .AVL = 0x0,
+ .L = 0x1,
+ .D = 0x0,
+ .G = 0x1,
+ .base_high = 0x0
+ };
+
+ //uint64_t addr = (uint64_t)tss_a;
+ //tss_a[16] = 0x00680000;
+
+ tss_g.rsv0 = 0x0;
+ tss_g.rsp0 = rrsp(); // <- change with ring 0 stack pointer(who knows which one is it, need to allocate or reserve?)
+ tss_g.rsp1 = 0x0;
+ tss_g.rsp2 = 0x0;
+ tss_g.rsv1 = 0x0;
+ tss_g.ist2 = 0x0;
+ tss_g.ist3 = 0x0;
+ tss_g.ist4 = 0x0;
+ tss_g.ist5 = 0x0;
+ tss_g.ist6 = 0x0;
+ tss_g.ist7 = 0x0;
+ tss_g.rsv2 = 0x0;
+ tss_g.rsv3 = 0x0;
+ tss_g.io_base = sizeof(tss);
+
+ uint64_t tss_m;
+ kmemcpy(&tss_g, &tss_m, sizeof(uint64_t));
+
+ tss_segment gdt_tss = {
+ .limit_low = 0xFFFF,
+ .base_low = tss_m & 0xFFFFFF,
+ .type = 0x9, // <- available tss ? (busy is 0xB)
+ .zero0 = 0x0,
+ .DPL = 0x0,
+ .P = 0x1,
+ .limit_high = 0xF,
+ .AVL = 0x0,
+ .zero1 = 0x0,
+ .zero2 = 0x0,
+ .G = 0x1, // <- maybe?
+ .base_high = (tss_m >> 24) & 0xFFFFFFFFFF,
+ .rsv1 = 0x0,
+ .zero3 = 0x0,
+ .rsv2 = 0x0,
+ };
+
+ /*
+ kmemcpy(&kernel_code, &gdt[KERNEL_CODE], sizeof(uint64_t));
+ kmemcpy(&kernel_data, &gdt[KERNEL_DATA], sizeof(uint64_t));
+ kmemcpy(&user_code, &gdt[USER_CODE], sizeof(uint64_t));
+ kmemcpy(&user_data, &gdt[USER_DATA], sizeof(uint64_t));
+ */
+ kmemcpy(&gdt_tss, &gdt[TASK_STATE_SEGMENT_LOW], 2*sizeof(uint64_t));
+
+ uint64_t kc = convert_code_segment(&kernel_code);
+ uint64_t kd = convert_data_segment(&kernel_data);
+ uint64_t uc = convert_code_segment(&user_code);
+ uint64_t ud = convert_data_segment(&user_data);
+
+ gdt[KERNEL_CODE] = kc;
+ // gdt[KERNEL_DATA] = kd;
+ gdt[KERNEL_DATA] = 0x0000920000000000; // maybe my code is wrong <- yes it is, no idea why, discovered, and can be safely hardcoded for 64bit
+ gdt[USER_CODE] = uc;
+ gdt[USER_DATA] = 0x0000920000000000;
+ // gdt[USER_DATA] = ud;
+
+ /*
+ gdt[TASK_STATE_SEGMENT_LOW] = (0x0067) | ((addr & 0xFFFFFF) << 16) |
+ (0x00E9LL << 40) | (((addr >> 24) & 0xFF) << 56);
+ gdt[TASK_STATE_SEGMENT_HIGH] = (addr >> 32);
+ */
+
+ #ifdef KDEBUG
+ kprintf("gdt pointer: %p\n", gdt);
+ kprintf("KERNEL CODE: %lX\n", gdt[KERNEL_CODE]);
+ kprintf("KERNEL DATA: %lX\n", gdt[KERNEL_DATA]);
+ kprintf("USER CODE: %lX\n", gdt[USER_CODE]);
+ kprintf("USER DATA: %lX\n", gdt[USER_DATA]);
+
+
+
+ kprintf("FUNCTION\n");
+
+ kprintf("KERNEL CODE: %lX\n", kc);
+ kprintf("KERNEL DATA: %lX\n", kd);
+ kprintf("USER CODE: %lX\n", uc);
+ kprintf("USER DATA: %lX\n", ud);
+ #endif
+
+ gdt_l.size = 7 * sizeof(uint64_t) - 1;
+ gdt_l.ptr = (uint64_t)(gdt);
+
+ lgdt(&gdt_l);
+ asm_reload_segments();
+
+ // ltr(TASK_STATE_SEGMENT_LOW << 3);
+
+ create_system_segment_descriptor();
+
+ return 1;
+}
+
+uint64_t create_descriptor(uint32_t base, uint32_t limit, uint8_t access_byte, uint16_t flag)
+{
+ // need to redo
+ uint64_t descriptor;
+
+ descriptor = limit & 0x000F0000;
+ descriptor |= (flag << 8) & 0x00F0FF00;
+ descriptor |= (base >> 16) & 0x000000FF;
+ descriptor |= base & 0xFF000000;
+
+ descriptor <<= 32;
+
+ descriptor |= base << 16;
+ descriptor |= limit & 0x0000FFFF;
+
+ return descriptor;
+}
+
+void create_system_segment_descriptor()
+{
+
+}
+
+uint64_t convert_code_segment(code_segment* segment)
+{
+ uint64_t s = 0x0;
+
+ s = segment->limit & 0xFFFF;
+ s |= (uint64_t)(segment->base_low & 0xFFFF) << 16;
+ s |= (uint64_t)(segment->base_mid & 0xFF) << 32;
+ s |= (uint64_t)(segment->A & 0x1) << 40;
+ s |= (uint64_t)(segment->R & 0x1) << 41;
+ s |= (uint64_t)(segment->C & 0x1) << 42;
+ s |= (uint64_t)(segment->one0 & 0x1) << 43;
+ s |= (uint64_t)(segment->one1 & 0x1) << 44;
+ s |= (uint64_t)(segment->DPL & 0x3) << 45;
+ s |= (uint64_t)(segment->P & 0x1) << 47;
+ s |= (uint64_t)(segment->limit_high & 0xF) << 48;
+ s |= (uint64_t)(segment->AVL & 0x1) << 52;
+ s |= (uint64_t)(segment->L & 0x1) << 53;
+ s |= (uint64_t)(segment->D & 0x1) << 54;
+ s |= (uint64_t)(segment->G & 0x1) << 55;
+ s |= (uint64_t)(segment->base_high) << 56;
+
+ return s;
+}
+
+uint64_t convert_data_segment(data_segment* segment)
+{
+ uint64_t s = 0x0;
+ uint32_t* ss = (uint32_t*)&s;
+
+ s = segment->limit & 0xFFFF;
+ s |= (uint64_t)(segment->base_low & 0xFFFF) << 16;
+ s |= (uint64_t)(segment->base_mid & 0xFF) << 32;
+ s |= (uint64_t)(segment->A & 0x1) << 40;
+ s |= (uint64_t)(segment->W & 0x1) << 41;
+ s |= (uint64_t)(segment->E & 0x1) << 42;
+ s |= (uint64_t)(segment->one & 0x1) << 43;
+ s |= (uint64_t)(segment->zero & 0x1) << 44;
+ s |= (uint64_t)(segment->DPL & 0x3) << 45;
+ s |= (uint64_t)(segment->P & 0x1) << 47;
+ s |= (uint64_t)(segment->limit_high & 0xF) << 48;
+ s |= (uint64_t)(segment->AVL & 0x1) << 52;
+ s |= (uint64_t)(segment->L & 0x1) << 53;
+ s |= (uint64_t)(segment->D & 0x1) << 54;
+ s |= (uint64_t)(segment->G & 0x1) << 55;
+ s |= (uint64_t)(segment->base_high) << 56;
+
+ return s;
+}
diff --git a/kernel/gdt.h b/kernel/gdt.h
new file mode 100644
index 0000000..c0ba677
--- /dev/null
+++ b/kernel/gdt.h
@@ -0,0 +1,93 @@
+#pragma once
+
+#include <stdint.h>
+
+typedef struct __attribute__((packed))
+{
+ uint16_t size;
+ uint64_t ptr;
+} gdt_load;
+
+typedef struct __attribute__((packed))
+{
+ uint64_t limit: 16;
+ uint64_t base_low: 16;
+ uint64_t base_mid: 8;
+ uint64_t A: 1;
+ uint64_t R: 1;
+ uint64_t C: 1;
+ uint64_t one0: 1;
+ uint64_t one1: 1;
+ uint64_t DPL: 2;
+ uint64_t P: 1;
+ uint64_t limit_high: 4;
+ uint64_t AVL: 1;
+ uint64_t L: 1;
+ uint64_t D: 1;
+ uint64_t G: 1;
+ uint64_t base_high: 8;
+} code_segment;
+
+typedef struct __attribute__((packed))
+{
+ uint64_t limit: 16;
+ uint64_t base_low: 16;
+ uint64_t base_mid: 8;
+ uint64_t A: 1;
+ uint64_t W: 1;
+ uint64_t E: 1;
+ uint64_t zero: 1;
+ uint64_t one: 1;
+ uint64_t DPL: 2;
+ uint64_t P: 1;
+ uint64_t limit_high: 4;
+ uint64_t AVL: 1;
+ uint64_t L: 1;
+ uint64_t D: 1;
+ uint64_t G: 1;
+ uint64_t base_high: 8;
+} data_segment;
+
+typedef struct __attribute__((packed))
+{
+ uint64_t limit_low: 16;
+ uint64_t base_low: 24;
+ uint64_t type: 4;
+ uint64_t zero0: 1;
+ uint64_t DPL: 2;
+ uint64_t P: 1;
+ uint64_t limit_high: 4;
+ uint64_t AVL: 1;
+ uint64_t zero1: 1;
+ uint64_t zero2: 1;
+ uint64_t G: 1;
+ uint64_t base_high: 40;
+ uint64_t rsv1: 8;
+ uint64_t zero3: 5;
+ uint64_t rsv2: 19;
+} tss_segment;
+
+typedef struct __attribute__((packed))
+{
+ uint32_t rsv0;
+ uint64_t rsp0;
+ uint64_t rsp1;
+ uint64_t rsp2;
+ uint64_t rsv1;
+ uint64_t ist1;
+ uint64_t ist2;
+ uint64_t ist3;
+ uint64_t ist4;
+ uint64_t ist5;
+ uint64_t ist6;
+ uint64_t ist7;
+ uint64_t rsv2;
+ uint16_t rsv3;
+ uint16_t io_base;
+} tss;
+
+int init_gdt();
+uint64_t create_descriptor(uint32_t base, uint32_t limit, uint8_t access_byte, uint16_t flag);
+uint64_t convert_code_segment(code_segment* segment);
+uint64_t convert_data_segment(data_segment* segment);
+void create_system_segment_descriptor();
diff --git a/kernel/generate_vectors.py b/kernel/generate_vectors.py
new file mode 100644
index 0000000..8471ef8
--- /dev/null
+++ b/kernel/generate_vectors.py
@@ -0,0 +1,19 @@
+if __name__ == "__main__":
+ with open("interrupts/vectors.s", "w") as f:
+ for i in range(256):
+ f.write("global vector" + '{}'.format(i) + "\n")
+ f.write("extern s_trap_start\n")
+ f.write("extern s_trap_end\n")
+ f.write("\n")
+ f.write("section .text\n")
+ f.write("align 4\n")
+ f.write("\n")
+ for i in range(256):
+ upper = '{0:02X}'.format((i >> 16) & 0xFF)
+ lower = '{0:02X}'.format(i & 0xFF)
+ f.write("vector" + '{}'.format(i) + ":\n")
+ f.write(" push 0x" + upper + "\n")
+ f.write(" push 0x" + lower + "\n")
+ f.write(" jmp s_trap_start\n")
+ f.write("\n")
+ f.write("\n")
diff --git a/kernel/idt.c b/kernel/idt.c
new file mode 100644
index 0000000..01cee06
--- /dev/null
+++ b/kernel/idt.c
@@ -0,0 +1,131 @@
+#include "idt.h"
+#include "memops.h"
+#include "interrupts/generic.h"
+#include "asm_inline.h"
+#include "kprintf.h"
+
+extern void asm_generic_interrupt();
+
+idt_load idt_l;
+__attribute__((aligned(0x08)))
+uint64_t idt[512] = {0};
+
+#define VNM(x) vector##x
+
+void fill_idt();
+
+void init_idt()
+{
+ /*
+ for(int i = 0; i < 512; i+=2)
+ {
+ gate g = {
+ // .target_offset = (uint64_t)asm_generic_interrupt,
+ .target_offset = (uint64_t)vector1,
+ .target_selector = 0x8,
+ .ist = 0x0,
+ .type = INT_INT,
+ .dpl = 0x0,
+ .p = true
+ };
+
+ uint64_t converted_gate[2];
+
+ make_int_gate(&g, converted_gate);
+
+ kmemcpy(&converted_gate, &idt[i], 2*sizeof(uint64_t));
+ }
+ */
+
+ fill_idt();
+
+ /*
+ kprintf("IDT ADDR: %p\n", idt);
+ kprintf("INTERRUPT ADDR: %p\n", asm_generic_interrupt);
+ */
+
+ idt_l.size = 256 * 2 * sizeof(uint64_t) - 1;
+ idt_l.ptr = (uint64_t)(idt);
+
+ lidt(&idt_l);
+}
+
+void make_call_gate(gate* g, uint64_t* rg)
+{
+ uint32_t* srg = (uint32_t*)rg;
+ // lower 64
+ rg[0] = 0x0;
+ rg[1] = 0x0;
+
+ srg[0] |= g->target_offset & 0xFFFF;
+ srg[0] |= (g->target_selector & 0xFFFF) << 16;
+
+ // srg[1] |= (g->ist & 0xFF);
+ srg[1] |= (g->type & 0xFF ) << 8;
+ srg[1] |= (g->dpl & 0xFF) << 13;
+ srg[1] |= (g->p & 0xF) << 15; // <- this +16 (next field side is 61, so I did this wrong) <- this should offset by 47, to end in 48
+ srg[1] |= ((g->target_offset >> 16) & 0xFFFF) << 16;
+
+ srg[2] |= ((g->target_offset >> 32) & 0xFFFFFFFF);
+}
+
+void make_int_gate(gate* g, uint64_t* rg)
+{
+ uint32_t* srg = (uint32_t*)rg;
+ // lower 64
+ rg[0] = 0x0;
+ rg[1] = 0x0;
+
+ srg[0] |= g->target_offset & 0xFFFF;
+ srg[0] |= (g->target_selector & 0xFFFF) << 16;
+
+ srg[1] |= (g->ist & 0xFF);
+ srg[1] |= (g->type & 0xFF ) << 8;
+ srg[1] |= (g->dpl & 0xFF) << 13;
+ srg[1] |= (g->p & 0xF) << 15; // <- this +16 (next field side is 61, so I did this wrong) <- this should offset by 47, to end in 48
+ // srg[1] |= ((g->target_offset >> 16) & 0xFFFF) << 16;
+ srg[1] |= g->target_offset & 0xFFFF0000;
+
+ srg[2] |= ((g->target_offset >> 32) & 0xFFFFFFFF);
+}
+
+#define MKI(x) make_gate((uint64_t) vector##x, x)
+
+void make_gate(uint64_t vector, uint32_t i)
+{
+ gate g = {
+ // .target_offset = (uint64_t)asm_generic_interrupt,
+ .target_offset = vector,
+ .target_selector = 0x8,
+ .ist = 0x0,
+ .type = INT_INT,
+ .dpl = 0x0,
+ .p = true
+ };
+
+ uint64_t converted_gate[2];
+
+ make_int_gate(&g, converted_gate);
+
+ kmemcpy(&converted_gate, &idt[2*i], 2*sizeof(uint64_t));
+}
+
+void fill_idt()
+{
+ MKI(0); MKI(1); MKI(2); MKI(3); MKI(4); MKI(5); MKI(6); MKI(7); MKI(8); MKI(9); MKI(10); MKI(11); MKI(12); MKI(13); MKI(14); MKI(15);
+ MKI(16); MKI(17); MKI(18); MKI(19); MKI(20); MKI(21); MKI(22); MKI(23); MKI(24); MKI(25); MKI(26); MKI(27); MKI(28); MKI(29); MKI(30); MKI(31);
+ MKI(32); MKI(33); MKI(34); MKI(35); MKI(36); MKI(37); MKI(38); MKI(39); MKI(40); MKI(41); MKI(42); MKI(43); MKI(44); MKI(45); MKI(46); MKI(47);
+ MKI(48); MKI(49); MKI(50); MKI(51); MKI(52); MKI(53); MKI(54); MKI(55); MKI(56); MKI(57); MKI(58); MKI(59); MKI(60); MKI(61); MKI(62); MKI(63);
+ MKI(64); MKI(65); MKI(66); MKI(67); MKI(68); MKI(69); MKI(70); MKI(71); MKI(72); MKI(73); MKI(74); MKI(75); MKI(76); MKI(77); MKI(78); MKI(79);
+ MKI(80); MKI(81); MKI(82); MKI(83); MKI(84); MKI(85); MKI(86); MKI(87); MKI(88); MKI(89); MKI(90); MKI(91); MKI(92); MKI(93); MKI(94); MKI(95);
+ MKI(96); MKI(97); MKI(98); MKI(99); MKI(100); MKI(101); MKI(102); MKI(103); MKI(104); MKI(105); MKI(106); MKI(107); MKI(108); MKI(109); MKI(110); MKI(111);
+ MKI(112); MKI(113); MKI(114); MKI(115); MKI(116); MKI(117); MKI(118); MKI(119); MKI(120); MKI(121); MKI(122); MKI(123); MKI(124); MKI(125); MKI(126); MKI(127);
+ MKI(128); MKI(129); MKI(130); MKI(131); MKI(132); MKI(133); MKI(134); MKI(135); MKI(136); MKI(137); MKI(138); MKI(139); MKI(140); MKI(141); MKI(142); MKI(143);
+ MKI(144); MKI(145); MKI(146); MKI(147); MKI(148); MKI(149); MKI(150); MKI(151); MKI(152); MKI(153); MKI(154); MKI(155); MKI(156); MKI(157); MKI(158); MKI(159);
+ MKI(160); MKI(161); MKI(162); MKI(163); MKI(164); MKI(165); MKI(166); MKI(167); MKI(168); MKI(169); MKI(170); MKI(171); MKI(172); MKI(173); MKI(174); MKI(175);
+ MKI(176); MKI(177); MKI(178); MKI(179); MKI(180); MKI(181); MKI(182); MKI(183); MKI(184); MKI(185); MKI(186); MKI(187); MKI(188); MKI(189); MKI(190); MKI(191);
+ MKI(192); MKI(193); MKI(194); MKI(195); MKI(196); MKI(197); MKI(198); MKI(199); MKI(200); MKI(201); MKI(202); MKI(203); MKI(204); MKI(205); MKI(206); MKI(207);
+ MKI(208); MKI(209); MKI(210); MKI(211); MKI(212); MKI(213); MKI(214); MKI(215); MKI(216); MKI(217); MKI(218); MKI(219); MKI(220); MKI(221); MKI(222); MKI(223);
+ MKI(224); MKI(225); MKI(226); MKI(227); MKI(228); MKI(229); MKI(230); MKI(231); MKI(232); MKI(233); MKI(234); MKI(235); MKI(236); MKI(237); MKI(238); MKI(239);
+ MKI(240); MKI(241); MKI(242); MKI(243); MKI(244); MKI(245); MKI(246); MKI(247); MKI(248); MKI(249); MKI(250); MKI(251); MKI(252); MKI(253); MKI(254); MKI(255);
+}
diff --git a/kernel/idt.h b/kernel/idt.h
new file mode 100644
index 0000000..74ae7f9
--- /dev/null
+++ b/kernel/idt.h
@@ -0,0 +1,287 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#define INT_CALL 0xC
+#define INT_INT 0xE
+#define INT_TRAP 0xF
+
+extern void vector0();
+extern void vector1();
+extern void vector2();
+extern void vector3();
+extern void vector4();
+extern void vector5();
+extern void vector6();
+extern void vector7();
+extern void vector8();
+extern void vector9();
+extern void vector10();
+extern void vector11();
+extern void vector12();
+extern void vector13();
+extern void vector14();
+extern void vector15();
+extern void vector16();
+extern void vector17();
+extern void vector18();
+extern void vector19();
+extern void vector20();
+extern void vector21();
+extern void vector22();
+extern void vector23();
+extern void vector24();
+extern void vector25();
+extern void vector26();
+extern void vector27();
+extern void vector28();
+extern void vector29();
+extern void vector30();
+extern void vector31();
+extern void vector32();
+extern void vector33();
+extern void vector34();
+extern void vector35();
+extern void vector36();
+extern void vector37();
+extern void vector38();
+extern void vector39();
+extern void vector40();
+extern void vector41();
+extern void vector42();
+extern void vector43();
+extern void vector44();
+extern void vector45();
+extern void vector46();
+extern void vector47();
+extern void vector48();
+extern void vector49();
+extern void vector50();
+extern void vector51();
+extern void vector52();
+extern void vector53();
+extern void vector54();
+extern void vector55();
+extern void vector56();
+extern void vector57();
+extern void vector58();
+extern void vector59();
+extern void vector60();
+extern void vector61();
+extern void vector62();
+extern void vector63();
+extern void vector64();
+extern void vector65();
+extern void vector66();
+extern void vector67();
+extern void vector68();
+extern void vector69();
+extern void vector70();
+extern void vector71();
+extern void vector72();
+extern void vector73();
+extern void vector74();
+extern void vector75();
+extern void vector76();
+extern void vector77();
+extern void vector78();
+extern void vector79();
+extern void vector80();
+extern void vector81();
+extern void vector82();
+extern void vector83();
+extern void vector84();
+extern void vector85();
+extern void vector86();
+extern void vector87();
+extern void vector88();
+extern void vector89();
+extern void vector90();
+extern void vector91();
+extern void vector92();
+extern void vector93();
+extern void vector94();
+extern void vector95();
+extern void vector96();
+extern void vector97();
+extern void vector98();
+extern void vector99();
+extern void vector100();
+extern void vector101();
+extern void vector102();
+extern void vector103();
+extern void vector104();
+extern void vector105();
+extern void vector106();
+extern void vector107();
+extern void vector108();
+extern void vector109();
+extern void vector110();
+extern void vector111();
+extern void vector112();
+extern void vector113();
+extern void vector114();
+extern void vector115();
+extern void vector116();
+extern void vector117();
+extern void vector118();
+extern void vector119();
+extern void vector120();
+extern void vector121();
+extern void vector122();
+extern void vector123();
+extern void vector124();
+extern void vector125();
+extern void vector126();
+extern void vector127();
+extern void vector128();
+extern void vector129();
+extern void vector130();
+extern void vector131();
+extern void vector132();
+extern void vector133();
+extern void vector134();
+extern void vector135();
+extern void vector136();
+extern void vector137();
+extern void vector138();
+extern void vector139();
+extern void vector140();
+extern void vector141();
+extern void vector142();
+extern void vector143();
+extern void vector144();
+extern void vector145();
+extern void vector146();
+extern void vector147();
+extern void vector148();
+extern void vector149();
+extern void vector150();
+extern void vector151();
+extern void vector152();
+extern void vector153();
+extern void vector154();
+extern void vector155();
+extern void vector156();
+extern void vector157();
+extern void vector158();
+extern void vector159();
+extern void vector160();
+extern void vector161();
+extern void vector162();
+extern void vector163();
+extern void vector164();
+extern void vector165();
+extern void vector166();
+extern void vector167();
+extern void vector168();
+extern void vector169();
+extern void vector170();
+extern void vector171();
+extern void vector172();
+extern void vector173();
+extern void vector174();
+extern void vector175();
+extern void vector176();
+extern void vector177();
+extern void vector178();
+extern void vector179();
+extern void vector180();
+extern void vector181();
+extern void vector182();
+extern void vector183();
+extern void vector184();
+extern void vector185();
+extern void vector186();
+extern void vector187();
+extern void vector188();
+extern void vector189();
+extern void vector190();
+extern void vector191();
+extern void vector192();
+extern void vector193();
+extern void vector194();
+extern void vector195();
+extern void vector196();
+extern void vector197();
+extern void vector198();
+extern void vector199();
+extern void vector200();
+extern void vector201();
+extern void vector202();
+extern void vector203();
+extern void vector204();
+extern void vector205();
+extern void vector206();
+extern void vector207();
+extern void vector208();
+extern void vector209();
+extern void vector210();
+extern void vector211();
+extern void vector212();
+extern void vector213();
+extern void vector214();
+extern void vector215();
+extern void vector216();
+extern void vector217();
+extern void vector218();
+extern void vector219();
+extern void vector220();
+extern void vector221();
+extern void vector222();
+extern void vector223();
+extern void vector224();
+extern void vector225();
+extern void vector226();
+extern void vector227();
+extern void vector228();
+extern void vector229();
+extern void vector230();
+extern void vector231();
+extern void vector232();
+extern void vector233();
+extern void vector234();
+extern void vector235();
+extern void vector236();
+extern void vector237();
+extern void vector238();
+extern void vector239();
+extern void vector240();
+extern void vector241();
+extern void vector242();
+extern void vector243();
+extern void vector244();
+extern void vector245();
+extern void vector246();
+extern void vector247();
+extern void vector248();
+extern void vector249();
+extern void vector250();
+extern void vector251();
+extern void vector252();
+extern void vector253();
+extern void vector254();
+extern void vector255();
+
+typedef struct __attribute__((packed))
+{
+ uint16_t size;
+ uint64_t ptr;
+} idt_load;
+
+typedef struct __attribute__((packed))
+{
+ uint64_t target_offset;
+ uint16_t target_selector;
+ uint8_t ist; // 3 bits
+ uint8_t type; // 4 bits
+ uint8_t dpl;
+ bool p;
+} gate;
+
+void init_idt();
+void make_call_gate(gate* g, uint64_t* rg);
+void make_int_gate(gate* g, uint64_t* rg);
+
+
diff --git a/kernel/interrupts/common.s b/kernel/interrupts/common.s
new file mode 100644
index 0000000..a03fb1c
--- /dev/null
+++ b/kernel/interrupts/common.s
@@ -0,0 +1,94 @@
+extern generic_interrupt
+global asm_generic_interrupt
+global s_trap_start
+global s_trap_end
+
+section .text
+align 4
+
+s_trap_start:
+ push r15
+ push r14
+ push r13
+ push r12
+ push r11
+ push r10
+ push r9
+ push r8
+ push rdi
+ push rsi
+ push rbp
+ push rdx
+ push rcx
+ push rbx
+ push rax
+
+ mov rdi, rsp
+ call generic_interrupt
+
+s_trap_end:
+ pop rax
+ pop rbx
+ pop rcx
+ pop rdx
+ pop rbp
+ pop rsi
+ pop rdi
+ pop r8
+ pop r9
+ pop r10
+ pop r11
+ pop r12
+ pop r13
+ pop r14
+ pop r15
+
+ add rsp, 16
+
+ iretq
+
+asm_generic_interrupt:
+ ;push 0x0 ;
+ ;push 0xE ; <- need to create the individual interrupts pushing the specific values to the stack (how to pop them?)
+ push r15
+ push r14
+ push r13
+ push r12
+ push r11
+ push r10
+ push r9
+ push r8
+ push rdi
+ push rsi
+ push rbp
+ push rdx
+ push rcx
+ push rbx
+ push rax
+
+ ; ??
+ ; cld
+ mov rdi, rsp
+ call generic_interrupt
+
+ pop rax
+ pop rbx
+ pop rcx
+ pop rdx
+ pop rbp
+ pop rsi
+ pop rdi
+ pop r8
+ pop r9
+ pop r10
+ pop r11
+ pop r12
+ pop r13
+ pop r14
+ pop r15
+ ;pop
+ ;pop
+
+ add rsp, 16
+
+ iretq
diff --git a/kernel/interrupts/generic.c b/kernel/interrupts/generic.c
new file mode 100644
index 0000000..900c7e3
--- /dev/null
+++ b/kernel/interrupts/generic.c
@@ -0,0 +1,95 @@
+#include "generic.h"
+#include "../kprintf.h"
+#include "../asm_inline.h"
+
+void generic_interrupt(trapframe* f)
+{
+
+ kprintf("!!!! INTERRUPT !!!!\n");
+ kprintf("ARG: %p\n", f);
+ switch(f->trapno)
+ {
+ case 0x0:
+ kprintf("NO: %s | ERR_ %lX\n", "Division Error", f->err);
+ break;
+ case 0x1:
+ kprintf("NO: %s | ERR_ %lX\n", "Debug", f->err);
+ break;
+ case 0x2:
+ kprintf("NO: %s | ERR_ %lX\n", "Non-Maskable", f->err);
+ break;
+ case 0x3:
+ kprintf("NO: %s | ERR_ %lX\n", "Breakpoint", f->err);
+ break;
+ case 0x4:
+ kprintf("NO: %s | ERR_ %lX\n", "Overflow", f->err);
+ break;
+ case 0x5:
+ kprintf("NO: %s | ERR_ %lX\n", "Bound Range Exceeded", f->err);
+ break;
+ case 0x6:
+ kprintf("NO: %s | ERR_ %lX\n", "Invalid Opcode", f->err);
+ break;
+ case 0x7:
+ kprintf("NO: %s | ERR_ %lX\n", "Device Not Available", f->err);
+ break;
+ case 0x8:
+ kprintf("NO: %s | ERR_ %lX\n", "Double Fault", f->err);
+ break;
+ case 0xA:
+ kprintf("NO: %s | ERR_ %lX\n", "Invalid TSS", f->err);
+ break;
+ case 0xB:
+ kprintf("NO: %s | ERR_ %lX\n", "Segment Not Present", f->err);
+ break;
+ case 0xC:
+ kprintf("NO: %s | ERR_ %lX\n", "Stack-Segment fault", f->err);
+ break;
+ case 0xD:
+ kprintf("NO: %s | ERR_ %lX\n", "General Protection Fault", f->err);
+ break;
+ case 0xE:
+ kprintf("NO: %s | ERR_ %lX\n", "Page Fault", f->err);
+ break;
+ case 0x10:
+ kprintf("NO: %s | ERR_ %lX\n", "x87 Floating Point Exception", f->err);
+ break;
+ case 0x11:
+ kprintf("NO: %s | ERR_ %lX\n", "Alignment Check", f->err);
+ break;
+ case 0x12:
+ kprintf("NO: %s | ERR_ %lX\n", "Machine Check", f->err);
+ break;
+ case 0x13:
+ kprintf("NO: %s | ERR_ %lX\n", "SIMD Floating Point Exception", f->err);
+ break;
+ case 0x14:
+ kprintf("NO: %s | ERR_ %lX\n", "Virtualization Exception", f->err);
+ break;
+ case 0x15:
+ kprintf("NO: %s | ERR_ %lX\n", "Control Protection Exception", f->err);
+ break;
+ case 0x1C:
+ kprintf("NO: %s | ERR_ %lX\n", "Hypervisor Injection Exception", f->err);
+ break;
+ case 0x1D:
+ kprintf("NO: %s | ERR_ %lX\n", "VMM Communication Exception", f->err);
+ break;
+ case 0x1E:
+ kprintf("NO: %s | ERR_ %lX\n", "Security Exception", f->err);
+ break;
+ default:
+ kprintf("NO: %lX | ERR: %lX\n", f->trapno, f->err);
+ }
+ kprintf("RAX: %lX | RBX: %lX | RCX: %lX | RDX: %lX\n", f->rax, f->rbx, f->rcx, f->rdx);
+ kprintf("RSI: %lX | RDI: %lX | RBP: %lX\n", f->rsi, f->rdi, f->rbp);
+ kprintf("R8: %lX | R9: %lX | R10: %lX | R11: %lX\n", f->r8, f->r9, f->r10, f->r11);
+ kprintf("R12: %lX | R13: %lX | R14: %lX | R15: %lX\n", f->r12, f->r13, f->r14, f->r15);
+ kprintf("===================\n");
+ hlt();
+
+ //if(f->err == 0xE)
+ //{
+ // hlt();
+ //}
+}
diff --git a/kernel/interrupts/generic.h b/kernel/interrupts/generic.h
new file mode 100644
index 0000000..aee4dde
--- /dev/null
+++ b/kernel/interrupts/generic.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <stdint.h>
+
+typedef struct {
+ uint64_t rax; // rax
+ uint64_t rbx;
+ uint64_t rcx;
+ uint64_t rdx;
+ uint64_t rbp;
+ uint64_t rsi;
+ uint64_t rdi;
+ uint64_t r8;
+ uint64_t r9;
+ uint64_t r10;
+ uint64_t r11;
+ uint64_t r12;
+ uint64_t r13;
+ uint64_t r14;
+ uint64_t r15;
+
+ uint64_t trapno;
+ uint64_t err;
+
+ uint64_t rip; // rip
+ uint64_t cs;
+ uint64_t eflags; // rflags
+ uint64_t esp; // rsp
+ uint64_t ds; // ss
+} trapframe;
+
+void generic_interrupt(trapframe* frame);
+
diff --git a/kernel/interrupts/vectors.s b/kernel/interrupts/vectors.s
new file mode 100644
index 0000000..17f05d7
--- /dev/null
+++ b/kernel/interrupts/vectors.s
@@ -0,0 +1,1543 @@
+global vector0
+global vector1
+global vector2
+global vector3
+global vector4
+global vector5
+global vector6
+global vector7
+global vector8
+global vector9
+global vector10
+global vector11
+global vector12
+global vector13
+global vector14
+global vector15
+global vector16
+global vector17
+global vector18
+global vector19
+global vector20
+global vector21
+global vector22
+global vector23
+global vector24
+global vector25
+global vector26
+global vector27
+global vector28
+global vector29
+global vector30
+global vector31
+global vector32
+global vector33
+global vector34
+global vector35
+global vector36
+global vector37
+global vector38
+global vector39
+global vector40
+global vector41
+global vector42
+global vector43
+global vector44
+global vector45
+global vector46
+global vector47
+global vector48
+global vector49
+global vector50
+global vector51
+global vector52
+global vector53
+global vector54
+global vector55
+global vector56
+global vector57
+global vector58
+global vector59
+global vector60
+global vector61
+global vector62
+global vector63
+global vector64
+global vector65
+global vector66
+global vector67
+global vector68
+global vector69
+global vector70
+global vector71
+global vector72
+global vector73
+global vector74
+global vector75
+global vector76
+global vector77
+global vector78
+global vector79
+global vector80
+global vector81
+global vector82
+global vector83
+global vector84
+global vector85
+global vector86
+global vector87
+global vector88
+global vector89
+global vector90
+global vector91
+global vector92
+global vector93
+global vector94
+global vector95
+global vector96
+global vector97
+global vector98
+global vector99
+global vector100
+global vector101
+global vector102
+global vector103
+global vector104
+global vector105
+global vector106
+global vector107
+global vector108
+global vector109
+global vector110
+global vector111
+global vector112
+global vector113
+global vector114
+global vector115
+global vector116
+global vector117
+global vector118
+global vector119
+global vector120
+global vector121
+global vector122
+global vector123
+global vector124
+global vector125
+global vector126
+global vector127
+global vector128
+global vector129
+global vector130
+global vector131
+global vector132
+global vector133
+global vector134
+global vector135
+global vector136
+global vector137
+global vector138
+global vector139
+global vector140
+global vector141
+global vector142
+global vector143
+global vector144
+global vector145
+global vector146
+global vector147
+global vector148
+global vector149
+global vector150
+global vector151
+global vector152
+global vector153
+global vector154
+global vector155
+global vector156
+global vector157
+global vector158
+global vector159
+global vector160
+global vector161
+global vector162
+global vector163
+global vector164
+global vector165
+global vector166
+global vector167
+global vector168
+global vector169
+global vector170
+global vector171
+global vector172
+global vector173
+global vector174
+global vector175
+global vector176
+global vector177
+global vector178
+global vector179
+global vector180
+global vector181
+global vector182
+global vector183
+global vector184
+global vector185
+global vector186
+global vector187
+global vector188
+global vector189
+global vector190
+global vector191
+global vector192
+global vector193
+global vector194
+global vector195
+global vector196
+global vector197
+global vector198
+global vector199
+global vector200
+global vector201
+global vector202
+global vector203
+global vector204
+global vector205
+global vector206
+global vector207
+global vector208
+global vector209
+global vector210
+global vector211
+global vector212
+global vector213
+global vector214
+global vector215
+global vector216
+global vector217
+global vector218
+global vector219
+global vector220
+global vector221
+global vector222
+global vector223
+global vector224
+global vector225
+global vector226
+global vector227
+global vector228
+global vector229
+global vector230
+global vector231
+global vector232
+global vector233
+global vector234
+global vector235
+global vector236
+global vector237
+global vector238
+global vector239
+global vector240
+global vector241
+global vector242
+global vector243
+global vector244
+global vector245
+global vector246
+global vector247
+global vector248
+global vector249
+global vector250
+global vector251
+global vector252
+global vector253
+global vector254
+global vector255
+extern s_trap_start
+extern s_trap_end
+
+section .text
+align 4
+
+vector0:
+ push 0x00
+ push 0x00
+ jmp s_trap_start
+
+vector1:
+ push 0x00
+ push 0x01
+ jmp s_trap_start
+
+vector2:
+ push 0x00
+ push 0x02
+ jmp s_trap_start
+
+vector3:
+ push 0x00
+ push 0x03
+ jmp s_trap_start
+
+vector4:
+ push 0x00
+ push 0x04
+ jmp s_trap_start
+
+vector5:
+ push 0x00
+ push 0x05
+ jmp s_trap_start
+
+vector6:
+ push 0x00
+ push 0x06
+ jmp s_trap_start
+
+vector7:
+ push 0x00
+ push 0x07
+ jmp s_trap_start
+
+vector8:
+ push 0x00
+ push 0x08
+ jmp s_trap_start
+
+vector9:
+ push 0x00
+ push 0x09
+ jmp s_trap_start
+
+vector10:
+ push 0x00
+ push 0x0A
+ jmp s_trap_start
+
+vector11:
+ push 0x00
+ push 0x0B
+ jmp s_trap_start
+
+vector12:
+ push 0x00
+ push 0x0C
+ jmp s_trap_start
+
+vector13:
+ push 0x00
+ push 0x0D
+ jmp s_trap_start
+
+vector14:
+ push 0x00
+ push 0x0E
+ jmp s_trap_start
+
+vector15:
+ push 0x00
+ push 0x0F
+ jmp s_trap_start
+
+vector16:
+ push 0x00
+ push 0x10
+ jmp s_trap_start
+
+vector17:
+ push 0x00
+ push 0x11
+ jmp s_trap_start
+
+vector18:
+ push 0x00
+ push 0x12
+ jmp s_trap_start
+
+vector19:
+ push 0x00
+ push 0x13
+ jmp s_trap_start
+
+vector20:
+ push 0x00
+ push 0x14
+ jmp s_trap_start
+
+vector21:
+ push 0x00
+ push 0x15
+ jmp s_trap_start
+
+vector22:
+ push 0x00
+ push 0x16
+ jmp s_trap_start
+
+vector23:
+ push 0x00
+ push 0x17
+ jmp s_trap_start
+
+vector24:
+ push 0x00
+ push 0x18
+ jmp s_trap_start
+
+vector25:
+ push 0x00
+ push 0x19
+ jmp s_trap_start
+
+vector26:
+ push 0x00
+ push 0x1A
+ jmp s_trap_start
+
+vector27:
+ push 0x00
+ push 0x1B
+ jmp s_trap_start
+
+vector28:
+ push 0x00
+ push 0x1C
+ jmp s_trap_start
+
+vector29:
+ push 0x00
+ push 0x1D
+ jmp s_trap_start
+
+vector30:
+ push 0x00
+ push 0x1E
+ jmp s_trap_start
+
+vector31:
+ push 0x00
+ push 0x1F
+ jmp s_trap_start
+
+vector32:
+ push 0x00
+ push 0x20
+ jmp s_trap_start
+
+vector33:
+ push 0x00
+ push 0x21
+ jmp s_trap_start
+
+vector34:
+ push 0x00
+ push 0x22
+ jmp s_trap_start
+
+vector35:
+ push 0x00
+ push 0x23
+ jmp s_trap_start
+
+vector36:
+ push 0x00
+ push 0x24
+ jmp s_trap_start
+
+vector37:
+ push 0x00
+ push 0x25
+ jmp s_trap_start
+
+vector38:
+ push 0x00
+ push 0x26
+ jmp s_trap_start
+
+vector39:
+ push 0x00
+ push 0x27
+ jmp s_trap_start
+
+vector40:
+ push 0x00
+ push 0x28
+ jmp s_trap_start
+
+vector41:
+ push 0x00
+ push 0x29
+ jmp s_trap_start
+
+vector42:
+ push 0x00
+ push 0x2A
+ jmp s_trap_start
+
+vector43:
+ push 0x00
+ push 0x2B
+ jmp s_trap_start
+
+vector44:
+ push 0x00
+ push 0x2C
+ jmp s_trap_start
+
+vector45:
+ push 0x00
+ push 0x2D
+ jmp s_trap_start
+
+vector46:
+ push 0x00
+ push 0x2E
+ jmp s_trap_start
+
+vector47:
+ push 0x00
+ push 0x2F
+ jmp s_trap_start
+
+vector48:
+ push 0x00
+ push 0x30
+ jmp s_trap_start
+
+vector49:
+ push 0x00
+ push 0x31
+ jmp s_trap_start
+
+vector50:
+ push 0x00
+ push 0x32
+ jmp s_trap_start
+
+vector51:
+ push 0x00
+ push 0x33
+ jmp s_trap_start
+
+vector52:
+ push 0x00
+ push 0x34
+ jmp s_trap_start
+
+vector53:
+ push 0x00
+ push 0x35
+ jmp s_trap_start
+
+vector54:
+ push 0x00
+ push 0x36
+ jmp s_trap_start
+
+vector55:
+ push 0x00
+ push 0x37
+ jmp s_trap_start
+
+vector56:
+ push 0x00
+ push 0x38
+ jmp s_trap_start
+
+vector57:
+ push 0x00
+ push 0x39
+ jmp s_trap_start
+
+vector58:
+ push 0x00
+ push 0x3A
+ jmp s_trap_start
+
+vector59:
+ push 0x00
+ push 0x3B
+ jmp s_trap_start
+
+vector60:
+ push 0x00
+ push 0x3C
+ jmp s_trap_start
+
+vector61:
+ push 0x00
+ push 0x3D
+ jmp s_trap_start
+
+vector62:
+ push 0x00
+ push 0x3E
+ jmp s_trap_start
+
+vector63:
+ push 0x00
+ push 0x3F
+ jmp s_trap_start
+
+vector64:
+ push 0x00
+ push 0x40
+ jmp s_trap_start
+
+vector65:
+ push 0x00
+ push 0x41
+ jmp s_trap_start
+
+vector66:
+ push 0x00
+ push 0x42
+ jmp s_trap_start
+
+vector67:
+ push 0x00
+ push 0x43
+ jmp s_trap_start
+
+vector68:
+ push 0x00
+ push 0x44
+ jmp s_trap_start
+
+vector69:
+ push 0x00
+ push 0x45
+ jmp s_trap_start
+
+vector70:
+ push 0x00
+ push 0x46
+ jmp s_trap_start
+
+vector71:
+ push 0x00
+ push 0x47
+ jmp s_trap_start
+
+vector72:
+ push 0x00
+ push 0x48
+ jmp s_trap_start
+
+vector73:
+ push 0x00
+ push 0x49
+ jmp s_trap_start
+
+vector74:
+ push 0x00
+ push 0x4A
+ jmp s_trap_start
+
+vector75:
+ push 0x00
+ push 0x4B
+ jmp s_trap_start
+
+vector76:
+ push 0x00
+ push 0x4C
+ jmp s_trap_start
+
+vector77:
+ push 0x00
+ push 0x4D
+ jmp s_trap_start
+
+vector78:
+ push 0x00
+ push 0x4E
+ jmp s_trap_start
+
+vector79:
+ push 0x00
+ push 0x4F
+ jmp s_trap_start
+
+vector80:
+ push 0x00
+ push 0x50
+ jmp s_trap_start
+
+vector81:
+ push 0x00
+ push 0x51
+ jmp s_trap_start
+
+vector82:
+ push 0x00
+ push 0x52
+ jmp s_trap_start
+
+vector83:
+ push 0x00
+ push 0x53
+ jmp s_trap_start
+
+vector84:
+ push 0x00
+ push 0x54
+ jmp s_trap_start
+
+vector85:
+ push 0x00
+ push 0x55
+ jmp s_trap_start
+
+vector86:
+ push 0x00
+ push 0x56
+ jmp s_trap_start
+
+vector87:
+ push 0x00
+ push 0x57
+ jmp s_trap_start
+
+vector88:
+ push 0x00
+ push 0x58
+ jmp s_trap_start
+
+vector89:
+ push 0x00
+ push 0x59
+ jmp s_trap_start
+
+vector90:
+ push 0x00
+ push 0x5A
+ jmp s_trap_start
+
+vector91:
+ push 0x00
+ push 0x5B
+ jmp s_trap_start
+
+vector92:
+ push 0x00
+ push 0x5C
+ jmp s_trap_start
+
+vector93:
+ push 0x00
+ push 0x5D
+ jmp s_trap_start
+
+vector94:
+ push 0x00
+ push 0x5E
+ jmp s_trap_start
+
+vector95:
+ push 0x00
+ push 0x5F
+ jmp s_trap_start
+
+vector96:
+ push 0x00
+ push 0x60
+ jmp s_trap_start
+
+vector97:
+ push 0x00
+ push 0x61
+ jmp s_trap_start
+
+vector98:
+ push 0x00
+ push 0x62
+ jmp s_trap_start
+
+vector99:
+ push 0x00
+ push 0x63
+ jmp s_trap_start
+
+vector100:
+ push 0x00
+ push 0x64
+ jmp s_trap_start
+
+vector101:
+ push 0x00
+ push 0x65
+ jmp s_trap_start
+
+vector102:
+ push 0x00
+ push 0x66
+ jmp s_trap_start
+
+vector103:
+ push 0x00
+ push 0x67
+ jmp s_trap_start
+
+vector104:
+ push 0x00
+ push 0x68
+ jmp s_trap_start
+
+vector105:
+ push 0x00
+ push 0x69
+ jmp s_trap_start
+
+vector106:
+ push 0x00
+ push 0x6A
+ jmp s_trap_start
+
+vector107:
+ push 0x00
+ push 0x6B
+ jmp s_trap_start
+
+vector108:
+ push 0x00
+ push 0x6C
+ jmp s_trap_start
+
+vector109:
+ push 0x00
+ push 0x6D
+ jmp s_trap_start
+
+vector110:
+ push 0x00
+ push 0x6E
+ jmp s_trap_start
+
+vector111:
+ push 0x00
+ push 0x6F
+ jmp s_trap_start
+
+vector112:
+ push 0x00
+ push 0x70
+ jmp s_trap_start
+
+vector113:
+ push 0x00
+ push 0x71
+ jmp s_trap_start
+
+vector114:
+ push 0x00
+ push 0x72
+ jmp s_trap_start
+
+vector115:
+ push 0x00
+ push 0x73
+ jmp s_trap_start
+
+vector116:
+ push 0x00
+ push 0x74
+ jmp s_trap_start
+
+vector117:
+ push 0x00
+ push 0x75
+ jmp s_trap_start
+
+vector118:
+ push 0x00
+ push 0x76
+ jmp s_trap_start
+
+vector119:
+ push 0x00
+ push 0x77
+ jmp s_trap_start
+
+vector120:
+ push 0x00
+ push 0x78
+ jmp s_trap_start
+
+vector121:
+ push 0x00
+ push 0x79
+ jmp s_trap_start
+
+vector122:
+ push 0x00
+ push 0x7A
+ jmp s_trap_start
+
+vector123:
+ push 0x00
+ push 0x7B
+ jmp s_trap_start
+
+vector124:
+ push 0x00
+ push 0x7C
+ jmp s_trap_start
+
+vector125:
+ push 0x00
+ push 0x7D
+ jmp s_trap_start
+
+vector126:
+ push 0x00
+ push 0x7E
+ jmp s_trap_start
+
+vector127:
+ push 0x00
+ push 0x7F
+ jmp s_trap_start
+
+vector128:
+ push 0x00
+ push 0x80
+ jmp s_trap_start
+
+vector129:
+ push 0x00
+ push 0x81
+ jmp s_trap_start
+
+vector130:
+ push 0x00
+ push 0x82
+ jmp s_trap_start
+
+vector131:
+ push 0x00
+ push 0x83
+ jmp s_trap_start
+
+vector132:
+ push 0x00
+ push 0x84
+ jmp s_trap_start
+
+vector133:
+ push 0x00
+ push 0x85
+ jmp s_trap_start
+
+vector134:
+ push 0x00
+ push 0x86
+ jmp s_trap_start
+
+vector135:
+ push 0x00
+ push 0x87
+ jmp s_trap_start
+
+vector136:
+ push 0x00
+ push 0x88
+ jmp s_trap_start
+
+vector137:
+ push 0x00
+ push 0x89
+ jmp s_trap_start
+
+vector138:
+ push 0x00
+ push 0x8A
+ jmp s_trap_start
+
+vector139:
+ push 0x00
+ push 0x8B
+ jmp s_trap_start
+
+vector140:
+ push 0x00
+ push 0x8C
+ jmp s_trap_start
+
+vector141:
+ push 0x00
+ push 0x8D
+ jmp s_trap_start
+
+vector142:
+ push 0x00
+ push 0x8E
+ jmp s_trap_start
+
+vector143:
+ push 0x00
+ push 0x8F
+ jmp s_trap_start
+
+vector144:
+ push 0x00
+ push 0x90
+ jmp s_trap_start
+
+vector145:
+ push 0x00
+ push 0x91
+ jmp s_trap_start
+
+vector146:
+ push 0x00
+ push 0x92
+ jmp s_trap_start
+
+vector147:
+ push 0x00
+ push 0x93
+ jmp s_trap_start
+
+vector148:
+ push 0x00
+ push 0x94
+ jmp s_trap_start
+
+vector149:
+ push 0x00
+ push 0x95
+ jmp s_trap_start
+
+vector150:
+ push 0x00
+ push 0x96
+ jmp s_trap_start
+
+vector151:
+ push 0x00
+ push 0x97
+ jmp s_trap_start
+
+vector152:
+ push 0x00
+ push 0x98
+ jmp s_trap_start
+
+vector153:
+ push 0x00
+ push 0x99
+ jmp s_trap_start
+
+vector154:
+ push 0x00
+ push 0x9A
+ jmp s_trap_start
+
+vector155:
+ push 0x00
+ push 0x9B
+ jmp s_trap_start
+
+vector156:
+ push 0x00
+ push 0x9C
+ jmp s_trap_start
+
+vector157:
+ push 0x00
+ push 0x9D
+ jmp s_trap_start
+
+vector158:
+ push 0x00
+ push 0x9E
+ jmp s_trap_start
+
+vector159:
+ push 0x00
+ push 0x9F
+ jmp s_trap_start
+
+vector160:
+ push 0x00
+ push 0xA0
+ jmp s_trap_start
+
+vector161:
+ push 0x00
+ push 0xA1
+ jmp s_trap_start
+
+vector162:
+ push 0x00
+ push 0xA2
+ jmp s_trap_start
+
+vector163:
+ push 0x00
+ push 0xA3
+ jmp s_trap_start
+
+vector164:
+ push 0x00
+ push 0xA4
+ jmp s_trap_start
+
+vector165:
+ push 0x00
+ push 0xA5
+ jmp s_trap_start
+
+vector166:
+ push 0x00
+ push 0xA6
+ jmp s_trap_start
+
+vector167:
+ push 0x00
+ push 0xA7
+ jmp s_trap_start
+
+vector168:
+ push 0x00
+ push 0xA8
+ jmp s_trap_start
+
+vector169:
+ push 0x00
+ push 0xA9
+ jmp s_trap_start
+
+vector170:
+ push 0x00
+ push 0xAA
+ jmp s_trap_start
+
+vector171:
+ push 0x00
+ push 0xAB
+ jmp s_trap_start
+
+vector172:
+ push 0x00
+ push 0xAC
+ jmp s_trap_start
+
+vector173:
+ push 0x00
+ push 0xAD
+ jmp s_trap_start
+
+vector174:
+ push 0x00
+ push 0xAE
+ jmp s_trap_start
+
+vector175:
+ push 0x00
+ push 0xAF
+ jmp s_trap_start
+
+vector176:
+ push 0x00
+ push 0xB0
+ jmp s_trap_start
+
+vector177:
+ push 0x00
+ push 0xB1
+ jmp s_trap_start
+
+vector178:
+ push 0x00
+ push 0xB2
+ jmp s_trap_start
+
+vector179:
+ push 0x00
+ push 0xB3
+ jmp s_trap_start
+
+vector180:
+ push 0x00
+ push 0xB4
+ jmp s_trap_start
+
+vector181:
+ push 0x00
+ push 0xB5
+ jmp s_trap_start
+
+vector182:
+ push 0x00
+ push 0xB6
+ jmp s_trap_start
+
+vector183:
+ push 0x00
+ push 0xB7
+ jmp s_trap_start
+
+vector184:
+ push 0x00
+ push 0xB8
+ jmp s_trap_start
+
+vector185:
+ push 0x00
+ push 0xB9
+ jmp s_trap_start
+
+vector186:
+ push 0x00
+ push 0xBA
+ jmp s_trap_start
+
+vector187:
+ push 0x00
+ push 0xBB
+ jmp s_trap_start
+
+vector188:
+ push 0x00
+ push 0xBC
+ jmp s_trap_start
+
+vector189:
+ push 0x00
+ push 0xBD
+ jmp s_trap_start
+
+vector190:
+ push 0x00
+ push 0xBE
+ jmp s_trap_start
+
+vector191:
+ push 0x00
+ push 0xBF
+ jmp s_trap_start
+
+vector192:
+ push 0x00
+ push 0xC0
+ jmp s_trap_start
+
+vector193:
+ push 0x00
+ push 0xC1
+ jmp s_trap_start
+
+vector194:
+ push 0x00
+ push 0xC2
+ jmp s_trap_start
+
+vector195:
+ push 0x00
+ push 0xC3
+ jmp s_trap_start
+
+vector196:
+ push 0x00
+ push 0xC4
+ jmp s_trap_start
+
+vector197:
+ push 0x00
+ push 0xC5
+ jmp s_trap_start
+
+vector198:
+ push 0x00
+ push 0xC6
+ jmp s_trap_start
+
+vector199:
+ push 0x00
+ push 0xC7
+ jmp s_trap_start
+
+vector200:
+ push 0x00
+ push 0xC8
+ jmp s_trap_start
+
+vector201:
+ push 0x00
+ push 0xC9
+ jmp s_trap_start
+
+vector202:
+ push 0x00
+ push 0xCA
+ jmp s_trap_start
+
+vector203:
+ push 0x00
+ push 0xCB
+ jmp s_trap_start
+
+vector204:
+ push 0x00
+ push 0xCC
+ jmp s_trap_start
+
+vector205:
+ push 0x00
+ push 0xCD
+ jmp s_trap_start
+
+vector206:
+ push 0x00
+ push 0xCE
+ jmp s_trap_start
+
+vector207:
+ push 0x00
+ push 0xCF
+ jmp s_trap_start
+
+vector208:
+ push 0x00
+ push 0xD0
+ jmp s_trap_start
+
+vector209:
+ push 0x00
+ push 0xD1
+ jmp s_trap_start
+
+vector210:
+ push 0x00
+ push 0xD2
+ jmp s_trap_start
+
+vector211:
+ push 0x00
+ push 0xD3
+ jmp s_trap_start
+
+vector212:
+ push 0x00
+ push 0xD4
+ jmp s_trap_start
+
+vector213:
+ push 0x00
+ push 0xD5
+ jmp s_trap_start
+
+vector214:
+ push 0x00
+ push 0xD6
+ jmp s_trap_start
+
+vector215:
+ push 0x00
+ push 0xD7
+ jmp s_trap_start
+
+vector216:
+ push 0x00
+ push 0xD8
+ jmp s_trap_start
+
+vector217:
+ push 0x00
+ push 0xD9
+ jmp s_trap_start
+
+vector218:
+ push 0x00
+ push 0xDA
+ jmp s_trap_start
+
+vector219:
+ push 0x00
+ push 0xDB
+ jmp s_trap_start
+
+vector220:
+ push 0x00
+ push 0xDC
+ jmp s_trap_start
+
+vector221:
+ push 0x00
+ push 0xDD
+ jmp s_trap_start
+
+vector222:
+ push 0x00
+ push 0xDE
+ jmp s_trap_start
+
+vector223:
+ push 0x00
+ push 0xDF
+ jmp s_trap_start
+
+vector224:
+ push 0x00
+ push 0xE0
+ jmp s_trap_start
+
+vector225:
+ push 0x00
+ push 0xE1
+ jmp s_trap_start
+
+vector226:
+ push 0x00
+ push 0xE2
+ jmp s_trap_start
+
+vector227:
+ push 0x00
+ push 0xE3
+ jmp s_trap_start
+
+vector228:
+ push 0x00
+ push 0xE4
+ jmp s_trap_start
+
+vector229:
+ push 0x00
+ push 0xE5
+ jmp s_trap_start
+
+vector230:
+ push 0x00
+ push 0xE6
+ jmp s_trap_start
+
+vector231:
+ push 0x00
+ push 0xE7
+ jmp s_trap_start
+
+vector232:
+ push 0x00
+ push 0xE8
+ jmp s_trap_start
+
+vector233:
+ push 0x00
+ push 0xE9
+ jmp s_trap_start
+
+vector234:
+ push 0x00
+ push 0xEA
+ jmp s_trap_start
+
+vector235:
+ push 0x00
+ push 0xEB
+ jmp s_trap_start
+
+vector236:
+ push 0x00
+ push 0xEC
+ jmp s_trap_start
+
+vector237:
+ push 0x00
+ push 0xED
+ jmp s_trap_start
+
+vector238:
+ push 0x00
+ push 0xEE
+ jmp s_trap_start
+
+vector239:
+ push 0x00
+ push 0xEF
+ jmp s_trap_start
+
+vector240:
+ push 0x00
+ push 0xF0
+ jmp s_trap_start
+
+vector241:
+ push 0x00
+ push 0xF1
+ jmp s_trap_start
+
+vector242:
+ push 0x00
+ push 0xF2
+ jmp s_trap_start
+
+vector243:
+ push 0x00
+ push 0xF3
+ jmp s_trap_start
+
+vector244:
+ push 0x00
+ push 0xF4
+ jmp s_trap_start
+
+vector245:
+ push 0x00
+ push 0xF5
+ jmp s_trap_start
+
+vector246:
+ push 0x00
+ push 0xF6
+ jmp s_trap_start
+
+vector247:
+ push 0x00
+ push 0xF7
+ jmp s_trap_start
+
+vector248:
+ push 0x00
+ push 0xF8
+ jmp s_trap_start
+
+vector249:
+ push 0x00
+ push 0xF9
+ jmp s_trap_start
+
+vector250:
+ push 0x00
+ push 0xFA
+ jmp s_trap_start
+
+vector251:
+ push 0x00
+ push 0xFB
+ jmp s_trap_start
+
+vector252:
+ push 0x00
+ push 0xFC
+ jmp s_trap_start
+
+vector253:
+ push 0x00
+ push 0xFD
+ jmp s_trap_start
+
+vector254:
+ push 0x00
+ push 0xFE
+ jmp s_trap_start
+
+vector255:
+ push 0x00
+ push 0xFF
+ jmp s_trap_start
+
+
diff --git a/kernel/kernel.c b/kernel/kernel.c
new file mode 100644
index 0000000..335cfe4
--- /dev/null
+++ b/kernel/kernel.c
@@ -0,0 +1,131 @@
+
+#include <stdint.h>
+#include "kprintf.h"
+#include "gdt.h"
+#include "idt.h"
+#include "acpi.h"
+
+#include "asm_inline.h"
+
+typedef struct _OSDATA
+{
+ uint32_t Magic; // magic number to check
+
+ uint32_t FBWidth; // with of the framebuffer
+ uint32_t FBHeight; // height
+ uint32_t PixelSize; // size of each pixel(an rgb pixel might have a bigger size)
+ void * FBAddr; // address of the linear framebuffer
+
+ void * MEMMap; // pointer to the system memory map
+
+ void * RAMDisk; // pointer to a ramdisk loaded from the hdd
+
+ void* RSDP;
+} OSDATA;
+
+typedef struct _Pixel
+{
+ uint8_t B;
+ uint8_t G;
+ uint8_t R;
+ uint8_t Z;
+} Pixel;
+
+void early_serial_init()
+{
+ outb(COM1 + 1, 0x00);
+ outb(COM1 + 3, 0x80);
+ outb(COM1 + 0, 0x03);
+ outb(COM1 + 1, 0x00);
+ outb(COM1 + 3, 0x03);
+ outb(COM1 + 2, 0xC7);
+ outb(COM1 + 4, 0x0B);
+}
+
+int kmain(void * osdata)
+{
+ early_serial_init();
+
+ fldcw(0x37F);
+
+ kprintf("\n\n\n");
+ kprintf("=====================\n");
+ kprintf(" OrnitorrincOS\n");
+ kprintf("=====================\n");
+ kprintf("\n\n\n");
+ // kprintf("Hello from the kernel\n");
+ // kprintf("This is a %d complex %x test: %X\n", 1234, 1234, 1234);
+
+ uint32_t regs[4] = {0};
+ char* str = (char*)regs;
+ uint32_t rax, rbx, rcx, rdx;
+ cpuid(0, 0, &rax, &rbx, &rcx, &rdx);
+ regs[0] = rbx;
+ regs[1] = rdx;
+ regs[2] = rcx;
+ kprintf("CPU: %s\n", str);
+
+ OSDATA* data = (OSDATA*)osdata;
+
+ Pixel* fb = data->FBAddr;
+
+ // kprintf("FB Address: %p\n", fb);
+
+ {
+ int i = 0;
+ int j = 0;
+
+ for(i = 0; i < 256; ++i)
+ {
+ for(j = 0; j < 256; ++j)
+ {
+ Pixel p;
+ p.R = 0;
+ p.G = 255;
+ p.B = 0;
+ p.Z = 255;
+ fb[j + 800*i] = p; // original: 1024 but 800 seems to work better(maybe we are not setting the display mode correctly
+ }
+ }
+ }
+
+ // kprintf("image finished\n");
+
+ kprintf("\n");
+ kprintf("=> Initializing GDT\n");
+
+ cli();
+
+ init_gdt();
+
+ kprintf("=> GDT initialized\n");
+
+ kprintf("\n");
+
+ kprintf("=> Initializing IDT\n");
+
+ init_idt();
+
+ kprintf("=> IDT initialized\n");
+
+ sti();
+
+ kprintf("=> Interrupts reenabled\n");
+
+ char* test_value = (char*)0xFFFFFFFF00000000;
+ // *test_value = 'B';
+
+ XSDP* xsdt = (XSDP*)data->RSDP;
+
+ kprintf("\n");
+
+ init_acpi(xsdt);
+
+ while(1) {};
+
+ kprintf("KERNEL FINISHED\n");
+
+ hlt();
+
+ return 0;
+}
diff --git a/kernel/kprintf.c b/kernel/kprintf.c
new file mode 100644
index 0000000..20769ea
--- /dev/null
+++ b/kernel/kprintf.c
@@ -0,0 +1,259 @@
+#include <stdbool.h>
+
+#include "kprintf.h"
+
+#include "asm_inline.h"
+
+// #define KDEBUG
+
+int check_transmission() {
+ return inb(COM1 + 5) & 0x20;
+}
+
+void write_serial_char(char a) {
+ while (check_transmission() == 0);
+ outb(COM1,a);
+}
+
+void write_serial_string(const char* str)
+{
+ while(*str != '\0')
+ {
+ if(*str == '\n')
+ {
+ write_serial_char('\r');
+ }
+ write_serial_char(*str);
+ str++;
+ }
+}
+
+char* convert_U_integer(uint64_t n, uint16_t base, bool caps)
+{
+ static char* format = "0123456789abcdef";
+ static char* C_format = "0123456789ABCDEF";
+
+ static char buffer[50];
+ char *ptr;
+
+ ptr = &buffer[49];
+ *ptr = '\0';
+
+ do
+ {
+ if(caps)
+ {
+ *--ptr = C_format[n%base];
+ }
+ else
+ {
+ *--ptr = format[n%base];
+ }
+ n /= base;
+ } while(n != 0);
+
+ return ptr;
+}
+
+void kprintf(const char* str, ...)
+{
+ va_list args;
+
+ va_start(args, str);
+
+ while(*str)
+ {
+ if(*str == '%')
+ {
+ #ifdef KDEBUG
+ write_serial_string("{stradv}");
+ #endif
+ str++;
+ if(*str == 'i' || *str == 'd')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[INT]");
+ #endif
+ int32_t n = va_arg(args, int32_t);
+ char* s = convert_U_integer(n, 10, false);
+ write_serial_string(s);
+ }
+ else if(*str == 'u')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[UINT]");
+ #endif
+ uint32_t n = va_arg(args, uint32_t);
+ char* s = convert_U_integer(n, 10, false);
+ write_serial_string(s);
+ }
+ else if(*str == 'x')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[HEX]");
+ #endif
+ uint32_t n = va_arg(args, uint32_t);
+ char* s = convert_U_integer(n, 16, false);
+ write_serial_string("0x");
+ write_serial_string(s);
+ }
+ else if(*str == 'X')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[HEX]");
+ #endif
+ uint32_t n = va_arg(args, uint32_t);
+ char* s = convert_U_integer(n, 16, true);
+ write_serial_string("0x");
+ write_serial_string(s);
+ }
+ else if(*str == 'l')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[LONG]");
+ write_serial_string("{ladv}");
+ #endif
+ str++;
+ if(*str == 'i' || *str == 'd')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[INT]");
+ #endif
+ int64_t n = va_arg(args, int64_t);
+ char* s = convert_U_integer(n, 10, false);
+ write_serial_string(s);
+ }
+ else if(*str == 'u')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[UINT]");
+ #endif
+ uint64_t n = va_arg(args, uint64_t);
+ char* s = convert_U_integer(n, 10, false);
+ write_serial_string(s);
+ }
+ else if(*str == 'x')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[HEX]");
+ #endif
+ uint64_t n = va_arg(args, uint64_t);
+ char* s = convert_U_integer(n, 16, false);
+ write_serial_string("0x");
+ write_serial_string(s);
+ }
+ else if(*str == 'X')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[HEX]");
+ #endif
+ uint64_t n = va_arg(args, uint64_t);
+ char* s = convert_U_integer(n, 16, true);
+ write_serial_string("0x");
+ write_serial_string(s);
+ }
+ }
+ else if(*str == 'h')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[SHORT]");
+ write_serial_string("{ladv}");
+ #endif
+ str++;
+ if(*str == 'i' || *str == 'd')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[INT]");
+ #endif
+ int16_t n = va_arg(args, int);
+ char* s = convert_U_integer(n, 10, false);
+ write_serial_string(s);
+ }
+ else if(*str == 'u')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[UINT]");
+ #endif
+ uint16_t n = va_arg(args, int);
+ char* s = convert_U_integer(n, 10, false);
+ write_serial_string(s);
+ }
+ else if(*str == 'x')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[HEX]");
+ #endif
+ uint16_t n = va_arg(args, int);
+ char* s = convert_U_integer(n, 16, false);
+ write_serial_string("0x");
+ write_serial_string(s);
+ }
+ else if(*str == 'X')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[HEX]");
+ #endif
+ uint16_t n = va_arg(args, int);
+ char* s = convert_U_integer(n, 16, true);
+ write_serial_string("0x");
+ write_serial_string(s);
+ }
+ }
+ else if(*str == 'p')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[PTR]");
+ #endif
+ void* p = va_arg(args, void*);
+ uint64_t n = (uint64_t)p;
+ char* s = convert_U_integer(n, 16, true);
+ write_serial_string("0x");
+ write_serial_string(s);
+ }
+ else if(*str == 'c')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[CHAR]");
+ #endif
+ char c = va_arg(args, int);
+ write_serial_char(c);
+ }
+ else if(*str == 's')
+ {
+ #ifdef KDEBUG
+ write_serial_string("[STR]");
+ #endif
+ char* s = va_arg(args, char*);
+ write_serial_string(s);
+ }
+ else
+ {
+ write_serial_string("\nFailed to write malformed kprintf: ");
+ write_serial_char(*str);
+ write_serial_string("\n");
+ va_end(args);
+ return;
+ }
+ #ifdef KDEBUG
+ write_serial_string("{pend}");
+ #endif
+ }
+ else if(*str == '\n')
+ {
+ write_serial_char('\r');
+ write_serial_char('\n');
+ }
+ else
+ {
+ write_serial_char(*str);
+ }
+ #ifdef KDEBUG
+ write_serial_string("{oadv}");
+ #endif
+ str++;
+ }
+
+ //write_serial_string(str);
+
+ va_end(args);
+}
diff --git a/kernel/kprintf.h b/kernel/kprintf.h
new file mode 100644
index 0000000..f646e60
--- /dev/null
+++ b/kernel/kprintf.h
@@ -0,0 +1,3 @@
+#include <stdarg.h>
+
+void kprintf(const char* str, ...);
diff --git a/kernel/linker.ld b/kernel/linker.ld
new file mode 100644
index 0000000..43f8a15
--- /dev/null
+++ b/kernel/linker.ld
@@ -0,0 +1,51 @@
+ENTRY(loader)
+/* ENTRY(kmain) */
+
+SECTIONS
+{
+ /* 0xffffffff80000000 is the kernel virtual memory load address */
+ . = 0xffffffff80000000;
+
+ .text : AT(ADDR(.text) - 0xffffffff80000000)
+ {
+ _code = .;
+ *(.text)
+ *(.rodata*)
+ . = ALIGN(4096);
+ }
+
+ .data : AT(ADDR(.data) - 0xffffffff80000000)
+ {
+ _data = .;
+ *(.data)
+ . = ALIGN(4096);
+ }
+
+ .eh_frame : AT(ADDR(.eh_frame) - 0xffffffff80000000)
+ {
+ _ehframe = .;
+ *(.eh_frame)
+ . = ALIGN(4096);
+ }
+
+ .bss : AT(ADDR(.bss) - 0xffffffff80000000)
+ {
+ _bss = .;
+ *(.bss)
+
+ /*
+ * You usually need to include generated COMMON symbols
+ * under kernel BSS section or use gcc's -fno-common
+ */
+
+ *(COMMON)
+ . = ALIGN(4096);
+ }
+
+ _end = .;
+
+ /DISCARD/ :
+ {
+ *(.comment)
+ }
+}
diff --git a/kernel/loader.s b/kernel/loader.s
new file mode 100644
index 0000000..791c231
--- /dev/null
+++ b/kernel/loader.s
@@ -0,0 +1,32 @@
+global loader
+extern kmain
+
+section .text
+align 4
+STACKSIZE equ 0x4000
+
+
+loader:
+ ;setup the stack and call the kernel entry point
+ ; shouldn't really use it this way, but take the loading address and move that to rsp to get a working stack
+ mov rsp, stack+STACKSIZE
+ mov rbp, rsp
+
+ ; enable FPU, SSE
+ mov rax, cr0
+ and ax, 0xFFFB
+ or ax, 0x2
+ mov cr0, rax
+ mov rax, cr4
+ or ax, 3 << 9 ; OSFXSR OSXMMEXCPT
+ mov cr4, rax
+
+ ; pass arguments we receiver, or maybe have to get them first fropm the stack
+ call kmain
+ hlt
+
+
+section .bss
+align 32
+stack:
+ resb STACKSIZE
diff --git a/kernel/makefile b/kernel/makefile
new file mode 100644
index 0000000..387fc4d
--- /dev/null
+++ b/kernel/makefile
@@ -0,0 +1,25 @@
+CC = x86_64-elf-gcc
+
+.PHONY: all clean
+
+#CFLAGS = -ffreestanding -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -masm=intel
+CFLAGS = -ffreestanding -mcmodel=kernel -mno-red-zone -masm=intel
+
+all:
+ nasm loader.s -f elf64 -o loader.o
+ nasm segments.s -f elf64 -o segments.o
+ nasm interrupts/common.s -f elf64 -o interrupts/common.o
+ nasm interrupts/vectors.s -f elf64 -o interrupts/vectors.o
+ $(CC) $(CFLAGS) -c kernel.c -o kernel.o
+ $(CC) $(CFLAGS) -c kprintf.c -o kprintf.o
+ $(CC) $(CFLAGS) -c memops.c -o memops.o
+ $(CC) $(CFLAGS) -c gdt.c -o gdt.o
+ $(CC) $(CFLAGS) -c idt.c -o idt.o
+ $(CC) $(CFLAGS) -c interrupts/generic.c -o interrupts/generic.o
+ $(CC) $(CFLAGS) -c cpu_info.c -o cpu_info.o
+ $(CC) $(CFLAGS) -c acpi.c -o acpi.o
+ $(CC) -T linker.ld -o kernel.bin -ffreestanding -O0 -nostdlib kernel.o kprintf.o memops.o gdt.o loader.o segments.o idt.o interrupts/common.o interrupts/generic.o interrupts/vectors.o cpu_info.o acpi.o -lgcc
+
+clean:
+ rm *.o
+ rm kernel.bin
diff --git a/kernel/memops.c b/kernel/memops.c
new file mode 100644
index 0000000..12fae8b
--- /dev/null
+++ b/kernel/memops.c
@@ -0,0 +1,36 @@
+#include "memops.h"
+
+void kmemset(void* dst, uint8_t value)
+{
+
+}
+
+void kmemcpy(void* src, void* dst, uint64_t size)
+{
+ uint64_t counter = 0;
+
+ uint8_t* c_src = src;
+ uint8_t* c_dst = dst;
+
+ while(counter < size)
+ {
+ c_dst[counter] = c_src[counter];
+ counter++;
+ }
+}
+
+bool kmemcmp(void* lhs, void* rhs, uint64_t size)
+{
+ uint8_t* clhs = (uint8_t*)lhs;
+ uint8_t* crhs = (uint8_t*)rhs;
+
+ for(int i = 0; i < size; i++)
+ {
+ if(clhs[i] != crhs[i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
diff --git a/kernel/memops.h b/kernel/memops.h
new file mode 100644
index 0000000..e42ac29
--- /dev/null
+++ b/kernel/memops.h
@@ -0,0 +1,8 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+void kmemset(void* dst, uint8_t value);
+void kmemcpy(void* src, void* dst, uint64_t size);
+bool kmemcmp(void* lhs, void* rhs, uint64_t size);
diff --git a/kernel/segments.s b/kernel/segments.s
new file mode 100644
index 0000000..77e6502
--- /dev/null
+++ b/kernel/segments.s
@@ -0,0 +1,21 @@
+
+global asm_reload_segments
+
+section .text
+align 4
+
+asm_reload_segments:
+ push 0x08
+ lea rax, [rel .reload_cs]
+ push rax
+ retfq
+
+; 0z10 is 16 bytes in decimal, so this should reload the segment correctly
+.reload_cs:
+ mov ax, 0x10
+ mov ds, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+ mov ss, ax
+ ret \ No newline at end of file
diff --git a/kernel/uefi.h b/kernel/uefi.h
new file mode 100644
index 0000000..722dfac
--- /dev/null
+++ b/kernel/uefi.h
@@ -0,0 +1,104 @@
+#pragma once
+
+#include <stdint.h>
+
+typedef enum
+{
+ ///
+ /// Not used.
+ ///
+ EfiReservedMemoryType,
+ ///
+ /// The code portions of a loaded application.
+ /// (Note that UEFI OS loaders are UEFI applications.)
+ ///
+ EfiLoaderCode,
+ ///
+ /// The data portions of a loaded application and the default data allocation
+ /// type used by an application to allocate pool memory.
+ ///
+ EfiLoaderData,
+ ///
+ /// The code portions of a loaded Boot Services Driver.
+ ///
+ EfiBootServicesCode,
+ ///
+ /// The data portions of a loaded Boot Serves Driver, and the default data
+ /// allocation type used by a Boot Services Driver to allocate pool memory.
+ ///
+ EfiBootServicesData,
+ ///
+ /// The code portions of a loaded Runtime Services Driver.
+ ///
+ EfiRuntimeServicesCode,
+ ///
+ /// The data portions of a loaded Runtime Services Driver and the default
+ /// data allocation type used by a Runtime Services Driver to allocate pool memory.
+ ///
+ EfiRuntimeServicesData,
+ ///
+ /// Free (unallocated) memory.
+ ///
+ EfiConventionalMemory,
+ ///
+ /// Memory in which errors have been detected.
+ ///
+ EfiUnusableMemory,
+ ///
+ /// Memory that holds the ACPI tables.
+ ///
+ EfiACPIReclaimMemory,
+ ///
+ /// Address space reserved for use by the firmware.
+ ///
+ EfiACPIMemoryNVS,
+ ///
+ /// Used by system firmware to request that a memory-mapped IO region
+ /// be mapped by the OS to a virtual address so it can be accessed by EFI runtime services.
+ ///
+ EfiMemoryMappedIO,
+ ///
+ /// System memory-mapped IO region that is used to translate memory
+ /// cycles to IO cycles by the processor.
+ ///
+ EfiMemoryMappedIOPortSpace,
+ ///
+ /// Address space reserved by the firmware for code that is part of the processor.
+ ///
+ EfiPalCode,
+ ///
+ /// A memory region that operates as EfiConventionalMemory,
+ /// however it happens to also support byte-addressable non-volatility.
+ ///
+ EfiPersistentMemory,
+ ///
+ /// A memory region that describes system memory that has not been accepted
+ /// by a corresponding call to the underlying isolation architecture.
+ ///
+ EfiUnacceptedMemoryType,
+ EfiMaxMemoryType,
+ //
+ // +---------------------------------------------------+
+ // | 0..(EfiMaxMemoryType - 1) - Normal memory type |
+ // +---------------------------------------------------+
+ // | EfiMaxMemoryType..0x6FFFFFFF - Invalid |
+ // +---------------------------------------------------+
+ // | 0x70000000..0x7FFFFFFF - OEM reserved |
+ // +---------------------------------------------------+
+ // | 0x80000000..0xFFFFFFFF - OS reserved |
+ // +---------------------------------------------------+
+ //
+ MEMORY_TYPE_OEM_RESERVED_MIN = 0x70000000,
+ MEMORY_TYPE_OEM_RESERVED_MAX = 0x7FFFFFFF,
+ MEMORY_TYPE_OS_RESERVED_MIN = 0x80000000,
+ MEMORY_TYPE_OS_RESERVED_MAX = 0xFFFFFFFF
+} EFI_MEMORY_TYPE;
+
+typedef struct __attribute__((packed))
+{
+ uint32_t type;
+ uint64_t physicalStart;
+ uint64_t virtualStart;
+ uint64_t numberOfPages;
+ uint64_t Attribute;
+} EFI_MEMORY_DESCRIPTOR;
diff --git a/misc-host/ELF/ELF-loader-test/.gitignore b/misc-host/ELF/ELF-loader-test/.gitignore
new file mode 100644
index 0000000..ee4c926
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/.gitignore
@@ -0,0 +1 @@
+/test
diff --git a/misc-host/ELF/ELF-loader-test/ELF-loader-test.pro b/misc-host/ELF/ELF-loader-test/ELF-loader-test.pro
new file mode 100644
index 0000000..b945d81
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/ELF-loader-test.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+CONFIG += console
+CONFIG -= app_bundle
+CONFIG -= qt
+
+SOURCES += \
+ elfinfoprint.cpp \
+ main.cpp \
+ bootloader_compat.cpp
+
+include(deployment.pri)
+qtcAddDeployment()
+
+HEADERS += \
+ datatypes.h \
+ elf64header.h \
+ elfinfoprint.h \
+ bootloader_compat.h
+
diff --git a/misc-host/ELF/ELF-loader-test/ELF-loader-test.pro.user b/misc-host/ELF/ELF-loader-test/ELF-loader-test.pro.user
new file mode 100644
index 0000000..243fdee
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/ELF-loader-test.pro.user
@@ -0,0 +1,472 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE QtCreatorProject>
+<!-- Written by QtCreator 3.5.0, 2015-10-08T00:19:07. -->
+<qtcreator>
+ <data>
+ <variable>EnvironmentId</variable>
+ <value type="QByteArray">{2c3e9189-5d42-4938-9849-c0bb2ac935ae}</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.ActiveTarget</variable>
+ <value type="int">1</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.EditorSettings</variable>
+ <valuemap type="QVariantMap">
+ <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
+ <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
+ <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
+ <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
+ <value type="QString" key="language">Cpp</value>
+ <valuemap type="QVariantMap" key="value">
+ <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
+ </valuemap>
+ </valuemap>
+ <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
+ <value type="QString" key="language">QmlJS</value>
+ <valuemap type="QVariantMap" key="value">
+ <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
+ </valuemap>
+ </valuemap>
+ <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
+ <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
+ <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
+ <value type="int" key="EditorConfiguration.IndentSize">4</value>
+ <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
+ <value type="int" key="EditorConfiguration.MarginColumn">80</value>
+ <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
+ <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
+ <value type="int" key="EditorConfiguration.PaddingMode">1</value>
+ <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
+ <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
+ <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
+ <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
+ <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
+ <value type="int" key="EditorConfiguration.TabSize">8</value>
+ <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
+ <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
+ <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
+ <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
+ <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
+ <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.PluginSettings</variable>
+ <valuemap type="QVariantMap"/>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Target.0</variable>
+ <valuemap type="QVariantMap">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">GCC</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">GCC</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{d432c706-8e6f-4f4f-92f1-4099cda2d690}</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ornitorrincos/OS-github/misc-host/ELF/build-ELF-loader-test-GCC-Debug</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ornitorrincos/OS-github/misc-host/ELF/build-ELF-loader-test-GCC-Release</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+ <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+ <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+ <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">ELF-loader-test</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/ornitorrincos/OS-github/misc-host/ELF/ELF-loader-test/ELF-loader-test.pro</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">ELF-loader-test.pro</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
+ <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+ <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+ <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Target.1</variable>
+ <valuemap type="QVariantMap">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clang</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clang</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e689128d-986e-453c-9cd3-1600795ccd25}</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ornitorrincos/OS-github/misc-host/ELF/build-ELF-loader-test-Clang-Debug</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ornitorrincos/OS-github/misc-host/ELF/build-ELF-loader-test-Clang-Release</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
+ <value type="QString">-w</value>
+ <value type="QString">-r</value>
+ </valuelist>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+ <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+ <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+ <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">ELF-loader-test</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/ornitorrincos/OS-github/misc-host/ELF/ELF-loader-test/ELF-loader-test.pro</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">ELF-loader-test.pro</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
+ <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+ <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+ <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.TargetCount</variable>
+ <value type="int">2</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+ <value type="int">18</value>
+ </data>
+ <data>
+ <variable>Version</variable>
+ <value type="int">18</value>
+ </data>
+</qtcreator>
diff --git a/misc-host/ELF/ELF-loader-test/bootloader_compat.cpp b/misc-host/ELF/ELF-loader-test/bootloader_compat.cpp
new file mode 100644
index 0000000..038e597
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/bootloader_compat.cpp
@@ -0,0 +1,18 @@
+#include "bootloader_compat.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+UEFIPrint Print = wprintf;
+
+void * EFIAPI LoadFile(char * name, UINTN memtype)
+{
+ FILE * f = fopen(name, "rb");
+ fseek(f, 0, SEEK_END);
+ long fsize = ftell(f);
+ fseek(f, 0, SEEK_SET);
+ char * mem = (char*)malloc(fsize);
+ fread(mem, fsize, 1, f);
+ fclose(f);
+
+ return mem;
+}
diff --git a/misc-host/ELF/ELF-loader-test/bootloader_compat.h b/misc-host/ELF/ELF-loader-test/bootloader_compat.h
new file mode 100644
index 0000000..d6f56a5
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/bootloader_compat.h
@@ -0,0 +1,35 @@
+#ifndef BOOTLOADER_COMPAT_H
+#define BOOTLOADER_COMPAT_H
+
+// partial API of UEFI/bootloader
+
+#include <wchar.h>
+#include <stdint.h>
+
+#define EFIAPI
+#define IN
+#define OUT
+
+// basic UEFI datatypes
+typedef uint8_t BOOLEAN;
+typedef int8_t INT8;
+typedef uint8_t UINT8;
+typedef int16_t INT16;
+typedef uint16_t UINT16;
+typedef int32_t INT32;
+typedef uint32_t UINT32;
+typedef int64_t INT64;
+typedef uint64_t UINT64;
+typedef char CHAR8;
+typedef wchar_t CHAR16;
+typedef uint64_t UINTN;
+
+// UEFI native functions
+typedef int (*UEFIPrint)(const wchar_t *, ...);
+extern UEFIPrint Print;
+
+// Bootloader defined
+void * EFIAPI LoadFile(char * name, UINTN memtype);
+
+#endif // BOOTLOADER_COMPAT_H
+
diff --git a/misc-host/ELF/ELF-loader-test/datatypes.h b/misc-host/ELF/ELF-loader-test/datatypes.h
new file mode 100644
index 0000000..b50c3c8
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/datatypes.h
@@ -0,0 +1,16 @@
+#ifndef DATATYPES_H
+#define DATATYPES_H
+
+#include <stdint.h>
+
+// sizes as defined in the System V ABI
+typedef uint16_t Elf64_Half;
+typedef uint64_t Elf64_Off;
+typedef uint64_t Elf64_Addr;
+typedef int32_t Elf64_Word;
+typedef uint64_t Elf64_Xword;
+
+
+
+#endif // DATATYPES_H
+
diff --git a/misc-host/ELF/ELF-loader-test/deployment.pri b/misc-host/ELF/ELF-loader-test/deployment.pri
new file mode 100644
index 0000000..5f1749f
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/deployment.pri
@@ -0,0 +1,191 @@
+# This file was generated by an application wizard of Qt Creator.
+# The code below handles deployment to Android and Maemo, aswell as copying
+# of the application data to shadow build directories on desktop.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+defineTest(qtcAddDeployment) {
+for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ greaterThan(QT_MAJOR_VERSION, 4) {
+ itemsources = $${item}.files
+ } else {
+ itemsources = $${item}.sources
+ }
+ $$itemsources = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath= $$eval($${deploymentfolder}.target)
+ export($$itemsources)
+ export($$itempath)
+ DEPLOYMENT += $$item
+}
+
+MAINPROFILEPWD = $$PWD
+
+android-no-sdk {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ target.path = /data/user/qt
+
+ export(target.path)
+ INSTALLS += target
+} else:android {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /assets/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ x86 {
+ target.path = /libs/x86
+ } else: armeabi-v7a {
+ target.path = /libs/armeabi-v7a
+ } else {
+ target.path = /libs/armeabi
+ }
+
+ export(target.path)
+ INSTALLS += target
+} else:win32 {
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, /, \\)
+ sourcePathSegments = $$split(source, \\)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
+ target = $$replace(target, /, \\)
+ target ~= s,\\\\\\.?\\\\,\\,
+ !isEqual(source,$$target) {
+ !isEmpty(copyCommand):copyCommand += &&
+ isEqual(QMAKE_DIR_SEP, \\) {
+ copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
+ } else {
+ source = $$replace(source, \\\\, /)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ target = $$replace(target, \\\\, /)
+ copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
+ }
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+} else:ios {
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, \\\\, /)
+ target = $CODESIGNING_FOLDER_PATH/$$eval($${deploymentfolder}.target)
+ target = $$replace(target, \\\\, /)
+ sourcePathSegments = $$split(source, /)
+ targetFullPath = $$target/$$last(sourcePathSegments)
+ targetFullPath ~= s,/\\.?/,/,
+ !isEqual(source,$$targetFullPath) {
+ !isEmpty(copyCommand):copyCommand += &&
+ copyCommand += mkdir -p \"$$target\"
+ copyCommand += && cp -r \"$$source\" \"$$target\"
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = echo Copying application data... && $$copyCommand
+ !isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";"
+ QMAKE_POST_LINK += "$$copyCommand"
+ export(QMAKE_POST_LINK)
+ }
+} else:unix {
+ maemo5 {
+ desktopfile.files = $${TARGET}.desktop
+ desktopfile.path = /usr/share/applications/hildon
+ icon.files = $${TARGET}64.png
+ icon.path = /usr/share/icons/hicolor/64x64/apps
+ } else:!isEmpty(MEEGO_VERSION_MAJOR) {
+ desktopfile.files = $${TARGET}_harmattan.desktop
+ desktopfile.path = /usr/share/applications
+ icon.files = $${TARGET}80.png
+ icon.path = /usr/share/icons/hicolor/80x80/apps
+ } else { # Assumed to be a Desktop Unix
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, \\\\, /)
+ macx {
+ target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
+ } else {
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ }
+ target = $$replace(target, \\\\, /)
+ sourcePathSegments = $$split(source, /)
+ targetFullPath = $$target/$$last(sourcePathSegments)
+ targetFullPath ~= s,/\\.?/,/,
+ !isEqual(source,$$targetFullPath) {
+ !isEmpty(copyCommand):copyCommand += &&
+ copyCommand += $(MKDIR) \"$$target\"
+ copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+ }
+ !isEmpty(target.path) {
+ installPrefix = $${target.path}
+ } else {
+ installPrefix = /opt/$${TARGET}
+ }
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ !isEmpty(desktopfile.path) {
+ export(icon.files)
+ export(icon.path)
+ export(desktopfile.files)
+ export(desktopfile.path)
+ INSTALLS += icon desktopfile
+ }
+
+ isEmpty(target.path) {
+ target.path = $${installPrefix}/bin
+ export(target.path)
+ }
+ INSTALLS += target
+}
+
+export (ICON)
+export (INSTALLS)
+export (DEPLOYMENT)
+export (LIBS)
+export (QMAKE_EXTRA_TARGETS)
+}
+
diff --git a/misc-host/ELF/ELF-loader-test/elf64header.h b/misc-host/ELF/ELF-loader-test/elf64header.h
new file mode 100644
index 0000000..ed83168
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/elf64header.h
@@ -0,0 +1,97 @@
+#ifndef ELF64HEADER_H
+#define ELF64HEADER_H
+
+#include "datatypes.h"
+
+#define EI_NIDENT 16
+
+// ELF header
+typedef struct {
+ unsigned char e_ident[EI_NIDENT];
+ Elf64_Half e_type;
+ Elf64_Half e_machine;
+ Elf64_Word e_version;
+ Elf64_Addr e_entry;
+ Elf64_Off e_phoff;
+ Elf64_Off e_shoff;
+ Elf64_Word e_flags;
+ Elf64_Half e_ehsize;
+ Elf64_Half e_phentsize;
+ Elf64_Half e_phnum;
+ Elf64_Half e_shentsize;
+ Elf64_Half e_shnum;
+ Elf64_Half e_shstrndx;
+} Elf64_Ehdr;
+
+// Section header
+typedef struct {
+ Elf64_Word sh_name;
+ Elf64_Word sh_type;
+ Elf64_Xword sh_flags;
+ Elf64_Addr sh_addr;
+ Elf64_Off sh_offset;
+ Elf64_Xword sh_size;
+ Elf64_Word sh_link;
+ Elf64_Word sh_info;
+ Elf64_Xword sh_addralign;
+ Elf64_Xword sh_entsize;
+} Elf64_Shdr;
+
+// indentification struct
+enum Elf_Ident {
+ EI_MAG0 = 0, // 0x7F
+ EI_MAG1 = 1, // 'E'
+ EI_MAG2 = 2, // 'L'
+ EI_MAG3 = 3, // 'F'
+ EI_CLASS = 4, // Architecture (32/64)
+ EI_DATA = 5, // Byte Order
+ EI_VERSION = 6, // ELF Version
+ EI_OSABI = 7, // OS Specific
+ EI_ABIVERSION = 8, // OS Specific
+ EI_PAD = 9 // Padding
+};
+
+// MAgic Numbers
+#define ELFMAG0 0x7F
+#define ELFMAG1 'E'
+#define ELFMAG2 'L'
+#define ELFMAG3 'F'
+
+#define ELFCLASS64 2
+
+
+enum Elf_Type {
+ ET_NONE = 0, // Unkown Type
+ ET_REL = 1, // Relocatable File
+ ET_EXEC = 2 // Executable File
+};
+
+
+// Machine
+#define EM_X86_64 62
+
+// version
+#define EV_CURRENT 1
+
+// Section header specific values
+# define SHN_UNDEF (0x00) // Undefined/Not present
+
+enum ShT_Types {
+ SHT_NULL = 0,
+ SHT_PROGBITS = 1,
+ SHT_SYMTAB = 2,
+ SHT_STRTAB = 3,
+ SHT_RELA = 4,
+ SHT_NOBITS = 8,
+ SHT_REL = 9,
+};
+
+enum ShT_Attributes {
+ SHF_WRITE = 0x01,
+ SHF_ALLOC = 0x02
+};
+
+
+
+#endif // ELF64HEADER_H
+
diff --git a/misc-host/ELF/ELF-loader-test/elfinfoprint.cpp b/misc-host/ELF/ELF-loader-test/elfinfoprint.cpp
new file mode 100644
index 0000000..d5dcbfd
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/elfinfoprint.cpp
@@ -0,0 +1,74 @@
+#include "elfinfoprint.h"
+
+#include "bootloader_compat.h"
+
+
+bool IsElf(Elf64_Ehdr * header)
+{
+ if(!header)
+ {
+ return false;
+ }
+
+ if(header->e_ident[EI_MAG0] != ELFMAG0) {
+ return false;
+ }
+ if(header->e_ident[EI_MAG1] != ELFMAG1) {
+ return false;
+ }
+ if(header->e_ident[EI_MAG2] != ELFMAG2) {
+ return false;
+ }
+ if(header->e_ident[EI_MAG3] != ELFMAG3) {
+ return false;
+ }
+
+ return true;
+}
+
+void ElfInfoPrint(Elf64_Ehdr * header)
+{
+ // check if actual elf file
+ if(!IsElf(header))
+ {
+ Print(L"Not an ELF File\n");
+ return;
+ }
+
+ if(header->e_type == ET_EXEC)
+ {
+ Print(L"Executable file\n");
+ }
+
+ if(header->e_machine == EM_X86_64)
+ {
+ Print(L"AMD64 Machine\n");
+ } else
+ {
+ Print(L"Unrecorginzed Machine\n");
+ }
+
+ Print(L"Entry point: hx%x\n", header->e_entry);
+
+
+ char * strtable = elf_str_table(header);
+ Print(L"%s\n", strtable);
+}
+
+// functions to access section headers
+Elf64_Shdr *elf_sheader(Elf64_Ehdr *hdr)
+{
+ return (Elf64_Shdr *)((uintptr_t)hdr + hdr->e_shoff);
+}
+
+Elf64_Shdr *elf_section(Elf64_Ehdr *hdr, int idx)
+{
+ return &elf_sheader(hdr)[idx];
+}
+
+char *elf_str_table(Elf64_Ehdr *hdr)
+{
+ if(hdr->e_shstrndx == SHN_UNDEF) return NULL;
+ return (char *)hdr + elf_section(hdr, hdr->e_shstrndx)->sh_offset;
+}
+
diff --git a/misc-host/ELF/ELF-loader-test/elfinfoprint.h b/misc-host/ELF/ELF-loader-test/elfinfoprint.h
new file mode 100644
index 0000000..2f61860
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/elfinfoprint.h
@@ -0,0 +1,12 @@
+#ifndef ELFINFOPRINT_H
+#define ELFINFOPRINT_H
+
+
+#include "elf64header.h"
+
+void ElfInfoPrint(Elf64_Ehdr * header);
+
+Elf64_Shdr *elf_sheader(Elf64_Ehdr *hdr);
+Elf64_Shdr *elf_section(Elf64_Ehdr *hdr, int idx);
+char *elf_str_table(Elf64_Ehdr *hdr);
+#endif // ELFINFOPRINT_H
diff --git a/misc-host/ELF/ELF-loader-test/main.cpp b/misc-host/ELF/ELF-loader-test/main.cpp
new file mode 100644
index 0000000..30b44bf
--- /dev/null
+++ b/misc-host/ELF/ELF-loader-test/main.cpp
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include "bootloader_compat.h"
+#include "elfinfoprint.h"
+
+int main(void)
+{
+ void * kernel = LoadFile("kernel.bin", 0);
+
+ ElfInfoPrint((Elf64_Ehdr *)kernel);
+ return 0;
+}
+
diff --git a/misc-host/ELF/build-ELF-loader-test-Clang-Debug/.gitignore b/misc-host/ELF/build-ELF-loader-test-Clang-Debug/.gitignore
new file mode 100644
index 0000000..746693d
--- /dev/null
+++ b/misc-host/ELF/build-ELF-loader-test-Clang-Debug/.gitignore
@@ -0,0 +1,2 @@
+/ELF-loader-test
+*.bin
diff --git a/misc-host/ELF/build-ELF-loader-test-Clang-Debug/Makefile b/misc-host/ELF/build-ELF-loader-test-Clang-Debug/Makefile
new file mode 100644
index 0000000..7edeff9
--- /dev/null
+++ b/misc-host/ELF/build-ELF-loader-test-Clang-Debug/Makefile
@@ -0,0 +1,590 @@
+#############################################################################
+# Makefile for building: ELF-loader-test
+# Generated by qmake (3.0) (Qt 5.5.0)
+# Project: ../ELF-loader-test/ELF-loader-test.pro
+# Template: app
+# Command: /usr/lib/qt/bin/qmake -spec linux-clang CONFIG+=debug -o Makefile ../ELF-loader-test/ELF-loader-test.pro
+#############################################################################
+
+MAKEFILE = Makefile
+
+####### Compiler, tools and options
+
+CC = clang
+CXX = clang++
+DEFINES =
+CFLAGS = -pipe -g -Wall -W -fPIC $(DEFINES)
+CXXFLAGS = -pipe -g -Wall -W -fPIC $(DEFINES)
+INCPATH = -I../ELF-loader-test -I. -I/usr/lib/qt/mkspecs/linux-clang
+QMAKE = /usr/lib/qt/bin/qmake
+DEL_FILE = rm -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+COPY = cp -f
+COPY_FILE = cp -f
+COPY_DIR = cp -f -R
+INSTALL_FILE = install -m 644 -p
+INSTALL_PROGRAM = install -m 755 -p
+INSTALL_DIR = cp -f -R
+DEL_FILE = rm -f
+SYMLINK = ln -f -s
+DEL_DIR = rmdir
+MOVE = mv -f
+TAR = tar -cf
+COMPRESS = gzip -9f
+DISTNAME = ELF-loader-test1.0.0
+DISTDIR = /home/ornitorrincos/OS-github/misc-host/ELF/build-ELF-loader-test-Clang-Debug/.tmp/ELF-loader-test1.0.0
+LINK = clang++
+LFLAGS = -ccc-gcc-name g++
+LIBS = $(SUBLIBS)
+AR = ar cqs
+RANLIB =
+SED = sed
+STRIP = strip
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = ../ELF-loader-test/elfinfoprint.cpp \
+ ../ELF-loader-test/main.cpp \
+ ../ELF-loader-test/bootloader_compat.cpp
+OBJECTS = elfinfoprint.o \
+ main.o \
+ bootloader_compat.o
+DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \
+ /usr/lib/qt/mkspecs/common/unix.conf \
+ /usr/lib/qt/mkspecs/common/linux.conf \
+ /usr/lib/qt/mkspecs/common/sanitize.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base-unix.conf \
+ /usr/lib/qt/mkspecs/common/clang.conf \
+ /usr/lib/qt/mkspecs/qconfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Attica.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KActivities.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KArchive.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KAuth.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCrash.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KI18n.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KParts.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPty.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KService.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWallet.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \
+ /usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Solid.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \
+ /usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri \
+ /usr/lib/qt/mkspecs/features/qt_functions.prf \
+ /usr/lib/qt/mkspecs/features/qt_config.prf \
+ /usr/lib/qt/mkspecs/linux-clang/qmake.conf \
+ /usr/lib/qt/mkspecs/features/spec_post.prf \
+ /usr/lib/qt/mkspecs/features/exclusive_builds.prf \
+ /usr/lib/qt/mkspecs/features/default_pre.prf \
+ ../ELF-loader-test/deployment.pri \
+ /usr/lib/qt/mkspecs/features/resolve_config.prf \
+ /usr/lib/qt/mkspecs/features/default_post.prf \
+ /usr/lib/qt/mkspecs/features/warn_on.prf \
+ /usr/lib/qt/mkspecs/features/testcase_targets.prf \
+ /usr/lib/qt/mkspecs/features/exceptions.prf \
+ /usr/lib/qt/mkspecs/features/yacc.prf \
+ /usr/lib/qt/mkspecs/features/lex.prf \
+ ../ELF-loader-test/ELF-loader-test.pro datatypes.h \
+ elf64header.h \
+ elfinfoprint.h \
+ bootloader_compat.h ../ELF-loader-test/elfinfoprint.cpp \
+ ../ELF-loader-test/main.cpp \
+ ../ELF-loader-test/bootloader_compat.cpp
+QMAKE_TARGET = ELF-loader-test
+DESTDIR = #avoid trailing-slash linebreak
+TARGET = ELF-loader-test
+
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+$(TARGET): $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: ../ELF-loader-test/ELF-loader-test.pro /usr/lib/qt/mkspecs/linux-clang/qmake.conf /usr/lib/qt/mkspecs/features/spec_pre.prf \
+ /usr/lib/qt/mkspecs/common/unix.conf \
+ /usr/lib/qt/mkspecs/common/linux.conf \
+ /usr/lib/qt/mkspecs/common/sanitize.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base-unix.conf \
+ /usr/lib/qt/mkspecs/common/clang.conf \
+ /usr/lib/qt/mkspecs/qconfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Attica.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KActivities.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KArchive.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KAuth.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCrash.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KI18n.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KParts.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPty.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KService.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWallet.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \
+ /usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Solid.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \
+ /usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri \
+ /usr/lib/qt/mkspecs/features/qt_functions.prf \
+ /usr/lib/qt/mkspecs/features/qt_config.prf \
+ /usr/lib/qt/mkspecs/linux-clang/qmake.conf \
+ /usr/lib/qt/mkspecs/features/spec_post.prf \
+ /usr/lib/qt/mkspecs/features/exclusive_builds.prf \
+ /usr/lib/qt/mkspecs/features/default_pre.prf \
+ ../ELF-loader-test/deployment.pri \
+ /usr/lib/qt/mkspecs/features/resolve_config.prf \
+ /usr/lib/qt/mkspecs/features/default_post.prf \
+ /usr/lib/qt/mkspecs/features/warn_on.prf \
+ /usr/lib/qt/mkspecs/features/testcase_targets.prf \
+ /usr/lib/qt/mkspecs/features/exceptions.prf \
+ /usr/lib/qt/mkspecs/features/yacc.prf \
+ /usr/lib/qt/mkspecs/features/lex.prf \
+ ../ELF-loader-test/ELF-loader-test.pro
+ $(QMAKE) -spec linux-clang CONFIG+=debug -o Makefile ../ELF-loader-test/ELF-loader-test.pro
+/usr/lib/qt/mkspecs/features/spec_pre.prf:
+/usr/lib/qt/mkspecs/common/unix.conf:
+/usr/lib/qt/mkspecs/common/linux.conf:
+/usr/lib/qt/mkspecs/common/sanitize.conf:
+/usr/lib/qt/mkspecs/common/gcc-base.conf:
+/usr/lib/qt/mkspecs/common/gcc-base-unix.conf:
+/usr/lib/qt/mkspecs/common/clang.conf:
+/usr/lib/qt/mkspecs/qconfig.pri:
+/usr/lib/qt/mkspecs/modules/qt_Attica.pri:
+/usr/lib/qt/mkspecs/modules/qt_KActivities.pri:
+/usr/lib/qt/mkspecs/modules/qt_KArchive.pri:
+/usr/lib/qt/mkspecs/modules/qt_KAuth.pri:
+/usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCodecs.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCompletion.pri:
+/usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri:
+/usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri:
+/usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCrash.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri:
+/usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri:
+/usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KI18n.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIOCore.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KItemModels.pri:
+/usr/lib/qt/mkspecs/modules/qt_KItemViews.pri:
+/usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNotifications.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNTLM.pri:
+/usr/lib/qt/mkspecs/modules/qt_KParts.pri:
+/usr/lib/qt/mkspecs/modules/qt_KPlotting.pri:
+/usr/lib/qt/mkspecs/modules/qt_KPty.pri:
+/usr/lib/qt/mkspecs/modules/qt_KService.pri:
+/usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri:
+/usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri:
+/usr/lib/qt/mkspecs/modules/qt_KWallet.pri:
+/usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri:
+/usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_core.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_designer.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_gui.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_help.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_location.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_network.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qml.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quick.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_script.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sql.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_svg.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xml.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri:
+/usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_Solid.pri:
+/usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri:
+/usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri:
+/usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri:
+/usr/lib/qt/mkspecs/features/qt_functions.prf:
+/usr/lib/qt/mkspecs/features/qt_config.prf:
+/usr/lib/qt/mkspecs/linux-clang/qmake.conf:
+/usr/lib/qt/mkspecs/features/spec_post.prf:
+/usr/lib/qt/mkspecs/features/exclusive_builds.prf:
+/usr/lib/qt/mkspecs/features/default_pre.prf:
+../ELF-loader-test/deployment.pri:
+/usr/lib/qt/mkspecs/features/resolve_config.prf:
+/usr/lib/qt/mkspecs/features/default_post.prf:
+/usr/lib/qt/mkspecs/features/warn_on.prf:
+/usr/lib/qt/mkspecs/features/testcase_targets.prf:
+/usr/lib/qt/mkspecs/features/exceptions.prf:
+/usr/lib/qt/mkspecs/features/yacc.prf:
+/usr/lib/qt/mkspecs/features/lex.prf:
+../ELF-loader-test/ELF-loader-test.pro:
+qmake: FORCE
+ @$(QMAKE) -spec linux-clang CONFIG+=debug -o Makefile ../ELF-loader-test/ELF-loader-test.pro
+
+qmake_all: FORCE
+
+
+all: Makefile $(TARGET)
+
+dist: distdir FORCE
+ (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
+
+distdir: FORCE
+ @test -d $(DISTDIR) || mkdir -p $(DISTDIR)
+ $(COPY_FILE) --parents $(DIST) $(DISTDIR)/
+
+
+clean: compiler_clean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+distclean: clean
+ -$(DEL_FILE) $(TARGET)
+ -$(DEL_FILE) Makefile
+
+
+####### Sub-libraries
+
+check: first
+
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean:
+
+####### Compile
+
+elfinfoprint.o: ../ELF-loader-test/elfinfoprint.cpp ../ELF-loader-test/elfinfoprint.h \
+ ../ELF-loader-test/elf64header.h \
+ ../ELF-loader-test/datatypes.h \
+ ../ELF-loader-test/bootloader_compat.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o elfinfoprint.o ../ELF-loader-test/elfinfoprint.cpp
+
+main.o: ../ELF-loader-test/main.cpp ../ELF-loader-test/bootloader_compat.h \
+ ../ELF-loader-test/elfinfoprint.h \
+ ../ELF-loader-test/elf64header.h \
+ ../ELF-loader-test/datatypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../ELF-loader-test/main.cpp
+
+bootloader_compat.o: ../ELF-loader-test/bootloader_compat.cpp ../ELF-loader-test/bootloader_compat.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o bootloader_compat.o ../ELF-loader-test/bootloader_compat.cpp
+
+####### Install
+
+install_target: first FORCE
+ @test -d $(INSTALL_ROOT)/opt/ELF-loader-test/bin || mkdir -p $(INSTALL_ROOT)/opt/ELF-loader-test/bin
+ -$(INSTALL_PROGRAM) $(QMAKE_TARGET) $(INSTALL_ROOT)/opt/ELF-loader-test/bin/$(QMAKE_TARGET)
+
+uninstall_target: FORCE
+ -$(DEL_FILE) $(INSTALL_ROOT)/opt/ELF-loader-test/bin/$(QMAKE_TARGET)
+ -$(DEL_DIR) $(INSTALL_ROOT)/opt/ELF-loader-test/bin/
+
+
+install: install_target FORCE
+
+uninstall: uninstall_target FORCE
+
+FORCE:
+
diff --git a/misc-host/ELF/build-ELF-loader-test-GCC-Debug/Makefile b/misc-host/ELF/build-ELF-loader-test-GCC-Debug/Makefile
new file mode 100644
index 0000000..91c7b80
--- /dev/null
+++ b/misc-host/ELF/build-ELF-loader-test-GCC-Debug/Makefile
@@ -0,0 +1,593 @@
+#############################################################################
+# Makefile for building: ELF-loader-test
+# Generated by qmake (3.0) (Qt 5.5.0)
+# Project: ../ELF-loader-test/ELF-loader-test.pro
+# Template: app
+# Command: /usr/lib/qt/bin/qmake -spec linux-g++ CONFIG+=debug -o Makefile ../ELF-loader-test/ELF-loader-test.pro
+#############################################################################
+
+MAKEFILE = Makefile
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+DEFINES =
+CFLAGS = -pipe -g -Wall -W -fPIC $(DEFINES)
+CXXFLAGS = -pipe -g -Wall -W -fPIC $(DEFINES)
+INCPATH = -I../ELF-loader-test -I. -I/usr/lib/qt/mkspecs/linux-g++
+QMAKE = /usr/lib/qt/bin/qmake
+DEL_FILE = rm -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+COPY = cp -f
+COPY_FILE = cp -f
+COPY_DIR = cp -f -R
+INSTALL_FILE = install -m 644 -p
+INSTALL_PROGRAM = install -m 755 -p
+INSTALL_DIR = cp -f -R
+DEL_FILE = rm -f
+SYMLINK = ln -f -s
+DEL_DIR = rmdir
+MOVE = mv -f
+TAR = tar -cf
+COMPRESS = gzip -9f
+DISTNAME = ELF-loader-test1.0.0
+DISTDIR = /home/ornitorrincos/OS-github/misc-host/ELF/build-ELF-loader-test-GCC-Debug/.tmp/ELF-loader-test1.0.0
+LINK = g++
+LFLAGS =
+LIBS = $(SUBLIBS)
+AR = ar cqs
+RANLIB =
+SED = sed
+STRIP = strip
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = ../ELF-loader-test/elfinfoprint.cpp \
+ ../ELF-loader-test/main.cpp \
+ ../ELF-loader-test/bootloader_compat.cpp
+OBJECTS = elfinfoprint.o \
+ main.o \
+ bootloader_compat.o
+DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \
+ /usr/lib/qt/mkspecs/common/unix.conf \
+ /usr/lib/qt/mkspecs/common/linux.conf \
+ /usr/lib/qt/mkspecs/common/sanitize.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base-unix.conf \
+ /usr/lib/qt/mkspecs/common/g++-base.conf \
+ /usr/lib/qt/mkspecs/common/g++-unix.conf \
+ /usr/lib/qt/mkspecs/qconfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Attica.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KActivities.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KArchive.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KAuth.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCrash.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KI18n.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KParts.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPty.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KService.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWallet.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \
+ /usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Solid.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \
+ /usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri \
+ /usr/lib/qt/mkspecs/features/qt_functions.prf \
+ /usr/lib/qt/mkspecs/features/qt_config.prf \
+ /usr/lib/qt/mkspecs/linux-g++/qmake.conf \
+ /usr/lib/qt/mkspecs/features/spec_post.prf \
+ /usr/lib/qt/mkspecs/features/exclusive_builds.prf \
+ /usr/lib/qt/mkspecs/features/default_pre.prf \
+ ../ELF-loader-test/deployment.pri \
+ /usr/lib/qt/mkspecs/features/resolve_config.prf \
+ /usr/lib/qt/mkspecs/features/default_post.prf \
+ /usr/lib/qt/mkspecs/features/warn_on.prf \
+ /usr/lib/qt/mkspecs/features/testcase_targets.prf \
+ /usr/lib/qt/mkspecs/features/exceptions.prf \
+ /usr/lib/qt/mkspecs/features/yacc.prf \
+ /usr/lib/qt/mkspecs/features/lex.prf \
+ ../ELF-loader-test/ELF-loader-test.pro datatypes.h \
+ elf64header.h \
+ elfinfoprint.h \
+ bootloader_compat.h ../ELF-loader-test/elfinfoprint.cpp \
+ ../ELF-loader-test/main.cpp \
+ ../ELF-loader-test/bootloader_compat.cpp
+QMAKE_TARGET = ELF-loader-test
+DESTDIR = #avoid trailing-slash linebreak
+TARGET = ELF-loader-test
+
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+$(TARGET): $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: ../ELF-loader-test/ELF-loader-test.pro /usr/lib/qt/mkspecs/linux-g++/qmake.conf /usr/lib/qt/mkspecs/features/spec_pre.prf \
+ /usr/lib/qt/mkspecs/common/unix.conf \
+ /usr/lib/qt/mkspecs/common/linux.conf \
+ /usr/lib/qt/mkspecs/common/sanitize.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base-unix.conf \
+ /usr/lib/qt/mkspecs/common/g++-base.conf \
+ /usr/lib/qt/mkspecs/common/g++-unix.conf \
+ /usr/lib/qt/mkspecs/qconfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Attica.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KActivities.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KArchive.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KAuth.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCrash.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KI18n.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KParts.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPty.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KService.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWallet.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \
+ /usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Solid.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \
+ /usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri \
+ /usr/lib/qt/mkspecs/features/qt_functions.prf \
+ /usr/lib/qt/mkspecs/features/qt_config.prf \
+ /usr/lib/qt/mkspecs/linux-g++/qmake.conf \
+ /usr/lib/qt/mkspecs/features/spec_post.prf \
+ /usr/lib/qt/mkspecs/features/exclusive_builds.prf \
+ /usr/lib/qt/mkspecs/features/default_pre.prf \
+ ../ELF-loader-test/deployment.pri \
+ /usr/lib/qt/mkspecs/features/resolve_config.prf \
+ /usr/lib/qt/mkspecs/features/default_post.prf \
+ /usr/lib/qt/mkspecs/features/warn_on.prf \
+ /usr/lib/qt/mkspecs/features/testcase_targets.prf \
+ /usr/lib/qt/mkspecs/features/exceptions.prf \
+ /usr/lib/qt/mkspecs/features/yacc.prf \
+ /usr/lib/qt/mkspecs/features/lex.prf \
+ ../ELF-loader-test/ELF-loader-test.pro
+ $(QMAKE) -spec linux-g++ CONFIG+=debug -o Makefile ../ELF-loader-test/ELF-loader-test.pro
+/usr/lib/qt/mkspecs/features/spec_pre.prf:
+/usr/lib/qt/mkspecs/common/unix.conf:
+/usr/lib/qt/mkspecs/common/linux.conf:
+/usr/lib/qt/mkspecs/common/sanitize.conf:
+/usr/lib/qt/mkspecs/common/gcc-base.conf:
+/usr/lib/qt/mkspecs/common/gcc-base-unix.conf:
+/usr/lib/qt/mkspecs/common/g++-base.conf:
+/usr/lib/qt/mkspecs/common/g++-unix.conf:
+/usr/lib/qt/mkspecs/qconfig.pri:
+/usr/lib/qt/mkspecs/modules/qt_Attica.pri:
+/usr/lib/qt/mkspecs/modules/qt_KActivities.pri:
+/usr/lib/qt/mkspecs/modules/qt_KArchive.pri:
+/usr/lib/qt/mkspecs/modules/qt_KAuth.pri:
+/usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCodecs.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCompletion.pri:
+/usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri:
+/usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri:
+/usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCrash.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri:
+/usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri:
+/usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KI18n.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIOCore.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KItemModels.pri:
+/usr/lib/qt/mkspecs/modules/qt_KItemViews.pri:
+/usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNotifications.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNTLM.pri:
+/usr/lib/qt/mkspecs/modules/qt_KParts.pri:
+/usr/lib/qt/mkspecs/modules/qt_KPlotting.pri:
+/usr/lib/qt/mkspecs/modules/qt_KPty.pri:
+/usr/lib/qt/mkspecs/modules/qt_KService.pri:
+/usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri:
+/usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri:
+/usr/lib/qt/mkspecs/modules/qt_KWallet.pri:
+/usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri:
+/usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_core.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_designer.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_gui.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_help.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_location.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_network.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qml.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quick.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_script.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sql.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_svg.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xml.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri:
+/usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_Solid.pri:
+/usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri:
+/usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri:
+/usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri:
+/usr/lib/qt/mkspecs/features/qt_functions.prf:
+/usr/lib/qt/mkspecs/features/qt_config.prf:
+/usr/lib/qt/mkspecs/linux-g++/qmake.conf:
+/usr/lib/qt/mkspecs/features/spec_post.prf:
+/usr/lib/qt/mkspecs/features/exclusive_builds.prf:
+/usr/lib/qt/mkspecs/features/default_pre.prf:
+../ELF-loader-test/deployment.pri:
+/usr/lib/qt/mkspecs/features/resolve_config.prf:
+/usr/lib/qt/mkspecs/features/default_post.prf:
+/usr/lib/qt/mkspecs/features/warn_on.prf:
+/usr/lib/qt/mkspecs/features/testcase_targets.prf:
+/usr/lib/qt/mkspecs/features/exceptions.prf:
+/usr/lib/qt/mkspecs/features/yacc.prf:
+/usr/lib/qt/mkspecs/features/lex.prf:
+../ELF-loader-test/ELF-loader-test.pro:
+qmake: FORCE
+ @$(QMAKE) -spec linux-g++ CONFIG+=debug -o Makefile ../ELF-loader-test/ELF-loader-test.pro
+
+qmake_all: FORCE
+
+
+all: Makefile $(TARGET)
+
+dist: distdir FORCE
+ (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
+
+distdir: FORCE
+ @test -d $(DISTDIR) || mkdir -p $(DISTDIR)
+ $(COPY_FILE) --parents $(DIST) $(DISTDIR)/
+
+
+clean: compiler_clean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+distclean: clean
+ -$(DEL_FILE) $(TARGET)
+ -$(DEL_FILE) Makefile
+
+
+####### Sub-libraries
+
+check: first
+
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean:
+
+####### Compile
+
+elfinfoprint.o: ../ELF-loader-test/elfinfoprint.cpp ../ELF-loader-test/elfinfoprint.h \
+ ../ELF-loader-test/elf64header.h \
+ ../ELF-loader-test/datatypes.h \
+ ../ELF-loader-test/bootloader_compat.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o elfinfoprint.o ../ELF-loader-test/elfinfoprint.cpp
+
+main.o: ../ELF-loader-test/main.cpp ../ELF-loader-test/bootloader_compat.h \
+ ../ELF-loader-test/elfinfoprint.h \
+ ../ELF-loader-test/elf64header.h \
+ ../ELF-loader-test/datatypes.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../ELF-loader-test/main.cpp
+
+bootloader_compat.o: ../ELF-loader-test/bootloader_compat.cpp ../ELF-loader-test/bootloader_compat.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o bootloader_compat.o ../ELF-loader-test/bootloader_compat.cpp
+
+####### Install
+
+install_target: first FORCE
+ @test -d $(INSTALL_ROOT)/opt/ELF-loader-test/bin || mkdir -p $(INSTALL_ROOT)/opt/ELF-loader-test/bin
+ -$(INSTALL_PROGRAM) $(QMAKE_TARGET) $(INSTALL_ROOT)/opt/ELF-loader-test/bin/$(QMAKE_TARGET)
+
+uninstall_target: FORCE
+ -$(DEL_FILE) $(INSTALL_ROOT)/opt/ELF-loader-test/bin/$(QMAKE_TARGET)
+ -$(DEL_DIR) $(INSTALL_ROOT)/opt/ELF-loader-test/bin/
+
+
+install: install_target FORCE
+
+uninstall: uninstall_target FORCE
+
+FORCE:
+
diff --git a/misc-host/paging-debug/build-paging-debug-GCC-Debug/Makefile b/misc-host/paging-debug/build-paging-debug-GCC-Debug/Makefile
new file mode 100644
index 0000000..c0b03e8
--- /dev/null
+++ b/misc-host/paging-debug/build-paging-debug-GCC-Debug/Makefile
@@ -0,0 +1,595 @@
+#############################################################################
+# Makefile for building: paging-debug
+# Generated by qmake (3.0) (Qt 5.5.0)
+# Project: ../paging-debug/paging-debug.pro
+# Template: app
+# Command: /usr/lib/qt/bin/qmake -spec linux-g++ CONFIG+=debug -o Makefile ../paging-debug/paging-debug.pro
+#############################################################################
+
+MAKEFILE = Makefile
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+DEFINES =
+CFLAGS = -pipe -g -Wall -W -fPIC $(DEFINES)
+CXXFLAGS = -pipe -g -std=c++0x -Wall -W -fPIC $(DEFINES)
+INCPATH = -I../paging-debug -I. -I/usr/lib/qt/mkspecs/linux-g++
+QMAKE = /usr/lib/qt/bin/qmake
+DEL_FILE = rm -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+COPY = cp -f
+COPY_FILE = cp -f
+COPY_DIR = cp -f -R
+INSTALL_FILE = install -m 644 -p
+INSTALL_PROGRAM = install -m 755 -p
+INSTALL_DIR = cp -f -R
+DEL_FILE = rm -f
+SYMLINK = ln -f -s
+DEL_DIR = rmdir
+MOVE = mv -f
+TAR = tar -cf
+COMPRESS = gzip -9f
+DISTNAME = paging-debug1.0.0
+DISTDIR = /home/ornitorrincos/OS-github/misc-host/paging-debug/build-paging-debug-GCC-Debug/.tmp/paging-debug1.0.0
+LINK = g++
+LFLAGS =
+LIBS = $(SUBLIBS)
+AR = ar cqs
+RANLIB =
+SED = sed
+STRIP = strip
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = ../paging-debug/main.c \
+ ../paging-debug/bootloader_compat.cpp \
+ ../paging-debug/paging.c
+OBJECTS = main.o \
+ bootloader_compat.o \
+ paging.o
+DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \
+ /usr/lib/qt/mkspecs/common/unix.conf \
+ /usr/lib/qt/mkspecs/common/linux.conf \
+ /usr/lib/qt/mkspecs/common/sanitize.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base-unix.conf \
+ /usr/lib/qt/mkspecs/common/g++-base.conf \
+ /usr/lib/qt/mkspecs/common/g++-unix.conf \
+ /usr/lib/qt/mkspecs/qconfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Attica.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KActivities.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KArchive.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KAuth.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCrash.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDNSSD.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KHtml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KI18n.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIdleTime.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJS.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJSApi.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KParts.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPty.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KService.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWallet.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \
+ /usr/lib/qt/mkspecs/modules/qt_QGpgme.pri \
+ /usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Solid.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \
+ /usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri \
+ /usr/lib/qt/mkspecs/features/qt_functions.prf \
+ /usr/lib/qt/mkspecs/features/qt_config.prf \
+ /usr/lib/qt/mkspecs/linux-g++/qmake.conf \
+ /usr/lib/qt/mkspecs/features/spec_post.prf \
+ /usr/lib/qt/mkspecs/features/exclusive_builds.prf \
+ /usr/lib/qt/mkspecs/features/default_pre.prf \
+ /usr/lib/qt/mkspecs/features/resolve_config.prf \
+ /usr/lib/qt/mkspecs/features/default_post.prf \
+ /usr/lib/qt/mkspecs/features/c++11.prf \
+ /usr/lib/qt/mkspecs/features/warn_on.prf \
+ /usr/lib/qt/mkspecs/features/testcase_targets.prf \
+ /usr/lib/qt/mkspecs/features/exceptions.prf \
+ /usr/lib/qt/mkspecs/features/yacc.prf \
+ /usr/lib/qt/mkspecs/features/lex.prf \
+ ../paging-debug/paging-debug.pro bootloader_compat.h \
+ paging_struct.h \
+ paging.h ../paging-debug/main.c \
+ ../paging-debug/bootloader_compat.cpp \
+ ../paging-debug/paging.c
+QMAKE_TARGET = paging-debug
+DESTDIR = #avoid trailing-slash linebreak
+TARGET = paging-debug
+
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+$(TARGET): $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: ../paging-debug/paging-debug.pro /usr/lib/qt/mkspecs/linux-g++/qmake.conf /usr/lib/qt/mkspecs/features/spec_pre.prf \
+ /usr/lib/qt/mkspecs/common/unix.conf \
+ /usr/lib/qt/mkspecs/common/linux.conf \
+ /usr/lib/qt/mkspecs/common/sanitize.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base.conf \
+ /usr/lib/qt/mkspecs/common/gcc-base-unix.conf \
+ /usr/lib/qt/mkspecs/common/g++-base.conf \
+ /usr/lib/qt/mkspecs/common/g++-unix.conf \
+ /usr/lib/qt/mkspecs/qconfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Attica.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KActivities.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KArchive.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KAuth.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KCrash.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KDNSSD.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KHtml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KI18n.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIdleTime.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJS.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KJSApi.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KParts.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KPty.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KService.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWallet.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \
+ /usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \
+ /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
+ /usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \
+ /usr/lib/qt/mkspecs/modules/qt_QGpgme.pri \
+ /usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri \
+ /usr/lib/qt/mkspecs/modules/qt_Solid.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \
+ /usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \
+ /usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri \
+ /usr/lib/qt/mkspecs/features/qt_functions.prf \
+ /usr/lib/qt/mkspecs/features/qt_config.prf \
+ /usr/lib/qt/mkspecs/linux-g++/qmake.conf \
+ /usr/lib/qt/mkspecs/features/spec_post.prf \
+ /usr/lib/qt/mkspecs/features/exclusive_builds.prf \
+ /usr/lib/qt/mkspecs/features/default_pre.prf \
+ /usr/lib/qt/mkspecs/features/resolve_config.prf \
+ /usr/lib/qt/mkspecs/features/default_post.prf \
+ /usr/lib/qt/mkspecs/features/c++11.prf \
+ /usr/lib/qt/mkspecs/features/warn_on.prf \
+ /usr/lib/qt/mkspecs/features/testcase_targets.prf \
+ /usr/lib/qt/mkspecs/features/exceptions.prf \
+ /usr/lib/qt/mkspecs/features/yacc.prf \
+ /usr/lib/qt/mkspecs/features/lex.prf \
+ ../paging-debug/paging-debug.pro
+ $(QMAKE) -spec linux-g++ CONFIG+=debug -o Makefile ../paging-debug/paging-debug.pro
+/usr/lib/qt/mkspecs/features/spec_pre.prf:
+/usr/lib/qt/mkspecs/common/unix.conf:
+/usr/lib/qt/mkspecs/common/linux.conf:
+/usr/lib/qt/mkspecs/common/sanitize.conf:
+/usr/lib/qt/mkspecs/common/gcc-base.conf:
+/usr/lib/qt/mkspecs/common/gcc-base-unix.conf:
+/usr/lib/qt/mkspecs/common/g++-base.conf:
+/usr/lib/qt/mkspecs/common/g++-unix.conf:
+/usr/lib/qt/mkspecs/qconfig.pri:
+/usr/lib/qt/mkspecs/modules/qt_Attica.pri:
+/usr/lib/qt/mkspecs/modules/qt_KActivities.pri:
+/usr/lib/qt/mkspecs/modules/qt_KArchive.pri:
+/usr/lib/qt/mkspecs/modules/qt_KAuth.pri:
+/usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCodecs.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCompletion.pri:
+/usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri:
+/usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri:
+/usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KCrash.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri:
+/usr/lib/qt/mkspecs/modules/qt_KDNSSD.pri:
+/usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri:
+/usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KHtml.pri:
+/usr/lib/qt/mkspecs/modules/qt_KI18n.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIdleTime.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIOCore.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KItemModels.pri:
+/usr/lib/qt/mkspecs/modules/qt_KItemViews.pri:
+/usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KJS.pri:
+/usr/lib/qt/mkspecs/modules/qt_KJSApi.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNotifications.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri:
+/usr/lib/qt/mkspecs/modules/qt_KNTLM.pri:
+/usr/lib/qt/mkspecs/modules/qt_KParts.pri:
+/usr/lib/qt/mkspecs/modules/qt_KPlotting.pri:
+/usr/lib/qt/mkspecs/modules/qt_KPty.pri:
+/usr/lib/qt/mkspecs/modules/qt_KService.pri:
+/usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri:
+/usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri:
+/usr/lib/qt/mkspecs/modules/qt_KWallet.pri:
+/usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri:
+/usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_core.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_designer.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_gui.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_help.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_location.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_network.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qml.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quick.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_script.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sql.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_svg.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xml.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri:
+/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri:
+/usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri:
+/usr/lib/qt/mkspecs/modules/qt_QGpgme.pri:
+/usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri:
+/usr/lib/qt/mkspecs/modules/qt_Solid.pri:
+/usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri:
+/usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri:
+/usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri:
+/usr/lib/qt/mkspecs/features/qt_functions.prf:
+/usr/lib/qt/mkspecs/features/qt_config.prf:
+/usr/lib/qt/mkspecs/linux-g++/qmake.conf:
+/usr/lib/qt/mkspecs/features/spec_post.prf:
+/usr/lib/qt/mkspecs/features/exclusive_builds.prf:
+/usr/lib/qt/mkspecs/features/default_pre.prf:
+/usr/lib/qt/mkspecs/features/resolve_config.prf:
+/usr/lib/qt/mkspecs/features/default_post.prf:
+/usr/lib/qt/mkspecs/features/c++11.prf:
+/usr/lib/qt/mkspecs/features/warn_on.prf:
+/usr/lib/qt/mkspecs/features/testcase_targets.prf:
+/usr/lib/qt/mkspecs/features/exceptions.prf:
+/usr/lib/qt/mkspecs/features/yacc.prf:
+/usr/lib/qt/mkspecs/features/lex.prf:
+../paging-debug/paging-debug.pro:
+qmake: FORCE
+ @$(QMAKE) -spec linux-g++ CONFIG+=debug -o Makefile ../paging-debug/paging-debug.pro
+
+qmake_all: FORCE
+
+
+all: Makefile $(TARGET)
+
+dist: distdir FORCE
+ (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
+
+distdir: FORCE
+ @test -d $(DISTDIR) || mkdir -p $(DISTDIR)
+ $(COPY_FILE) --parents $(DIST) $(DISTDIR)/
+
+
+clean: compiler_clean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+distclean: clean
+ -$(DEL_FILE) $(TARGET)
+ -$(DEL_FILE) Makefile
+
+
+####### Sub-libraries
+
+check: first
+
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean:
+
+####### Compile
+
+main.o: ../paging-debug/main.c
+ $(CC) -c $(CFLAGS) $(INCPATH) -o main.o ../paging-debug/main.c
+
+bootloader_compat.o: ../paging-debug/bootloader_compat.cpp ../paging-debug/bootloader_compat.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o bootloader_compat.o ../paging-debug/bootloader_compat.cpp
+
+paging.o: ../paging-debug/paging.c ../paging-debug/paging_struct.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o paging.o ../paging-debug/paging.c
+
+####### Install
+
+install: FORCE
+
+uninstall: FORCE
+
+FORCE:
+
diff --git a/misc-host/paging-debug/paging-debug/.gitignore b/misc-host/paging-debug/paging-debug/.gitignore
new file mode 100644
index 0000000..5439c79
--- /dev/null
+++ b/misc-host/paging-debug/paging-debug/.gitignore
@@ -0,0 +1,73 @@
+# This file is used to ignore files which are generated
+# ----------------------------------------------------------------------------
+
+*~
+*.autosave
+*.a
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.rej
+*.so
+*.so.*
+*_pch.h.cpp
+*_resource.rc
+*.qm
+.#*
+*.*#
+core
+!core/
+tags
+.DS_Store
+*.debug
+Makefile*
+*.prl
+*.app
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+Thumbs.db
+*.res
+*.rc
+/.qmake.cache
+/.qmake.stash
+
+# qtcreator generated files
+*.pro.user*
+
+# xemacs temporary files
+*.flc
+
+# Vim temporary files
+.*.swp
+
+# Visual Studio generated files
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+*.sdf
+*.opensdf
+*.vcxproj
+*vcxproj.*
+
+# MinGW generated files
+*.Debug
+*.Release
+
+# Python byte code
+*.pyc
+
+# Binaries
+# --------
+*.dll
+*.exe
+
+
diff --git a/misc-host/paging-debug/paging-debug/bootloader_compat.cpp b/misc-host/paging-debug/paging-debug/bootloader_compat.cpp
new file mode 100644
index 0000000..8852dad
--- /dev/null
+++ b/misc-host/paging-debug/paging-debug/bootloader_compat.cpp
@@ -0,0 +1,20 @@
+#define _CRT_SECURE_NO_WARNINGS
+
+#include "bootloader_compat.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+UEFIPrint Print = wprintf;
+
+void * EFIAPI LoadFile(char * name, UINTN memtype)
+{
+ FILE * f = fopen(name, "rb");
+ fseek(f, 0, SEEK_END);
+ long fsize = ftell(f);
+ fseek(f, 0, SEEK_SET);
+ char * mem = (char*)malloc(fsize);
+ fread(mem, fsize, 1, f);
+ fclose(f);
+
+ return mem;
+}
diff --git a/misc-host/paging-debug/paging-debug/bootloader_compat.h b/misc-host/paging-debug/paging-debug/bootloader_compat.h
new file mode 100644
index 0000000..973e623
--- /dev/null
+++ b/misc-host/paging-debug/paging-debug/bootloader_compat.h
@@ -0,0 +1,40 @@
+#ifndef BOOTLOADER_COMPAT_H
+#define BOOTLOADER_COMPAT_H
+
+// partial API of UEFI/bootloader
+
+#include <wchar.h>
+#include <stdint.h>
+
+#define EFIAPI
+#define IN
+#define OUT
+
+// basic UEFI datatypes
+typedef uint8_t BOOLEAN;
+typedef int8_t INT8;
+typedef uint8_t UINT8;
+typedef int16_t INT16;
+typedef uint16_t UINT16;
+typedef int32_t INT32;
+typedef uint32_t UINT32;
+typedef int64_t INT64;
+typedef uint64_t UINT64;
+typedef char CHAR8;
+typedef wchar_t CHAR16;
+typedef uint64_t UINTN;
+
+typedef uint64_t* EFI_PHYSICAL_ADDRESS;
+typedef uint32_t EFI_STATUS;
+
+#define EFI_SUCCESS 0
+
+// UEFI native functions
+typedef int (*UEFIPrint)(const wchar_t *, ...);
+extern UEFIPrint Print;
+
+// Bootloader defined
+void * EFIAPI LoadFile(char * name, UINTN memtype);
+
+#endif // BOOTLOADER_COMPAT_H
+
diff --git a/misc-host/paging-debug/paging-debug/main.c b/misc-host/paging-debug/paging-debug/main.c
new file mode 100644
index 0000000..9db9c18
--- /dev/null
+++ b/misc-host/paging-debug/paging-debug/main.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include "paging.h"
+
+int main(void)
+{
+ printf("Hello World!\n");
+
+
+ initCR3();
+
+ uint64_t addr = 4; // GB
+ addr *= 1024; // MB
+ addr *= 1024; // KB
+
+ for(uint64_t i = 0; i < addr; i += 0x1000)
+ {
+ SetVirtualAddress(i, i);
+ }
+ //SetVirtualAddress(0x4000, 0x4000);
+
+ //SetVirtualAddress(0x6523000, 0x6523000);
+
+ return 0;
+}
+
diff --git a/misc-host/paging-debug/paging-debug/paging-debug.pro b/misc-host/paging-debug/paging-debug/paging-debug.pro
new file mode 100644
index 0000000..86e553c
--- /dev/null
+++ b/misc-host/paging-debug/paging-debug/paging-debug.pro
@@ -0,0 +1,14 @@
+TEMPLATE = app
+CONFIG += console c++11
+CONFIG -= app_bundle
+CONFIG -= qt
+
+SOURCES += main.c \
+ bootloader_compat.cpp \
+ paging.c
+
+HEADERS += \
+ bootloader_compat.h \
+ paging_struct.h \
+ paging.h
+
diff --git a/misc-host/paging-debug/paging-debug/paging.c b/misc-host/paging-debug/paging-debug/paging.c
new file mode 100644
index 0000000..80adbda
--- /dev/null
+++ b/misc-host/paging-debug/paging-debug/paging.c
@@ -0,0 +1,310 @@
+#include "paging_struct.h"
+#include "memory.h"
+
+#include <stdlib.h>
+#include <intrin.h>
+#include <malloc.h>
+
+uint64_t size;
+uint64_t baseaddr;
+uint64_t current;
+
+uint64_t count;
+
+EFI_PHYSICAL_ADDRESS pages;
+uint64_t * CR3;
+
+uint64_t virtualmemory;
+uint64_t maxneg;
+uint64_t maxnegcomp;
+//uint64_t base_memory;
+
+void bootloader_memset(void* ptr, uint64_t size, uint8_t value)
+{
+ memset(ptr, value, size);
+}
+
+uint64_t GetNextEntry()
+{
+ uint64_t ret = current + 0x1000;//1024*4;
+
+ count++;
+
+ if(count > 1023)
+ {
+ // need to allocate new page
+ // 1024 pages for 4MB
+
+ //pages = (EFI_PHYSICAL_ADDRESS)malloc(size*0x1000);
+ pages = (EFI_PHYSICAL_ADDRESS)_aligned_malloc(size * 0x1000, 0x1000);
+
+ /*EFI_STATUS allocstatus = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, MEM_PAGING, size, &pages);
+ if(allocstatus != EFI_SUCCESS)
+ {
+ Print(L"Paging space allocation failed");
+ return -1;
+ }*/
+ bootloader_memset((void*)pages, size*0x1000, 0x0);
+ baseaddr = (uint64_t)pages;
+ ret = baseaddr;
+
+ //Print(L"New Chunk: 0x%llX\n", baseaddr);
+ count = 0;
+
+ current = ret;
+
+ if(ret % 0x1000 != 0)
+ {
+ Print(L"WARNING Memory not aligned\n");
+ }
+
+ return ret;
+ }
+
+ //Print(L"New Entry: 0x%llX\n", ret);
+ current = ret;
+
+ if(ret % 0x1000 != 0)
+ {
+ Print(L"WARNING Memory not aligned\n");
+ }
+
+ return ret;
+}
+
+uint8_t NeedAllocation(uint64_t in)
+{
+ if(in == -1)
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+UINT64 EFIAPI GetVMCPUID()
+{
+ long out = 0;
+ long id = 0x80000008;
+
+ int arr[4] = {0};
+
+ __cpuid(arr, id);
+
+ out = arr[0];
+
+ return out;
+}
+
+uint64_t powerTwo(uint64_t power)
+{
+ uint64_t ret = 1;
+
+ while(power > 0)
+ {
+ ret *= 2;
+
+ power--;
+ }
+
+ return ret;
+}
+
+void initCR3()
+{
+ UINT64 cpu = GetVMCPUID();
+
+ CPUIDsizes * sizes = (CPUIDsizes*)&cpu;
+
+ Print(L"raw: %x\n", cpu);
+ Print(L"Physical: %d\n", sizes->PhysicalAddress);
+ Print(L"Virtual: %d\n", sizes->VirtualAddress);
+ virtualmemory = sizes->PhysicalAddress;
+
+ maxneg = powerTwo(virtualmemory) - 1;
+ maxnegcomp = maxneg << PE_ADDR_SHIFT;
+
+ size = 1024;
+
+ Print(L"Started CR3\n");
+
+ // 1024 pages for 4MB
+ //EFI_STATUS allocstatus = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, MEM_PAGING, size, &pages);
+ pages = (EFI_PHYSICAL_ADDRESS)_aligned_malloc(size * 0x1000, 0x1000);
+ /*if(allocstatus != EFI_SUCCESS)
+ {
+ Print(L"Paging space allocation failed");
+ return;
+ }*/
+
+ count = 1;
+
+ // 1024 pages at 4kb each
+ bootloader_memset((void*)pages, size*4*1024, 0x0);
+
+ baseaddr = (uint64_t)pages;
+ current = baseaddr;
+
+ CR3 = (uint64_t*)current;
+ *CR3 = 0;
+
+ *CR3 |= CR3_PCD;
+ *CR3 |= CR3_PWT;
+ uint64_t tmpaddr = GetNextEntry();
+
+ memset((uint64_t*)tmpaddr, 0, 0x1000);
+
+ *CR3 &= CR3_ERASE;
+ //*CR3 |= CR3SetAddr(tmpaddr);
+ *CR3 |= MaskPhyAddr(tmpaddr);
+
+ //*CR3 |=(maxneg << CR3_ADDR_SHIFT);
+
+ //((s_CR3*)CR3)->PCD = 1;
+ //((s_CR3*)CR3)->PWT = 1;
+ //((s_CR3*)CR3)->base_addr = GetNextEntry();
+
+
+ //int32_t pml4es = sizeof(s_PML4E);
+
+
+ //((s_CR3*)CR3)->base_addr = maxneg;
+
+}
+
+void printCR3()
+{
+ Print(L"CR3 value: 0x%llX\n", *((uint64_t*)CR3));
+}
+
+void writeCR3()
+{
+
+}
+
+void SetVirtualAddress(uint64_t phy, uint64_t virt)
+{
+ uint64_t* pml4 = (uint64_t*)MaskPhyAddr(*CR3);
+
+ // Get the offsets to each page table
+ uint64_t pml4offset = GetPML4Offset(virt);
+ uint64_t pdpoffset = GetPDPOffset(virt);
+ uint64_t pdoffset = GetPDOffset(virt);
+ uint64_t ptoffset = GetPTOffset(virt);
+
+
+ uint64_t pml4e = pml4[pml4offset];
+
+ // if not present, allocate the page
+ if((pml4e & PE_P) == 0x0ull)
+ {
+ //assign the physical addr, and clear all to zero
+ uint64_t tmpaddr = GetNextEntry();
+ pml4e |= MaskPhyAddr(tmpaddr);
+
+ // initialize the page
+ pml4e |= PE_P;
+ pml4e |= PE_RW;
+ pml4e |= PE_US;
+ pml4e |= PE_PWT;
+ pml4e |= PE_PCD;
+ }
+ // assign the values to the array
+ pml4[pml4offset] = pml4e;
+
+
+ uint64_t pdpe = ((uint64_t*)MaskPhyAddr(pml4e))[pdpoffset];
+ if((pdpe & PE_P) == 0x0ull)
+ {
+ // page not present
+ uint64_t tmpaddr = GetNextEntry();
+ pdpe |= MaskPhyAddr(tmpaddr);
+
+ pdpe |= PE_P;
+ pdpe |= PE_RW;
+ pdpe |= PE_US;
+ pdpe |= PE_PWT;
+ pdpe |= PE_PCD;
+ }
+ ((uint64_t*)MaskPhyAddr(pml4e))[pdpoffset] = pdpe;
+
+ uint64_t pde = ((uint64_t*)MaskPhyAddr(pdpe))[pdoffset];
+
+ if((pde & PE_P) == 0x0ull)
+ {
+ uint64_t tmpaddr = GetNextEntry();
+
+ pde |= MaskPhyAddr(tmpaddr);
+
+ pde |= PE_P;
+ pde |= PE_RW;
+ pde |= PE_US;
+ pde |= PE_PWT;
+ pde |= PE_PCD;
+ }
+ ((uint64_t*)MaskPhyAddr(pdpe))[pdoffset] = pde;
+
+ uint64_t pte = ((uint64_t*)MaskPhyAddr(pde))[ptoffset];
+
+ // need to make the pt entry
+
+ if((pte & PE_P) == 0x0ull)
+ {
+ pte |= PE_P;
+ pte |= PE_RW;
+ pte |= PE_US;
+ pte |= PE_PWT;
+ pte |= PE_PCD;
+ pte |= MaskPhyAddr(phy);
+ }
+ ((uint64_t*)MaskPhyAddr(pde))[ptoffset] = pte;
+}
+
+uint8_t checkIdentity(uint64_t phy)
+{
+ //uint8_t phyvalue = (uint8_t)(*(uint64_t*)phy);
+ uint8_t phyvalue = (uint8_t)*(uint64_t*)phy; // to check values in memory, not really used in hosted environment
+ uint8_t virtvalue;
+ uint64_t pml4e = CR3GetAddr(*CR3);// + GetPML4Offset(phy);
+ pml4e = *(((uint64_t*)pml4e) + GetPML4Offset(phy));
+ uint64_t pdpe = *(((uint64_t*)GetAddr(pml4e)) + GetPDPOffset(phy));
+ uint64_t pde = *(((uint64_t*)GetAddr(pdpe)) + GetPDOffset(phy));
+ uint64_t pte = *(((uint64_t*)GetAddr(pde)) + GetPTOffset(phy));
+ uint64_t pteptr = ((GetAddr(pte)) + GetPhyOffset(phy));
+ virtvalue = (uint8_t)*(uint64_t*)((GetAddr(pte)) + GetPhyOffset(phy));
+
+ //s_PDPE * pdpe = ((s_PDPE*)(pml4e->PDPBA + 8*virt->PDP));
+ //s_PDE * pde = ((s_PDE*)(pdpe->PDBA + 8*virt->PD));
+ //s_PTE * pte = ((s_PTE*)(pde->PTBA + 8*virt->PT));
+ //virtvalue = *(uint8_t*)(pte->PPBA + virt->offset);
+
+ // get the correct virtual value
+
+ Print(L"ADDR: 0x%llx\n", phy);
+
+ Print(L"PML4E 0x%llx\n", pml4e);
+ Print(L"PDPE 0x%llx\n", pdpe);
+ Print(L"PDE 0x%llx\n", pde);
+ Print(L"PTE 0x%llx\n", pte);
+ Print(L"pageentry: 0x%llx\n", pteptr);
+ Print(L"PPBA 0x%llx\n", GetAddr(pte));
+
+ Print(L"PML4 %d\n", GetPML4Offset(phy));
+ Print(L"PDP %d\n", GetPDPOffset(phy));
+ Print(L"PD %d\n", GetPDOffset(phy));
+ Print(L"PT %d\n", GetPTOffset(phy));
+ Print(L"PHY 0x%llx\n", GetPhyOffset(phy));
+
+
+ Print(L"PHYSICAL: 0x%x\n", phyvalue);
+ Print(L"VIRTUAL: 0x%x\n", virtvalue);
+
+ if(phyvalue != virtvalue)
+ {
+ Print(L"Incorrect physical virtual value\n");
+ return 0;
+ }
+
+ Print(L"Correct physical virtual value\n");
+ return 1;
+}
diff --git a/misc-host/paging-debug/paging-debug/paging.h b/misc-host/paging-debug/paging-debug/paging.h
new file mode 100644
index 0000000..59eef1e
--- /dev/null
+++ b/misc-host/paging-debug/paging-debug/paging.h
@@ -0,0 +1,17 @@
+#ifndef PAGING_H
+#define PAGING_H
+
+#include <stdint.h>
+
+uint64_t GetNextEntry();
+void initCR3();
+void printCR3();
+void writeCR3();
+void SetVirtualAddress(uint64_t phy, uint64_t virt);
+uint8_t checkIdentity(uint64_t phy);
+
+
+//void * SetPagingStructs();
+
+#endif // PAGING_H
+
diff --git a/misc-host/paging-debug/paging-debug/paging_struct.h b/misc-host/paging-debug/paging-debug/paging_struct.h
new file mode 100644
index 0000000..7fca6d5
--- /dev/null
+++ b/misc-host/paging-debug/paging-debug/paging_struct.h
@@ -0,0 +1,189 @@
+#ifndef PAGING_STRUCT_H
+#define PAGING_STRUCT_H
+
+#include "bootloader_compat.h"
+#include <stdint.h>
+
+typedef UINT64 uchar; // need to replace this for other more sensible thing or location
+
+UINT64 GetVMCPUID(); // implemented in misc.s
+
+extern uint64_t maxneg;
+
+typedef struct _CPUIDsizes
+{
+ UINT64 PhysicalAddress:8;
+ UINT64 VirtualAddress:8;
+ UINT64 Padding:48;
+} CPUIDsizes;
+
+// these entries are for 4KB pages
+
+
+// Virtual pointer bits breakdown (4KB pages)
+// +---------------+-------------+------------+-----------+-----------+-----------------------+
+// | 63 - 48 | 47 - 39 | 38 - 30 | 29 - 21 | 20 - 12 | 11 - 0 |
+// +---------------+-------------+------------+-----------+-----------+-----------------------+
+// | sign extend | PML4 offset | PDP offset | PD offset | PT offset | physical page offset |
+// +---------------+-------------+------------+-----------+-----------+-----------------------+
+
+// Virtual pointer bits breakdown (2MB pages)
+// +---------------+-------------+------------+-----------+-----------------------------------+
+// | 63 - 48 | 47 - 39 | 38 - 30 | 29 - 21 | 20 - 0 |
+// +---------------+-------------+------------+-----------+-----------------------------------+
+// | sign extend | PML4 offset | PDP offset | PD offset | physical page offset |
+// +---------------+-------------+------------+-----------+-----------------------------------+
+
+
+// paging structure:
+
+// CR3
+// the contents of this struct go into CR3
+#pragma pack(1)
+typedef struct
+{
+ uint64_t reserved1:3;
+ uint64_t PWT:1; // page level writethough
+ uint64_t PCD:1; // page level cache disable
+ uint64_t reserved2:7;
+ uint64_t base_addr:40; // base address to the table of PML4 entries
+ uint64_t reserved3:13;
+} s_CR3;
+
+// Virtual Pointer
+#define VP_OFF_PHY 0ull
+#define VP_OFF_PT 12ull
+#define VP_OFF_PD 21ull
+#define VP_OFF_PDP 30ull
+#define VP_OFF_PML4 39ull
+#define VP_OFF_SIGN 48ull
+
+#define GetPhyOffset(x) (x & 0xFFFull)
+#define GetPTOffset(x) ((x >> VP_OFF_PT) & 0x1FFull)
+#define GetPDOffset(x) ((x >> VP_OFF_PD) & 0x1FFull)
+#define GetPDPOffset(x) ((x >> VP_OFF_PDP) & 0x1FFull)
+#define GetPML4Offset(x) ((x >> VP_OFF_PML4) & 0x1FFull)
+#define GetSignOffset(x) ((x >> VP_OFF_SIGN) & 0xFFFFull)
+
+
+// CR3
+#define CR3_PWT (1ull << 3ull)
+#define CR3_PCD (1ull << 4ull)
+#define CR3_ADDR_SHIFT 12ull
+#define CR3_ERASE (~(maxneg << CR3_ADDR_SHIFT))
+
+#define CR3GetAddr(x) ((x >> CR3_ADDR_SHIFT) & maxneg)
+#define CR3SetAddr(x) ((x & maxneg) << CR3_ADDR_SHIFT)
+
+// Page Entry
+#define PE_P (1ull << 0ull)
+#define PE_RW (1ull << 1ull)
+#define PE_US (1ull << 2ull)
+#define PE_PWT (1ull << 3ull)
+#define PE_PCD (1ull << 4ull)
+#define PE_A (1ull << 5ull)
+#define PE_D (1ull << 6ull)
+#define PE_PS (1ull << 7ull)
+#define PE_G (1ull << 8ull)
+#define PE_BA (1ull << 12ull)
+#define PE_NX (1ull << 63ull)
+#define PE_ADDR_SHIFT 12ull
+#define PE_ERASE (~(maxneg << PE_ADDR_SHIFT))
+
+#define MaskTable(x) (x & maxneg)
+#define MaskPhyAddr(x) (x & maxnegcomp)
+#define SetAddr(x) (x << PE_ADDR_SHIFT)
+#define GetAddr(x) (x >> PE_ADDR_SHIFT)
+//#define GetAddr(x) (x & ~0xFFFull)
+
+
+
+// PML4E
+
+typedef struct
+{
+ uint64_t P:1; // present bit
+ uint64_t RW:1; // read write (if 0 write protected)
+ uint64_t US:1; // user/supervisor if 0 no user mode access
+ uint64_t PWT:1; // page level write though
+ uint64_t PCD:1; // page level cache disable
+ uint64_t A:1; // accesed
+ uint64_t PS:1; // value must be 1 for 1GB pages
+ uint64_t MBZ:2;
+ uint64_t AVL:3;
+ uint64_t PDPBA:40; // physical address of the table pointed by this entry
+ uint64_t available:11; // need to look into what values go here
+ uint64_t NX:1; // execute disable
+} s_PML4E;
+
+
+
+// PDPE
+
+typedef struct
+{
+ uint64_t P:1;
+ uint64_t RW:1;
+ uint64_t US:1;
+ uint64_t PWT:1;
+ uint64_t PCD:1;
+ uint64_t A:1;
+ uint64_t PS:1; // value must be 1 for 2MB pages
+ uint64_t zero:1; // zero
+ uint64_t MBZ:1;
+ uint64_t AVL:3;
+ uint64_t PDBA:40;
+ uint64_t available:11;
+ uint64_t NX:1;
+} s_PDPE;
+
+// PDE
+
+typedef struct
+{
+ uint64_t P:1;
+ uint64_t RW:1;
+ uint64_t US:1;
+ uint64_t PWT:1;
+ uint64_t PCD:1;
+ uint64_t A:1;
+ uint64_t ignored1:1;
+ uint64_t zero:1;
+ uint64_t ignored2:1;
+ uint64_t AVL:3;
+ uint64_t PTBA:40;
+ uint64_t available:11;
+ uint64_t NX:1;
+} s_PDE;
+
+// PTE
+
+typedef struct
+{
+ uint64_t P:1;
+ uint64_t RW:1;
+ uint64_t US:1;
+ uint64_t PWT:1;
+ uint64_t PCD:1;
+ uint64_t A:1;
+ uint64_t D:1;
+ uint64_t PAT:1;
+ uint64_t G:1;
+ uint64_t AVL:3;
+ uint64_t PPBA:40;
+ uint64_t available:11;
+ uint64_t NX:1;
+} s_PTE;
+
+typedef struct
+{
+ uint64_t offset:12;
+ uint64_t PT:9;
+ uint64_t PD:9;
+ uint64_t PDP:9;
+ uint64_t PML4:9;
+ uint64_t sign:16;
+} s_VPTR;
+
+#endif // PAGING_STRUCT_H
+
diff --git a/misc-host/test-vaddr/vaddr.cpp b/misc-host/test-vaddr/vaddr.cpp
new file mode 100644
index 0000000..c5af491
--- /dev/null
+++ b/misc-host/test-vaddr/vaddr.cpp
@@ -0,0 +1,50 @@
+#include <iostream>
+#include <cstdio>
+#include <cstdint>
+
+typedef struct __attribute__((packed))
+{
+ unsigned long page:21;
+ unsigned long PD:9;
+ unsigned long PDP:9;
+ unsigned long PML4:9;
+ unsigned long sign:16;
+} s_vptr;
+
+union v
+{
+s_vptr vptr;
+unsigned long ptr;
+};
+
+int main()
+{
+ // 0x0FFFFFFFF; below 4GB
+ //unsigned long vaddr = 0x40000000; // 1GB // 0x100000000; // 4GB
+
+ unsigned long vaddr = 0x280000000; // 10GB
+
+ uint64_t kr = 0xffffffff7fffffff; // -2GB mark
+
+ //v * p = (v*)&vaddr;
+ v * p = (v*)&kr;
+
+ std::cout << "sign " << p->vptr.sign << std::endl;
+ std::cout << "PML4 " << p->vptr.PML4 << std::endl;
+ std::cout << "PDP " << p->vptr.PDP << std::endl;
+ std::cout << "PD " << p->vptr.PD << std::endl;
+ std::cout << "Page " << p->vptr.page << std::endl;
+
+
+ printf("%p\n", p->ptr);
+ //std::cout << "Pointer " << p->ptr << std::endl;
+
+ v p2;
+ p2.ptr = 0;
+ p2.vptr.PML4 = 1;
+
+ printf("p2: %p\n", p2.ptr);
+
+ return 0;
+}
+