diff --git a/repos/app-file.ads b/repos/app-file.ads
new file mode 100644
index 0000000000..c9dadbcc3a
--- /dev/null
+++ b/repos/app-file.ads
@@ -0,0 +1,16 @@
+pragma Ada_2012;
+
+package App.File with Spark_Mode is
+
+ type Chunk_Number_Type is new Integer;
+ type Chunk_Type is array (Positive range 1..4096) of Byte;
+
+ procedure Read(Offset : in Offset_Type;
+ Destination : in out Chunk_Type;
+ Size : in Size_Type)
+ with
+ import,
+ convention => c,
+ external_name => "c_genode_file_read";
+
+end App.File;
diff --git a/repos/app-file_cache.adb b/repos/app-file_cache.adb
new file mode 100644
index 0000000000..474381d875
--- /dev/null
+++ b/repos/app-file_cache.adb
@@ -0,0 +1,40 @@
+pragma Ada_2012;
+
+with App.File;
+
+use type App.File.Chunk_Number_Type;
+
+package body App.File_Cache with Spark_Mode is
+
+ procedure Read_Chunk(Object_Private : in out Object_Private_Type;
+ Object_Public : in out Object_Public_Type;
+ Chunk_Number : in File.Chunk_Number_Type;
+ Chunk_In_Slot : out Boolean;
+ Slot_Index : out Slot_Array_Index_Type)
+ is
+-- Object_Public.Slot_Array(1)'Address
+ begin
+
+ Object_Private.Slot_Array_Last_Index := 1;
+ Object_Public.Slot_Array(1)(1) := 0;
+ Chunk_In_Slot := False;
+ Slot_Index := 1;
+
+ Slot_Array_Loop : for Index in Object_Private.Slot_Array'Range loop
+ if Object_Private.Slot_Array(Index).Chunk_Number = Chunk_Number then
+ Chunk_In_Slot := True;
+ Slot_Index := Index;
+ exit Slot_Array_Loop;
+ end if;
+ end loop Slot_Array_Loop;
+
+ if not Chunk_In_Slot then
+ Log("Chunk in Slot");
+-- File.Read(0, , Chunk_Type'Size / Byte'Size);
+ else
+ Log("Chunk not in Slot");
+ end if;
+
+ end Read_Chunk;
+
+end App.File_Cache;
diff --git a/repos/app-file_cache.ads b/repos/app-file_cache.ads
new file mode 100644
index 0000000000..84f1534b8f
--- /dev/null
+++ b/repos/app-file_cache.ads
@@ -0,0 +1,35 @@
+pragma Ada_2012;
+
+with App.File;
+
+
+package App.File_Cache with Spark_Mode is
+
+ type Slot_Array_Index_Type is new Positive range 1..128;
+ type Slot_Array_Public_Type is array (Slot_Array_Index_Type) of File.Chunk_Type;
+
+ type Object_Private_Type is private;
+ type Object_Public_Type is record
+ Slot_Array : Slot_Array_Public_Type;
+ end record;
+
+ procedure Read_Chunk(Object_Private : in out Object_Private_Type;
+ Object_Public : in out Object_Public_Type;
+ Chunk_Number : in File.Chunk_Number_Type;
+ Chunk_In_Slot : out Boolean;
+ Slot_Index : out Slot_Array_Index_Type);
+
+private
+
+ type Slot_Type is record
+ Used : Boolean := False;
+ Chunk_Number : File.Chunk_Number_Type := 0;
+ end record;
+
+ type Slot_Array_Private_Type is array (Slot_Array_Index_Type) of Slot_Type;
+ type Object_Private_Type is record
+ Slot_Array_Last_Index : Slot_Array_Index_Type;
+ Slot_Array : Slot_Array_Private_Type;
+ end record;
+
+end App.File_Cache;
diff --git a/repos/gems/run/depot_autopilot.run b/repos/gems/run/depot_autopilot.run
index 2406594eb1..49a8938211 100644
--- a/repos/gems/run/depot_autopilot.run
+++ b/repos/gems/run/depot_autopilot.run
@@ -595,6 +595,7 @@ set default_test_pkgs {
test-fs_rom_update
test-fs_rom_update_fs
test-fs_rom_update_ram
+ test-gnatio
test-init
test-init_loop
test-ldso
diff --git a/repos/libports/lib/mk/ada.mk b/repos/libports/lib/mk/ada.mk
index 7b9b84ba49..ae3ec3fd02 100644
--- a/repos/libports/lib/mk/ada.mk
+++ b/repos/libports/lib/mk/ada.mk
@@ -15,7 +15,10 @@ SRC_ADS += system.ads \
s-stoele.ads \
s-secsta.ads \
interfac.ads \
- a-except.ads
+ a-except.ads \
+ gnat.ads
+
+SRC_ADB += g-io.adb
CUSTOM_ADA_MAKE = $(CC)
CUSTOM_ADA_FLAGS = -c -gnatg -gnatp -gnatpg -gnatn2
@@ -39,12 +42,15 @@ vpath s-secsta.ads $(ADA_RUNTIME_DIR)
vpath s-imgint.ads $(ADA_RTS_SOURCE)
vpath a-except.ads $(ADA_RUNTIME_DIR)
vpath interfac.ads $(ADA_RTS_SOURCE)
+vpath gnat.ads $(ADA_RTS_SOURCE)
+vpath g-io.ads $(ADA_RTS_SOURCE)
vpath s-stoele.adb $(ADA_RTS_SOURCE)
vpath s-secsta.adb $(ADA_RUNTIME_DIR)
vpath s-soflin.adb $(ADA_RUNTIME_DIR)
vpath s-imgint.adb $(ADA_RTS_SOURCE)
vpath a-except.adb $(ADA_RUNTIME_DIR)
+vpath g-io.adb $(ADA_RTS_SOURCE)
vpath platform.% $(ADA_RUNTIME_LIB_DIR)
vpath string_utils.% $(ADA_RUNTIME_LIB_DIR)
diff --git a/repos/libports/lib/symbols/ada b/repos/libports/lib/symbols/ada
index 4a77b3e207..d8f32d498d 100644
--- a/repos/libports/lib/symbols/ada
+++ b/repos/libports/lib/symbols/ada
@@ -20,6 +20,19 @@ ada__exceptions__warn_not_implemented T
allocate_secondary_stack T
constraint_error T
get_thread T
+gnat__io__new_line__2 T
+gnat__io__new_line T
+gnat__io__put__2 T
+gnat__io__put__3 T
+gnat__io__put__4 T
+gnat__io__put__5 T
+gnat__io__put__6 T
+gnat__io__put_line__2 T
+gnat__io__put_line T
+gnat__io__put T
+gnat__io__set_output T
+gnat__io__standard_error T
+gnat__io__standard_output T
memcmp T
raise_ada_exception T
ss_utils_E D 2
diff --git a/repos/libports/ports/ada-runtime.hash b/repos/libports/ports/ada-runtime.hash
index 071ba2297c..ec3df6f373 100644
--- a/repos/libports/ports/ada-runtime.hash
+++ b/repos/libports/ports/ada-runtime.hash
@@ -1 +1 @@
-1898150e6e4544954634733a2384674b0193d4fd
+eea97604807f7cbb9b9c1aea9d4f0da6256d75b9
diff --git a/repos/libports/ports/ada-runtime.port b/repos/libports/ports/ada-runtime.port
index 1d14e6c246..870cebcc54 100644
--- a/repos/libports/ports/ada-runtime.port
+++ b/repos/libports/ports/ada-runtime.port
@@ -3,5 +3,5 @@ VERSION := 0
DOWNLOADS := ada-runtime.git
URL(ada-runtime) := https://github.com/Componolit/ada-runtime.git
-REV(ada-runtime) := 82e4df4ed4ae73b9e391dc250d25a524d69a7598
+REV(ada-runtime) := 6ebc27d7954eff4d027b3834f10a0934523c569b
DIR(ada-runtime) := ada-runtime
diff --git a/repos/libports/recipes/api/ada/content.mk b/repos/libports/recipes/api/ada/content.mk
index b4668377ce..ddd5a96c92 100644
--- a/repos/libports/recipes/api/ada/content.mk
+++ b/repos/libports/recipes/api/ada/content.mk
@@ -6,6 +6,8 @@ MIRROR_FROM_ADA_RT_DIR := \
system.ads \
s-stoele.ads \
a-unccon.ads \
+ gnat.ads \
+ g-io.ads \
)\
$(addprefix ada-runtime/src/,\
s-stalib.ads \
diff --git a/repos/libports/recipes/api/ada/hash b/repos/libports/recipes/api/ada/hash
index e7879cfb41..e2e81fd5ea 100644
--- a/repos/libports/recipes/api/ada/hash
+++ b/repos/libports/recipes/api/ada/hash
@@ -1 +1 @@
-2018-11-27 3862934b204ecb8a4f0944b511ba3f4b4598d299
+2019-01-03 f064c0ffc41ac5571bdaaf66dbad6b35c79db390
diff --git a/repos/libports/recipes/pkg/test-gnatio/README b/repos/libports/recipes/pkg/test-gnatio/README
new file mode 100644
index 0000000000..c02a79c4f4
--- /dev/null
+++ b/repos/libports/recipes/pkg/test-gnatio/README
@@ -0,0 +1 @@
+Test for the GNAT.IO support of the Ada runtime.
diff --git a/repos/libports/recipes/pkg/test-gnatio/archives b/repos/libports/recipes/pkg/test-gnatio/archives
new file mode 100644
index 0000000000..ef671c93db
--- /dev/null
+++ b/repos/libports/recipes/pkg/test-gnatio/archives
@@ -0,0 +1,4 @@
+_/src/init
+_/src/test-gnatio
+_/src/ada
+_/src/log_terminal
diff --git a/repos/libports/recipes/pkg/test-gnatio/hash b/repos/libports/recipes/pkg/test-gnatio/hash
new file mode 100644
index 0000000000..0bf20e0782
--- /dev/null
+++ b/repos/libports/recipes/pkg/test-gnatio/hash
@@ -0,0 +1 @@
+2019-01-04-a f712e9b8ab863b024127b0f29beecca4dea1d487
diff --git a/repos/libports/recipes/pkg/test-gnatio/runtime b/repos/libports/recipes/pkg/test-gnatio/runtime
new file mode 100644
index 0000000000..8b4de37faa
--- /dev/null
+++ b/repos/libports/recipes/pkg/test-gnatio/runtime
@@ -0,0 +1,41 @@
+
+
+
+
+ GNAT.IO test program started successfully.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/repos/libports/recipes/src/ada/content.mk b/repos/libports/recipes/src/ada/content.mk
index 5c5a51ee92..357ce91a0b 100644
--- a/repos/libports/recipes/src/ada/content.mk
+++ b/repos/libports/recipes/src/ada/content.mk
@@ -11,6 +11,9 @@ MIRROR_FROM_ADA_RT_DIR := \
s-imgint.ads \
s-imgint.adb \
a-unccon.ads \
+ gnat.ads \
+ g-io.ads \
+ g-io.adb \
) \
ada-runtime/src \
ada-runtime/platform/genode.cc
diff --git a/repos/libports/recipes/src/ada/hash b/repos/libports/recipes/src/ada/hash
index 269df1e91f..bfa2e8828e 100644
--- a/repos/libports/recipes/src/ada/hash
+++ b/repos/libports/recipes/src/ada/hash
@@ -1 +1 @@
-2019-01-02 3b7f984823ebb680568cdf546a8f0edce7f12b6e
+2019-01-04-a 0a6e927cfa8fc2b28674aa4f9b766568babd3b53
diff --git a/repos/libports/recipes/src/ada/used_apis b/repos/libports/recipes/src/ada/used_apis
index 2ffc8b76b0..40c5028425 100644
--- a/repos/libports/recipes/src/ada/used_apis
+++ b/repos/libports/recipes/src/ada/used_apis
@@ -1,2 +1,3 @@
base
-so
+os
+terminal_session
diff --git a/repos/libports/recipes/src/test-gnatio/content.mk b/repos/libports/recipes/src/test-gnatio/content.mk
new file mode 100644
index 0000000000..2fcbb37dd3
--- /dev/null
+++ b/repos/libports/recipes/src/test-gnatio/content.mk
@@ -0,0 +1,3 @@
+SRC_DIR = src/test/gnatio
+
+include $(GENODE_DIR)/repos/base/recipes/src/content.inc
diff --git a/repos/libports/recipes/src/test-gnatio/hash b/repos/libports/recipes/src/test-gnatio/hash
new file mode 100644
index 0000000000..ff9ad413fb
--- /dev/null
+++ b/repos/libports/recipes/src/test-gnatio/hash
@@ -0,0 +1 @@
+2019-01-04 da199ed59c5327be8c6cf04ccfab93a0c5214d22
diff --git a/repos/libports/recipes/src/test-gnatio/used_apis b/repos/libports/recipes/src/test-gnatio/used_apis
new file mode 100644
index 0000000000..b0f9cdc43b
--- /dev/null
+++ b/repos/libports/recipes/src/test-gnatio/used_apis
@@ -0,0 +1,3 @@
+base
+ada
+terminal_session
diff --git a/repos/libports/src/test/gnatio/main.adb b/repos/libports/src/test/gnatio/main.adb
new file mode 100644
index 0000000000..23c3ed76b1
--- /dev/null
+++ b/repos/libports/src/test/gnatio/main.adb
@@ -0,0 +1,36 @@
+--
+-- \brief GNAT.IO test program
+-- \author Alexander Senier
+-- \date 2019-01-03
+--
+
+with GNAT.IO;
+
+procedure Main is
+ use GNAT.IO;
+begin
+ Put (Standard_Output, "Hell");
+ Put (Standard_Output, 'o');
+ Put_Line (Standard_Output, " World!");
+ New_Line (Standard_Output);
+ Put (Standard_Output, 98765432);
+ New_Line;
+
+ Put ("Integer: ");
+ Put (123456);
+ New_Line;
+
+ Put_Line ("Character: ");
+ Put ('X');
+ Put ('Y');
+ Put ('Z');
+ New_Line;
+
+ Put ("New_Line with spacing:");
+ New_Line (Spacing => 5);
+
+ Set_Output (Standard_Error);
+ Put (11223344);
+ New_Line;
+ Put_Line ("GNAT.IO test program started successfully.");
+end Main;
diff --git a/repos/libports/src/test/gnatio/startup.cc b/repos/libports/src/test/gnatio/startup.cc
new file mode 100644
index 0000000000..7dd6925ba3
--- /dev/null
+++ b/repos/libports/src/test/gnatio/startup.cc
@@ -0,0 +1,23 @@
+/*
+ * \brief Wrapper for Ada main program using Terminal session
+ * \author Alexander Senier
+ * \date 2019-01-03
+ */
+
+/* Genode includes */
+#include
+#include
+
+extern "C" void _ada_main(void);
+
+/* Required in runtime */
+Terminal::Connection *__genode_terminal;
+
+void Component::construct(Genode::Env &env)
+{
+ Terminal::Connection _terminal (env, "Ada");
+ __genode_terminal = &_terminal;
+
+ _ada_main();
+ env.parent().exit(0);
+}
diff --git a/repos/libports/src/test/gnatio/target.mk b/repos/libports/src/test/gnatio/target.mk
new file mode 100644
index 0000000000..57cb43d1ff
--- /dev/null
+++ b/repos/libports/src/test/gnatio/target.mk
@@ -0,0 +1,4 @@
+TARGET = test-gnatio
+SRC_ADB = main.adb
+SRC_CC = startup.cc
+LIBS = base ada