Skip to content

Commit 890086e

Browse files
authored
Page Fault Vector Typo (#123)
* Page Fault Vector Typo * Femtoseconds conversion * RSDP Typo The signature for the RSDP is "RSD PTR ", and it is not an SDT. https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html?highlight=rsdt#root-system-description-table-rsdt * APIC Address Incorrect Fixed the description of the APIC address (the physaddr is not shifted, but the lower bits are masked), and fixed a typo with the location. On my ``qemu-system-x86_64``, the LAPIC base is 0xFEE00000 in physical memory. * Latex-style exponent * C struct syntax error You need to create a entry in the symbol table to reference a C-object itself, e.g. for self-referencing in a struct
1 parent f36ac62 commit 890086e

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

02_Architecture/06_ACPITables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ The RSDT is an SDT header followed by an array of `uint32_t`s, representing the
124124
The XSDT is the same, except the array is of `uint64_t`s.
125125

126126
```c
127-
struct RSDP {
128-
ACPISDTHeader sdtHeader; //signature "RSDP"
127+
struct RSDT {
128+
ACPISDTHeader sdtHeader; //signature "RSDT"
129129
uint32_t sdtAddresses[];
130130
};
131131

02_Architecture/07_APIC.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ This register contains the following information:
6363
* Bit 8: if set, it means that the processor is the Bootstrap Processor (BSP).
6464
* Bits 9:10: reserved.
6565
* Bit 11: APIC global enable. This bit can be cleared to disable the local APIC for this processor. Realistically there is no reason to do this on modern processors.
66-
* Bits 12:31: Contains the base address of the local APIC for this processor core.
66+
* Bits 12:31: Contains the base address of the local APIC for this processor core. NOTE: The value read from these bits should not be shifted, e.g. if you read ``0xFEE00``, then the address is ``0xFEE00000``, just with bits 0:11 zeroed out.
6767
* Bits 32:63: reserved.
6868

69-
Note that the registers are given as a *physical address*, so to access these we will need to map them somewhere in the virtual address space. This is true for the addresses of any I/O APICs we obtain as well. When the system boots, the base address is usually `0xFEE0000` and often this is the value we read from `rdmsr`. For correct operation the local APIC registers should be mapped as 'strong uncachable'.
69+
Note that the registers are given as a *physical address*, so to access these we will need to map them somewhere in the virtual address space. This is true for the addresses of any I/O APICs we obtain as well. When the system boots, the base address is usually `0xFEE00000` and often this is the value we read from `rdmsr`. For correct operation the local APIC registers should be mapped as 'strong uncachable'.
7070

7171
A complete list of local APIC registers is available in the Intel/AMD software development manuals, but the important ones for now are:
7272

02_Architecture/08_Timers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Each register is accessed by adding an offset to the base address we obtained be
143143
- General configuration: offset `0x10`.
144144
- Main counter value: `0xF0`.
145145

146-
We can read the main counter at any time, which is measured in timer ticks. We can convert these ticks into realtime by multiplying them with the timer period in the general capabilities register. Bits 63:32 of the general capabilities register contain the number of femtoseconds for each tick. A nanosecond is 1000 femtoseconds, and 1 second is 1'000'000'000 femtoseconds.
146+
We can read the main counter at any time, which is measured in timer ticks. We can convert these ticks into realtime by multiplying them with the timer period in the general capabilities register. Bits 63:32 of the general capabilities register contain the number of femtoseconds for each tick. A nanosecond is 1'000'000 femtoseconds, and 1 second is $10^{15}$ femtoseconds.
147147

148148
We can also write to the main counter, usually we would write a 0 here when initializing the HPET in order to be able to determine uptime, but this is not really necessary.
149149

04_Memory_Management/03_Paging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ There are 3 possible scenarios:
8585
* 2Mib Pages: in this case we only need 3 page levels.
8686
* 1Gib Pages: Only 2 levels are needed.
8787

88-
To implement paging, is strongly recommended to have already implemented interrupts too, specifically handling #PF (vector 0xd).
88+
To implement paging, is strongly recommended to have already implemented interrupts too, specifically handling #PF (vector 0xE).
8989

9090
The 4 levels of page directories/tables are:
9191

04_Memory_Management/04_Virtual_Memory_Manager.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ In addition, we might want to store some flags in the *vm object*, they are like
3838
Here's what our example virtual memory object looks like:
3939

4040
```c
41-
typedef struct {
41+
typedef struct vm_object {
4242
uintptr_t base;
4343
size_t length;
4444
size_t flags;
45-
vm_object* next;
45+
struct vm_object* next;
4646
} vm_object;
4747

4848
#define VM_FLAG_NONE 0

0 commit comments

Comments
 (0)