mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-05 02:53:19 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
991f1056ad | ||
|
|
dc8c366fc0 | ||
|
|
30c62ffbd0 |
@@ -14,7 +14,7 @@ struct TSS32 {
|
||||
int ldtr, iomap;
|
||||
};
|
||||
|
||||
void task_b_main(void);
|
||||
void task_b_main(struct SHEET *sht_back);
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
@@ -106,7 +106,7 @@ void HariMain(void)
|
||||
set_segmdesc(gdt + 3, 103, (int) &tss_a, AR_TSS32);
|
||||
set_segmdesc(gdt + 4, 103, (int) &tss_b, AR_TSS32);
|
||||
load_tr(3 * 8);
|
||||
task_b_esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024;
|
||||
task_b_esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024 - 8;
|
||||
tss_b.eip = (int) &task_b_main;
|
||||
tss_b.eflags = 0x00000202; /* IF = 1; */
|
||||
tss_b.eax = 0;
|
||||
@@ -123,6 +123,7 @@ void HariMain(void)
|
||||
tss_b.ds = 1 * 8;
|
||||
tss_b.fs = 1 * 8;
|
||||
tss_b.gs = 1 * 8;
|
||||
*((int *) (task_b_esp + 4)) = (int) sht_back;
|
||||
|
||||
for (;;) {
|
||||
io_cli();
|
||||
@@ -281,26 +282,46 @@ void make_textbox8(struct SHEET *sht, int x0, int y0, int sx, int sy, int c)
|
||||
return;
|
||||
}
|
||||
|
||||
void task_b_main(void)
|
||||
void task_b_main(struct SHEET *sht_back)
|
||||
{
|
||||
struct FIFO32 fifo;
|
||||
struct TIMER *timer_ts;
|
||||
int i, fifobuf[128];
|
||||
struct TIMER *timer_ts, *timer_put, *timer_1s;
|
||||
int i, fifobuf[128], count = 0, count0 = 0;
|
||||
char s[12];
|
||||
|
||||
fifo32_init(&fifo, 128, fifobuf);
|
||||
timer_ts = timer_alloc();
|
||||
timer_init(timer_ts, &fifo, 1);
|
||||
timer_init(timer_ts, &fifo, 2);
|
||||
timer_settime(timer_ts, 2);
|
||||
timer_put = timer_alloc();
|
||||
timer_init(timer_put, &fifo, 1);
|
||||
timer_settime(timer_put, 1);
|
||||
timer_1s = timer_alloc();
|
||||
timer_init(timer_1s, &fifo, 100);
|
||||
timer_settime(timer_1s, 100);
|
||||
|
||||
for (;;) {
|
||||
count++;
|
||||
sprintf(s, "%10d", count);
|
||||
putfonts8_asc_sht(sht_back, 0, 144, COL8_FFFFFF, COL8_008484, s, 10);
|
||||
io_cli();
|
||||
if (fifo32_status(&fifo) == 0) {
|
||||
io_stihlt();
|
||||
io_sti();
|
||||
} else {
|
||||
i = fifo32_get(&fifo);
|
||||
io_sti();
|
||||
if (i == 1) { /*任务切换*/
|
||||
if (i == 1) {
|
||||
sprintf(s, "%11d", count);
|
||||
putfonts8_asc_sht(sht_back, 0, 144, COL8_FFFFFF, COL8_008484, s, 11);
|
||||
timer_settime(timer_put, 1);
|
||||
} else if (i == 2) {
|
||||
farjmp(0, 3 * 8);
|
||||
timer_settime(timer_ts, 2);
|
||||
} else if (i == 100) {
|
||||
sprintf(s, "%11d", count - count0);
|
||||
putfonts8_asc_sht(sht_back, 0, 128, COL8_FFFFFF, COL8_008484, s, 11);
|
||||
count0 = count;
|
||||
timer_settime(timer_1s, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user