From cb3c784e37d827a76f16475885cea2ce3507051d Mon Sep 17 00:00:00 2001 From: trickster0 Date: Thu, 30 Sep 2021 16:03:11 +0300 Subject: [PATCH] asm --- asm_syscall/Cargo.toml | 8 ++++++++ asm_syscall/src/main.rs | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 asm_syscall/Cargo.toml create mode 100644 asm_syscall/src/main.rs diff --git a/asm_syscall/Cargo.toml b/asm_syscall/Cargo.toml new file mode 100644 index 0000000..7f59791 --- /dev/null +++ b/asm_syscall/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "asm_syscall" +version = "0.1.0" +edition = "2018" +author = "trickster0" +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/asm_syscall/src/main.rs b/asm_syscall/src/main.rs new file mode 100644 index 0000000..dbda70f --- /dev/null +++ b/asm_syscall/src/main.rs @@ -0,0 +1,17 @@ +#![feature(asm)] + +fn main() { + let rax:u64; + unsafe { + asm!( + "push rbx", + "xor rbx, rbx", + "xor rax, rax", + "mov rbx, qword ptr gs:[0x60]", + "mov rax,rbx", + "pop rbx", + out("rax") rax, + ); + } + println!("PEB Address: 0x{:x}",rax); +}