Skip to content

Commit b9c3339

Browse files
committed
Fix syntax for some code blocks
1 parent ec200d1 commit b9c3339

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

Chapter-3/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This boot process also initializes some of our C++ runtime, it will be described
3737

3838
Multiboot header structure:
3939

40-
```
40+
```cpp
4141
struct multiboot_info {
4242
u32 flags;
4343
u32 low_mem;
@@ -82,7 +82,7 @@ qemu-img create c.img 2M
8282
8383
We need now to partition the disk using fdisk:
8484
85-
```
85+
```bash
8686
fdisk ./c.img
8787
8888
# Switch to Expert commands
@@ -132,27 +132,27 @@ We need now to attach the created partition to the loop-device (which allows a f
132132

133133
Using ```fdisk -l -u c.img```, you get: 63 * 512 = 32256.
134134

135-
```
135+
```bash
136136
losetup -o 32256 /dev/loop1 ./c.img
137137
```
138138

139139
We create a EXT2 filesystem on this new device using:
140140

141-
```
141+
```bash
142142
mke2fs /dev/loop1
143143
```
144144

145145
We copy our files on a mounted disk:
146146

147-
```
147+
```bash
148148
mount /dev/loop1 /mnt/
149149
cp -R bootdisk/* /mnt/
150150
umount /mnt/
151151
```
152152

153153
Install GRUB on the disk:
154154

155-
```
155+
```bash
156156
grub --device-map=/dev/null << EOF
157157
device (hd0) ./c.img
158158
geometry (hd0) 4 16 63
@@ -164,7 +164,7 @@ EOF
164164

165165
And finally we detach the loop device:
166166

167-
```
167+
```bash
168168
losetup -d /dev/loop1
169169
```
170170

Chapter-5/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ void Io::putc(char c){
2121
unsigned char *video;
2222
video = (unsigned char *) (real_screen+ 2 * x + 160 * y);
2323
// newline
24-
if (c == '\n') {
24+
if (c == '\n') {
2525
x = 0;
2626
y++;
2727
// back space
28-
} else if (c == '\b') {
28+
} else if (c == '\b') {
2929
if (x) {
3030
*(video + 1) = 0x0;
3131
x--;
3232
}
3333
// horizontal tab
34-
} else if (c == '\t') {
34+
} else if (c == '\t') {
3535
x = x + 8 - (x % 8);
3636
// carriage return
37-
} else if (c == '\r') {
37+
} else if (c == '\r') {
3838
x = 0;
39-
} else {
39+
} else {
4040
*video = c;
4141
*(video + 1) = kattr;
4242

@@ -144,7 +144,7 @@ void Io::print(const char *s, ...){
144144
print("0x%s", buf);
145145
} else if (c == 's') {
146146
print((char *) va_arg(ap, int));
147-
}
147+
}
148148
} else
149149
putc(c);
150150
}

Chapter-7/README.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ Here is a table of common interrupts (Maskable hardware interrupt are called IRQ
5555

5656
| IRQ | Description |
5757
|:-----:| -------------------------- |
58-
| 0 | Programmable Interrupt Timer Interrupt |
59-
| 1 | Keyboard Interrupt |
60-
| 2 | Cascade (used internally by the two PICs. never raised) |
61-
| 3 | COM2 (if enabled) |
62-
| 4 | COM1 (if enabled) |
63-
| 5 | LPT2 (if enabled) |
64-
| 6 | Floppy Disk |
65-
| 7 | LPT1 |
66-
| 8 | CMOS real-time clock (if enabled) |
67-
| 9 | Free for peripherals / legacy SCSI / NIC |
68-
| 10 | Free for peripherals / SCSI / NIC |
69-
| 11 | Free for peripherals / SCSI / NIC |
70-
| 12 | PS2 Mouse |
71-
| 13 | FPU / Coprocessor / Inter-processor |
72-
| 14 | Primary ATA Hard Disk |
58+
| 0 | Programmable Interrupt Timer Interrupt |
59+
| 1 | Keyboard Interrupt |
60+
| 2 | Cascade (used internally by the two PICs. never raised) |
61+
| 3 | COM2 (if enabled) |
62+
| 4 | COM1 (if enabled) |
63+
| 5 | LPT2 (if enabled) |
64+
| 6 | Floppy Disk |
65+
| 7 | LPT1 |
66+
| 8 | CMOS real-time clock (if enabled) |
67+
| 9 | Free for peripherals / legacy SCSI / NIC |
68+
| 10 | Free for peripherals / SCSI / NIC |
69+
| 11 | Free for peripherals / SCSI / NIC |
70+
| 12 | PS2 Mouse |
71+
| 13 | FPU / Coprocessor / Inter-processor |
72+
| 14 | Primary ATA Hard Disk |
7373
| 15 | Secondary ATA Hard Disk |
7474

7575
#### How to initialize the interrupts?
@@ -101,23 +101,23 @@ void init_idt(void)
101101
{
102102
/* Init irq */
103103
int i;
104-
for (i = 0; i < IDTSIZE; i++)
105-
init_idt_desc(0x08, (u32)_asm_schedule, INTGATE, &kidt[i]); //
106-
104+
for (i = 0; i < IDTSIZE; i++)
105+
init_idt_desc(0x08, (u32)_asm_schedule, INTGATE, &kidt[i]); //
106+
107107
/* Vectors 0 -> 31 are for exceptions */
108108
init_idt_desc(0x08, (u32) _asm_exc_GP, INTGATE, &kidt[13]); /* #GP */
109109
init_idt_desc(0x08, (u32) _asm_exc_PF, INTGATE, &kidt[14]); /* #PF */
110-
110+
111111
init_idt_desc(0x08, (u32) _asm_schedule, INTGATE, &kidt[32]);
112112
init_idt_desc(0x08, (u32) _asm_int_1, INTGATE, &kidt[33]);
113-
113+
114114
init_idt_desc(0x08, (u32) _asm_syscalls, TRAPGATE, &kidt[48]);
115115
init_idt_desc(0x08, (u32) _asm_syscalls, TRAPGATE, &kidt[128]); //48
116-
116+
117117
kidtr.limite = IDTSIZE * 8;
118118
kidtr.base = IDTBASE;
119-
120-
119+
120+
121121
/* Copy the IDT to the memory */
122122
memcpy((char *) kidtr.base, (char *) kidt, kidtr.limite);
123123

@@ -175,7 +175,7 @@ The registries have to be configured in order.
175175

176176
**ICW2 (port 0x21 / port 0xA1)**
177177
```
178-
|x|x|x|x|x|0|0|0|
178+
|x|x|x|x|x|0|0|0|
179179
| | | | |
180180
+----------------- base address for interrupts vectors
181181
```
@@ -212,13 +212,13 @@ It is used to define in which mode the controller should work.
212212

213213
You should have noticed that when I'm initializing our IDT segments, I'm using offsets to segment the code in Assembly. The different functions are defined in [x86int.asm](https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System/blob/master/src/kernel/arch/x86/x86int.asm) and are of the following scheme:
214214

215-
```
215+
```asm
216216
%macro SAVE_REGS 0
217-
pushad
217+
pushad
218218
push ds
219219
push es
220220
push fs
221-
push gs
221+
push gs
222222
push ebx
223223
mov bx,0x10
224224
mov ds,bx

0 commit comments

Comments
 (0)