-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
175 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[BITS 32] | ||
|
||
%include "cpu.inc" | ||
%include "sys/i386/cpu.inc" | ||
%include "base.inc" | ||
|
||
%macro ISR_NO_ERR 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
%include "sys/i386/mmu.inc" | ||
%include "sys/i386/task.inc" | ||
|
||
section .text | ||
global tss_install | ||
tss_install: | ||
push ebp | ||
mov ebp, esp | ||
push esi | ||
mov esi, [ebp + 8] | ||
|
||
mov eax, tss_size | ||
lea ebx, tss_entry | ||
mov [esi + gdt_entry.limit_low], ax | ||
mov [esi + gdt_entry.base_low], bx | ||
shr eax, 16 | ||
mov [esi + gdt_entry.base_mid], al | ||
|
||
mov al, 0x9 | (1 << 7) | ||
mov [esi + gdt_entry.access], al | ||
|
||
shr ebx, 16 | ||
and bl, 0xF | ||
mov [esi + gdt_entry.flags], bl | ||
|
||
mov [esi + gdt_entry.base_high], ah | ||
|
||
mov dword [tss_entry + tss.ss0], 0x10 | ||
extern stack_top | ||
mov dword [tss_entry + tss.esp0], stack_top | ||
|
||
leave | ||
ret | ||
|
||
global tss_flush | ||
tss_flush: | ||
mov ax, (5 * 8) | 0 | ||
ltr ax | ||
ret | ||
|
||
section .data | ||
|
||
tss_entry: | ||
times tss_size db 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
;; File: cpu.inc | ||
|
||
;; Structure: idt_gate | ||
;; .offset_low - TODO | ||
;; .selector - TODO | ||
;; .zero - TODO | ||
;; .attributes - TODO | ||
;; .offset_high - TODO | ||
;; | ||
struc idt_gate | ||
.offset_low: resw 1 | ||
.selector: resw 1 | ||
.zero: resb 1 | ||
.attributes: resb 1 | ||
.offset_high: resw 1 | ||
endstruc | ||
|
||
;; About: Gates | ||
;; - Task Gate | ||
;; > 31 23 15 7 0 | ||
;; > +----------------|----------------+-----------------|-----------------+ | ||
;; > | (NOT USED) | P DPL 0 0 1 0 1 (NOT USED) | | ||
;; > +----------------|----------------+-----------------|-----------------+ | ||
;; > | SELECTOR | (NOT USED) | | ||
;; > +----------------|----------------+-----------------|-----------------+ | ||
;; | ||
;; - Interrupt Gate | ||
;; > 31 23 15 7 0 | ||
;; > +----------------|----------------+-----------------|-----------------+ | ||
;; > | OFFSET 31..16 | P DPL 0 1 1 1 0 0 0 0 0 0 0 0 0 | | ||
;; > +----------------|----------------+-----------------|-----------------+ | ||
;; > | SELECTOR | OFFSET 15..0 | | ||
;; > +--------------- |----------------+-----------------|-----------------+ | ||
;; | ||
;; - Trap Gate | ||
;; > 31 23 15 7 0 | ||
;; > +----------------|----------------+-----------------|-----------------+ | ||
;; > | OFFSET 31..16 | P DPL 0 1 1 1 1 0 0 0 0 0 0 0 0 | | ||
;; > +----------------|----------------+-----------------|-----------------+ | ||
;; > | SELECTOR | OFFSET 15..0 | | ||
;; > +--------------- |----------------+-----------------|-----------------+ | ||
|
||
struc intframe | ||
;; registers | ||
.edi: resd 1 | ||
.esi: resd 1 | ||
.ebp: resd 1 | ||
.esp: resd 1 | ||
.ebx: resd 1 | ||
.edx: resd 1 | ||
.ecx: resd 1 | ||
.eax: resd 1 | ||
|
||
;; | ||
.gs: resd 1 | ||
.fs: resd 1 | ||
.es: resd 1 | ||
.ds: resd 1 | ||
.intno: resd 1 | ||
|
||
;; by x86 hardware | ||
.err: resd 1 | ||
.eip: resd 1 | ||
.cs: resd 1 | ||
.eflags: resd 1 | ||
|
||
;; crossring | ||
.useresp: resd 1 | ||
.ss: resd 1 | ||
endstruc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters