[PATCH] i386/virtualpok BSP, virtual BSP to be used with POK, build with enable-paravirt

Philipp Eppelt philipp.eppelt at mailbox.tu-dresden.de
Mon Jan 6 17:13:37 UTC 2014


Where are we on this?

On 12/06/2013 03:40 PM, Gedare Bloom wrote:
> I'm generally OK with these 2 patches.
> 
> On Thu, Dec 5, 2013 at 10:59 AM, Philipp Eppelt
> <philipp.eppelt at mailbox.tu-dresden.de> wrote:
>> ---
>>  c/src/lib/libbsp/i386/acinclude.m4                 |   2 +
>>  c/src/lib/libbsp/i386/virtualpok/Makefile.am       |  87 +++++++
>>  c/src/lib/libbsp/i386/virtualpok/README.virt       |  23 ++
>>  c/src/lib/libbsp/i386/virtualpok/bsp_specs         |  14 ++
>>  c/src/lib/libbsp/i386/virtualpok/clock/ckinit.c    | 139 ++++++++++++
>>  c/src/lib/libbsp/i386/virtualpok/configure.ac      |  23 ++
>>  c/src/lib/libbsp/i386/virtualpok/console/console.c | 184 +++++++++++++++
>>  c/src/lib/libbsp/i386/virtualpok/include/bsp.h     |  53 +++++
>>  .../virtualpok/include/virtualizationlayerbsp.h    |  62 +++++
>>  c/src/lib/libbsp/i386/virtualpok/irq/irq.c         |  85 +++++++
>>  c/src/lib/libbsp/i386/virtualpok/irq/irq.h         |  79 +++++++
>>  .../i386/virtualpok/make/custom/virtualpok.cfg     |  17 ++
>>  c/src/lib/libbsp/i386/virtualpok/preinstall.am     |  79 +++++++
>>  c/src/lib/libbsp/i386/virtualpok/start/start.S     |  37 +++
>>  .../i386/virtualpok/startup/bspgetworkarea.c       | 102 +++++++++
>>  .../lib/libbsp/i386/virtualpok/startup/bspstart.c  |  41 ++++
>>  c/src/lib/libbsp/i386/virtualpok/startup/linkcmds  | 251 +++++++++++++++++++++
>>  17 files changed, 1278 insertions(+)
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/Makefile.am
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/README.virt
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/bsp_specs
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/clock/ckinit.c
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/configure.ac
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/console/console.c
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/include/bsp.h
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/include/virtualizationlayerbsp.h
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/irq/irq.c
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/irq/irq.h
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/make/custom/virtualpok.cfg
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/preinstall.am
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/start/start.S
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/startup/bspgetworkarea.c
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/startup/bspstart.c
>>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/startup/linkcmds
>>
>> diff --git a/c/src/lib/libbsp/i386/acinclude.m4 b/c/src/lib/libbsp/i386/acinclude.m4
>> index a2f2384..2d60714 100644
>> --- a/c/src/lib/libbsp/i386/acinclude.m4
>> +++ b/c/src/lib/libbsp/i386/acinclude.m4
>> @@ -4,6 +4,8 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
>>    case "$1" in
>>    pc386 )
>>      AC_CONFIG_SUBDIRS([pc386]);;
>> +  virtualpok )
>> +    AC_CONFIG_SUBDIRS([virtualpok]);;
>>    *)
>>      AC_MSG_ERROR([Invalid BSP]);;
>>    esac
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/Makefile.am b/c/src/lib/libbsp/i386/virtualpok/Makefile.am
>> new file mode 100644
>> index 0000000..e545962
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/Makefile.am
>> @@ -0,0 +1,87 @@
>> +##
>> +
>> +ACLOCAL_AMFLAGS = -I ../../../../aclocal
>> +
>> +include $(top_srcdir)/../../../../automake/compile.am
>> +include $(top_srcdir)/../../bsp.am
>> +
>> +include_bspdir = $(includedir)/bsp
>> +
>> +dist_project_lib_DATA = bsp_specs
>> +
>> +include_HEADERS = include/bsp.h
>> +include_HEADERS += ../../shared/include/tm27.h
>> +include_HEADERS += include/virtualizationlayerbsp.h
>> +#include_HEADERS += include/virtualizationlayercpu.h
>> +
>> +nodist_include_HEADERS = include/bspopts.h
>> +nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
>> +DISTCLEANFILES = include/bspopts.h
>> +noinst_PROGRAMS =
>> +
>> +include_bsp_HEADERS  = irq/irq.h
>> +include_bsp_HEADERS += ../../shared/include/irq-generic.h
>> +#include_bsp_HEADERS  +=
>> +
>> +nodist_include_HEADERS += ../../shared/include/coverhd.h
>> +
>> +#noinst_LIBRARIES = libbspstart.a
>> +#libbspstart_a_SOURCES = start/_start.S
>> +
>> +dist_project_lib_DATA += startup/linkcmds
>> +
>> +noinst_LIBRARIES = libbsp.a
>> +libbsp_a_SOURCES =
>> +
>> +# startup
>> +libbsp_a_SOURCES += start/start.S
>> +project_lib_DATA = start.$(OBJEXT)
>> +libbsp_a_SOURCES += ../../shared/bspclean.c
>> +libbsp_a_SOURCES += ../../shared/bsplibc.c
>> +libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
>> +libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
>> +libbsp_a_SOURCES += startup/bspgetworkarea.c
>> +libbsp_a_SOURCES += ../../shared/bsppost.c
>> +libbsp_a_SOURCES += startup/bspstart.c
>> +libbsp_a_SOURCES += ../../shared/bootcard.c
>> +libbsp_a_SOURCES += ../../shared/sbrk.c
>> +libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
>> +libbsp_a_SOURCES += ../../shared/bspreset_loop.c
>> +libbsp_a_SOURCES += irq/irq.c
>> +libbsp_a_SOURCES += ../../shared/src/irq-generic.c
>> +# TODO I don't really need an IDT, don't I?
>> +libbsp_a_SOURCES += ../../i386/shared/irq/idt.c
>> +
>> +# clock
>> +libbsp_a_SOURCES += clock/ckinit.c
>> +# console
>> +libbsp_a_SOURCES += console/console.c
>> +# timer
>> +#libbsp_a_SOURCES += timer/timer.c timer/timerisr.c
>> +
>> +libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/cache.rel
>> +libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/page.rel
>> +libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/score.rel
>> +
>> +noinst_LIBRARIES += libpokpart.a
>> +
>> +libpokpart.a :
>> +       cp -u $(top_srcdir)/libpart.a .
>> +       ar t libpart.a > libpart.list
>> +       sed -e "s/\.lo/\.o/g" libpart.list > libpart.o.list
>> +       ar x libpart.a
>> +       rename .lo .o `cat libpart.list`
>> +       ar q libbsp.a `cat libpart.o.list`
>> +#      ar cru libpokpart.a `cat libpart.o.list`
>> +# rm `cat libpart.o.list` is optional as all files get overwritten with new
>> +# ones by 'ar x'. But I think it's bad style to remove object files during
>> +# compilation.
>> +
>> +
>> +#libpokpart_a_LIBADD = libpart.a
>> +
>> +
>> +EXTRA_DIST = times
>> +
>> +include $(srcdir)/preinstall.am
>> +include $(top_srcdir)/../../../../automake/local.am
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/README.virt b/c/src/lib/libbsp/i386/virtualpok/README.virt
>> new file mode 100644
>> index 0000000..47382ca
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/README.virt
>> @@ -0,0 +1,23 @@
>> +Author: Philipp Eppelt
>> +  philipp.eppelt at mailbox.tu-dresden.de
>> +
>> +This BSP is intended to be used with POK. Other hosts are currently not
>> +supported.
>> +
>> +The BSP uses functions from the virtualization layer. The host system has to
>> +provide a library implementing the function specified in the virtualization
>> +layer. Otherwise the compilation process will fail.
>> +
>> +Further information on the project can be obtained in the RTEMS Wiki:
>> +wiki.rtems.org/wiki/index.php/GSOC_2013_-_Paravirtualization_of_RTEMS
>> +
>> +
>> +== ATTENTION ==
>> +In order to build this BSP you need a library file called "libpart.a". This
>> +file is produced by POK after you compiled the rtems-guest example found here:
>> +https://github.com/phipse/pok
>> +
>> +Then you have to copy libpart.a to this folder. Now you should be able to
>> +compile.
>> +Further information can be found here:
>> +http://phipse.github.io/rtems/blog/2013/07/08/HelloWorld/
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/bsp_specs b/c/src/lib/libbsp/i386/virtualpok/bsp_specs
>> new file mode 100644
>> index 0000000..861b21e
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/bsp_specs
>> @@ -0,0 +1,14 @@
>> +%rename lib old_lib
>> +
>> +*endfile:
>> +crtend.o%s crtn.o%s
>> +
>> +*startfile:
>> +%{!qrtems: %(old_startfile)} \
>> +%{!nostdlib: %{qrtems: crti.o%s crtbegin.o%s }}
>> +
>> +*lib:
>> +%{!qrtems: %(old_lib)} \
>> +%{!nostdlib: %{qrtems: --start-group -lrtemsbsp -lrtemscpu -lc -lgcc --end-group \
>> +%{!qnolinkcmds: -T linkcmds%s}}}
>> +
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/clock/ckinit.c b/c/src/lib/libbsp/i386/virtualpok/clock/ckinit.c
>> new file mode 100644
>> index 0000000..d36eb3d
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/clock/ckinit.c
>> @@ -0,0 +1,139 @@
>> +/*  ckinit.c
>> + *
>> + *  This file provides a clock device driver to be used with the
>> + *  virtualizationlayer.
>> + *
>> + *  COPYRIGHT (c) 2013.
>> + *  Philipp Eppelt.
>> + *
>> + *  COPYRIGHT (c) 1989-1999.
>> + *  On-Line Applications Research Corporation (OAR).
>> + *
>> + *  The license and distribution terms for this file may be
>> + *  found in the file LICENSE in this distribution or at
>> + *  http://www.rtems.com/license/LICENSE.
>> + *
>> + */
>> +
>> +#include <stdlib.h>
>> +#include <stdio.h>
>> +
>> +#include <bsp.h>
>> +#include <bsp/irq.h>
>> +
>> +#include <rtems.h>
>> +#include <rtems/config.h>
>> +#include <rtems/score/tod.h>
>> +#include <rtems/score/watchdog.h>
>> +#include <rtems/score/timestamp.h>
>> +#include <assert.h>
>> +#include <rtems/score/virtualizationlayercpu.h>
>> +#include <virtualizationlayerbsp.h>
>> +
>> +
>> +void Clock_isr(void *param);
>> +static void Clock_isr_handler(void *param);
>> +/*
>> + *  The interrupt vector number associated with the clock tick device
>> + *  driver.
>> + */
>> +
>> +#define CLOCK_VECTOR    0x0
>> +
>> +/*
>> + *  Clock_driver_ticks is a monotonically increasing counter of the
>> + *  number of clock ticks since the driver was initialized.
>> + */
>> +
>> +volatile uint32_t pc386_microseconds_per_isr;
>> +volatile uint32_t pc386_isrs_per_tick;
>> +volatile uint32_t         Clock_driver_ticks;
>> +
>> +void     (*Clock_driver_support_at_tick)(void) = NULL;
>> +
>> +#define Clock_driver_support_install_isr( _new, _old ) \
>> +  do { \
>> +    _old = NULL; \
>> +  } while(0)
>> +
>> +bool Clock_isr_enabled = false;
>> +
>> +static void Clock_isr_handler(void *param)
>> +{
>> +  if ( Clock_isr_enabled )
>> +    Clock_isr( param );
>> +} // Clock_isr_handler
>> +
>> +static void Clock_driver_support_at_tick_empty(void)
>> +{
>> +}
>> +
>> +/**
>> + * @brief Enable clock device; start receiving clock interrupts.
>> + */
>> +static void clockOn(void)
>> +{
>> +  pc386_isrs_per_tick        = 1;
>> +  pc386_microseconds_per_isr = rtems_configuration_get_microseconds_per_tick();
>> +
>> +  _CPU_Virtual_Irq_request( CLOCK_VECTOR );
>> +} // clockOn
>> +
>> +/**
>> + * @brief Disable clock device; stop receiving clock interrupts.
>> + */
>> +static void clockOff(void)
>> +{
>> +  _CPU_Virtual_Irq_detach( CLOCK_VECTOR );
>> +} // clockOff
>> +
>> +/**
>> + * @brief Install the clock ISR in the RTEMS interrupt table.
>> + */
>> +void Clock_driver_install_handler(void);
>> +void Clock_driver_install_handler(void)
>> +{
>> +  rtems_status_code status;
>> +
>> +  status = rtems_interrupt_handler_install(
>> +    BSP_PERIODIC_TIMER,
>> +    "ckinit",
>> +    RTEMS_INTERRUPT_UNIQUE,
>> +    Clock_isr_handler,
>> +    NULL
>> +  );
>> +  if(status != RTEMS_SUCCESSFUL)
>> +    printf( "ERROR: During clock interrupt handler install: %i\n", status);
>> +  else
>> +    printf( "CLOCK DRIVER installed successfully\n");
>> +
>> +  clockOn();
>> +} // Clock_driver_install_handler
>> +
>> +uint32_t (*Clock_driver_nanoseconds_since_last_tick)(void) = NULL;
>> +
>> +/**
>> + * @brief Setup the clock driver.
>> + */
>> +void Clock_driver_support_initialize_hardware(void);
>> +void Clock_driver_support_initialize_hardware(void)
>> +{
>> +    Clock_driver_support_at_tick = Clock_driver_support_at_tick_empty;
>> +
>> +    Clock_isr_enabled = true;
>> +} // Clock_driver_support_initialize_hardware
>> +
>> +#define Clock_driver_support_shutdown_hardware() \
>> +  do { \
>> +    rtems_status_code status; \
>> +    clockOff(); \
>> +    status = rtems_interrupt_handler_remove(  \
>> +      BSP_PERIODIC_TIMER, \
>> +      Clock_isr_handler,  \
>> +      NULL  \
>> +    );  \
>> +    assert(status == RTEMS_SUCCESSFUL); \
>> +  } while (0)
>> +
>> +
>> +#include "../../../shared/clockdrv_shell.h"
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/configure.ac b/c/src/lib/libbsp/i386/virtualpok/configure.ac
>> new file mode 100644
>> index 0000000..eca01cc
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/configure.ac
>> @@ -0,0 +1,23 @@
>> +## Process this file with autoconf to produce a configure script.
>> +##
>> +
>> +AC_PREREQ([2.68])
>> +AC_INIT([rtems-c-src-lib-libbsp-i386-virtualpok],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
>> +AC_CONFIG_SRCDIR([bsp_specs])
>> +RTEMS_TOP(../../../../../..)
>> +
>> +RTEMS_CANONICAL_TARGET_CPU
>> +AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.12.2])
>> +RTEMS_BSP_CONFIGURE
>> +
>> +RTEMS_PROG_CC_FOR_TARGET
>> +RTEMS_CANONICALIZE_TOOLS
>> +RTEMS_PROG_CCAS
>> +
>> +AC_SUBST([RTEMS_ROOT],[${rtems_updir}'$(top_builddir)'])
>> +
>> +RTEMS_BSP_CLEANUP_OPTIONS(0, 0)
>> +
>> +# Explicitly list all Makefiles here
>> +AC_CONFIG_FILES([Makefile])
>> +AC_OUTPUT
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/console/console.c b/c/src/lib/libbsp/i386/virtualpok/console/console.c
>> new file mode 100644
>> index 0000000..51ff319
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/console/console.c
>> @@ -0,0 +1,184 @@
>> +/*
>> + *  This file contains the template for a console IO package.
>> + *
>> + *  COPYRIGHT (c) 2013 Philipp Eppelt.
>> + *
>> + *  COPYRIGHT (c) 1989-1999.
>> + *  On-Line Applications Research Corporation (OAR).
>> + *
>> + *  The license and distribution terms for this file may be
>> + *  found in the file LICENSE in this distribution or at
>> + *  http://www.rtems.com/license/LICENSE.
>> + *
>> + */
>> +
>> +#define NO_BSP_INIT
>> +
>> +#include <bsp.h>
>> +#include <rtems/libio.h>
>> +#include <virtualizationlayerbsp.h>
>> +
>> +/**
>> + * @brief Initializes the console.
>> + */
>> +rtems_device_driver console_initialize(
>> +  rtems_device_major_number  major,
>> +  rtems_device_minor_number  minor,
>> +  void                      *arg
>> +)
>> +{
>> +  rtems_status_code status;
>> +
>> +  status = rtems_io_register_name(
>> +    "/dev/console",
>> +    major,
>> +    (rtems_device_minor_number) 0
>> +  );
>> +
>> +  if (status != RTEMS_SUCCESSFUL)
>> +  {
>> +    rtems_fatal_error_occurred(status);
>> +  }
>> +
>> +// Virtual console init
>> +  status = _BSP_Virtual_Console_init();
>> +
>> +  if( status != 0 )
>> +  {
>> +    rtems_fatal_error_occurred(status);
>> +  }
>> +
>> +  return RTEMS_SUCCESSFUL;
>> +}
>> +
>> +/**
>> + * @brief Read a char from the virtual console (if supported).
>> + */
>> +char inbyte( void )
>> +{
>> +  return _BSP_Virtual_Char_read();
>> +}
>> +
>> +
>> +/**
>> + * @brief Write a char to the virtual console.
>> + */
>> +void outbyte(
>> +  char ch
>> +)
>> +{
>> +  _BSP_Virtual_Char_write(&ch);
>> +}
>> +
>> +/* printk support */
>> +BSP_output_char_function_type BSP_output_char = outbyte;
>> +BSP_polling_getchar_function_type BSP_poll_char = inbyte;
>> +
>> +
>> +/* Console support */
>> +
>> +/*
>> + * It is mostly a translation of termios intended calls to the char by char
>> + * printk interface.
>> + */
>> +
>> +/**
>> + * @brief Does nothing.
>> + */
>> +rtems_device_driver console_open(
>> +  rtems_device_major_number major,
>> +  rtems_device_minor_number minor,
>> +  void                    * arg
>> +)
>> +{
>> +  return RTEMS_SUCCESSFUL;
>> +}
>> +
>> +/**
>> + * @brief Does nothing.
>> + */
>> +rtems_device_driver console_close(
>> +  rtems_device_major_number major,
>> +  rtems_device_minor_number minor,
>> +  void                    * arg
>> +)
>> +{
>> +  return RTEMS_SUCCESSFUL;
>> +}
>> +
>> +/*
>> + * read bytes from the serial port. We only have stdin.
>> + */
>> +
>> +/**
>> + * @brief Looks like termios, but reads through inbyte() function.
>> + */
>> +rtems_device_driver console_read(
>> +  rtems_device_major_number major,
>> +  rtems_device_minor_number minor,
>> +  void                    * arg
>> +)
>> +{
>> +  rtems_libio_rw_args_t *rw_args;
>> +  char *buffer;
>> +  int maximum;
>> +  int count = 0;
>> +
>> +  rw_args = (rtems_libio_rw_args_t *) arg;
>> +
>> +  buffer = rw_args->buffer;
>> +  maximum = rw_args->count;
>> +
>> +  for (count = 0; count < maximum; count++) {
>> +    buffer[ count ] = inbyte();
>> +    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
>> +      buffer[ count++ ]  = '\n';
>> +      break;
>> +    }
>> +  }
>> +
>> +  rw_args->bytes_moved = count;
>> +  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
>> +}
>> +
>> +/**
>> + * @brief Looks like termios, but writes through outbyte() function.
>> + */
>> +rtems_device_driver console_write(
>> +  rtems_device_major_number major,
>> +  rtems_device_minor_number minor,
>> +  void                    * arg
>> +)
>> +{
>> +  int count;
>> +  int maximum;
>> +  rtems_libio_rw_args_t *rw_args;
>> +  char *buffer;
>> +
>> +  rw_args = (rtems_libio_rw_args_t *) arg;
>> +
>> +  buffer = rw_args->buffer;
>> +  maximum = rw_args->count;
>> +
>> +  for (count = 0; count < maximum; count++) {
>> +    if ( buffer[ count ] == '\n') {
>> +      outbyte('\r');
>> +    }
>> +    outbyte( buffer[ count ] );
>> +  }
>> +
>> +  rw_args->bytes_moved = maximum;
>> +  return 0;
>> +}
>> +
>> +/**
>> + * @brief Does nothing!
>> + */
>> +rtems_device_driver console_control(
>> +  rtems_device_major_number major,
>> +  rtems_device_minor_number minor,
>> +  void                    * arg
>> +)
>> +{
>> +  return RTEMS_SUCCESSFUL;
>> +}
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/include/bsp.h b/c/src/lib/libbsp/i386/virtualpok/include/bsp.h
>> new file mode 100644
>> index 0000000..1d781ba
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/include/bsp.h
>> @@ -0,0 +1,53 @@
>> +/*  bsp.h
>> + *
>> + *  This include file contains all board IO definitions.
>> + *
>> + *  COPYRIGHT (c) 2013 Philipp Eppelt.
>> + *
>> + *  COPYRIGHT (c) 1989-1999.
>> + *  On-Line Applications Research Corporation (OAR).
>> + *
>> + *  The license and distribution terms for this file may be
>> + *  found in the file LICENSE in this distribution or at
>> + *  http://www.rtems.com/license/LICENSE.
>> + *
>> + */
>> +
>> +#ifndef _BSP_H
>> +#define _BSP_H
>> +
>> +#include <bspopts.h>
>> +
>> +#include <rtems.h>
>> +#include <rtems/console.h>
>> +#include <rtems/clockdrv.h>
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +/*
>> + *  Simple spin delay in microsecond units for device drivers.
>> + *  This is very dependent on the clock speed of the target.
>> + */
>> +
>> +#define rtems_bsp_delay( microseconds ) \
>> +  { \
>> +  }
>> +
>> +
>> +
>> +#define        BSP_DEFAULT_UNIFIED_WORK_AREAS 1
>> +/* functions */
>> +
>> +rtems_isr_entry set_vector(                    /* returns old vector */
>> +  rtems_isr_entry     handler,                  /* isr routine        */
>> +  rtems_vector_number vector,                   /* vector number      */
>> +  int                 type                      /* RTEMS or RAW intr  */
>> +);
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/include/virtualizationlayerbsp.h b/c/src/lib/libbsp/i386/virtualpok/include/virtualizationlayerbsp.h
>> new file mode 100644
>> index 0000000..a329610
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/include/virtualizationlayerbsp.h
>> @@ -0,0 +1,62 @@
>> +/*
>> + *
>> + *  COPYRIGHT (c) 2013 Philipp Eppelt.
>> + *    philipp.eppelt at mailbox.tu-dresden.de
>> + *
>> + *  Purpose:   BSP part of the virtualization layer.
>> + *
>> + *  The license and distribution terms for this file may be
>> + *  found in the file LICENSE in this distribution or at
>> + *  http://www.rtems.com/license/LICENSE.
>> + */
>> +
>> +#ifndef RTEMS_VIRT_LAYER_BSP_H
>> +#define RTEMS_VIRT_LAYER_BSP_H
>> +
>> +/**
>> + * \brief Initializes the console.
>> + *
>> + */
>> +int
>> +_BSP_Virtual_Console_init(void);
>> +
>> +/**
>> + * \brief Reads a character from the console.
>> + */
>> +char
>> +_BSP_Virtual_Char_read(void);
>> +
>> +/**
>> + * \brief Writes a character to the console.
>> + */
>> +void
>> +_BSP_Virtual_Char_write(char* c);
>> +
>> +/**
>> + * \brief Initializes the clock.
>> + */
>> +int
>> +_BSP_Virtual_Clock_init(void);
>> +
>> +/**
>> + * \brief Reads the clock.
>> + */
>> +int
>> +_BSP_Virtual_Clock_read(void);
>> +
>> +/**
>> + * \brief Handles faults delivered by the host system.
>> + *
>> + * POK will forward occuring faults to this handler.
>> + */
>> +int
>> +_BSP_Virtual_faulthandler(void);
>> +
>> +
>> +/* Startup functions
>> + */
>> +
>> +int
>> +_BSP_Virtual_getworkspacearea( void );
>> +
>> +#endif /* RTEMS_VIRT_LAYER_BSP_H */
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/irq/irq.c b/c/src/lib/libbsp/i386/virtualpok/irq/irq.c
>> new file mode 100644
>> index 0000000..a095e26
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/irq/irq.c
>> @@ -0,0 +1,85 @@
>> +#include <bsp/irq-generic.h>
>> +#include <stdlib.h>
>> +#include <stdio.h>
>> +#include <inttypes.h> /* PRIu32 */
>> +#include <virtualizationlayerbsp.h>
>> +
>> +uint32_t            irq_count[BSP_IRQ_LINES_NUMBER] = {0};
>> +
>> +uint32_t
>> +BSP_irq_count_dump(FILE *f)
>> +{
>> +  uint32_t tot = 0;
>> +  int      i;
>> +  if ( !f )
>> +    f = stdout;
>> +  for ( i=0; i<BSP_IRQ_LINES_NUMBER; i++ ) {
>> +    tot += irq_count[i];
>> +    fprintf(f,"IRQ %2u: %9"PRIu32"\n", i, irq_count[i]);
>> +  }
>> +  return tot;
>> +}
>> +
>> +/**
>> + * @brief Enable vector line at interrupt source. See description!
>> + *
>> + * Currently this is only a dummy function, as registering the vector on POK
>> + * will deliver interrupts before the handler is installed. So the driver
>> + * needing the interrupt needs to call _CPU_Virtual_Irq_attach().
>> + */
>> +rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
>> +{
>> +
>> +  return RTEMS_SUCCESSFUL;
>> +}
>> +
>> +/**
>> + * @brief Disabling vector line at interrupt source.
>> + */
>> +rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
>> +{
>> +  _CPU_Virtual_Irq_detach( vector );
>> +
>> +  return RTEMS_SUCCESSFUL;
>> +}
>> +
>> +/**
>> + * @brief Dummy function; necessary for a normal startup.
>> + */
>> +rtems_status_code bsp_interrupt_facility_initialize(void)
>> +{
>> +  return RTEMS_SUCCESSFUL;
>> +}
>> +
>> +/**
>> + * @brief If no interrupt handler is installed for a specified vector number,
>> + * this is called and will output a warning.
>> + */
>> +void bsp_interrupt_handler_default(rtems_vector_number vector)
>> +{
>> +  printk( "WARNING: Somebody forgot to register a handler for this interrupt: %x \n", vector );
>> +}
>> +
>> +/**
>> + * @brief Forwards the interrupt to bsp_interrupt_handler_dispatch to look for
>> + * the right handler.
>> + */
>> +void C_dispatch_isr(int vector)
>> +{
>> +  irq_count[vector]++;
>> +  bsp_interrupt_handler_dispatch(vector);
>> +}
>> +
>> +/**
>> + * @brief Initializes interrupts management.
>> + *
>> + * Called by bsp_start(), does all necessary IRQ initialization.
>> + */
>> +void  rtems_irq_mngt_init(void)
>> +{
>> +    /*
>> +     * Init initial Interrupt management config
>> +     */
>> +    bsp_interrupt_initialize();
>> +    printf("bsp_interrupt_initialize successful\n");
>> +}
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/irq/irq.h b/c/src/lib/libbsp/i386/virtualpok/irq/irq.h
>> new file mode 100644
>> index 0000000..83aa109
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/irq/irq.h
>> @@ -0,0 +1,79 @@
>> +/* irq.h
>> + *
>> + *  This include file describe the data structure and the functions implemented
>> + *  by rtems to write interrupt handlers.
>> + *
>> + *  CopyRight (C) 1998 valette at crf.canon.fr
>> + *
>> + *  This code is heavilly inspired by the public specification of STREAM V2
>> + *  that can be found at :
>> + *
>> + *      <http://www.chorus.com/Documentation/index.html> by following
>> + *  the STREAM API Specification Document link.
>> + *
>> + *  The license and distribution terms for this file may be
>> + *  found in the file LICENSE in this distribution or at
>> + *  http://www.rtems.com/license/LICENSE.
>> + */
>> +
>> +/*
>> + * The code here is to accomodate some drivers from the i386 shared directory,
>> + * for the POK BSP they are useless but removing will break compilation.
>> + *
>> + * Leaving this to be here is harmless, this code can be thrown when the POK
>> + * BSP gets its own architecture directory.
>> + */
>> +#ifndef _IRQ_H_
>> +#define _IRQ_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +/*
>> + * Include some preprocessor value also used by assember code
>> + */
>> +
>> +#include <rtems.h>
>> +#define BSP_SHARED_HANDLER_SUPPORT      1
>> +#include <rtems/irq.h>
>> +#include <rtems/irq-extension.h>
>> +
>> +/*-------------------------------------------------------------------------+
>> +| Constants
>> ++--------------------------------------------------------------------------*/
>> +
>> +    /* Base vector for our IRQ handlers. */
>> +#define BSP_IRQ_LINES_NUMBER           16
>> +#define BSP_LOWEST_OFFSET              0
>> +#define BSP_MAX_OFFSET                 (BSP_IRQ_LINES_NUMBER - 1)
>> +    /*
>> +     * Interrupt offset in comparison to BSP_ASM_IRQ_VECTOR_BASE
>> +     * NB : 1) Interrupt vector number in IDT = offset + BSP_ASM_IRQ_VECTOR_BASE
>> +     *             2) The same name should be defined on all architecture
>> +     *        so that handler connection can be unchanged.
>> +     */
>> +#define BSP_PERIODIC_TIMER      0
>> +#define BSP_KEYBOARD           1 /* can't be used, as POK doesn't support keyboards */
>> +#define BSP_UART_COM2_IRQ      3
>> +#define BSP_UART_COM1_IRQ      4
>> +#define BSP_UART_COM3_IRQ      5
>> +#define BSP_UART_COM4_IRQ      6
>> +#define BSP_RT_TIMER1          8
>> +#define BSP_RT_TIMER3          10
>> +#define BSP_SMP_IPI            16
>> +
>> +#define BSP_INTERRUPT_VECTOR_MIN BSP_LOWEST_OFFSET
>> +#define BSP_INTERRUPT_VECTOR_MAX BSP_MAX_OFFSET
>> +
>> +/*-------------------------------------------------------------------------+
>> +| Function Prototypes.
>> ++--------------------------------------------------------------------------*/
>> +
>> +void C_dispatch_isr(int vector);
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _IRQ_H_ */
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/make/custom/virtualpok.cfg b/c/src/lib/libbsp/i386/virtualpok/make/custom/virtualpok.cfg
>> new file mode 100644
>> index 0000000..a280b9d
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/make/custom/virtualpok.cfg
>> @@ -0,0 +1,17 @@
>> +#
>> +#  Configuration file for the "virtualpok" board
>> +#
>> +
>> +include $(RTEMS_ROOT)/make/custom/default.cfg
>> +
>> +RTEMS_CPU=i386
>> +RTEMS_CPU_MODEL=pentium
>> +
>> +#CPU_CFLAGS =
>> +
>> +# debug info
>> +CFLAGS_OPTIMIZE_V = -g
>> +
>> +# Miscellaneous additions go here
>> +
>> +#see pc386/make/custom/ for more information
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/preinstall.am b/c/src/lib/libbsp/i386/virtualpok/preinstall.am
>> new file mode 100644
>> index 0000000..698ede6
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/preinstall.am
>> @@ -0,0 +1,79 @@
>> +## Automatically generated by ampolish3 - Do not edit
>> +
>> +if AMPOLISH3
>> +$(srcdir)/preinstall.am: Makefile.am
>> +       $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
>> +endif
>> +
>> +PREINSTALL_DIRS =
>> +DISTCLEANFILES += $(PREINSTALL_DIRS)
>> +
>> +all-local: $(TMPINSTALL_FILES)
>> +
>> +TMPINSTALL_FILES =
>> +CLEANFILES = $(TMPINSTALL_FILES)
>> +
>> +all-am: $(PREINSTALL_FILES)
>> +
>> +PREINSTALL_FILES =
>> +CLEANFILES += $(PREINSTALL_FILES)
>> +
>> +$(PROJECT_LIB)/$(dirstamp):
>> +       @$(MKDIR_P) $(PROJECT_LIB)
>> +       @: > $(PROJECT_LIB)/$(dirstamp)
>> +PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
>> +
>> +$(PROJECT_INCLUDE)/$(dirstamp):
>> +       @$(MKDIR_P) $(PROJECT_INCLUDE)
>> +       @: > $(PROJECT_INCLUDE)/$(dirstamp)
>> +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
>> +
>> +$(PROJECT_INCLUDE)/bsp/$(dirstamp):
>> +       @$(MKDIR_P) $(PROJECT_INCLUDE)/bsp
>> +       @: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>> +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>> +
>> +$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
>> +PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
>> +
>> +$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
>> +
>> +$(PROJECT_INCLUDE)/tm27.h: ../../shared/include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
>> +
>> +$(PROJECT_INCLUDE)/virtualizationlayerbsp.h: include/virtualizationlayerbsp.h $(PROJECT_INCLUDE)/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/virtualizationlayerbsp.h
>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/virtualizationlayerbsp.h
>> +
>> +$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
>> +
>> +$(PROJECT_INCLUDE)/bsp/bootcard.h: ../../shared/include/bootcard.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/bootcard.h
>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/bootcard.h
>> +
>> +$(PROJECT_INCLUDE)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
>> +
>> +$(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-generic.h
>> +
>> +$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
>> +
>> +$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
>> +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
>> +
>> +$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
>> +       $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
>> +TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
>> +
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/start/start.S b/c/src/lib/libbsp/i386/virtualpok/start/start.S
>> new file mode 100644
>> index 0000000..5048586
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/start/start.S
>> @@ -0,0 +1,37 @@
>> +/*
>> + *  COPYRIGHT (c) 2013/
>> + *  Philipp Eppelt.
>> + *
>> + *  Contact:  philipp.eppelt at mailbox.tu-dresden.de
>> + *
>> + *  Purpose:  Provides GNU entry point and directly go to bootcard.
>> + */
>> +
>> +#include <rtems/asm.h>
>> +#include <rtems/score/cpu.h>
>> +
>> +
>> +#ifndef CPU_STACK_ALIGNMENT
>> +#error  "Missing header ? CPU_STACK_ALIGNMENT NOT DEFINED"
>> +#endif
>> +
>> +.set STACK_SIZE, 0x1000
>> +
>> +/*----------------------------------------------------------------------------+
>> +| CODE section
>> ++----------------------------------------------------------------------------*/
>> +
>> +BEGIN_CODE
>> +
>> +       PUBLIC (start)          # GNU default entry point
>> +
>> +       EXTERN (boot_card)
>> +       EXTERN (bsp_reset)
>> +
>> +
>> +SYM (start):
>> +
>> +       call    SYM (boot_card)
>> +
>> +       # TODO when this returns there should be some shut down handling
>> +       call    SYM (bsp_reset)
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/startup/bspgetworkarea.c b/c/src/lib/libbsp/i386/virtualpok/startup/bspgetworkarea.c
>> new file mode 100644
>> index 0000000..562a8e9
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/startup/bspgetworkarea.c
>> @@ -0,0 +1,102 @@
>> +/*
>> + *  This routine is an implementation of the bsp_get_work_area()
>> + *  that can be used by all BSPs following linkcmds conventions
>> + *  regarding heap, stack, and workspace allocation.
>> + *
>> + *  COPYRIGHT (c) 1989-2008.
>> + *  On-Line Applications Research Corporation (OAR).
>> + *
>> + *  Copyright (c) 2011 embedded brains GmbH.
>> + *
>> + *  The license and distribution terms for this file may be
>> + *  found in the file LICENSE in this distribution or at
>> + *  http://www.rtems.com/license/LICENSE.
>> + */
>> +
>> +/* #define BSP_GET_WORK_AREA_DEBUG */
>> +
>> +#include <bsp.h>
>> +#include <bsp/bootcard.h>
>> +#ifdef BSP_GET_WORK_AREA_DEBUG
>> +  #include <rtems/bspIo.h>
>> +#endif
>> +
>> +
>> +/*
>> + *  These are provided by the linkcmds for ALL of the BSPs which use this file.
>> + */
>> +extern char WorkAreaBase[];
>> +extern char HeapSize[];
>> +
>> +extern char ELFBase[];
>> +extern char textBase[];
>> +extern char rodataBase[];
>> +extern char dataBase[];
>> +
>> +unsigned long _Global_descriptor_table = 0;
>> +
>> +/*
>> + *  This method returns the base address and size of the area which
>> + *  is to be allocated between the RTEMS Workspace and the C Program
>> + *  Heap.
>> + */
>> +void bsp_work_area_initialize( void )
>> +{
>> +/*  uintptr_t ELF_Base = (uintptr_t) ELFBase;
>> +  uintptr_t text_Base = (uintptr_t) textBase;
>> +  uintptr_t rodata_Base = (uintptr_t) rodataBase;
>> +  uintptr_t data_Base = (uintptr_t) dataBase;
>> +*/
>> +  uintptr_t work_base = (uintptr_t) WorkAreaBase;
>> +  uint32_t work_size = 0x100000 * 4;
>> +//  uint32_t base_addr = 0;
>> +//  uint32_t pok_stack_size = 0;
>> +
>> +  // TODO add call to virtlayer to get space
>> +  bsp_work_area_initialize_default( work_base, work_size );
>> +/*
>> +  *work_area_start = (void *) work_base + pok_stack_size;
>> +  *work_area_size  = size - work_base - pok_stack_size;
>> +  *heap_start      = 0;
>> +  *heap_size       = (uintptr_t) HeapSize;
>> +*/
>> +  /*
>> +   *  The following may be helpful in debugging what goes wrong when
>> +   *  you are allocating the Work Area in a new BSP.
>> +   */
>> +  #ifdef BSP_GET_WORK_AREA_DEBUG
>> +    {
>> +      void *sp = __builtin_frame_address(0);
>> +      void *end = *work_area_start + *work_area_size;
>> +      printk(
>> +        "ELFBase = 0x%p\n"
>> +        "textBase = 0x%p\n"
>> +        "rodataBase = 0x%p\n"
>> +        "dataBase = 0x%p\n"
>> +        "work_area_start (base_addr) = 0x%p\n"
>> +        "WorkAreaBase = 0x%p\n"
>> +        "work_area_size = %d 0x%08x\n"
>> +        "end = 0x%p\n"
>> +        "heap_start = 0x%p\n"
>> +        "heap_size = %d\n"
>> +        "pok stack size = 0x%p\n"
>> +        "current stack pointer = 0x%p%s\n",
>> +        ELF_Base,
>> +        text_Base,
>> +        rodata_Base,
>> +        data_Base,
>> +        *work_area_start,
>> +        work_base,
>> +        *work_area_size,  /* decimal */
>> +        *work_area_size,  /* hexadecimal */
>> +        end,
>> +        *heap_start,
>> +        *heap_size,
>> +        pok_stack_size,
>> +        sp,
>> +        ((sp >= *work_area_start && sp <= end) ? " OVERLAPS!" : "")
>> +     );
>> +  }
>> + #endif
>> +
>> +}
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/startup/bspstart.c b/c/src/lib/libbsp/i386/virtualpok/startup/bspstart.c
>> new file mode 100644
>> index 0000000..e787f96
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/startup/bspstart.c
>> @@ -0,0 +1,41 @@
>> +/*
>> + *  This routine starts the application.  It includes application,
>> + *  board, and monitor specific initialization and configuration.
>> + *  The generic CPU dependent initialization has been performed
>> + *  before this routine is invoked.
>> + *
>> + *  COPYRIGHT (c) 1989-1999.
>> + *  On-Line Applications Research Corporation (OAR).
>> + *
>> + *  The license and distribution terms for this file may be
>> + *  found in the file LICENSE in this distribution or at
>> + *  http://www.rtems.com/license/LICENSE.
>> + *
>> + */
>> +
>> +#include <string.h>
>> +
>> +#include <bsp.h>
>> +#include <rtems.h>
>> +#include <rtems/bspIo.h>
>> +#include <virtualizationlayerbsp.h>
>> +
>> +
>> +extern void rtems_irq_mngt_init(void);
>> +
>> +/*
>> + *  bsp_start
>> + *
>> + *  This routine does the bulk of the system initialization.
>> + */
>> +void bsp_start( void )
>> +{
>> +
>> +  _BSP_Virtual_Char_write( "Hello RTEMS World\n" );
>> +
>> +  // Initialize IRQ management
>> +  rtems_irq_mngt_init();
>> +
>> +  // Register clock driver
>> +  Clock_driver_install_handler();
>> +}
>> diff --git a/c/src/lib/libbsp/i386/virtualpok/startup/linkcmds b/c/src/lib/libbsp/i386/virtualpok/startup/linkcmds
>> new file mode 100644
>> index 0000000..a425a94
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/i386/virtualpok/startup/linkcmds
>> @@ -0,0 +1,251 @@
>> +/*
>> + *  Copy of default "default linker script, for normal executables"
>> + *  provided with binutils 2.18 with minor modifications for use
>> + *  as pc386 linkcmds.  These changes include:
>> + *
>> + *    + sections commented out marked with "XXX commented out --joel"
>> + *    + addition of m_hdr section
>> + *    + addition of FreeBSD sysctl sections
>> + */
>> +
>> +/*
>> + * XXX commented out --joel
>> +OUTPUT_FORMAT("elf32-i386", "elf32-i386",
>> +             "elf32-i386")
>> +OUTPUT_ARCH(i386)
>> +*/
>> +ENTRY(start)
>> +HeapSize = DEFINED(HeapSize) ? HeapSize :
>> +          DEFINED(_HeapSize) ? _HeapSize : 0x0;
>> +RamBase = DEFINED(_RamBase) ? RamBase : 0x0;
>> +RamSize = DEFINED(RamSize) ? RamSize    :
>> +          DEFINED(_RamSize) ? _RamSize : 0xFFFFFFFF;
>> +
>> +SECTIONS
>> +{
>> +  . = 0x1000;
>> +  /* Read-only sections, merged into text segment: */
>> +/*
>> + * XXX commented out --joel
>> +  PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS;
>> +*/
>> +  .interp         : { *(.interp) }
>> +  .note.gnu.build-id : { *(.note.gnu.build-id) }
>> +  .hash           : { *(.hash) }
>> +  .gnu.hash       : { *(.gnu.hash) }
>> +  .dynsym         : { *(.dynsym) }
>> +  .dynstr         : { *(.dynstr) }
>> +  .gnu.version    : { *(.gnu.version) }
>> +  .gnu.version_d  : { *(.gnu.version_d) }
>> +  .gnu.version_r  : { *(.gnu.version_r) }
>> +  .rel.init       : { *(.rel.init) }
>> +  .rela.init      : { *(.rela.init) }
>> +  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
>> +  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
>> +  .rel.fini       : { *(.rel.fini) }
>> +  .rela.fini      : { *(.rela.fini) }
>> +  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
>> +  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
>> +  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
>> +  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
>> +  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
>> +  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
>> +  .rel.tdata     : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
>> +  .rela.tdata    : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
>> +  .rel.tbss      : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
>> +  .rela.tbss     : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
>> +  .rel.ctors      : { *(.rel.ctors) }
>> +  .rela.ctors     : { *(.rela.ctors) }
>> +  .rel.dtors      : { *(.rel.dtors) }
>> +  .rela.dtors     : { *(.rela.dtors) }
>> +  .rel.got        : { *(.rel.got) }
>> +  .rela.got       : { *(.rela.got) }
>> +  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
>> +  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
>> +  .rel.plt        : { *(.rel.plt) }
>> +  .rela.plt       : { *(.rela.plt) }
>> +  .plt            : { *(.plt) }
>> +  .text           :
>> +  {
>> +   *(.m_hdr)
>> +    *(.text .stub .text.* .gnu.linkonce.t.*)
>> +    KEEP (*(.text.*personality*))
>> +    /* .gnu.warning sections are handled specially by elf32.em.  */
>> +    *(.gnu.warning)
>> +
>> +  } =0x90909090
>> +
>> +  .robsdsets : {
>> +    /* for pre rtems-libbsd FreeBSD code */
>> +    __start_set_sysctl_set = .;
>> +    *(set_sysctl_*);
>> +    __stop_set_sysctl_set = .;
>> +    *(set_domain_*);
>> +    *(set_pseudo_*);
>> +
>> +    /* for rtems-libbsd FreeBSD code */
>> +    _bsd__start_set_modmetadata_set = .;
>> +    *(_bsd_set_modmetadata_set);
>> +    _bsd__stop_set_modmetadata_set = .;
>> +
>> +    _bsd__start_set_sysctl_set = .;
>> +    *(_bsd_set_sysctl_set);
>> +    _bsd__stop_set_sysctl_set = .;
>> +
>> +    _bsd__start_set_sysinit_set = .;
>> +    *(_bsd_set_sysinit_*);
>> +    _bsd__stop_set_sysinit_set = .;
>> +
>> +    bsp_section_rodata_end = .;
>> +
>> +  } =0x90909090
>> +
>> +  .init           :
>> +  {
>> +    KEEP (*(.init))
>> +  } =0x90909090
>> +  .fini           :
>> +  {
>> +    KEEP (*(.fini))
>> +  } =0x90909090
>> +  PROVIDE (__etext = .);
>> +  PROVIDE (_etext = .);
>> +  PROVIDE (etext = .);
>> +  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
>> +  .rodata1        : { *(.rodata1) }
>> +  .eh_frame_hdr : { *(.eh_frame_hdr) }
>> +  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
>> +  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
>> +  /* Adjust the address for the data segment.  We want to adjust up to
>> +     the same address within the page on the next page up.  */
>> +  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
>> +  /* Exception handling  */
>> +  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
>> +  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
>> +  /* Thread Local Storage sections  */
>> +  .tdata         : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
>> +  .tbss                  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
>> +  .preinit_array     :
>> +  {
>> +    PROVIDE_HIDDEN (__preinit_array_start = .);
>> +    KEEP (*(.preinit_array))
>> +    PROVIDE_HIDDEN (__preinit_array_end = .);
>> +  }
>> +  .init_array     :
>> +  {
>> +     PROVIDE_HIDDEN (__init_array_start = .);
>> +     KEEP (*(SORT(.init_array.*)))
>> +     KEEP (*(.init_array))
>> +     PROVIDE_HIDDEN (__init_array_end = .);
>> +  }
>> +  .fini_array     :
>> +  {
>> +    PROVIDE_HIDDEN (__fini_array_start = .);
>> +    KEEP (*(.fini_array))
>> +    KEEP (*(SORT(.fini_array.*)))
>> +    PROVIDE_HIDDEN (__fini_array_end = .);
>> +  }
>> +  .ctors          :
>> +  {
>> +    /* gcc uses crtbegin.o to find the start of
>> +       the constructors, so we make sure it is
>> +       first.  Because this is a wildcard, it
>> +       doesn't matter if the user does not
>> +       actually link against crtbegin.o; the
>> +       linker won't look for a file to match a
>> +       wildcard.  The wildcard also means that it
>> +       doesn't matter which directory crtbegin.o
>> +       is in.  */
>> +    KEEP (*crtbegin.o(.ctors))
>> +    KEEP (*crtbegin?.o(.ctors))
>> +    /* We don't want to include the .ctor section from
>> +       the crtend.o file until after the sorted ctors.
>> +       The .ctor section from the crtend file contains the
>> +       end of ctors marker and it must be last */
>> +    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
>> +    KEEP (*(SORT(.ctors.*)))
>> +    KEEP (*(.ctors))
>> +  }
>> +  .dtors          :
>> +  {
>> +    KEEP (*crtbegin.o(.dtors))
>> +    KEEP (*crtbegin?.o(.dtors))
>> +    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
>> +    KEEP (*(SORT(.dtors.*)))
>> +    KEEP (*(.dtors))
>> +  }
>> +  .jcr            : { KEEP (*(.jcr)) }
>> +  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
>> +  .dynamic        : { *(.dynamic) }
>> +  .got            : { *(.got) }
>> +  . = DATA_SEGMENT_RELRO_END (12, .);
>> +  .got.plt        : { *(.got.plt) }
>> +  .data           :
>> +  {
>> +    *(.data .data.* .gnu.linkonce.d.*)
>> +    KEEP (*(.gnu.linkonce.d.*personality*))
>> +    SORT(CONSTRUCTORS)
>> +  }
>> +  .data1          : { *(.data1) }
>> +  _edata = .; PROVIDE (edata = .);
>> +  __bss_start = .;
>> +  .bss            :
>> +  {
>> +   *(.dynbss)
>> +   *(.bss .bss.* .gnu.linkonce.b.*)
>> +   *(COMMON)
>> +   /* Align here to ensure that the .bss section occupies space up to
>> +      _end.  Align after .bss to ensure correct alignment even if the
>> +      .bss section disappears because there are no input sections.
>> +      FIXME: Why do we need it? When there is no .bss section, we don't
>> +      pad the .data section.  */
>> +   . = ALIGN(. != 0 ? 32 / 8 : 1);
>> +  }
>> +  . = ALIGN(32 / 8);
>> +  . = ALIGN(32 / 8);
>> +  _end = .; PROVIDE (end = .);
>> +  . = ALIGN(0x10);
>> +  WorkAreaBase = .;
>> +  . = DATA_SEGMENT_END (.);
>> +
>> +  /* Stabs debugging sections.  */
>> +  .stab          0 : { *(.stab) }
>> +  .stabstr       0 : { *(.stabstr) }
>> +  .stab.excl     0 : { *(.stab.excl) }
>> +  .stab.exclstr  0 : { *(.stab.exclstr) }
>> +  .stab.index    0 : { *(.stab.index) }
>> +  .stab.indexstr 0 : { *(.stab.indexstr) }
>> +  .comment       0 : { *(.comment) }
>> +  /* DWARF debug sections.
>> +     Symbols in the DWARF debugging sections are relative to the beginning
>> +     of the section so we begin them at 0.  */
>> +  /* DWARF 1 */
>> +  .debug          0 : { *(.debug) }
>> +  .line           0 : { *(.line) }
>> +  /* GNU DWARF 1 extensions */
>> +  .debug_srcinfo  0 : { *(.debug_srcinfo) }
>> +  .debug_sfnames  0 : { *(.debug_sfnames) }
>> +  /* DWARF 1.1 and DWARF 2 */
>> +  .debug_aranges  0 : { *(.debug_aranges) }
>> +  .debug_pubnames 0 : { *(.debug_pubnames) }
>> +  /* DWARF 2 */
>> +  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
>> +  .debug_abbrev   0 : { *(.debug_abbrev) }
>> +  .debug_line     0 : { *(.debug_line) }
>> +  .debug_frame    0 : { *(.debug_frame) }
>> +  .debug_str      0 : { *(.debug_str) }
>> +  .debug_loc      0 : { *(.debug_loc) }
>> +  .debug_macinfo  0 : { *(.debug_macinfo) }
>> +  /* SGI/MIPS DWARF 2 extensions */
>> +  .debug_weaknames 0 : { *(.debug_weaknames) }
>> +  .debug_funcnames 0 : { *(.debug_funcnames) }
>> +  .debug_typenames 0 : { *(.debug_typenames) }
>> +  .debug_varnames  0 : { *(.debug_varnames) }
>> +  /* DWARF 3 */
>> +  .debug_pubtypes 0 : { *(.debug_pubtypes) }
>> +  .debug_ranges   0 : { *(.debug_ranges) }
>> +  /* DWARF extension */
>> +  .debug_macro    0 : { *(.debug_macro) }
>> +  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
>> +  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
>> +}
>> --
>> 1.8.1.4
>>
>> _______________________________________________
>> rtems-devel mailing list
>> rtems-devel at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-devel




More information about the devel mailing list