The unified diff between revisions [cd268c48..] and [fe4cae3b..] is displayed below. It can also be downloaded as a raw diff.
#
#
# add_file "asm/loader-64.s"
# content [4817456fc33b9bc5ab1442fd0877feef333361b3]
#
# add_file "ld-scripts/linker-64.ld"
# content [9682213bc414c6e382e6340ee3b42705196e59c7]
#
# add_file "src/arch_32.ads"
# content [9414beb1dd0167088edacf68268e9a58bac7644a]
#
# add_file "src/arch_64.ads"
# content [239842124c28a0e954c1df6ac18c78c568ac66f3]
#
# patch "GNUmakefile"
# from [34ef1349c01c39e6c7114e5e988fbc672748bf05]
# to [b765c72d788bf06732594ef9a0df5d462a295d58]
#
# patch "lovelace.gpr"
# from [14776ab99535d12b42780102b48ebb266260752e]
# to [aecf832b1644143debf4bbd685fe0abe18167ac4]
#
# patch "old_src/lovelace-stage1-memory-paging.adb"
# from [1fb73b86a3074feabd4a09f37335fce12806c348]
# to [b19f461a3c00f0a9f52da4fc56e8b75b82f79668]
#
# patch "old_src/lovelace-stage1-memory.ads"
# from [7447e807f24307ab02a25d7575328c373424f3b0]
# to [32ad49a4b1dda26866f371a9aa3bf1d4d39f2060]
#
# patch "patches/runtime_base_patch"
# from [f473d9dfc96e1bbd530d4b7d4c1d975859bf7b33]
# to [d2c9aa58932e1f43bdcd621aea7d9be2a4ad20b2]
#
# patch "runtime_kernel/GNUmakefile"
# from [8c324a732540f697d90d44b968e7202ee7e62147]
# to [6284690f61583e561ef9ee4737db13b9f150e9c9]
#
# patch "src/kernel.adb"
# from [e317859b0fb1d7922ee6f6fc9af78e1d6b0b3801]
# to [a7812c6a01a792145099db0f498423ad39d304e4]
#
# patch "src/lovelace-stage1-console.adb"
# from [d6f54507200ecaa8bcc4666244360bb23e24378b]
# to [ff0eec29715756d099011aab75c78e7e5b5e2fc8]
#
# patch "src/lovelace-stage1.ads"
# from [817ac874907c14af2a55e9103bec4177f15cccc6]
# to [52a2c41cc007b36f999489b1297e07759488acfe]
#
# patch "src/lovelace.ads"
# from [32ae14a6985b0448795b60808c9b9a32c774bf9d]
# to [7a59819fa1d50593e564f491d8a8784c5b9fab11]
#
============================================================
--- asm/loader-64.s 4817456fc33b9bc5ab1442fd0877feef333361b3
+++ asm/loader-64.s 4817456fc33b9bc5ab1442fd0877feef333361b3
@@ -0,0 +1,29 @@
+.global loader # making entry point visible to linker
+
+# setting up the Multiboot header - see GRUB docs for details
+.set ALIGN, 1<<0 # align loaded modules on page boundaries
+.set MEMINFO, 1<<1 # provide memory map
+.set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field
+.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
+.set CHECKSUM, -(MAGIC + FLAGS) # checksum required
+
+.align 4
+.long MAGIC
+.long FLAGS
+.long CHECKSUM
+
+# reserve initial kernel stack space
+.set STACKSIZE, 0x4000 # that is, 16k.
+.comm stack, STACKSIZE, 32 # reserve 16k stack on a quadword boundary
+
+loader:
+ mov $(stack + STACKSIZE), %rsp # set up the stack
+ push %rax # Multiboot magic number
+ push %rbx # Multiboot data structure
+
+ call kmain # call kernel proper
+
+ cli
+hang:
+ hlt # halt machine should kernel return
+ jmp hang
============================================================
--- ld-scripts/linker-64.ld 9682213bc414c6e382e6340ee3b42705196e59c7
+++ ld-scripts/linker-64.ld 9682213bc414c6e382e6340ee3b42705196e59c7
@@ -0,0 +1,50 @@
+OUTPUT_FORMAT(elf64-x86-64)
+ENTRY(kmain)
+
+SECTIONS
+{
+ . = 0x00100000;
+
+ .text : AT(ADDR(.text) - 0x00100000)
+ {
+ _code = .;
+ *(.text)
+ *(.rodata*)
+ . = ALIGN(4096);
+ }
+
+ .data : AT(ADDR(.data) - 0x00100000)
+ {
+ _data = .;
+ *(.data)
+ . = ALIGN(4096);
+ }
+
+ .ehframe : AT(ADDR(.ehframe) - 0x00100000)
+ {
+ _ehframe = .;
+ *(.ehframe)
+ . = ALIGN(4096);
+ }
+
+ .bss : AT(ADDR(.bss) - 0x00100000)
+ {
+ _bss = .;
+ *(.bss)
+
+ /*
+ * You usually need to include generated COMMON symbols
+ * under kernel BSS section or use gcc's -fno-common
+ */
+
+ *(COMMON)
+ . = ALIGN(4096);
+ }
+
+ _end = .;
+
+ /DISCARD/ :
+ {
+ *(.comment)
+ }
+}
============================================================
--- src/arch_32.ads 9414beb1dd0167088edacf68268e9a58bac7644a
+++ src/arch_32.ads 9414beb1dd0167088edacf68268e9a58bac7644a
@@ -0,0 +1,9 @@
+with Interfaces;
+
+package Arch is
+ pragma Pure;
+ type Unsigned_Address is new Interfaces.Unsigned_32;
+
+ Phys_Page_Size : constant := 128;
+
+end Arch;
============================================================
--- src/arch_64.ads 239842124c28a0e954c1df6ac18c78c568ac66f3
+++ src/arch_64.ads 239842124c28a0e954c1df6ac18c78c568ac66f3
@@ -0,0 +1,9 @@
+with Interfaces;
+
+package Arch is
+ pragma Pure;
+ type Unsigned_Address is new Interfaces.Unsigned_64;
+
+ Phys_Page_Size : constant := 256;
+
+end Arch;
============================================================
--- GNUmakefile 34ef1349c01c39e6c7114e5e988fbc672748bf05
+++ GNUmakefile b765c72d788bf06732594ef9a0df5d462a295d58
@@ -3,6 +3,7 @@ OBJ_DIR_32=$(LOVELACE_TOPDIR)/obj32
RUNTIME_KERNEL_DIR=runtime_kernel
LOVELACE_TOPDIR=$(shell pwd)
OBJ_DIR_32=$(LOVELACE_TOPDIR)/obj32
+OBJ_DIR_64=$(LOVELACE_TOPDIR)/obj64
LIBGCC2_INCLUDES=-I. -I../build/gcc -I../src/include -I../src/gcc
LIBGCC2_FLAGS=-O2 -B. -m32 -fexceptions -fnon-call-exceptions
LIBGCC2_DEFINES=-DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
@@ -28,21 +29,28 @@ ADACTL=config/boards/project_x86.adp
ADACTL=config/boards/project_x86.adp
-all:test_kernel.elf lovelace-32.elf
+all:all_sources test_kernel.elf lovelace-32.elf lovelace-64.elf
-test_kernel.elf:$(OBJ_DIR_32)/kernel.o $(OBJ_DIR_32)/loader-32.o all_sources \
+test_kernel.elf:$(OBJ_DIR_32)/kernel.o $(OBJ_DIR_32)/loader-32.o \
$(OBJ_DIR_32)/lovelace-bootstrap.o
ld -T ld-scripts/linker-32.ld -m elf_i386 \
-o $@ $(OBJ_DIR_32)/kernel.o $(OBJ_DIR_32)/loader-32.o \
$(OBJ_DIR_32)/lovelace-stage1-console.o $(OBJ_DIR_32)/lovelace-outb.o
lovelace-32.elf:$(OBJ_DIR_32)/lovelace-bootstrap.o \
-$(OBJ_DIR_32)/loader-32.o all_sources
+$(OBJ_DIR_32)/loader-32.o
ld -T ld-scripts/linker-32.ld -m elf_i386 \
-o $@ $(OBJ_DIR_32)/lovelace-bootstrap.o $(OBJ_DIR_32)/loader-32.o \
$(OBJ_DIR_32)/lovelace-stage1-console.o $(OBJ_DIR_32)/lovelace-outb.o \
$(OBJ_DIR_32)/last_chance_handler.o
+lovelace-64.elf:$(OBJ_DIR_64)/lovelace-bootstrap.o \
+$(OBJ_DIR_64)/loader-64.o
+ ld -T ld-scripts/linker-64.ld -m elf_x86_64 \
+ -o $@ $(OBJ_DIR_64)/lovelace-bootstrap.o $(OBJ_DIR_64)/loader-64.o \
+ $(OBJ_DIR_64)/lovelace-stage1-console.o $(OBJ_DIR_64)/lovelace-outb.o \
+ $(OBJ_DIR_64)/last_chance_handler.o
+
all_sources:runtime_files
quilt push -a
touch all_sources
@@ -52,14 +60,11 @@ clean:
rm -Rf obj32 obj64 runtime_files obj_user
rm -f `find -name "*.ali"`
rm -f `find -name "*.adt"`
- rm -f lovelace-32.elf test_kernel.elf all_sources
+ rm -f lovelace-??.elf test_kernel.elf all_sources
-quilt pop -a
rm -Rf .pc
make -C $(RUNTIME_KERNEL_DIR) clean
-distclean:clean
- rm -Rf config/board.mk
-
force:
cleansource:
@@ -109,18 +114,19 @@ endif
done
endif
-$(OBJ_DIR_32)/kernel.o:$(LOVELACE_TOPDIR)/src/kernel.adb \
-$(LOVELACE_TOPDIR)/src/kernel.ads $(OBJ_DIR_32) all_sources
- gcc -m32 -c -nostdlib -nostdinc -I$(LOVELACE_TOPDIR)/runtime_kernel \
- -I$(LOVELACE_TOPDIR)/src \
- -o $@ $<
-
$(OBJ_DIR_32)/loader-32.o:$(LOVELACE_TOPDIR)/asm/loader-32.s $(OBJ_DIR_32)
gcc -m32 -c -o $@ $<
+$(OBJ_DIR_64)/loader-64.o:$(LOVELACE_TOPDIR)/asm/loader-64.s $(OBJ_DIR_64)
+ gcc -m64 -c -o $@ $<
+
.PHONY:$(OBJ_DIR_32)/lovelace-bootstrap.o
-$(OBJ_DIR_32)/lovelace-bootstrap.o:
+$(OBJ_DIR_32)/lovelace-bootstrap.o $(OBJ_DIR_32)/kernel.o:$(OBJ_DIR_32)
gnatmake -j$(CPUS) -a -c -P lovelace.gpr
+.PHONY:$(OBJ_DIR_64)/lovelace-bootstrap.o
+$(OBJ_DIR_64)/lovelace-bootstrap.o:$(OBJ_DIR_64)
+ gnatmake -j$(CPUS) -XTARGET=x86_64 -a -c -P lovelace.gpr
+
$(OBJ_DIR_32) $(OBJ_DIR_64):
mkdir -p $@
\ No newline at end of file
============================================================
--- lovelace.gpr 14776ab99535d12b42780102b48ebb266260752e
+++ lovelace.gpr aecf832b1644143debf4bbd685fe0abe18167ac4
@@ -4,13 +4,15 @@ project Lovelace is
target : target_type := external ("TARGET", "i686");
- for Source_Dirs use ("src", "runtime_kernel" , "old_src");
-
case target is
when "i686" =>
for Object_Dir use "obj32";
+ for Source_Dirs use ("src", "runtime_kernel" , "old_src",
+ "runtime_kernel/32");
when "x86_64" =>
for Object_Dir use "obj64";
+ for Source_Dirs use ("src", "runtime_kernel" , "old_src",
+ "runtime_kernel/64");
end case;
package Compiler is
@@ -22,11 +24,21 @@ project Lovelace is
when "x86_64" =>
for Default_Switches ("ada") use
("-O2", "-gnaty", "-gnatf", "-gnatL", "-nostdinc", "-nostdlib",
- "-gnat05", "-gnatwae", "-gnato", "-m64");
+ "-gnat05", "-gnatwae", "-gnato", "-m64", "-mcmodel=large",
+ "-mno-mmx", "-mno-sse", "-mno-sse2", "-mno-sse3", "-mno-red-zone",
+ "-mno-3dnow");
end case;
end Compiler;
+ package Naming is
+ case target is
+ when "i686" =>
+ for Spec ("arch") use "arch_32.ads";
+ when "x86_64" =>
+ for Spec ("arch") use "arch_64.ads";
+ end case;
+ end Naming;
- for main use ("lovelace-bootstrap.adb");
+ for main use ("lovelace-bootstrap.adb", "kernel.adb");
package Binder is
for Default_Switches ("ada") use ("-nostdinc", "-nostdlib", "-n");
============================================================
--- old_src/lovelace-stage1-memory-paging.adb 1fb73b86a3074feabd4a09f37335fce12806c348
+++ old_src/lovelace-stage1-memory-paging.adb b19f461a3c00f0a9f52da4fc56e8b75b82f79668
@@ -10,16 +10,16 @@ package body Lovelace.Stage1.Memory.Pagi
type Item is private;
type Pointer_Item is access Item;
function Incremente_N (Ptr : Pointer_Item;
- N : Unsigned_32) return Pointer_Item;
+ N : Unsigned_Address) return Pointer_Item;
pragma Inline (Incremente_N);
- function Incremente_N (Ptr : Pointer_Item; N : Unsigned_32)
+ function Incremente_N (Ptr : Pointer_Item; N : Unsigned_Address)
return Pointer_Item is
function To_Ptr is new Ada.Unchecked_Conversion
- (Unsigned_32, Pointer_Item);
- function To_Unsigned_32 is new Ada.Unchecked_Conversion
- (Pointer_Item, Unsigned_32);
+ (Unsigned_Address, Pointer_Item);
+ function To_Unsigned_Address is new Ada.Unchecked_Conversion
+ (Pointer_Item, Unsigned_Address);
begin
- return To_Ptr (To_Unsigned_32 (Ptr) + N * Item'Size/8);
+ return To_Ptr (To_Unsigned_Address (Ptr) + N * Item'Size / 8);
end Incremente_N;
procedure Invlpg (Address : System.Address);
@@ -35,21 +35,21 @@ package body Lovelace.Stage1.Memory.Pagi
end Invlpg;
function Virt_To_Pd_Index (Vaddr : Virtual_Address_Type)
- return Unsigned_32;
+ return Unsigned_Address;
pragma Inline (Virt_To_Pd_Index);
function Virt_To_Pd_Index (Vaddr : Virtual_Address_Type)
- return Unsigned_32 is
+ return Unsigned_Address is
begin
- return Shift_Right (Unsigned_32 (Vaddr), 22);
+ return Shift_Right (Unsigned_Address (Vaddr), 22);
end Virt_To_Pd_Index;
function Virt_To_Pt_Index (Vaddr : Virtual_Address_Type)
- return Unsigned_32;
+ return Unsigned_Address;
pragma Inline (Virt_To_Pt_Index);
function Virt_To_Pt_Index (Vaddr : Virtual_Address_Type)
- return Unsigned_32 is
+ return Unsigned_Address is
begin
- return Shift_Right (Unsigned_32 (Vaddr), 12)
+ return Shift_Right (Unsigned_Address (Vaddr), 12)
and 16#3ff#;
end Virt_To_Pt_Index;
@@ -89,7 +89,7 @@ package body Lovelace.Stage1.Memory.Pagi
function To_X86_Pde_Access is new Ada.Unchecked_Conversion
(Physical_Address_Type, X86_Pde_Access);
function To_X86_Pde_Access is new Ada.Unchecked_Conversion
- (Unsigned_32, X86_Pde_Access);
+ (Unsigned_Address, X86_Pde_Access);
function To_Physical_Address is new Ada.Unchecked_Conversion
(X86_Pde_Access, Physical_Address_Type);
@@ -128,7 +128,7 @@ package body Lovelace.Stage1.Memory.Pagi
function To_X86_Pte_Access is new Ada.Unchecked_Conversion
(Physical_Address_Type, X86_Pte_Access);
function To_X86_Pte_Access is new Ada.Unchecked_Conversion
- (Unsigned_32, X86_Pte_Access);
+ (Unsigned_Address, X86_Pte_Access);
function To_Address is new Ada.Unchecked_Conversion
(X86_Pte_Access, System.Address);
@@ -155,8 +155,8 @@ package body Lovelace.Stage1.Memory.Pagi
procedure Paging_Setup_Map_Helper (Pd : X86_Pde_Access;
Ppage : Physical_Address_Type;
Vaddr : Virtual_Address_Type) is
- Index_In_Pd : constant Unsigned_32 := Virt_To_Pd_Index (Vaddr);
- Index_In_Pt : constant Unsigned_32 := Virt_To_Pt_Index (Vaddr);
+ Index_In_Pd : constant Unsigned_Address := Virt_To_Pd_Index (Vaddr);
+ Index_In_Pt : constant Unsigned_Address := Virt_To_Pt_Index (Vaddr);
Pt : X86_Pte_Access;
Pd_Incremente : X86_Pde_Access;
Pt_Incremente : X86_Pte_Access;
@@ -223,19 +223,19 @@ package body Lovelace.Stage1.Memory.Pagi
Memset (Cr3.Zero1'Address, 16#0#, Cr3'Size / 8);
Cr3.Pd_Paddr := Shift_Right (To_Physical_Address (Pd), 12);
- System.Machine_Code.Asm
- ("movl %0, %%cr3" & ASCII.LF & ASCII.HT &
- "movl %%cr0, %%eax" & ASCII.LF & ASCII.HT &
- "orl $0x80010000, %%eax" & ASCII.LF & ASCII.HT &
- "movl %%eax, %%cr0" & ASCII.LF & ASCII.HT &
- "jmp 1f" & ASCII.LF & ASCII.HT &
- "1:" & ASCII.LF & ASCII.HT &
- "movl $2f, %%eax" & ASCII.LF & ASCII.HT &
- "jmp * %%eax" & ASCII.LF & ASCII.HT &
- "2:" & ASCII.LF & ASCII.HT,
- Inputs => X86_Pdbr'Asm_Input ("r", Cr3),
- Volatile => True,
- Clobber => "memory, eax");
+ -- System.Machine_Code.Asm
+ -- ("movl %0, %%cr3" & ASCII.LF & ASCII.HT &
+ -- "movl %%cr0, %%eax" & ASCII.LF & ASCII.HT &
+ -- "orl $0x80010000, %%eax" & ASCII.LF & ASCII.HT &
+ -- "movl %%eax, %%cr0" & ASCII.LF & ASCII.HT &
+ -- "jmp 1f" & ASCII.LF & ASCII.HT &
+ -- "1:" & ASCII.LF & ASCII.HT &
+ -- "movl $2f, %%eax" & ASCII.LF & ASCII.HT &
+ -- "jmp * %%eax" & ASCII.LF & ASCII.HT &
+ -- "2:" & ASCII.LF & ASCII.HT,
+ -- Inputs => X86_Pdbr'Asm_Input ("r", Cr3),
+ -- Volatile => True,
+ -- Clobber => "memory, eax");
end Setup;
----------------------
@@ -255,8 +255,8 @@ package body Lovelace.Stage1.Memory.Pagi
(Vaddr : Virtual_Address_Type)
return Physical_Address_Type
is
- Index_In_Pd : constant Unsigned_32 := Virt_To_Pd_Index (Vaddr);
- Index_In_Pt : constant Unsigned_32 := Virt_To_Pt_Index (Vaddr);
+ Index_In_Pd : constant Unsigned_Address := Virt_To_Pd_Index (Vaddr);
+ Index_In_Pt : constant Unsigned_Address := Virt_To_Pt_Index (Vaddr);
Offset_In_Page : constant Physical_Address_Type
:= Virt_To_Page_Offset (Vaddr);
Pd : constant X86_Pde_Access := To_X86_Pde_Access
@@ -292,8 +292,10 @@ package body Lovelace.Stage1.Memory.Pagi
Prot_Write : Boolean)
is
pragma Unreferenced (Atomic, Prot_Read);
- Index_In_Pd : constant Unsigned_32 := Virt_To_Pd_Index (Vpage_Vaddr);
- Index_In_Pt : constant Unsigned_32 := Virt_To_Pt_Index (Vpage_Vaddr);
+ Index_In_Pd : constant Unsigned_Address :=
+ Virt_To_Pd_Index (Vpage_Vaddr);
+ Index_In_Pt : constant Unsigned_Address :=
+ Virt_To_Pt_Index (Vpage_Vaddr);
Pd : constant X86_Pde_Access := To_X86_Pde_Access
(X86.PAGING_MIRROR_VADDR
+ PAGE_SIZE * Virt_To_Pd_Index (X86.PAGING_MIRROR_VADDR));
@@ -347,8 +349,10 @@ package body Lovelace.Stage1.Memory.Pagi
------------------
procedure Unmap (Vpage_Vaddr : Virtual_Address_Type) is
- Index_In_Pd : constant Unsigned_32 := Virt_To_Pd_Index (Vpage_Vaddr);
- Index_In_Pt : constant Unsigned_32 := Virt_To_Pt_Index (Vpage_Vaddr);
+ Index_In_Pd : constant Unsigned_Address :=
+ Virt_To_Pd_Index (Vpage_Vaddr);
+ Index_In_Pt : constant Unsigned_Address :=
+ Virt_To_Pt_Index (Vpage_Vaddr);
Pd : constant X86_Pde_Access := To_X86_Pde_Access
(X86.PAGING_MIRROR_VADDR +
PAGE_SIZE * Virt_To_Pd_Index (X86.PAGING_MIRROR_VADDR));
============================================================
--- old_src/lovelace-stage1-memory.ads 7447e807f24307ab02a25d7575328c373424f3b0
+++ old_src/lovelace-stage1-memory.ads 32ad49a4b1dda26866f371a9aa3bf1d4d39f2060
@@ -39,7 +39,7 @@ private
Next : Physical_Page_Descriptor_Access;
Prev : Physical_Page_Descriptor_Access;
end record;
- for Physical_Page_Descriptor'Size use 128;
+ for Physical_Page_Descriptor'Size use Arch.Phys_Page_Size;
pragma No_Strict_Aliasing (Physical_Page_Descriptor_Access);
Kernel_Start : Unsigned_32;
pragma Import (C, Kernel_Start, "__b_kernel");
============================================================
--- patches/runtime_base_patch f473d9dfc96e1bbd530d4b7d4c1d975859bf7b33
+++ patches/runtime_base_patch d2c9aa58932e1f43bdcd621aea7d9be2a4ad20b2
@@ -1,5 +1,7 @@
---- a/runtime_kernel/a-elchha.adb
-+++ b/runtime_kernel/a-elchha.adb
+Index: org.os-lovelace/runtime_kernel/a-elchha.adb
+===================================================================
+--- org.os-lovelace.orig/runtime_kernel/a-elchha.adb 2010-06-05 17:35:09.549729307 +0200
++++ org.os-lovelace/runtime_kernel/a-elchha.adb 2010-06-05 17:35:09.693735026 +0200
@@ -38,12 +38,18 @@
with System.Standard_Library; use System.Standard_Library;
with System.Soft_Links;
@@ -20,8 +22,10 @@
-- Perform system dependent shutdown code
function Exception_Message_Length
---- a/runtime_kernel/a-except.adb
-+++ b/runtime_kernel/a-except.adb
+Index: org.os-lovelace/runtime_kernel/a-except.adb
+===================================================================
+--- org.os-lovelace.orig/runtime_kernel/a-except.adb 2010-06-05 17:35:09.549729307 +0200
++++ org.os-lovelace/runtime_kernel/a-except.adb 2010-06-05 17:35:09.693735026 +0200
@@ -51,6 +51,10 @@
with System.WCh_Con; use System.WCh_Con;
with System.WCh_StW; use System.WCh_StW;
@@ -49,8 +53,10 @@
end To_Stderr;
procedure To_Stderr (S : String) is
---- a/runtime_kernel/s-memory.adb
-+++ b/runtime_kernel/s-memory.adb
+Index: org.os-lovelace/runtime_kernel/s-memory.adb
+===================================================================
+--- org.os-lovelace.orig/runtime_kernel/s-memory.adb 2010-06-05 17:35:09.549729307 +0200
++++ org.os-lovelace/runtime_kernel/s-memory.adb 2010-06-05 17:35:09.693735026 +0200
@@ -31,7 +31,7 @@
-- This is the default implementation of this package
@@ -137,21 +143,10 @@
- end Realloc;
-
end System.Memory;
---- a/runtime_kernel/system.ads
-+++ b/runtime_kernel/system.ads
-@@ -66,8 +66,8 @@
- Null_Address : constant Address;
-
- Storage_Unit : constant := 8;
-- Word_Size : constant := 64;
-- Memory_Size : constant := 2 ** 64;
-+ Word_Size : constant := 32;
-+ Memory_Size : constant := 2 ** 32;
-
- -- Address comparison
-
---- a/runtime_kernel/s-memory.ads
-+++ b/runtime_kernel/s-memory.ads
+Index: org.os-lovelace/runtime_kernel/s-memory.ads
+===================================================================
+--- org.os-lovelace.orig/runtime_kernel/s-memory.ads 2010-06-05 17:35:09.525732823 +0200
++++ org.os-lovelace/runtime_kernel/s-memory.ads 2010-06-05 17:35:09.693735026 +0200
@@ -75,35 +75,11 @@
-- Note: this is roughly equivalent to the standard C free call
-- with the additional semantics as described above.
============================================================
--- runtime_kernel/GNUmakefile 8c324a732540f697d90d44b968e7202ee7e62147
+++ runtime_kernel/GNUmakefile 6284690f61583e561ef9ee4737db13b9f150e9c9
@@ -17,11 +17,26 @@ a-excach.adb a-exexda.adb a-exexpr.adb a
FULL_ADB_FILES=$(addprefix $(GNAT_FILES)/,$(ADB_FILES) a-excpol.adb \
a-excach.adb a-exexda.adb a-exexpr.adb a-exextr.adb a-exstat.adb)
+SED_RULE_32='s/Word_Size : constant := ..;/Word_Size : constant := 32;/'
+SED_RULE_64='s/Word_Size : constant := ..;/Word_Size : constant := 64;/'
+SED_RULE_2_32='s/ : constant := 2 \*\* ..;/ : constant := 2 \*\* 32;/'
+SED_RULE_2_64='s/ : constant := 2 \*\* ..;/ : constant := 2 \*\* 64;/'
+
default:
all:
cp $(FULL_ADS_FILES) .
cp $(FULL_ADB_FILES) .
+ mkdir -p 32
+ mkdir -p 64
+ sed -e $(SED_RULE_32) system.ads > system__32.ads
+ sed -i -e $(SED_RULE_2_32) system__32.ads
+ mv system__32.ads 32/system.ads
+ sed -e $(SED_RULE_64) system.ads > system__64.ads
+ sed -i -e $(SED_RULE_2_64) system__64.ads
+ mv system__64.ads 64/system.ads
+ rm -f system.ads
clean:
rm -f *.ads *.adb *.o *.ali *~
+ rm -Rf 32 64
============================================================
--- src/kernel.adb e317859b0fb1d7922ee6f6fc9af78e1d6b0b3801
+++ src/kernel.adb a7812c6a01a792145099db0f498423ad39d304e4
@@ -4,6 +4,7 @@ procedure Kernel (Mdb : System.Address;
procedure Kernel (Mdb : System.Address;
Magic : Interfaces.Unsigned_32) is
use type Interfaces.Unsigned_32;
+ pragma Unreferenced (Mdb);
begin
if Magic /= 16#2BADB002# then
loop
@@ -16,7 +17,8 @@ begin
declare
type Ram is array (1 .. 2) of Interfaces.Unsigned_8;
Videoram : Ram;
- for Videoram'Address use System.Storage_Elements.To_Address (16#000b_8000#);
+ for Videoram'Address use
+ System.Storage_Elements.To_Address (16#000b_8000#);
begin
Videoram (1) := 65;
Videoram (2) := 7;
============================================================
--- src/lovelace-stage1-console.adb d6f54507200ecaa8bcc4666244360bb23e24378b
+++ src/lovelace-stage1-console.adb ff0eec29715756d099011aab75c78e7e5b5e2fc8
@@ -1,3 +1,4 @@
+with System.Storage_Elements;
with Lovelace.Outb;
package body Lovelace.Stage1.Console is
@@ -6,7 +7,7 @@ package body Lovelace.Stage1.Console is
LINES : constant := 25;
COLUMNS : constant := 80;
- VIDEO_ADDRESS : constant Unsigned_32 := 16#B8000#;
+ VIDEO_ADDRESS : constant := 16#B8000#;
CRT_REG_INDEX : constant := 16#3d4#;
CRT_REG_DATA : constant := 16#3d5#;
@@ -64,7 +65,7 @@ package body Lovelace.Stage1.Console is
Video_Offs : constant Integer := (Current_Line - 1) * COLUMNS +
Current_Colum;
Video : X86_Video_Mem;
- for Video'Address use To_Address (VIDEO_ADDRESS);
+ for Video'Address use System.Storage_Elements.To_Address (VIDEO_ADDRESS);
pragma Volatile (Video);
begin
if Video_Offs > LINES * COLUMNS or Video_Offs <= 0 then
@@ -122,7 +123,7 @@ package body Lovelace.Stage1.Console is
procedure Clear is
Video : X86_Video_Mem;
- for Video'Address use To_Address (VIDEO_ADDRESS);
+ for Video'Address use System.Storage_Elements.To_Address (VIDEO_ADDRESS);
pragma Volatile (Video);
begin
for I in Video'Range loop
============================================================
--- src/lovelace-stage1.ads 817ac874907c14af2a55e9103bec4177f15cccc6
+++ src/lovelace-stage1.ads 52a2c41cc007b36f999489b1297e07759488acfe
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- Lovelace --
-- --
--- Copyright (C) 2007 --
+-- Copyright (C) 2007-2010 --
-- X. Grave --
-- --
-- This software is free software; you can redistribute it and/or modify --
@@ -18,23 +18,24 @@
-- along with this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
+
with Ada.Unchecked_Conversion;
with System;
package Lovelace.Stage1 is
- pragma Preelaborate;
+ pragma Pure;
function To_Address is new Ada.Unchecked_Conversion
(Virtual_Address_Type, System.Address);
function To_Address is new Ada.Unchecked_Conversion
(Physical_Address_Type, System.Address);
function To_Address is new Ada.Unchecked_Conversion
- (Unsigned_32, System.Address);
+ (Unsigned_Address, System.Address);
function To_Physical_Address is new Ada.Unchecked_Conversion
(System.Address, Physical_Address_Type);
- function To_Unsigned_32 is new Ada.Unchecked_Conversion
- (System.Address, Unsigned_32);
+ function To_Unsigned_Address is new Ada.Unchecked_Conversion
+ (System.Address, Unsigned_Address);
function To_Virtual_Address is new Ada.Unchecked_Conversion
(System.Address, Virtual_Address_Type);
-- all stage1 packages will be used as a core bases in order to have
============================================================
--- src/lovelace.ads 32ae14a6985b0448795b60808c9b9a32c774bf9d
+++ src/lovelace.ads 7a59819fa1d50593e564f491d8a8784c5b9fab11
@@ -18,7 +18,10 @@
-- along with this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
+
with Interfaces.C;
+with Arch;
+
package Lovelace is
pragma Pure;
@@ -31,13 +34,14 @@ package Lovelace is
for Unsigned_32'Size use 32;
type Unsigned_64 is new Interfaces.Unsigned_64;
for Unsigned_64'Size use 64;
+ type Unsigned_Address is new Arch.Unsigned_Address;
type Base is (Binary, Octal, Decimal, Hexadecimal);
- type Physical_Address_Type is new Unsigned_32;
+ type Physical_Address_Type is new Unsigned_Address;
type Physical_Address_Array is array (Positive range <>)
of Physical_Address_Type;
- type Virtual_Address_Type is new Unsigned_32;
+ type Virtual_Address_Type is new Unsigned_Address;
type Virtual_Address_Array is array (Positive range <>)
of Virtual_Address_Type;
type Boolean_Array is array (Positive range <>) of Boolean;