Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 04 · How Computers Work · Inside the operating system · about 15 min to read

Play it as a journeyTutor comes with a plan

One program, three chips: x86, ARM, RISC-V and the ABI

Stack Frame Layout
Stack Frame Layout · Open board

The memory a function uses while it runs, including the place where its arguments wait. This lesson is about who agrees on what goes where.

Before you start. The CPU (fetch-decode-execute, the ISA, assembly) showed the same three-line C function compiled for ARM and x86, giving two instructions on one and five on the other, and named the instruction set architecture (ISA), the fixed list of instructions a chip understands. Doing many things at once inside one core: out-of-order, SIMD and speculation stayed inside one core and showed how it starts work early. The names a program needs to find showed that a compiled library makes promises about its names, and that breaking one stops a program. This lesson asks what else must match when two pieces of compiled code meet.

Lesson 19 of 41 in How Computers Work

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 22 June 2020: Apple says the Mac will change chips
  • Three chips, three sets of instructions, one C file
  • The calling convention: where the arguments wait
  • The ABI: the plug has to fit the socket
  • Callee-saved registers: what a function must give back
  • Apple’s own version of the ARM convention
  • Moving a platform: build twice, or translate
  • RISC-V: an ISA anyone may build
  • Reading the chip name out of a file
  • The argument model
  • Structure layout is part of the ABI
  • Calling with the wrong rules
  • Edge cases and real systems

Terms it explains: caller, callee, calling convention, application binary interface, ABI, callee-saved register, RISC-V, open ISA.

Review How Computers Work