Removed redundant x86 sources/headers.

This commit is contained in:
Alex Smith 2012-07-03 17:38:18 +01:00
parent c005e747ef
commit cbfe5fcd17
5 changed files with 0 additions and 155 deletions

View File

@ -1,32 +0,0 @@
/*
** 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
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

View File

@ -1,31 +0,0 @@
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _ARCH_x86_TYPES_H
#define _ARCH_x86_TYPES_H
#ifndef WIN32
typedef unsigned long long uint64;
typedef long long int64;
#else /* WIN32 */
typedef unsigned __int64 uint64;
typedef __int64 int64;
#endif
typedef unsigned long uint32;
typedef long int32;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned char uint8;
typedef char int8;
typedef unsigned long addr;
#define _OBOS_TIME_T_ int /* basic time_t type */
/* define this as not all platforms have it set, but we'll make sure as
* some conditional checks need it
*/
#define __INTEL__ 1
#endif /* _ARCH_x86_TYPES_H */

View File

@ -36,7 +36,6 @@ if $(TARGET_ARCH) = x86_64 {
arch_debug.cpp
arch_elf.cpp
arch_platform.cpp
# arch_selector.cpp
arch_real_time_clock.cpp
arch_smp.cpp
arch_thread.cpp

View File

@ -28,7 +28,6 @@
#include <arch_system_info.h>
#include <arch/x86/apic.h>
#include <arch/x86/selector.h>
#include <boot/kernel_args.h>
#include "interrupts.h"
@ -822,10 +821,6 @@ arch_cpu_init_post_vm(kernel_args *args)
create_area("gdt", (void **)&gGDT, B_EXACT_ADDRESS, B_PAGE_SIZE,
B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
// currently taken out of the build, because it's not yet used (and assumes
// (a fixed number of used GDT entries)
//i386_selector_init(gGDT); // pass the new gdt
// allocate an area for the double fault stacks
virtual_address_restrictions virtualRestrictions = {};
virtualRestrictions.address_specification = B_ANY_KERNEL_ADDRESS;

View File

@ -1,86 +0,0 @@
/*
** Copyright 2002, Michael Noisternig. All rights reserved.
** Distributed under the terms of the NewOS License.
** Distributed under the terms of the MIT License as part of the OpenBeOS project.
*/
#include <arch/x86/arch_stage2.h>
#include <arch/cpu.h>
#include <smp.h>
#include <int.h>
#include <arch/x86/selector.h>
#define MAX_SELECTORS (GDT_LIMIT/8)
#define ENTRIES (MAX_SELECTORS/(sizeof(uint32)*8))
static uint32 selector_bitmap[ENTRIES]
= { 0x000000ff }; // first 8 selectors reserved
static selector_type *gdt_table;
static struct gdt_idt_descr descr = { GDT_LIMIT - 1, NULL };
void i386_selector_init( void *gdt )
{
gdt_table = (selector_type *)gdt;
descr.b = (unsigned int *)gdt_table;
}
// creates a new selector in the gdt of given type (use SELECTOR macro)
// IN: selector type
// RET: selector that can be directly used for segment registers
// 0 on error
selector_id i386_selector_add( selector_type type )
{
static spinlock spinlock;
int state;
uint32 mask;
selector_id id = 0;
unsigned i;
state = disable_interrupts();
acquire_spinlock( &spinlock );
for ( i = 0; i < ENTRIES; i++ )
if ( selector_bitmap[i] != 0xffffffff ) { // found free place in there
id = i*sizeof(uint32)*8;
mask = 1;
while ( selector_bitmap[i] & mask ) {
mask <<= 1;
id++;
}
selector_bitmap[i] |= mask;
gdt_table[id] = type;
break;
}
release_spinlock( &spinlock );
restore_interrupts( state );
if ( id ) {
asm("lgdt %0;"
: : "m" (descr));
}
return id*8;
}
// removes a selector with given id from the gdt
void i386_selector_remove( selector_id id )
{
if ( id < 8*8 || id >= MAX_SELECTORS*8 )
return;
id /= 8;
gdt_table[id] = 0;
atomic_and( &selector_bitmap[id/32], ~(1<<(id&31)) );
asm("lgdt %0;"
: : "m" (descr));
}
// returns the selector type of a given id
selector_type i386_selector_get( selector_id id )
{
return gdt_table[id/8];
}