View of xos/include/gdt.h


XOS | Parent Directory | View | Download

/* Copyright (C) 2008  Emmanuel Varoquaux
 
   This file is part of XOS.
 
   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/>. */
 
#ifndef _GDT_H
#define _GDT_H
 
#define KERNEL_CODE_SEL  0x8
#define KERNEL_DATA_SEL 0x10
#define USER_CODE_SEL   0x1b
#define USER_DATA_SEL   0x23
 
#ifndef _ASM_SOURCE
 
struct tss_struct;
 
void setup_gdt();
 
void gdt_set_user_code_seg_descr(unsigned long base, unsigned long limit);
void gdt_set_user_data_seg_descr(unsigned long base, unsigned long limit);
void gdt_set_tss_descr(unsigned int task_nr, const struct tss_struct *tss);
 
unsigned short get_tss_sel(unsigned int task_nr);
unsigned int get_task_nr(unsigned short tss_sel);
 
#endif
 
#endif