x86_64¶
For a good list of op codes, checkout:
http://ref.x86asm.net/coder64.html
For an online assembler, checkout:
https://defuse.ca/online-x86-assembler.htm
Linux¶
For a good list of linux system calls, refer:
http://blog.rchapman.org/post/36801038863/linux-system-call-table-for-x86-64
-
class
ppci.arch.x86_64.
X86_64Arch
(options=None)¶ x86_64 architecture
-
determine_arg_locations
(arg_types)¶ - Given a set of argument types, determine locations
- the first arguments go into registers. The others on the stack.
see also http://www.x86-64.org/documentation/abi.pdf
ABI: p1 = rdi p2 = rsi p3 = rdx p4 = rcx p5 = r8 p6 = r9
floating point values are passed in xmm0, xmm1, xmm2, xmm3, etc..
return value in rax
self.rv = rax
On windows a different scheme is used: integers are passed in rcx, rdx, r8 and r9 floats are passed in xmm0, xmm1, xmm2 and xmm3
These examples show how it works:
func(int a, double b, int c, float d) // a in rcx, b in xmm1, c in r8 and d in xmm3
-
determine_rv_location
(ret_type)¶ return value in rax or xmm0
-
gen_call
(frame, label, args, rv)¶ This function moves arguments in the proper locations.
-
gen_epilogue
(frame)¶ Return epilogue sequence for a frame. Adjust frame pointer and add constant pool
-
gen_function_enter
(args)¶ Copy arguments into local temporaries and mark registers live
-
gen_memcpy
(dst, src, count)¶ Generate a memcpy action
-
gen_prologue
(frame)¶ Returns prologue instruction sequence
-
get_reloc_type
(reloc_type, symbol)¶ Get the reloc type for ELF format.
-
move
(dst, src)¶ Generate a move from src to dst
-