General differences in 64 bit: Default size is 64 bits If you wanted 32, use movl, addl, etc. push and pop operate with 64 bits now 64-bit registers start with r rax, rdi, rbp, etc. Use 64-bit version when dealing with memory addresses There are some extra registers: r8, r9, r10, r11, r12, r13, r14, r15 These can have d, w, or b suffix for 32, 16, or 8 bites If dealing with a C int, still use 32-bit (eax, etc) Unless you need to clear the whole register... System Calls: syscall replaces int 0x80 It's an instruction in x86_64 Fundamentally, it does the same thing Parameter order: rax: System Call Number After that: rdi, rsi, rdx, r10, r8, r9 An explanation: /usr/src/linux-source-6.1/arch/x86/entry/entry_64.S System call numbers are different Table at: /usr/src/linux-source-6.1/arch/x86/entry/syscalls/syscall_64.tbl Other than all that, they're pretty similar Examples: Hello world with write: hw_64.s Demo with printf/scanf: functions_64.s Function Calls: Different calling convention (see Wikipedia) Now a lot of parameters go into registers Other than that, it's basically the same You need to have the stack aligned on a 16-byte boundary! As in, the last hex digit should be 0 Otherwise it'll mysteriously segfault Now that we're 64-bit: Let's interact with a C program! A minor compatibility issue: Executable stacks We don't actually need one Could set as a linker option with -z Could also put a .section .note.GNU-stack in the assembly C libary used from Assembly: Write the library in a c file Compile it with gcc -c -o library_name.o source_code.c Assemble your program as usual Link it all together! Probably something like this: ld asm_object.o library_name.o -lc -z execstack --dynamic-linker /lib64/ld-linux-x86-64.so.2 Run the binary that comes out of all this Assembly library used from C: Write the library, build with as as usual Write the C program and use the function Make a C prototype for the function, either in the main file or a header Build the program with gcc or clang: gcc c_source.c asm_library.o -z execstack Could we make a build script for this? Of course!