Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- # CONSTANTS
- MYNAME: .string "Melvin\n"
- FORMATD: .string "%s" # %d: numbers | %s: for text
- .global main
- main:
- enter $0,$0 # Boilerplate: preserve caller bp and init callee bp
- movq $FORMATD, %rdi # 1st argument: FORMAT DIGIT
- movq $MYNAME, %rsi # 2st argument: Melvin
- call printf # C printf(%rdi: %d, $MYNAME: "Melvin")
- xor %rdi, %rdi # set the return code to magic num
- leave # Boilerplate: set the bp back to what it was for our fellow caller, and reset our sp to the top of it's stackframe and this line is getting prettylong
- call exit # C exit(%rdi)
- # movq $andy, %rip
- ################MEMORY##################
- ### STACK
- # The Lgenedary Caller
- # --- # 0xffffff72: 13 <--- %rbp
- # 0xffffff64: 24
- # --- # 0xffffff56: 35
- # We, the callee
- # --- # 0xffffff48: 0xffffff72 <--- %rsp
- # 0xffffff40: 0x69
- # --- # 0xffffff32: 69
- #### HEAP
- # 0x0fff4242: ""
- # 0x0fee3232: 0x42
- ### CONST
- # 0x0f231848: "M"
- # 0x0f231850: e 97
- # 0x0f231852: l ab
- #PROGRAM
- # 0x20 (main): F0 00 00
- # 0x21: 3f c3
- # 0x22:
- # 0x23:
- ################REGISTERS##################
- # (destination index) rdi: 1st arg
- # (source index) rsi: 2nd arg
- # (data) rdx:
- # (counter) rcx:
- # (temp8) r8:
- # (temp9) r9:
- # (base) rbx: 22
- # (base pointer) rbp: 0xffffff72
- # (stack pointer) rsp: 0xffffff48
- # (instruction ptr) rip:
- ###### SYMBOL TABLEEEE YEEEE BOIIIII
- # printf
- # scanf
- # exit
- # "c standard lib stuff"
- # " some other stuffffff"
- # main
- # bananderp
- ####### SHELSLLLLLL
- # ~$ ./programname -> call bananderp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement