Skip to content

Instantly share code, notes, and snippets.

@Zoxc
Zoxc / ggpk_defragment.rb
Last active January 4, 2024 02:50
GGPK Defragmenter
require 'bindata'
require 'benchmark'
require 'win32/registry'
require 'io/console'
class GGPK
class UTF16String < BinData::String
def snapshot
super.force_encoding('UTF-16LE')
end
@Zoxc
Zoxc / injector.cpp
Created June 10, 2012 17:40
DLL Injector for x86/x64
#pragma once
#include <SDKDDKVer.h>
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include <tchar.h>
#include <shellapi.h>
#include <string>
#include <sstream>
#include <functional>
@Zoxc
Zoxc / test.ll
Created February 6, 2020 03:54
LLVM infinite loop
; ModuleID = '../../../../output-func.ll'
source_filename = "rustc_mir.anxkd8ga-cgu.7"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
; Function Attrs: nounwind uwtable
define hidden fastcc void @_ZN5alloc5slice5merge17hae3c4424e1deafb6E([0 x i32]* nonnull align 4 %0, i64 %1, i64 %2, i32* %3) {
%5 = shl i64 %2, 2
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* undef to i8*
@Zoxc
Zoxc / PoE NPL
Last active February 28, 2019 16:39
struct PoEEmpty
{
}
[DataTypeByteOrder = 1] UnsignedNumber PoEU16
{
Size = 2
}
[DataTypeByteOrder = 0] UnsignedNumber PoEU16LE
@Zoxc
Zoxc / rustc.rs
Last active September 23, 2017 08:31
rustc TyCtxt model
use std::cell::RefCell;
use std::collections::HashSet;
// This is the mapping of types in this model to types in rustc:
// model => rustc
// TyS<'a> => TyS<'tcx>
// Ty<'a> => Ty<'tcx>
// Arena => DroplessArena
// Interner<'cx> => CtxtInterner<'tcx>
// Ctxt<'a, 'gcx, 'lcx> => TyCtxt<'a, 'gcx, 'tcx>
@Zoxc
Zoxc / future.rs
Last active January 8, 2017 01:29
// A function pointer and some data to pass to the callback
pub struct Callback<R> {
pointer: fn (R, *const ()),
data: *const (),
}
// This is the trait implemented for generators
pub trait Future {
type Return;

Remote procedure calls in Avery

Introduction

Avery's RPCs are based on capabilities. A capability is a reference to an object which the process has previously received. If you do not have a capability to an object, you cannot communicate with it.

You can do asynchronous calls to objects. These in calls, arguments and return values can contain both bytes and capabilities. If you send a capability to another process it gains access to it.

Objects belong to an event loop (a kernel object) and all messages sent to it is queued there.

@Zoxc
Zoxc / Caps.md
Last active July 23, 2016 07:47

Capability system

This is a sketch of a capability system which utilised data and operations in kernel mode.

There are 2 kernel objects used to support the capability system, Vat and Call. Cap is a global identifier of a capability consisting of a Vat reference and a vat defined number.

Messages

enum Message {
use "../core"
enum Token
None
Unknown
Id
struct Lexer
struct State
lexer *Lexer
@Zoxc
Zoxc / gist:5765678
Last active December 18, 2015 09:59
Rendering on multiple threads with Wayland subsurfaces
mutex commit
atomic<int> render_complete_count
signal resizing_complete
apply_pending_state(surface) {
wl_surface_attach(surface, ...)
wl_surface_damage(surface, ...)
}