User Tools

Site Tools


notes:comporg:projects:pnc3

PNC the 3

Alright, so PNC3!! So guys the goal is to create a primereg in assembly. It should be possible with our current knowledge in assembly. If you would like, and just primereg isn't enough for you by all means go further and do things such as:

  • primeregb
  • primeregs
  • primeregbs
  • primerega
  • primeregba
  • primeregboa

good luck guys! Have fun!

compiling

nasm -f elf64 -o pnc3.o pnc3.asm 
ld -o pnc3 pnc3.o 

gdb commands

  • show registers
  • info registers (shows info on register)
    • this can be shortened as an example to: i r eax
  • set disassembly-flavor intel (sets assembly flavor up to intel)
  • break _start: (start of program, go step by step from here)
  • layout asm
  • ni - next instruction
  • si - step instruction

example of displaying registers:

break _start \\Breakpoint 1, 0x0000000000400080 in _start ()
(gdb) display/x $rax
1: /x $rax = 0x0
(gdb) display/x $rbx
2: /x $rbx = 0x0
(gdb) display/x $rcx
3: /x $rcx = 0x0
(gdb) display/x $rip
4: /x $rip = 0x400080
(gdb)
si

Helpful sources:

Register usage: Take note of registers r12-r15

http://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/

https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatsheet.pdf

https://www.cs.uaf.edu/2017/fall/cs301/reference/x86_64.html

http://www.egr.unlv.edu/~ed/assembly64.pdf

http://www.felixcloutier.com/x86/ (large list of assembly instructions)

kupala nasm tutorial!! great tutorial!! https://www.youtube.com/watch?v=VQAKkuLL31g&list=PLetF-YjXm-sCH6FrTz4AQhfH6INDQvQSn

notes/comporg/projects/pnc3.txt · Last modified: 2018/03/14 00:15 by ktodd3