File : s-bbcppr-ppc.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
   4 --                                                                          --
   5 --               S Y S T E M . B B . C P U _ P R I M I T I V E S            --
   6 --                                                                          --
   7 --                                  S p e c                                 --
   8 --                                                                          --
   9 --        Copyright (C) 1999-2002 Universidad Politecnica de Madrid         --
  10 --             Copyright (C) 2003-2004 The European Space Agency            --
  11 --                     Copyright (C) 2003-2016, AdaCore                     --
  12 --                                                                          --
  13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14 -- terms of the  GNU General Public License as published  by the Free Soft- --
  15 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
  16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18 -- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
  19 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  22 --                                                                          --
  23 --                                                                          --
  24 -- You should have received a copy of the GNU General Public License and    --
  25 -- a copy of the GCC Runtime Library Exception along with this program;     --
  26 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
  27 -- <http://www.gnu.org/licenses/>.                                          --
  28 --                                                                          --
  29 -- GNAT was originally developed  by the GNAT team at  New York University. --
  30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  31 --                                                                          --
  32 -- The port of GNARL to bare board targets was initially developed by the   --
  33 -- Real-Time Systems Group at the Technical University of Madrid.           --
  34 --                                                                          --
  35 ------------------------------------------------------------------------------
  36 
  37 --  This package contains the primitives which are dependent on the
  38 --  underlying processor.
  39 
  40 pragma Restrictions (No_Elaboration_Code);
  41 
  42 with System;
  43 with System.Storage_Elements;
  44 with System.BB.Parameters;
  45 with System.BB.CPU_Specific;
  46 
  47 package System.BB.CPU_Primitives is
  48    pragma Preelaborate;
  49 
  50    ------------------------
  51    -- Context Management --
  52    ------------------------
  53 
  54    subtype Context_Buffer is System.BB.CPU_Specific.Context_Buffer;
  55 
  56    procedure Context_Switch;
  57    --  Perform the context switch between the running_thread and the first
  58    --  thread. The value of running_thread will be updated.
  59 
  60    procedure Initialize_Stack
  61      (Base          : Address;
  62       Size          : Storage_Elements.Storage_Offset;
  63       Stack_Pointer : out Address);
  64    --  Initialize a stack which spans BASE .. BASE + SIZE - 1. Set
  65    --  STACK_POINTER to the address to be used by the processor.
  66 
  67    procedure Initialize_Context
  68      (Buffer          : not null access Context_Buffer;
  69       Program_Counter : System.Address;
  70       Argument        : System.Address;
  71       Stack_Pointer   : System.Address);
  72    pragma Inline (Initialize_Context);
  73    --  Initialize_Context inserts inside the context buffer the default
  74    --  values for each register. The values for the stack pointer, the
  75    --  program counter, and argument to be passed are provided as arguments.
  76 
  77    ---------------------------------
  78    -- Interrupt and Trap Handling --
  79    ---------------------------------
  80 
  81    procedure Install_Error_Handlers
  82      renames CPU_Specific.Install_Error_Handlers;
  83    --  Called at system initialization time to install a CPU specific trap
  84    --  handler, GNAT_Error_Handler, that converts synchronous traps to
  85    --  appropriate exceptions.
  86 
  87    procedure Disable_Interrupts;
  88    pragma Inline (Disable_Interrupts);
  89    --  All external interrupts (asynchronous traps) are disabled
  90 
  91    procedure Enable_Interrupts (Level : Integer);
  92    pragma Inline (Enable_Interrupts);
  93    --  Interrupts are enabled if they are above the value given by Level
  94 
  95    procedure Initialize_CPU;
  96    pragma Inline (Initialize_CPU);
  97 
  98 end System.BB.CPU_Primitives;