fde77afb37
A couple of changes in various interrupt and thread functions and structures. These make it now possible to change the stack at any time without making the kernel crash. This is needed for calling VESA 3.0 VBE functions through the protected mode interface. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@422 a95241bf-73f2-0310-859d-f6bbb57e9c96
35 lines
1.1 KiB
C
35 lines
1.1 KiB
C
/*
|
|
** Copyright 2002, Michael Noisternig. All rights reserved.
|
|
** Distributed under the terms of the NewOS License.
|
|
*/
|
|
#ifndef _KERNEL_ARCH_x86_SELECTOR_H
|
|
#define _KERNEL_ARCH_x86_SELECTOR_H
|
|
|
|
#include <arch/x86/types.h>
|
|
|
|
typedef uint32 selector_id;
|
|
typedef uint64 selector_type;
|
|
|
|
// DATA segments are read-only
|
|
// CODE segments are execute-only
|
|
// both can be modified by using the suffixed enum versions
|
|
// legend: w = writable
|
|
// d = expand down
|
|
// r = readable
|
|
// c = conforming
|
|
enum segment_type {
|
|
DATA = 0x8, DATA_w, DATA_d, DATA_wd, CODE, CODE_r, CODE_c, CODE_rc
|
|
};
|
|
|
|
#define SELECTOR(base,limit,type,mode32) \
|
|
(((uint64)(((((uint32)base)>>16)&0xff) | (((uint32)base)&0xff000000) | ((type)<<9) | ((mode32)<<22) | (1<<15))<<32) \
|
|
| ( (limit) >= (1<<20) ? (((limit)>>12)&0xffff) | ((uint64)(((limit)>>12)&0xf0000)<<32) | ((uint64)1<<(23+32)) : ((limit)&0xffff) | ((uint64)((limit)&0xf0000)<<32) ) \
|
|
| ((((uint32)base)&0xffff)<<16))
|
|
|
|
void i386_selector_init( void *gdt );
|
|
selector_id i386_selector_add( selector_type selector );
|
|
void i386_selector_remove( selector_id id );
|
|
selector_type i386_selector_get( selector_id id );
|
|
|
|
#endif
|