-
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.
Merge pull request #73 from bassaer/develop
[ver 1.15.1] fix context switch
- Loading branch information
Showing
14 changed files
with
186 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# CHANGELOG | ||
|
||
## ver 1.15.1 | ||
- fix context switch | ||
|
||
## ver 1.15.0 | ||
- use linear list for timer | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef MYOS_SCHED_H | ||
#define MYOS_SCHED_H | ||
|
||
void init_sched(); | ||
|
||
void set_tr(int tr); | ||
|
||
void context_switch(int addr); | ||
|
||
void task2_main(); | ||
|
||
#endif |
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,57 @@ | ||
#ifndef MYOS_TSS_H | ||
#define MYOS_TSS_H | ||
|
||
/** | ||
* 32bit TSS(Task Status Segment) | ||
*/ | ||
typedef struct { | ||
/** | ||
* タスク設定の内容 | ||
*/ | ||
int backlink; | ||
int esp0; | ||
int ss0; | ||
int esp1; | ||
int ss1; | ||
int esp2; | ||
int ss2; | ||
int cr3; | ||
|
||
/** | ||
* 32bitレジスタ | ||
*/ | ||
int eip; | ||
int eflags; | ||
int eax; | ||
int ecx; | ||
int edx; | ||
int ebx; | ||
int esp; | ||
int ebp; | ||
int esi; | ||
int edi; | ||
|
||
/** | ||
* 16bitレジスタ | ||
*/ | ||
int es; | ||
int cs; | ||
int ss; | ||
int ds; | ||
int fs; | ||
int gs; | ||
|
||
/** | ||
* タスク設定の内容 | ||
* | ||
* 不正な値が入るとコンテキストスイッチが動作しないので | ||
* 以下の初期値を設定する | ||
* idtr = 0 | ||
* iomap = 0x400000000 | ||
*/ | ||
int ldtr; | ||
int iomap; | ||
} tss_t; | ||
|
||
#endif | ||
|
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include <sched.h> | ||
|
||
#include <console.h> | ||
#include <io.h> | ||
#include <tss.h> | ||
#include <dsctbl.h> | ||
#include <mm/memory.h> | ||
|
||
void init_sched() { | ||
/* | ||
tss_t tss1; | ||
tss1.ldtr = 0; | ||
tss1.iomap = 0x40000000; | ||
*/ | ||
|
||
|
||
//segment_descriptor_t *gdt = (segment_descriptor_t *) GDT_ADDR; | ||
|
||
//set_segmdesc(gdt + 3, 103, (int) &tss1, AR_TSS32); | ||
//set_segmdesc(gdt + 4, 103, (int) &tss2, AR_TSS32); | ||
|
||
//set_segmdesc(gdt + 3, 0xffffffff, 0x00000000, AR_TSS32); | ||
//set_segmdesc(gdt + 4, 0xffffffff, 0x00000000, AR_TSS32); | ||
|
||
//set_gdtr(GDT_LIMIT, GDT_ADDR); | ||
|
||
//set_tr(3 * 8); | ||
} | ||
|
||
void task2_main() { | ||
debug("task2_main!!"); | ||
/* | ||
while(1) { | ||
io_hlt(); | ||
} | ||
*/ | ||
} | ||
|
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