Skip to content

Commit 86ececa

Browse files
committed
Fix tss struct and minor typo
1 parent 4b07e31 commit 86ececa

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

04_Memory_Management/02_Physical_Memory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ What the physical memory manager has to take care of as its bare minimum is:
1010
2. Check if given an address it is already used or not
1111
3. Allocate/free a page
1212

13-
In this document we will explain the bitmap method, because is probably the simplest to understand for a beginner. To keep the explanation simple, we will assume that the kernel will support only one page size.
13+
In this chapter we will explain the bitmap method, because is probably the simplest to understand for a beginner. To keep the explanation simple, we will assume that the kernel will support only one page size.
1414

1515
## The Bitmap
1616

06_Userspace/03_Handling_Interrupts.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ As for the legacy part? `X86` is an old architecture, oringinally it had no conc
1515
The TSS served a different purpose on `x86` (protected mode, not `x86_64`), and was for *hardware task switching*. Since this proved to be slower than *software task switching*, this functionality was removed in long-mode. The 32 and 64 bit TSS structures are very different and not compatible. Note that the example below uses the `packed` attribute, as is always a good idea when using structures that are dealing with hardware directly. We want to ensure our compiler lays out the memory as we expect. A `C` version of the long mode TSS is given below:
1616

1717
```c
18-
__attribute__((packed))
19-
struct tss
18+
typedef struct tss
2019
{
2120
uint32_t reserved0;
2221
uint64_t rsp0;
2322
uint64_t rsp1;
2423
uint64_t rsp2;
2524
uint64_t reserved1;
25+
uint64_t reserved2;
2626
uint64_t ist1;
2727
uint64_t ist2;
2828
uint64_t ist3;
2929
uint64_t ist4;
3030
uint64_t ist5;
3131
uint64_t ist6;
3232
uint64_t ist7;
33-
uint64_t reserved2;
34-
uint16_t reserved3;
33+
uint64_t reserved3;
34+
uint16_t reserved4;
3535
uint16_t io_bitmap_offset;
36-
};
36+
}__attribute__((__packed__)) tss_t;
3737
```
3838

3939
As per the manual, the reserved fields should be left as zero. The rest of the fields can be broken up into three groups:

99_Appendices/J_Updates.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ Third Book Release
3333

3434
* Add more information on the Memory protection chapter, abouit its future implications
3535
* Emergency grammar fix!
36+
* Fix tss structure in Userspace/Handling_Interrupt chapter.

0 commit comments

Comments
 (0)