summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/cpu/i386/i386.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c/src/exec/score/cpu/i386/i386.h257
1 files changed, 0 insertions, 257 deletions
diff --git a/c/src/exec/score/cpu/i386/i386.h b/c/src/exec/score/cpu/i386/i386.h
index dfb8b062f6..9e49b5ab84 100644
--- a/c/src/exec/score/cpu/i386/i386.h
+++ b/c/src/exec/score/cpu/i386/i386.h
@@ -99,82 +99,6 @@ extern "C" {
#ifndef ASM
/*
- * Structure which makes it easier to deal with LxDT and SxDT instructions.
- */
-
-typedef struct {
- unsigned short limit;
- unsigned short physical_address[ 2 ];
-} i386_DTR_load_save_format;
-
-/* See Chapter 5 - Memory Management in i386 manual */
-
-typedef struct {
- unsigned short limit_0_15;
- unsigned short base_0_15;
- unsigned char base_16_23;
- unsigned char type_dt_dpl_p;
- unsigned char limit_16_19_granularity;
- unsigned char base_24_31;
-} i386_GDT_slot;
-
-/* See Chapter 9 - Exceptions and Interrupts in i386 manual
- *
- * NOTE: This is the IDT entry for interrupt gates ONLY.
- */
-
-typedef struct {
- unsigned short offset_0_15;
- unsigned short segment_selector;
- unsigned char reserved;
- unsigned char p_dpl;
- unsigned short offset_16_31;
-} i386_IDT_slot;
-
-/*
- * Interrupt Level Macros
- */
-
-#define i386_disable_interrupts( _level ) \
- { \
- _level = 0; /* avoids warnings */ \
- asm volatile ( "pushf ; \
- cli ; \
- pop %0" \
- : "=r" ((_level)) : "0" ((_level)) \
- ); \
- }
-
-#define i386_enable_interrupts( _level ) \
- { \
- asm volatile ( "push %0 ; \
- popf" \
- : "=r" ((_level)) : "0" ((_level)) \
- ); \
- }
-
-#define i386_flash_interrupts( _level ) \
- { \
- asm volatile ( "push %0 ; \
- popf ; \
- cli" \
- : "=r" ((_level)) : "0" ((_level)) \
- ); \
- }
-
-#define i386_get_interrupt_level( _level ) \
- do { \
- register unsigned32 _eflags = 0; \
- \
- asm volatile ( "pushf ; \
- pop %0" \
- : "=r" ((_eflags)) : "0" ((_eflags)) \
- ); \
- \
- _level = (_eflags & 0x0200) ? 0 : 1; \
- } while (0)
-
-/*
* The following routine swaps the endian format of an unsigned int.
* It must be static so it can be referenced indirectly.
*/
@@ -206,67 +130,6 @@ static inline unsigned int i386_swap_U16(
}
/*
- * Segment Access Routines
- *
- * NOTE: Unfortunately, these are still static inlines even when the
- * "macro" implementation of the generic code is used.
- */
-
-static inline unsigned short i386_get_cs()
-{
- register unsigned short segment = 0;
-
- asm volatile ( "movw %%cs,%0" : "=r" (segment) : "0" (segment) );
-
- return segment;
-}
-
-static inline unsigned short i386_get_ds()
-{
- register unsigned short segment = 0;
-
- asm volatile ( "movw %%ds,%0" : "=r" (segment) : "0" (segment) );
-
- return segment;
-}
-
-static inline unsigned short i386_get_es()
-{
- register unsigned short segment = 0;
-
- asm volatile ( "movw %%es,%0" : "=r" (segment) : "0" (segment) );
-
- return segment;
-}
-
-static inline unsigned short i386_get_ss()
-{
- register unsigned short segment = 0;
-
- asm volatile ( "movw %%ss,%0" : "=r" (segment) : "0" (segment) );
-
- return segment;
-}
-
-static inline unsigned short i386_get_fs()
-{
- register unsigned short segment = 0;
-
- asm volatile ( "movw %%fs,%0" : "=r" (segment) : "0" (segment) );
-
- return segment;
-}
-
-static inline unsigned short i386_get_gs()
-{
- register unsigned short segment = 0;
-
- asm volatile ( "movw %%gs,%0" : "=r" (segment) : "0" (segment) );
-
- return segment;
-}
-
-/*
* IO Port Access Routines
*/
@@ -327,101 +190,6 @@ static inline unsigned short i386_get_gs()
_value = __value; \
}
-/*
- * Descriptor Table helper routines
- */
-
-
-#define i386_get_GDTR( _gdtr_address ) \
- { \
- void *_gdtr = (_gdtr_address); \
- \
- asm volatile( "sgdt (%0)" : "=r" (_gdtr) : "0" (_gdtr) ); \
- }
-
-#define i386_get_GDT_slot( _gdtr_base, _segment, _slot_address ) \
- { \
- register unsigned int _gdt_slot = (_gdtr_base) + (_segment); \
- register volatile void *_slot = (_slot_address); \
- register unsigned int _temporary = 0; \
- \
- asm volatile( "movl %%gs:(%0),%1 ; \
- movl %1,(%2) ; \
- movl %%gs:4(%0),%1 ; \
- movl %1,4(%2)" \
- : "=r" (_gdt_slot), "=r" (_temporary), "=r" (_slot) \
- : "0" (_gdt_slot), "1" (_temporary), "2" (_slot) \
- ); \
- }
-
-#define i386_set_GDT_slot( _gdtr_base, _segment, _slot_address ) \
- { \
- register unsigned int _gdt_slot = (_gdtr_base) + (_segment); \
- register volatile void *_slot = (_slot_address); \
- register unsigned int _temporary = 0; \
- \
- asm volatile( "movl (%2),%1 ; \
- movl %1,%%gs:(%0) ; \
- movl 4(%2),%1 ; \
- movl %1,%%gs:4(%0) \
- " \
- : "=r" (_gdt_slot), "=r" (_temporary), "=r" (_slot) \
- : "0" (_gdt_slot), "1" (_temporary), "2" (_slot) \
- ); \
- }
-
-static inline void i386_set_segment(
- unsigned short segment,
- unsigned int base,
- unsigned int limit
-)
-{
- i386_DTR_load_save_format gdtr;
- volatile i386_GDT_slot Gdt_slot;
- volatile i386_GDT_slot *gdt_slot = &Gdt_slot;
- unsigned short tmp_segment = 0;
- unsigned int limit_adjusted;
-
- /* load physical address of the GDT */
-
- i386_get_GDTR( &gdtr );
-
- gdt_slot->type_dt_dpl_p = 0x92; /* present, dpl=0, */
- /* application=1, */
- /* type=data read/write */
- gdt_slot->limit_16_19_granularity = 0x40; /* 32 bit segment */
-
- limit_adjusted = limit;
- if ( limit > 4095 ) {
- gdt_slot->limit_16_19_granularity |= 0x80; /* set granularity bit */
- limit_adjusted /= 4096;
- }
-
- gdt_slot->limit_16_19_granularity |= (limit_adjusted >> 16) & 0xff;
- gdt_slot->limit_0_15 = limit_adjusted & 0xffff;
-
- gdt_slot->base_0_15 = base & 0xffff;
- gdt_slot->base_16_23 = (base >> 16) & 0xff;
- gdt_slot->base_24_31 = (base >> 24);
-
- i386_set_GDT_slot(
- gdtr.physical_address[0] + (gdtr.physical_address[1] << 16),
- segment,
- gdt_slot
- );
-
- /* Now, reload all segment registers so the limit takes effect. */
-
- asm volatile( "movw %%ds,%0 ; movw %0,%%ds
- movw %%es,%0 ; movw %0,%%es
- movw %%fs,%0 ; movw %0,%%fs
- movw %%gs,%0 ; movw %0,%%gs
- movw %%ss,%0 ; movw %0,%%ss"
- : "=r" (tmp_segment)
- : "0" (tmp_segment)
- );
-
-}
/* routines */
@@ -447,17 +215,6 @@ void *i386_Physical_to_logical(
void *address
);
-/*
- * i386_Install_idt
- *
- * This routine installs an IDT entry.
- */
-
-void i386_Install_idt(
- unsigned int source_offset,
- unsigned short destination_segment,
- unsigned int destination_offset
-);
/*
* "Simpler" names for a lot of the things defined in this file
@@ -484,20 +241,6 @@ void i386_Install_idt(
#define inport_word( _port, _value ) i386_inport_word( _port, _value )
#define inport_long( _port, _value ) i386_inport_long( _port, _value )
-/* complicated static inline functions */
-
-#define get_GDTR( _gdtr_address ) \
- i386_get_GDTR( _gdtr_address )
-
-#define get_GDT_slot( _gdtr_base, _segment, _slot_address ) \
- i386_get_GDT_slot( _gdtr_base, _segment, _slot_address )
-
-#define set_GDT_slot( _gdtr_base, _segment, _slot_address ) \
- i386_set_GDT_slot( _gdtr_base, _segment, _slot_address )
-
-#define set_segment( _segment, _base, _limit ) \
- i386_set_segment( _segment, _base, _limit )
-
#ifdef __cplusplus
}