summaryrefslogtreecommitdiff
path: root/README
blob: 4ddff4cc2d570757c97de0798a4f7bc3847c2e61 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Requirements
------------

nasm
gcc, clang, tcc or pcc

Debugging
---------

hexdump -C image.bin | less

ndisasm -b16 -o7c00h -a image.bin | less

objdump -M intel -d kernel.o | less

gcc -m32 -ffreestanding -c -o kernel.o kernel.c
ld -o kernel.bin -Ttext 0x8800 kernel.o -m elf_i386 --oformat binary
objdump -M intel -d kernel.bin | less

# oformat: objdump -i lists tons of formats
# -m: ld -V
# -T: set text segment ot start at BIOS block 3
# TEXT means code

bochs -q 'boot:floppy' 'floppya: 1_44=image.bin, status=inserted'

Some interesting breakpoints:

boot loader (boot.asm, stage 1)
break 0x7c00

boot loeader after switching to protecting mode:
break 0x7e4e

Booting from 0000:7c00
(0) Breakpoint 1, 0x0000000000007c00 in ?? ()
Next at t=14040244
(0) [0x000000007c00] 0000:7c00 (unk. ctxt): mov ax, 0x0000            ; b80000

C entry:
break 0x8800

disassemble kernel in 32-bit mode
ndisasm -b32 -o8800h -a kernel.bin | less

With qemu remote (see http://wiki.osdev.org/Kernel_Debugging):

make run-qemu-debug

gdb) target remote localhost:1234
gdb) symbol-file kernel.sym
gdb) break entry
gdb) c

or make a enable execution of the local .gdbinit file in 'src'
with the following settings in the user ~/.gdbinit

set auto-load local-gdbinit
set auto-load safe-path /

for assembly code view:

set disassemble-next-line on 

analyze network traffic:

tcpdump -enr network.log

links
-----

Writing a Simple Operating System - from Scratch, Nick Blundell
http://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf

OS Development: Low-level Boot-Sector Programming, Nick Blundell
https://www.youtube.com/watch?v=YvZhgRO7hL4&list=UUjrLiYrvbpXR37c0HV4PmqA

http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-manual-325462.html
http://wiki.osdev.org/Global_Descriptor_Table
https://en.wikipedia.org/wiki/INT_10H
http://www.osdever.net/FreeVGA/vga/crtcreg.htm
http://wiki.osdev.org/Text_Mode_Cursor
https://en.wikipedia.org/wiki/Calling_convention
http://wiki.osdev.org/Main_Page

other project links
-------------------

http://www.helenos.org
https://github.com/cfenollosa/os-tutorial
http://wyoos.org: in C++
http://osdev.org
https://github.com/Codepixl/CodeOS
http://www.osdever.net/tutorials/
http://lowelevel.eu
http://download.tyndur.org/releases/0.2/
https://code.google.com/archive/p/fpos/source/default/source, FreePascal
https://mirage.io/
http://www.jamesmolloy.co.uk/tutorial_html/
http://prettyos.de
http://www.jbox.dk/sanos/index.htm
https://github.com/omarrx024/xos/
http://minirighi.sourceforge.net
http://contiki-os.org/