Master the fundamental concepts of arm assembly (aarch64) through this focused micro-challenge.
You have read the whole brief, and the concepts above stay free on every task. Writing and running the code needs a plan.
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it worksAndroid's bionic memcpy and ARM's optimized-routines repo ship multiple tuned variants; your version teaches the load/store core. AArch64 cannot add to memory directly: load into a register, store out, advance pointers.
asmLoading…
[x1], #1 loads then bumps srcFor this exercise, you will copy arbitrary byte counts including zero. This task asks you to return the original dest pointer in x0, matching libc semantics, because OS kernels and network stacks call memcpy millions of times per second on arm64 servers.
Keep the relevant man page, ABI doc, or Rust reference chapter open while you work. When your output disagrees with the reference implementation on the same machine, the mismatch is usually an alignment rule, an off-by-one terminator, or a register slot you misread in GDB. Skim the official documentation for the tool or ABI named in the exercise; the prose changes, but register roles, syscall numbers, and ownership rules stay stable across releases. Treat each failure as a contract test: the CPU, kernel, and borrow checker enforce rules whether or not the tutorial mentioned them explicitly.
Write memcpy in AArch64 assembly:
asmLoading…
memcpy does.ldrb w4, [x1], #1 loads a byte and then advances x1.stp/ldp), because the harness keeps its own state there. A function that calls another with bl must save x30 (the return address) first.The harness reads one line, calls my_memcpy to copy it into a buffer of its own, and prints the buffer through the pointer you return, so returning the wrong pointer shows up in the output.
One line of text, possibly empty.
The same line: hello for hello, an empty line for empty input.
ARM code is not run on this site yet. Submit completes the task once your code assembles for AArch64 and still declares and defines every .global symbol in the starter. The tests below show exactly what a correct program prints, so you can run it yourself: aarch64-linux-gnu-as, aarch64-linux-gnu-ld and qemu-aarch64, or natively on an ARM Linux machine.