File : s-macres-prep.adb
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . M A C H I N E _ R E S E T --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2011-2016, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- --
19 -- --
20 -- --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 with System.IOPorts; use System.IOPorts;
33
34 package body System.Machine_Reset is
35 procedure OS_Exit;
36 pragma Export (Ada, OS_Exit, "_exit");
37 pragma No_Return (OS_Exit);
38 -- Reset the board or shut-down the simulator
39
40 procedure OS_Abort;
41 pragma Export (Ada, OS_Abort, "abort");
42 pragma No_Return (OS_Abort);
43 -- Same as OS_Exit (rename in body to allow multiple pragma Export)
44
45 --------------
46 -- OS_Abort --
47 --------------
48
49 procedure OS_Abort renames OS_Exit;
50
51 -------------
52 -- OS_Exit --
53 -------------
54
55 procedure OS_Exit is
56 begin
57 -- Trigger a reset
58
59 Outb (16#92#, 0);
60 Outb (16#92#, 1);
61
62 -- Make sure we don't return before reset takes effect
63
64 loop
65 null;
66 end loop;
67 end OS_Exit;
68
69 ----------
70 -- Stop --
71 ----------
72
73 procedure Stop renames OS_Exit;
74 end System.Machine_Reset;