Skip to content

Instantly share code, notes, and snippets.

View andreiw's full-sized avatar
💭
RISCy Business

Andrei Warkentin andreiw

💭
RISCy Business
View GitHub Profile
@andreiw
andreiw / walker.c
Last active December 22, 2016 05:22
x64 identity-mapped page table walker - useful for detecting non-identity-mapped bits
{
uint64_t i4;
uint64_t *l4pt;
@andreiw
andreiw / cgate.c
Created February 8, 2016 20:07
x64 override idt handlers in existing system (useful for UEFI)
void c_gate_entry(uint64_t *regs)
{
uint64_t gate = regs[15];
unsigned ix = 0;
uint64_t pc;
uint64_t sp;
uint64_t cr2;
warn("Gate = 0x%lx", gate);
warn("----------------------");
@andreiw
andreiw / PyImporter.py
Last active December 22, 2016 05:34
Pythonista extension to import URL as Python script
import appex
import clipboard
import urllib3
import os
def main():
if not appex.is_running_extension():
print('This script is intended to be run from the sharing extension.')
return
@andreiw
andreiw / main.c
Created July 21, 2019 18:34 — forked from mrandri19/main.c
main.c: Modern text rendering with Linux: Part 1
#include <stdio.h>
#include <freetype2/ft2build.h>
#include FT_FREETYPE_H
int main() {
FT_Library ft;
FT_Error err = FT_Init_FreeType(&ft);
if (err != 0) {
printf("Failed to initialize FreeType\n");
@andreiw
andreiw / _dma-for-every-acpi-dev.diff
Last active July 25, 2020 14:33
5.5 patch to support _DMA restrictions/translations for ACPI objects, to properly support xHCI with a 4GB Pi via ACPI
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 33f71983e..f7f7114c4 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1076,12 +1076,13 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size)
else
size = 1ULL << 32;
- if (dev_is_pci(dev)) {
- ret = acpi_dma_get_range(dev, &dmaaddr, &offset, &size);
#!/bin/sh
pkgin -y install xorg
pkgin -y install hal
pkgin -y install fam
pkgin -y install mpv compton midori firefox mozilla-rootcerts-openssl
pkgin -y install wpa_gui sysupgrade deluge slim slim-themes uget thunderbird
pkgin -y install xfce4 xfce4-extras
cp /usr/pkg/share/examples/rc.d/hal /etc/rc.d
cp /usr/pkg/share/examples/rc.d/dbus /etc/rc.d
cp /usr/pkg/share/examples/rc.d/famd /etc/rc.d