Source Code

Linux 0.11 source code can be downloaded oldlinux.org linux-0.11.tar.gz

Check CPU Arch

$ uname -a

Quick Start on Mac

Because we can’t install bochs on mac, so we can install qemu instead.

Use fellow command to install

$ brew install qemu

Download qemu-images and unzip it.

$ qemu-system-x86_64 ./qemu-12.5.i386/linux-0.11-devel-060625.qcow2 to test.

Hello World

Linux Arm

$ echo "int main() { int a = 1; int b = 2; int c = a + b; return c;}" > main.c
$ gcc -S main.c
$ cat main.s
        .arch armv8-a
        .file   "main.c"
        .text
        .align  2
        .global main
        .type   main, %function
main:
.LFB0:
        .cfi_startproc
        sub     sp, sp, #16
        .cfi_def_cfa_offset 16
        mov     w0, 1
        str     w0, [sp, 12]
        mov     w0, 2
        str     w0, [sp, 8]
        ldr     w1, [sp, 12]
        ldr     w0, [sp, 8]
        add     w0, w1, w0
        str     w0, [sp, 4]
        ldr     w0, [sp, 4]
        add     sp, sp, 16
        .cfi_def_cfa_offset 0
        ret
        .cfi_endproc
.LFE0:
        .size   main, .-main
        .ident  "GCC: (GNU) 12.2.0"
        .section        .note.GNU-stack,"",@progbits

MacOS Arm

$ echo "int main() { int a = 1; int b = 2; int c = a + b; return c;}" > main.c
$ gcc -S main.c
$ cat main.s
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 12, 0	sdk_version 12, 3
	.globl	_main                           ; -- Begin function main
	.p2align	2
_main:                                  ; @main
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #16
	.cfi_def_cfa_offset 16
	str	wzr, [sp, #12]
	mov	w8, #1
	str	w8, [sp, #8]
	mov	w8, #2
	str	w8, [sp, #4]
	ldr	w8, [sp, #8]
	ldr	w9, [sp, #4]
	add	w8, w8, w9
	str	w8, [sp]
	ldr	w0, [sp]
	add	sp, sp, #16
	ret
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols

LLDB

MacOS M1 can’t install gdb lldb is installed on MacOS nativly.

References