Patch introducing libbsp/i386/virtPok BSP.
diff --git a/c/src/lib/libbsp/i386/acinclude.m4 b/c/src/lib/libbsp/i386/acinclude.m4
index a2f2384..83259a8 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]);;
+  virtPok )
+    AC_CONFIG_SUBDIRS([virtPok]);;
   *)
     AC_MSG_ERROR([Invalid BSP]);;
   esac
diff --git a/c/src/lib/libbsp/i386/virtPok/Makefile.am b/c/src/lib/libbsp/i386/virtPok/Makefile.am
new file mode 100644
index 0000000..7fbe2d0
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/Makefile.am
@@ -0,0 +1,87 @@
+##
+## $Id$
+##
+
+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/virtLayerBSP.h
+include_HEADERS += include/virtLayerCPU.h
+
+nodist_include_HEADERS = include/bspopts.h
+nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
+DISTCLEANFILES = include/bspopts.h
+noinst_PROGRAMS =
+
+include_bsp_HEADERS  = ../shared/irq/irq.h
+include_bsp_HEADERS  += ../shared/irq/irq_asm.h
+
+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 += start/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 += startup/setvec.c 
+libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c 
+libbsp_a_SOURCES += ../../shared/bspreset_loop.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/virtPok/README.virt b/c/src/lib/libbsp/i386/virtPok/README.virt
new file mode 100644
index 0000000..f12a947
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/README.virt
@@ -0,0 +1,16 @@
+Date: 06/10/2013
+Author: Philipp Eppelt
+Purpose: Information on this BSP
+
+
+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
+
+
diff --git a/c/src/lib/libbsp/i386/virtPok/bsp_specs b/c/src/lib/libbsp/i386/virtPok/bsp_specs
new file mode 100644
index 0000000..861b21e
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/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/virtPok/configure.ac b/c/src/lib/libbsp/i386/virtPok/configure.ac
new file mode 100644
index 0000000..6424f77
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/configure.ac
@@ -0,0 +1,24 @@
+## Process this file with autoconf to produce a configure script.
+##
+## $Id$
+
+AC_PREREQ([2.68])
+AC_INIT([rtems-c-src-lib-libbsp-i386-virtPok],[_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/virtPok/console/console.c b/c/src/lib/libbsp/i386/virtPok/console/console.c
new file mode 100644
index 0000000..fb8ddf9
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/console/console.c
@@ -0,0 +1,230 @@
+/*
+ *  This file contains the template for a console IO package.
+ *
+ *  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.
+ *
+ *  $Id$
+ */
+
+#define NO_BSP_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+//#include <bsp/poksyscalls.h>
+#include <virtLayerBSP.h>
+
+/*  console_initialize
+ *
+ *  This routine initializes the console IO driver.
+ *
+ *  Input parameters: NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  Return values:
+ */
+
+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);
+  }
+
+// Virt: Added the virtual console init.
+  status = virt_consoleInit();
+
+  if( status != 0 )
+  {
+    rtems_fatal_error_occurred(status);
+  }
+
+  return RTEMS_SUCCESSFUL;
+}
+
+/*  is_character_ready
+ *
+ *  This routine returns TRUE if a character is available.
+ *
+ *  Input parameters: NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  Return values:
+ */
+
+bool is_character_ready(
+  char *ch
+)
+{
+  *ch = '\0';   /* return NULL for no particular reason */
+  return true;
+}
+
+/*  inbyte
+ *
+ *  This routine reads a character from the SOURCE.
+ *
+ *  Input parameters: NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  Return values:
+ *    character read from SOURCE
+ */
+
+char inbyte( void )
+{
+  /*
+   *  If polling, wait until a character is available.
+   */
+
+  return virt_charRead();
+}
+
+/*  outbyte
+ *
+ *  This routine transmits a character out the SOURCE.  It may support
+ *  XON/XOFF flow control.
+ *
+ *  Input parameters:
+ *    ch  - character to be transmitted
+ *
+ *  Output parameters:  NONE
+ */
+
+void outbyte(
+  char ch
+)
+{
+  virt_charWrite(&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
+ */
+
+/*
+ *  Open entry point
+ */
+
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ *  Close entry point
+ */
+
+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.
+ */
+
+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;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+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;
+}
+
+/*
+ *  IO Control entry point
+ */
+
+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/virtPok/include/bsp.h b/c/src/lib/libbsp/i386/virtPok/include/bsp.h
new file mode 100644
index 0000000..a2eff67
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/include/bsp.h
@@ -0,0 +1,54 @@
+/*  bsp.h
+ *
+ *  This include file contains all board IO definitions.
+ *
+ *  XXX : put yours in here
+ *
+ *  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.
+ *
+ *  $Id$
+ */
+
+#ifndef _BSP_H
+#define _BSP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bspopts.h>
+
+#include <rtems.h>
+#include <rtems/console.h>
+#include <rtems/clockdrv.h>
+
+/*
+ *  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/virtPok/include/virtLayerBSP.h b/c/src/lib/libbsp/i386/virtPok/include/virtLayerBSP.h
new file mode 100644
index 0000000..847604a
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/include/virtLayerBSP.h
@@ -0,0 +1,55 @@
+/* Date:      06/10/2013
+ * Author:    Philipp Eppelt
+ * Purpose:   BSP part of the virtualization layer.
+ * Licencse:  see RTEMS License.
+ */
+
+#ifndef RTEMS_VIRT_LAYER_BSP_H
+#define RTEMS_VIRT_LAYER_BSP_H
+
+/**
+ * \brief Initializes the console.
+ *
+ */
+__attribute__((fastcall)) int
+virt_consoleInit(void);
+
+/**
+ * \brief Reads a character from the console.
+ */
+__attribute__((fastcall)) char
+virt_charRead(void);
+
+/**
+ * \brief Writes a character to the console.
+ */
+__attribute__((fastcall)) void
+virt_charWrite(char* c);
+
+/**
+ * \brief Initializes the clock.
+ */
+__attribute__((fastcall)) int
+virt_clockInit(void);
+
+/**
+ * \brief Reads the clock.
+ */
+__attribute__((fastcall)) int
+virt_clockRead(void);
+
+/**
+ * \brief Handles faults delivered by the host system.
+ *
+ * POK will forward occuring faults to this handler.
+ */
+__attribute__((fastcall)) int
+virt_faultHandler(void);
+
+
+/* Startup functions */
+
+__attribute__((fastcall)) int 
+virt_getWorkSpaceArea( void );
+
+#endif /* RTEMS_VIRT_LAYER_BSP_H */
diff --git a/c/src/lib/libbsp/i386/virtPok/include/virtLayerCPU.h b/c/src/lib/libbsp/i386/virtPok/include/virtLayerCPU.h
new file mode 100644
index 0000000..d6e5dee
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/include/virtLayerCPU.h
@@ -0,0 +1,57 @@
+/* Date:      06/19/2013
+ * Author:    Philipp Eppelt
+ * Purpose:   CPU part of the virtualization layer.
+ * Licencse:  see RTEMS License.
+ */
+
+
+#ifndef RTEMS_VIRT_LAYER_CPU_H
+#define RTEMS_VIRT_LAYER_CPU_H
+
+#ifndef ASM
+
+/* Interrupts */
+__attribute__((fastcall)) int
+virt_requestIrq( int vector );
+
+__attribute__((fastcall)) void
+virt_detachIrq( int vector );
+
+__attribute__((fastcall)) void
+virt_enableInterrupts( int _level );
+
+__attribute__((fastcall)) void
+virt_disableInterrupts( int _level );
+
+__attribute__((fastcall)) void 
+virt_flashInterrupts( int _level );
+
+__attribute__((fastcall)) void
+virt_openInterrupts( void );
+
+__attribute__((fastcall)) void
+virt_closeInterrupts( void );
+
+__attribute__((fastcall)) int
+virt_getInterruptLevel( int _level );
+
+
+
+/* Idle Thread */
+
+/**
+ * @brief Lowest priority thread, doing nothing, never returns;
+ */
+
+__attribute__((fastcall)) void
+virt_idleThread( void );
+
+
+/* Error handling */
+
+__attribute__((fastcall)) void
+virt_execStopError( int _error );
+
+#endif /* ASM */
+
+#endif /* RTEMS_VIRT_LAYER_CPU_H */
diff --git a/c/src/lib/libbsp/i386/virtPok/make/custom/virtPok.cfg b/c/src/lib/libbsp/i386/virtPok/make/custom/virtPok.cfg
new file mode 100644
index 0000000..abd53fd
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/make/custom/virtPok.cfg
@@ -0,0 +1,17 @@
+#
+#  Configuration file for the "virtPok" board
+#
+#  $Id$
+#
+
+include $(RTEMS_ROOT)/make/custom/default.cfg
+
+RTEMS_CPU=i386
+RTEMS_CPU_MODEL=virt-pok
+
+#CPU_CFLAGS = -I/$(POK_PATH)/libpok/include	#FIXME: not recognized during compilation of libbsp
+
+# debug info
+CFLAGS_OPTIMIZE_V = -g
+
+# Miscellaneous additions go here
diff --git a/c/src/lib/libbsp/i386/virtPok/preinstall.am b/c/src/lib/libbsp/i386/virtPok/preinstall.am
new file mode 100644
index 0000000..c745ce8
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/preinstall.am
@@ -0,0 +1,83 @@
+## 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)/virtLayerBSP.h: include/virtLayerBSP.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/virtLayerBSP.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/virtLayerBSP.h
+
+$(PROJECT_INCLUDE)/virtLayerCPU.h: include/virtLayerCPU.h $(PROJECT_INCLUDE)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/virtLayerCPU.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/virtLayerCPU.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: ../shared/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_asm.h: ../shared/irq/irq_asm.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq_asm.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq_asm.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/virtPok/start/_start.S b/c/src/lib/libbsp/i386/virtPok/start/_start.S
new file mode 100644
index 0000000..08f0492
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/start/_start.S
@@ -0,0 +1,35 @@
+/*  Date:     06/24/2013
+    Author:   Philipp Eppelt
+    Contact:  philipp.epp...@mailbox.tu-dresden.de
+
+    Purpose:  Provide 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/virtPok/start/bspgetworkarea.c b/c/src/lib/libbsp/i386/virtPok/start/bspgetworkarea.c
new file mode 100644
index 0000000..562a8e9
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/start/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/virtPok/start/start.c b/c/src/lib/libbsp/i386/virtPok/start/start.c
new file mode 100644
index 0000000..83543b3
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/start/start.c
@@ -0,0 +1,12 @@
+/*
+ * 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 <bsp/bootcard.h>
+
+void _start(void)
+{
+	boot_card (NULL);
+}
diff --git a/c/src/lib/libbsp/i386/virtPok/startup/bspstart.c b/c/src/lib/libbsp/i386/virtPok/startup/bspstart.c
new file mode 100644
index 0000000..1b3da1d
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/startup/bspstart.c
@@ -0,0 +1,39 @@
+/*
+ *  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.
+ *
+ *  $Id$
+ */
+
+#include <string.h>
+
+#include <bsp.h>
+#include <rtems.h>
+#include <rtems/bspIo.h>
+#include <virtLayerBSP.h>
+
+
+/*
+ *  bsp_start
+ *
+ *  This routine does the bulk of the system initialization.
+ */
+void bsp_start( void )
+{
+
+  virt_charWrite( "Hello RTEMS World\n" );
+
+  char buff[] = {"RTEMS bsp_start()\n"};
+
+  virt_charWrite( buff );
+
+}
diff --git a/c/src/lib/libbsp/i386/virtPok/startup/linkcmds b/c/src/lib/libbsp/i386/virtPok/startup/linkcmds
new file mode 120000
index 0000000..6a6cf7c
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/startup/linkcmds
@@ -0,0 +1 @@
+linkcmds_old
\ No newline at end of file
diff --git a/c/src/lib/libbsp/i386/virtPok/startup/linkcmds_old b/c/src/lib/libbsp/i386/virtPok/startup/linkcmds_old
new file mode 100644
index 0000000..c8a5273
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/startup/linkcmds_old
@@ -0,0 +1,244 @@
+/*
+ *  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
+{
+  /* 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)
+    /*
+     * Special FreeBSD sysctl sections.
+     */
+    . = ALIGN (16);
+    __start_set_sysctl_set = .;
+    *(set_sysctl_*);
+    __stop_set_sysctl_set = ABSOLUTE(.);
+    *(set_domain_*);
+    *(set_pseudo_*);
+    _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) }
+  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
+}
+
diff --git a/c/src/lib/libbsp/i386/virtPok/startup/linkcmds_pok b/c/src/lib/libbsp/i386/virtPok/startup/linkcmds_pok
new file mode 100644
index 0000000..e4e68d2
--- /dev/null
+++ b/c/src/lib/libbsp/i386/virtPok/startup/linkcmds_pok
@@ -0,0 +1,32 @@
+HeapSize = DEFINED(HeapSize) ? HeapSize : 
+          DEFINED(_HeapSize) ? _HeapSize : 0x0;
+RamBase = DEFINED(_RamBase) ? RamBase : 0x0;
+RamSize = DEFINED(RamSize) ? RamSize    : 
+          DEFINED(_RamSize) ? _RamSize : 0xFFFFFFFF;
+
+ENTRY(_start)
+SECTIONS
+{
+  /* . = 0x0;*/
+  
+  ELFBase = .;
+  __partition_begin = . ;
+  textBase = .;
+  .text :
+  {
+    *(.text)
+  }
+  
+  rodataBase = .;
+  .rodata :
+  {
+    *(.rodata)
+  }
+  dataBase = .;
+  .data :
+  {
+    *(.data) *(.bss) *(COMMON)
+  }
+  WorkAreaBase = .;
+  __partition_end = . ;
+} 
_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to