
- use readable macros instead of constants - use the same error number like newlib git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@156 315a16e6-25f9-4109-90ae-ca3045a26c18
72 lines
1.8 KiB
C
72 lines
1.8 KiB
C
/*
|
|
* Copyright 2010 Stefan Lankes, Chair for Operating Systems,
|
|
* RWTH Aachen University
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*
|
|
* This file is part of MetalSVM.
|
|
*/
|
|
|
|
#ifndef __ARCH_GDT_H__
|
|
#define __ARCH_GDT_H__
|
|
|
|
#include <metalsvm/stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define GDT_FLAG_DATASEG 0x02
|
|
#define GDT_FLAG_CODESEG 0x0a
|
|
#define GDT_FLAG_TSS 0x09
|
|
#define GDT_FLAG_TSS_BUSY 0x02
|
|
|
|
#define GDT_FLAG_SEGMENT 0x10
|
|
#define GDT_FLAG_RING0 0x00
|
|
#define GDT_FLAG_RING1 0x20
|
|
#define GDT_FLAG_RING2 0x40
|
|
#define GDT_FLAG_RING3 0x60
|
|
#define GDT_FLAG_PRESENT 0x80
|
|
|
|
#define GDT_FLAG_4K_GRAN 0x80
|
|
#define GDT_FLAG_32_BIT 0x40
|
|
|
|
/* Defines a GDT entry */
|
|
typedef struct {
|
|
unsigned short limit_low;
|
|
unsigned short base_low;
|
|
unsigned char base_middle;
|
|
unsigned char access;
|
|
unsigned char granularity;
|
|
unsigned char base_high;
|
|
} __attribute__ ((packed)) gdt_entry_t;
|
|
|
|
typedef struct {
|
|
unsigned short limit;
|
|
unsigned int base;
|
|
} __attribute__ ((packed)) gdt_ptr_t;
|
|
|
|
#define GDT_ENTRIES (5+MAX_TASKS)
|
|
#if GDT_ENTRIES > 8192
|
|
#error Too many GDT entries!
|
|
#endif
|
|
|
|
//extern gdt_entry_t gdt[GDT_ENTRIES];
|
|
|
|
void gdt_install(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|