Git Product home page Git Product logo

mep-wtf's Introduction

mep-wtf works by translating MeP code to aarch64 assembly. Since the ABI differs between these architectures, you need to manually set function prototypes.

Prototypes for functions:
	int __usercall ZeroArgs@<W4>()
	int __usercall OneArg@<W4>(__int64 a1@<X0>)
	int __usercall TwoArgs@<W4>(__int64 a1@<X0>, __int64 a2@<X1>)
	int __usercall ThreeArgs@<W4>(__int64 a1@<X0>, __int64 a2@<X1>, __int64 a3@<X2>)
	int __usercall FourArgs@<W4>(__int64 a1@<X0>, __int64 a2@<X1>, __int64 a3@<X2>, __int64 a4@<X3>)
	int __usercall FiveArgs@<W4>(__int64 a1@<X0>, __int64 a2@<X1>, __int64 a3@<X2>, __int64 a4@<X3>, _DWORD)
	int __usercall SixArgs@<W4>(__int64 a1@<X0>, __int64 a2@<X1>, __int64 a3@<X2>, __int64 a4@<X3>, __int64)
	int __usercall SevenArgs@<W4>(__int64 a1@<X0>, __int64 a2@<X1>, __int64 a3@<X2>, __int64 a4@<X3>, __int64, _DWORD)
	int __usercall EightArgs@<W4>(__int64 a1@<X0>, __int64 a2@<X1>, __int64 a3@<X2>, __int64 a4@<X3>, __int64, __int64)
	int __usercall NineArgs@<W4>(__int64 a1@<X0>, __int64 a2@<X1>, __int64 a3@<X2>, __int64 a4@<X3>, __int64, __int64, _DWORD)
	int __usercall TenArgs@<W4>(__int64 a1@<X0>, __int64 a2@<X1>, __int64 a3@<X2>, __int64 a4@<X3>, __int64, __int64, __int64)

Note that the args past fourth are passed on stack. We pretend that they are int64_t's, but it's actually two separate args.

Compile secure_kernel:
	aarch64-linux-gnu-as test.asm -o file.o -c && aarch64-linux-gnu-ld file.o -o f00d_169.elf -Ttext=0x900000

Compile an sm module:
	aarch64-linux-gnu-as test.asm -o file.o -c && aarch64-linux-gnu-ld file.o -o sm.elf -Ttext=0x9B0000

mep-wtf's People

Contributors

xyzz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.