Compare commits
10 Commits
626e94b78f
...
main
Author | SHA1 | Date | |
---|---|---|---|
b1379590ca | |||
2153e52c75 | |||
394fddb024 | |||
c3b61c2d95 | |||
df3b8bd0f8 | |||
20be72dbf9 | |||
afd7076106 | |||
da62a80b0e | |||
5fbf00fa11 | |||
b3ae622bd0 |
9
a_test_addition.txt
Normal file
9
a_test_addition.txt
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
Suppose this is like a piece of code that I'm adding to the repository. This is version 1.
|
||||
|
||||
I'm adding stuff. Lots of stuff. just piling it in.
|
||||
|
||||
Suppose I make a mistake during some commit?
|
||||
|
||||
git reset --soft HEAD~1 isn't really undoing the addition of the mistake line?
|
30
assemblyexample1.asm
Normal file
30
assemblyexample1.asm
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
.global _start
|
||||
//exposes a symbol called start to the assembler
|
||||
.intel_syntax noprefix
|
||||
|
||||
//See: https://www.youtube.com/watch?v=6S5KRJv-7RU
|
||||
//See: https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/
|
||||
|
||||
_start:
|
||||
//write call (sys_write)
|
||||
mov rax,1
|
||||
//sys_write system call
|
||||
mov rdi, 1
|
||||
//unsigned int fd = 1 (stdout)
|
||||
lea rsi,[hello_world]
|
||||
//load effective address (lea) into rsi of hello_world data
|
||||
mov rdx, 14
|
||||
//size_t count excluding null terminator
|
||||
syscall
|
||||
|
||||
//exit call
|
||||
mov rax, 60
|
||||
mov rdi, 33
|
||||
//return result (must be "rdi" not "rdx" - how are these registers named?)
|
||||
syscall
|
||||
//apprently int 80h interrupt is also syscall?
|
||||
|
||||
hello_world:
|
||||
.asciz "Hello, World!\n"
|
||||
|
24
assemblytutorial.txt
Normal file
24
assemblytutorial.txt
Normal file
@ -0,0 +1,24 @@
|
||||
https://www.youtube.com/watch?v=6S5KRJv-7RU
|
||||
|
||||
rdi
|
||||
rsi
|
||||
r8
|
||||
r - 64 bit pointer
|
||||
|
||||
mov rdi,8
|
||||
mov rdi,rsi
|
||||
|
||||
memory operations
|
||||
|
||||
mov rdi, qword ptr[rsi] values from memory into register
|
||||
mov qword ptr[rsi], rdi store into memory operation
|
||||
|
||||
https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/
|
||||
|
||||
|
||||
Compilation:
|
||||
as -c assemblyexample1.asm -o assemblyexample1.o
|
||||
gcc assemblyexample1.o -o assemblyexample1 -nostdlib -static
|
||||
|
||||
Check error code:
|
||||
echo $?
|
18
csharphelloworld.cs
Normal file
18
csharphelloworld.cs
Normal file
@ -0,0 +1,18 @@
|
||||
// https://www.geeksforgeeks.org/how-to-compile-decompile-and-run-c-code-in-linux/
|
||||
//
|
||||
// Use mcs compiler to create a windows executable csharphelloworld.exe from csharphelloworld.cs
|
||||
//
|
||||
// mcs -out:csharphelloworld.exe csharphelloworld.cs
|
||||
// mono csharphelloworld.exe
|
||||
|
||||
using System;
|
||||
|
||||
public class GFG {
|
||||
|
||||
static public void Main()
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
Console.ReadKey();
|
||||
|
||||
}
|
||||
}
|
50
csharphelloworld.decomp.cs
Normal file
50
csharphelloworld.decomp.cs
Normal file
@ -0,0 +1,50 @@
|
||||
.assembly extern mscorlib
|
||||
{
|
||||
.ver 4:0:0:0
|
||||
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
|
||||
}
|
||||
.assembly 'csharphelloworld'
|
||||
{
|
||||
.custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
|
||||
01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
|
||||
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
|
||||
|
||||
.hash algorithm 0x00008004
|
||||
.ver 0:0:0:0
|
||||
}
|
||||
.module csharphelloworld.exe // GUID = {D5E6E53D-50CA-452F-AED9-6A961E988718}
|
||||
|
||||
|
||||
.class public auto ansi beforefieldinit GFG
|
||||
extends [mscorlib]System.Object
|
||||
{
|
||||
|
||||
// method line 1
|
||||
.method public hidebysig specialname rtspecialname
|
||||
instance default void '.ctor' () cil managed
|
||||
{
|
||||
// Method begins at RVA 0x2050
|
||||
// Code size 7 (0x7)
|
||||
.maxstack 8
|
||||
IL_0000: ldarg.0
|
||||
IL_0001: call instance void object::'.ctor'()
|
||||
IL_0006: ret
|
||||
} // end of method GFG::.ctor
|
||||
|
||||
// method line 2
|
||||
.method public static hidebysig
|
||||
default void Main () cil managed
|
||||
{
|
||||
// Method begins at RVA 0x2058
|
||||
.entrypoint
|
||||
// Code size 17 (0x11)
|
||||
.maxstack 8
|
||||
IL_0000: ldstr "Hello World!"
|
||||
IL_0005: call void class [mscorlib]System.Console::WriteLine(string)
|
||||
IL_000a: call valuetype [mscorlib]System.ConsoleKeyInfo class [mscorlib]System.Console::ReadKey()
|
||||
IL_000f: pop
|
||||
IL_0010: ret
|
||||
} // end of method GFG::Main
|
||||
|
||||
} // end of class GFG
|
||||
|
10
csharphelloworld.txt
Normal file
10
csharphelloworld.txt
Normal file
@ -0,0 +1,10 @@
|
||||
https://www.geeksforgeeks.org/how-to-compile-decompile-and-run-c-code-in-linux/
|
||||
|
||||
Use mcs compiler to create a windows executable csharphelloworld.exe from csharphelloworld.cs
|
||||
|
||||
mcs -out:csharphelloworld.exe csharphelloworld.cs
|
||||
mono csharphelloworld.exe
|
||||
|
||||
To decompile this executable file run the following command:
|
||||
|
||||
monodis --output=csharphelloworld.decomp.cs csharphelloworld.exe
|
6
test.txt
6
test.txt
@ -3,3 +3,9 @@ I've added this new thing
|
||||
a new addition
|
||||
|
||||
Added a third line
|
||||
|
||||
a third line
|
||||
|
||||
A fourth line
|
||||
An alternate fourth line.
|
||||
|
||||
|
7
test_repo.code-workspace
Normal file
7
test_repo.code-workspace
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "./"
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user