Getting ready to add a TSS.

This commit is contained in:
Nicolás Ortega Froysa 2018-03-09 18:19:52 +01:00
parent fab247e213
commit 06aa177eef
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF
2 changed files with 76 additions and 0 deletions

View File

@ -86,6 +86,15 @@ gdt_udata:
.byte 0b11001111 # 2nd flags | limit .byte 0b11001111 # 2nd flags | limit
.byte 0x0 # base .byte 0x0 # base
# TODO: setup the TSS
gdt_tss:
.word 0x0 # size of TSS (set later)
.word 0x0 # address of TSS (set later)
.byte 0x0 # address of TSS (set later)
.byte 0b10010001 # 1st flags | type flags
.byte 0b01000000 # 2nd flags | size of TSS (set later
.byte 0x0 # address of TSS (set later)
gdt_end: gdt_end:
gdtr: gdtr:

67
src/kernel/arch/x86/tss.h Normal file
View File

@ -0,0 +1,67 @@
/*
* Copyright (C) 2018 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
* Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
volatile struct tss {
uint16_t link;
uint16_t link_r; // reserved
uint32_t esp0;
uint16_t ss0;
uint16_t ss0_r; // reserved
uint32_t esp1;
uint16_t ss1;
uint16_t ss1_r; // reserved
uint32_t esp2;
uint16_t ss2;
uint16_t ss2_r; // reserved
uint32_t cr3;
uint32_t eip;
uint32_t eflags;
uint32_t eax;
uint32_t ecx;
uint32_t edx;
uint32_t ebx;
uint32_t esp;
uint32_t ebp;
uint32_t esi;
uint32_t edi;
uint16_t es;
uint16_t es_r; // reserved
uint16_t cs;
uint16_t cs_r; // reserved
uint16_t ss;
uint16_t ss_r; // reserved
uint16_t ds;
uint16_t ds_r; // reserved
uint16_t fs;
uint16_t fs_r; // reserved
uint16_t gs;
uint16_t gs_r; // reserved
uint16_t ldtr;
uint16_t ldtr_r; // reserved
uint16_t iopb_r; // reserved
uint16_t iopb;
} __attribute__((packed));
struct tss tss;