mirror of
https://github.com/lowlevellearning/rosetta-stone.git
synced 2025-08-03 17:56:15 -04:00
Initial commit
This commit is contained in:
commit
8e2ad0e8d8
15
Makefile
Normal file
15
Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
default: all
|
||||
|
||||
all: powerpc arm aarch64
|
||||
|
||||
powerpc:
|
||||
powerpc-linux-gnu-gcc -o ppc rosetta.c -static
|
||||
powerpc-linux-gnu-objdump -d -Mintel ./ppc > ppc-dump
|
||||
|
||||
arm:
|
||||
arm-linux-gnueabi-gcc -o arm rosetta.c -static
|
||||
arm-linux-gnueabi-objdump -d -Mintel ./arm > arm-dump
|
||||
|
||||
aarch64:
|
||||
aarch64-linux-gnu-gcc -o aarch64 rosetta.c -static
|
||||
aarch64-linux-gnu-objdump -d -Mintel ./aarch64 > aarch64-dump
|
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# The ASM Rosetta Stone
|
||||
This respository contains the ASM Rosetta Stone, a small snippet of C
|
||||
that you can use to learn a new assembly variant in a short amount of
|
||||
time.
|
||||
|
||||
## Checklist
|
||||
- registers
|
||||
- names []
|
||||
- width []
|
||||
- stack memory
|
||||
- how is it used []
|
||||
- prolouge, epilouge []
|
||||
- calling conventions
|
||||
- arguments []
|
||||
- return value []
|
||||
- return address []
|
||||
- control flow
|
||||
- branching []
|
||||
- conditional branches[]
|
||||
- calls []
|
||||
- syscall interface []
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
38
rosetta.c
Normal file
38
rosetta.c
Normal file
@ -0,0 +1,38 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
// calling conventions
|
||||
int returny_func(int *a, char b, short c, int d)
|
||||
{
|
||||
// return value
|
||||
return b+c;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// 64-bit
|
||||
long long mylong = 0xbabecafef00dface;
|
||||
|
||||
// 32-bit
|
||||
int myint = 0xdeadf00d;
|
||||
|
||||
// string operations
|
||||
char str[] = "mystr";
|
||||
|
||||
// canary value
|
||||
int i = 1337;
|
||||
|
||||
// control flow
|
||||
while (i)
|
||||
{
|
||||
i--;
|
||||
}
|
||||
|
||||
int ret = returny_func(&i, 0x42, 0x69, 0x31337);
|
||||
|
||||
// syscall interface
|
||||
syscall(SYS_write, 1, "done:)\n", 7);
|
||||
|
||||
return 32;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user