blob: 48b7e6296c77ff6c7942aad19a1a99f4e1847272 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* This file was a very early example, written by consulting [1]. It was
* useful primarily to see how the GNU assembler handles these opcodes, to
* better understand the encoding.
*
* [1] https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
*
*
* gcc -o exit-code -nostartfiles -nostdlib exit-code.gnu.asm && ./exit-code ; echo $?
*
* or
*
* as -o exit-code.o exit-code.gnu.asm && ld -s -o exit-code exit-code.o && ./exit-code; echo $?
*
* Can't use nasm, nasm is 32-bit only.
*
* Since you get a nice clean file, you can then do:
*
* objdump --disassemble exit-code
*/
.text
.global _start
_start:
mov $60, %eax
mov $42, %edi
syscall
|