Skip to content

Instantly share code, notes, and snippets.

View exjam's full-sized avatar
🐢
is this facebook now

James exjam

🐢
is this facebook now
  • London, United Kingdom
View GitHub Profile
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of GCC.
GCC 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, or (at your option) any later
version.
OUTPUT_FORMAT("elf32-powerpc")
OUTPUT_ARCH(powerpc:common)
MEMORY {
relmem (rw) : ORIGIN = 0x00000000, LENGTH = 32M
codemem (rwx) : ORIGIN = 0x02000000, LENGTH = 224M
datamem (rw) : ORIGIN = 0x10000000, LENGTH = 800M
loadmem (rwx) : ORIGIN = 0xC0000000, LENGTH = 128M
}
/* Patch for MCP_LoadFile (ioctl 0x53).
*
* Reference for most of the types and whatever:
* https://github.com/exjam/decaf-emu/tree/ios/src/libdecaf/src/ios/mcp
*
* This is a proof of concept, and shouldn't be used until it's cleaned up a bit.
* Co-authored by QuarkTheAwesome, exjam and Maschell
*
* Flow of calls:
* - kernel loads system libraries, app rpx or user calls OSDynLoad
#include "cafe_loader.h"
#include "cafe_loader_bounce.h"
#include "cafe_loader_iop.h"
#include "cafe_loader_ipcldriver.h"
#include "cafe/cafe_stackobject.h"
#include "cafe/cafe_tinyheap.h"
#include "cafe/kernel/cafe_kernel_process.h"
#include "cafe_loader_rpl.h"
#include <array>
#pragma once
#include <cstdint>
#include <common/type_traits.h>
#include <libcpu/be2_struct.h>
#include <type_traits>
namespace cafe
{
namespace detail
signed int net::readHostsFile()
{
int *v0; // r2
int v1; // r1
int v2; // r0
signed int v3; // r6
int v4; // r4
int k; // r3
_DWORD *i; // r5
_DWORD *j; // r4
@exjam
exjam / Change.MD
Last active September 27, 2017 20:30
#include "ppcutils/stackobject.h"
...
IMError
IMStartAPDVideoMode()
{
ppcutils::StackObject<be_val<uint32_t>> previous;
auto result = IM_GetNvParameterWithoutHandleAndItb(IMParameter::APDPeriod, previous);
Program <- _ (Instruction / Comment)* _ EndOfProgram?
Instruction <- _ (CfInst / CfExpInst / TexClause / AluClause)
Number <- < [0-9]+ >
HexNumber <- < '0x' [0-9A-Fa-f]+ >
Float <- $< '-'? [0-9]+ ('.' [0-9]+ )? 'f'? >
EndOfLine <- '\r\n' / '\n' / '\r'
EndOfFile <- !.
End <- EndOfLine / EndOfFile
Program <- _ (Instructions _)* _ EndOfProgram
Instructions <- CfInst / CfExpInst / TexClause / AluClause
CfInst <- (InstCount _ CfOpcode _ CfInstPropertiesOpt _)
CfExpInst <- (InstCount _ ExpOpcode ':' _ ExpTarget _ ',' _ VecGpr _ CfInstPropertiesOpt _)
TexClause <- (InstCount _ TexClauseInstType _ ':' _ CfInstPropertiesOpt _) TexInst*
AluClause <- (InstCount _ AluClauseInstType _ ':' _ CfInstPropertiesOpt _) AluInst*
EndOfProgram <- 'END_OF_PROGRAM'
Number <- < [0-9]+ >