Skip to content

Instantly share code, notes, and snippets.

Alexander van der Grinten avdgrinten

Block or report user

Report or block avdgrinten

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@avdgrinten
avdgrinten / dso-load.cpp
Last active Nov 20, 2018
Loading ELF shared libraries as kernel modules; includes relocation and symbol lookup
View dso-load.cpp
void processElfDso(const char *buffer) {
auto base = reinterpret_cast<char *>(KernelVirtualMemory::global().allocate(0x10000));
// Check the EHDR file header.
Elf64_Ehdr ehdr;
memcpy(&ehdr, buffer, sizeof(Elf64_Ehdr));
assert(ehdr.e_ident[0] == 0x7F
&& ehdr.e_ident[1] == 'E'
&& ehdr.e_ident[2] == 'L'
&& ehdr.e_ident[3] == 'F');
@avdgrinten
avdgrinten / main.cpp
Created May 1, 2018
Buddy allocator benchmark
View main.cpp
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#include <chrono>
#include <iostream>
// ----------------------------------------------------------------------------
// The new buddy allocator.
@avdgrinten
avdgrinten / Controller.ko
Last active Apr 26, 2018
.kor language examples
View Controller.ko
/* This file is part of the Managarm operating system.
* Copyright (C) 2007, 2008, 2009 Alexander van der Grinten
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@avdgrinten
avdgrinten / elf_x86_64.x
Created Oct 20, 2017
Default LD linker script (elf_x86_64 on Linux)
View elf_x86_64.x
/* Default linker script, for normal executables */
/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
Copying and distribution of this script, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
"elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
SEARCH_DIR("=/usr/local/lib/x86_64-linux-gnu"); SEARCH_DIR("=/lib/x86_64-linux-gnu"); SEARCH_DIR("=/usr/lib/x86_64-linux-gnu"); SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); SEARCH_DIR("=/usr/x86_64-linux-gnu/lib64"); SEARCH_DIR("=/usr/x86_64-linux-gnu/lib");
You can’t perform that action at this time.