i386/pc386: configurable size of descriptor tables

This commit is contained in:
Jan Dolezal
2014-11-20 15:00:26 +01:00
committed by Gedare Bloom
parent a634febae4
commit ec494ffbfc
6 changed files with 51 additions and 8 deletions

View File

@@ -32,6 +32,7 @@ include_bsp_HEADERS += ../../shared/include/irq-generic.h
include_bsp_HEADERS += ../../shared/include/irq-info.h
include_bsp_HEADERS += console/rtd316.h
include_bsp_HEADERS += console/exar17d15x.h
include_bsp_HEADERS += include/tblsizes.h
if HAS_SMP
include_bsp_HEADERS += ../../i386/shared/irq/apic.h

View File

@@ -82,6 +82,11 @@ RTEMS_BSPOPTS_HELP([USE_CIRRUS_GD5446],
NOTE: This has only been tested on Qemu.])
AM_CONDITIONAL(USE_CIRRUS_GD5446,test "$USE_CIRRUS_GD5446" = "1")
RTEMS_BSPOPTS_SET([NUM_APP_DRV_GDT_DESCRIPTORS],[*],[0])
RTEMS_BSPOPTS_HELP([NUM_APP_DRV_GDT_DESCRIPTORS],
[Defines how many descriptors in GDT may be allocated for application or
driver usage.])
if test X${CLOCK_DRIVER_USE_TSC} = X1 -a X${CLOCK_DRIVER_USE_8254} = X1 ; then
AC_MSG_ERROR([pc386 both TSC and 8254 specified for clock driver])
fi

View File

@@ -51,6 +51,7 @@
#include <bspopts.h>
#include <bsp/default-initial-extension.h>
#include <bsp/tblsizes.h>
#include <rtems.h>
#include <rtems/iosupp.h>
@@ -166,11 +167,8 @@ extern int rtems_3c509_driver_attach(struct rtems_bsdnet_ifconfig *config);
/*-------------------------------------------------------------------------+
| External Variables.
+--------------------------------------------------------------------------*/
#define IDT_SIZE 256
#define GDT_SIZE 3
extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
extern segment_descriptors Global_descriptor_table [GDT_SIZE];
extern segment_descriptors _Global_descriptor_table [GDT_SIZE];
/*-------------------------------------------------------------------------+
| Function Prototypes.

View File

@@ -0,0 +1,25 @@
/**
* @file
*
* @ingroup i386_pc386
*
* @brief Sizes of Global and Interrupt descriptor tables.
*/
/*
* Definitions related to the PC386 BSP.
* This header file is also used in assembler modules.
*
* Copyright (C) 2014 Jan Doležal (dolezj21@fel.cvut.cz)
* CTU in Prague.
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#include <bspopts.h>
#define IDT_SIZE (256)
#define GDT_SIZE (3 + NUM_APP_DRV_GDT_DESCRIPTORS)

View File

@@ -81,6 +81,10 @@ $(PROJECT_INCLUDE)/bsp/exar17d15x.h: console/exar17d15x.h $(PROJECT_INCLUDE)/bsp
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/exar17d15x.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/exar17d15x.h
$(PROJECT_INCLUDE)/bsp/tblsizes.h: include/tblsizes.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/tblsizes.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/tblsizes.h
if HAS_SMP
$(PROJECT_INCLUDE)/bsp/apic.h: ../../i386/shared/irq/apic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/apic.h

View File

@@ -34,6 +34,7 @@
+--------------------------------------------------------------------------*/
#include <rtems/asm.h>
#include <bsp/tblsizes.h> /* contains sizes of GDT and IDT */
/*----------------------------------------------------------------------------+
| CODE section
@@ -167,6 +168,9 @@ next_step:
/*---------------------------------------------------------------------------+
| GDT itself
+--------------------------------------------------------------------------*/
#if GDT_SIZE < 3
#error "GDT_SIZE must be at least 3"
#endif
BEGIN_DATA
.p2align 4
@@ -186,11 +190,17 @@ SYM (_Global_descriptor_table):
.word 0xffff, 0
.byte 0, 0x92, 0xcf, 0
/* allocated space for user segments */
.rept (GDT_SIZE - 3)
.word 0,0,0,0
.endr
/*---------------------------------------------------------------------------+
| Descriptor of GDT
+--------------------------------------------------------------------------*/
SYM (gdtdesc):
.word (3*8 - 1)
PUBLIC(gdtdesc)
SYM(gdtdesc):
.word (GDT_SIZE*8 - 1)
.long SYM (_Global_descriptor_table)
/*---------------------------------------------------------------------------+
@@ -200,7 +210,7 @@ SYM (gdtdesc):
PUBLIC(Interrupt_descriptor_table)
SYM(Interrupt_descriptor_table):
.rept 256
.rept IDT_SIZE
.word 0,0,0,0
.endr
@@ -211,7 +221,7 @@ SYM(Interrupt_descriptor_table):
.p2align 4
PUBLIC(IDT_Descriptor)
SYM(IDT_Descriptor):
.word (256*8 - 1)
.word (IDT_SIZE*8 - 1)
.long SYM (Interrupt_descriptor_table)
END_DATA