gdt.h

来自「一个操作系统的源代码」· C头文件 代码 · 共 73 行

H
73
字号
/** gdt.h ** ** Original Author: Kasper Verdich Lund ** Date: 10/11/99 ** ** Description: ** Global Descriptor Table functions ** ** 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 ** 2 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 or 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, write to the ** Free Software Foundation, Inc., 59 Temple Place, Suite 330, ** Boston, MA 02111-1307 USA ** *********************************************************Apostle OS**/#ifndef __GDT_H_#define __GDT_H_#include <types.h>#define GDT_SIZE 8192#define LIMIT_1MB 0xFFFFF#define LIMIT_4GB 0xFFFFFFFF#define KERNEL_CS 0x8#define KERNEL_DS 0x10typedef struct descriptor {  /* segment limit 15:00 */  word limit0_15;   /* base address 15:00 */  word base0_15;  /* base address 23:16 */  byte base16_23;  /* segment type */  byte type : 4;  /* descriptor type */  byte s : 1;  /* descriptor privilege level */  byte dpl : 2;  /* segment present */  byte p : 1;  /* segment limit 19:16 */  byte limit16_19 : 4;  /* available for use by system software */  byte avl : 1;  /* always 0 */  byte zero : 1;  /* default operation size */  byte db : 1;  /* granularity */   byte g : 1;  /* base address 31:24 */  byte base24_31;} __attribute__ ((packed)) descriptor;extern descriptor *GDT;extern void setupGDT(void);extern void setupDescriptor(descriptor *d, dword base, dword limit, byte type, byte dpl, byte s, byte db);#endif /* ifndef __GDT_H_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?