Skip to content

Commit

Permalink
Fix tss struct and minor typo
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamos82 committed Nov 17, 2023
1 parent 4b07e31 commit 86ececa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 04_Memory_Management/02_Physical_Memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ What the physical memory manager has to take care of as its bare minimum is:
2. Check if given an address it is already used or not
3. Allocate/free a page

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.
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.

## The Bitmap

Expand Down
10 changes: 5 additions & 5 deletions 06_Userspace/03_Handling_Interrupts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ As for the legacy part? `X86` is an old architecture, oringinally it had no conc
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:

```c
__attribute__((packed))
struct tss
typedef struct tss
{
uint32_t reserved0;
uint64_t rsp0;
uint64_t rsp1;
uint64_t rsp2;
uint64_t reserved1;
uint64_t reserved2;
uint64_t ist1;
uint64_t ist2;
uint64_t ist3;
uint64_t ist4;
uint64_t ist5;
uint64_t ist6;
uint64_t ist7;
uint64_t reserved2;
uint16_t reserved3;
uint64_t reserved3;
uint16_t reserved4;
uint16_t io_bitmap_offset;
};
}__attribute__((__packed__)) tss_t;
```

As per the manual, the reserved fields should be left as zero. The rest of the fields can be broken up into three groups:
Expand Down
1 change: 1 addition & 0 deletions 99_Appendices/J_Updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ Third Book Release

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

0 comments on commit 86ececa

Please sign in to comment.