Skip to contentSkip to conversation

Porting Mini-OS to ia64

PATCH In review Dietmar Hahn 2 participants 7 messages Aug 1, 2006 – Aug 9, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Porting Mini-OS to ia64

Hi,

last week I send a mail asking for some small re-architectures of mini-os for porting to ia64. Unfortunately I didn't get an answer so I try it again with a first draft. I tried the changes as small as possible. Currently I did only adding some new directories and moving some files.
I created:
mini-os/include/x86
It's for common header files for x86_32 and x86_64, currently os.h and spinlock.h .
mini-os/include/x86_32
It's for special x86_32 header files, currently hypercall-x86_32.h.
mini-os/include/x86_64
It's for special x86_64 header files, currently hypercall-x86_64.h.
mini-os/x86
For common code files for x86_32 and x86_64, currently traps.c

I changed mini-os/Makefile to support the new structure. Please can anybody look at this and give some feedback. Thanks.

Dietmar.

extras/mini-os/Makefile +29 -3
diff -r d2bf1a7cc131 extras/mini-os/Makefile
@@ -11,8 +11,12 @@ CFLAGS := -fno-builtin -Wall -Werror -Wr
 CFLAGS := -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format
 CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
 
-override CPPFLAGS := -Iinclude $(CPPFLAGS)
 ASFLAGS = -D__ASSEMBLY__
+
+# For possible special source directories.
+EXTRA_DIRS =
+# For possible special header directories.
+EXTRA_INC =
 
 LDLIBS =  -L. -lminios
 LDFLAGS := -N -T minios-$(TARGET_ARCH).lds
@@ -20,17 +24,23 @@ ifeq ($(TARGET_ARCH),x86_32)
 ifeq ($(TARGET_ARCH),x86_32)
 CFLAGS += -m32 -march=i686
 LDFLAGS += -m elf_i386
+EXTRA_INC = x86
+EXTRA_DIRS = x86
 endif
 
 ifeq ($(TARGET_ARCH)$(pae),x86_32y)
 CFLAGS  += -DCONFIG_X86_PAE=1
 ASFLAGS += -DCONFIG_X86_PAE=1
+EXTRA_INC = x86
+EXTRA_DIRS = x86
 endif
 
 ifeq ($(TARGET_ARCH),x86_64)
 CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks
 CFLAGS += -fno-asynchronous-unwind-tables
 LDFLAGS += -m elf_x86_64
+EXTRA_INC = x86
+EXTRA_DIRS = x86
 endif
 
 ifeq ($(debug),y)
@@ -39,6 +49,8 @@ CFLAGS += -O3
 CFLAGS += -O3
 endif
 
+override CPPFLAGS := -Iinclude $(CPPFLAGS) -Iinclude/$(TARGET_ARCH) -Iinclude/$(EXTRA_INC)
+
 TARGET := mini-os
 
 HEAD := $(TARGET_ARCH).o
@@ -46,9 +58,20 @@ OBJS += $(patsubst %.c,%.o,$(wildcard li
 OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
+OBJS += $(patsubst %.S,%.o,$(wildcard $(TARGET_ARCH)/*.S))
+OBJS += $(patsubst %.S,%.o,$(wildcard $(TARGET_ARCH)/*.c))
+# For special wanted source directories.
+extra_objs := $(foreach dir,$(EXTRA_DIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c)))
+OBJS += $(extra_objs)
+extra_objs := $(foreach dir,$(EXTRA_DIRS),$(patsubst %.S,%.o,$(wildcard $(dir)/*.S)))
+OBJS += $(extra_objs)
 
 HDRS := $(wildcard include/*.h)
 HDRS += $(wildcard include/xen/*.h)
+HDRS += $(wildcard include/$(TARGET_ARCH)/*.h)
+# For special wanted header directories.
+extra_heads := $(foreach dir,$(EXTRA_INC),$(wildcard $(dir)/*.h))
+HDRS += $(extra_heads)
 
 .PHONY: default
 default: $(TARGET)
@@ -57,8 +80,11 @@ links:
 links:
 	[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
 
-libminios.a: links $(OBJS) $(HEAD)
-	$(AR) r libminios.a $(HEAD) $(OBJS)
+libminios.a: links $(OBJS)
+	@echo HAHN_extra_objs: $(extra_objs)
+	@echo HAHN_OBJS: $(OBJS)
+	@echo HAHN_HDRS: $(HDRS)
+	$(AR) r libminios.a $(OBJS)
 
 $(TARGET): libminios.a $(HEAD)
 	$(LD) $(LDFLAGS) $(HEAD) $(LDLIBS) -o [email protected]
extras/mini-os/include/x86/os.h new file +561 -0

561 lines not on this page · raw message

extras/mini-os/include/x86/spinlock.h new file +121 -0

121 lines not on this page · raw message

extras/mini-os/include/x86_32/hypercall-x86_32.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/include/x86_64/hypercall-x86_64.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/x86/traps.c new file +229 -0

229 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_32.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_64.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/os.h deleted +0 -561

561 lines not on this page · raw message

extras/mini-os/include/spinlock.h deleted +0 -121

121 lines not on this page · raw message

extras/mini-os/traps.c deleted +0 -229

26 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.

#1 lore raw

Am Dienstag, 1. August 2006 08:28 schrieb Dietmar Hahn:

Quoted 17 lines

Hi,

last week I send a mail asking for some small re-architectures of mini-os for porting to ia64. Unfortunately I didn't get an answer so I try it again with a first draft. I tried the changes as small as possible. Currently I did only adding some new directories and moving some files.
I created:
mini-os/include/x86
It's for common header files for x86_32 and x86_64, currently os.h and spinlock.h .
mini-os/include/x86_32
It's for special x86_32 header files, currently hypercall-x86_32.h.
mini-os/include/x86_64
It's for special x86_64 header files, currently hypercall-x86_64.h.
mini-os/x86
For common code files for x86_32 and x86_64, currently traps.c

Quoted 6 lines

I changed mini-os/Makefile to support the new structure. Please can anybody look at this and give some feedback. Thanks.

Dietmar.

Sorry for not sending a real patch (I'am still learning!). This is done now.
Thanks.

Dietmar.

# HG changeset patch
# User hahn@amur
# Date 1154415804 -7200
# Node ID 287178fbc3209bccd1fa6668415f3118d2926e84 # Parent d2bf1a7cc1319d2e0379c3394a6c09ec2f0c51e1 First small re-architecture for porting mini-os to ia64.

extras/mini-os/Makefile +29 -3
diff -r d2bf1a7cc131 -r 287178fbc320 extras/mini-os/Makefile
@@ -11,8 +11,12 @@ CFLAGS := -fno-builtin -Wall -Werror -Wr
 CFLAGS := -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format
 CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
 
-override CPPFLAGS := -Iinclude $(CPPFLAGS)
 ASFLAGS = -D__ASSEMBLY__
+
+# For possible special source directories.
+EXTRA_DIRS =
+# For possible special header directories.
+EXTRA_INC =
 
 LDLIBS =  -L. -lminios
 LDFLAGS := -N -T minios-$(TARGET_ARCH).lds
@@ -20,17 +24,23 @@ ifeq ($(TARGET_ARCH),x86_32)
 ifeq ($(TARGET_ARCH),x86_32)
 CFLAGS += -m32 -march=i686
 LDFLAGS += -m elf_i386
+EXTRA_INC = x86
+EXTRA_DIRS = x86
 endif
 
 ifeq ($(TARGET_ARCH)$(pae),x86_32y)
 CFLAGS  += -DCONFIG_X86_PAE=1
 ASFLAGS += -DCONFIG_X86_PAE=1
+EXTRA_INC = x86
+EXTRA_DIRS = x86
 endif
 
 ifeq ($(TARGET_ARCH),x86_64)
 CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks
 CFLAGS += -fno-asynchronous-unwind-tables
 LDFLAGS += -m elf_x86_64
+EXTRA_INC = x86
+EXTRA_DIRS = x86
 endif
 
 ifeq ($(debug),y)
@@ -39,6 +49,8 @@ CFLAGS += -O3
 CFLAGS += -O3
 endif
 
+override CPPFLAGS := -Iinclude $(CPPFLAGS) -Iinclude/$(TARGET_ARCH) -Iinclude/$(EXTRA_INC)
+
 TARGET := mini-os
 
 HEAD := $(TARGET_ARCH).o
@@ -46,9 +58,20 @@ OBJS += $(patsubst %.c,%.o,$(wildcard li
 OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
+OBJS += $(patsubst %.S,%.o,$(wildcard $(TARGET_ARCH)/*.S))
+OBJS += $(patsubst %.S,%.o,$(wildcard $(TARGET_ARCH)/*.c))
+# For special wanted source directories.
+extra_objs := $(foreach dir,$(EXTRA_DIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c)))
+OBJS += $(extra_objs)
+extra_objs := $(foreach dir,$(EXTRA_DIRS),$(patsubst %.S,%.o,$(wildcard $(dir)/*.S)))
+OBJS += $(extra_objs)
 
 HDRS := $(wildcard include/*.h)
 HDRS += $(wildcard include/xen/*.h)
+HDRS += $(wildcard include/$(TARGET_ARCH)/*.h)
+# For special wanted header directories.
+extra_heads := $(foreach dir,$(EXTRA_INC),$(wildcard $(dir)/*.h))
+HDRS += $(extra_heads)
 
 .PHONY: default
 default: $(TARGET)
@@ -57,8 +80,11 @@ links:
 links:
 	[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
 
-libminios.a: links $(OBJS) $(HEAD)
-	$(AR) r libminios.a $(HEAD) $(OBJS)
+libminios.a: links $(OBJS)
+	@echo HAHN_extra_objs: $(extra_objs)
+	@echo HAHN_OBJS: $(OBJS)
+	@echo HAHN_HDRS: $(HDRS)
+	$(AR) r libminios.a $(OBJS)
 
 $(TARGET): libminios.a $(HEAD)
 	$(LD) $(LDFLAGS) $(HEAD) $(LDLIBS) -o [email protected]
extras/mini-os/include/x86/os.h new file +561 -0

561 lines not on this page · raw message

extras/mini-os/include/x86/spinlock.h new file +121 -0

121 lines not on this page · raw message

extras/mini-os/include/x86_32/hypercall-x86_32.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/include/x86_64/hypercall-x86_64.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/x86/traps.c new file +229 -0

229 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_32.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_64.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/os.h deleted +0 -561

561 lines not on this page · raw message

extras/mini-os/include/spinlock.h deleted +0 -121

121 lines not on this page · raw message

extras/mini-os/traps.c deleted +0 -229

26 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.

#2 lore raw
In reply to Dietmar Hahn

Dear Dietmar

Yes, I'm Mini-OS maintainer. It's great that somebody wants to port it to IA64.

With respect to your patch. I would prefer to see the following directory structure:
mini-os/include/x86
mini-os/include/x86/x86_32
mini-os/include/x86/x86_64
If we find that there is only one file in x86_32/x86_64 it would be better to scrap the two directories and put the files in x86.

Continuing, architecture dependent .c files should end up in:
mini-os/arch/x86
mini-os/arch/x86/x86_32
mini-os/arch/x86/x86_64

The above is consistant with the directory structure in xen itself.

I have also noticed that you left some debug statements in your version of Makefile. Obviously we will not commit these to the public repository. So if you remove them before dumping the diff it would make my life little easier.

Finally, when you moved the files around, have you used: hg mv, or just mv. The first one is better :).

Cheers
Gregor

Quoted 30 lines · Dietmar Hahn

Hi,

last week I send a mail asking for some small re-architectures of mini-os for porting to ia64. Unfortunately I didn't get an answer so I try it again with a first draft. I tried the changes as small as possible. Currently I did only adding some new directories and moving some files.
I created:
mini-os/include/x86
It's for common header files for x86_32 and x86_64, currently
os.h and
spinlock.h .
mini-os/include/x86_32
It's for special x86_32 header files, currently hypercall-
x86_32.h.
mini-os/include/x86_64
It's for special x86_64 header files, currently hypercall-
x86_64.h.
mini-os/x86
For common code files for x86_32 and x86_64, currently traps.c

I changed mini-os/Makefile to support the new structure. Please can anybody look at this and give some feedback. Thanks.

Dietmar.
<mini-os.diff>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

Hi Grzegorz ,

Am Donnerstag, 3. August 2006 12:30 schrieb Grzegorz Milos:

Quoted 5 lines

Dear Dietmar

Yes, I'm Mini-OS maintainer. It's great that somebody wants to port it to IA64.

Nice to hear.

Quoted 8 lines

With respect to your patch. I would prefer to see the following directory structure:
mini-os/include/x86
mini-os/include/x86/x86_32
mini-os/include/x86/x86_64
If we find that there is only one file in x86_32/x86_64 it would be better to scrap the two directories and put the files in x86.

Quoted 6 lines

Continuing, architecture dependent .c files should end up in:
mini-os/arch/x86
mini-os/arch/x86/x86_32
mini-os/arch/x86/x86_64

The above is consistant with the directory structure in xen itself.

Yes you are right!

Quoted 6 lines

I have also noticed that you left some debug statements in your version of Makefile. Obviously we will not commit these to the public repository. So if you remove them before dumping the diff it would make my life little easier.

Sorry, I saw this short time after sending the patch - now it's fixed;-).

Quoted 3 lines

Finally, when you moved the files around, have you used: hg mv, or just mv. The first one is better :).

Yes I did 'hg rename'.

Quoted 3 lines

Cheers
Gregor

I moved only few files and changed the Makefile. In the next step I will look into the files for special defines for x86_32 and x86_64.
I hope this patch is ok now.
Thanks.

Dietmar.

# HG changeset patch
# User [email protected]
# Date 1154606880 -7200
# Node ID 6a527018b9bf767a5964378c3f43b074b9f42fb9
# Parent aa1ab056bfbffc28c8f2f8c7142ceb076d9a784d
A first step to re-architecture mini-os for a port to ia64. Create architecture specific directories below mini-os for sources and below mini-os/include for headers.

extras/mini-os/Makefile +32 -3
diff -r aa1ab056bfbf -r 6a527018b9bf extras/mini-os/Makefile
@@ -11,8 +11,12 @@ CFLAGS := -fno-builtin -Wall -Werror -Wr
 CFLAGS := -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format
 CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
 
-override CPPFLAGS := -Iinclude $(CPPFLAGS)
 ASFLAGS = -D__ASSEMBLY__
+
+# For possible special source directories.
+EXTRA_SRC =
+# For possible special header directories.
+EXTRA_INC =
 
 LDLIBS =  -L. -lminios
 LDFLAGS := -N -T minios-$(TARGET_ARCH).lds
@@ -20,17 +24,29 @@ ifeq ($(TARGET_ARCH),x86_32)
 ifeq ($(TARGET_ARCH),x86_32)
 CFLAGS += -m32 -march=i686
 LDFLAGS += -m elf_i386
+EXTRA_INC = x86
+EXTRA_SRC = arch/x86
 endif
 
 ifeq ($(TARGET_ARCH)$(pae),x86_32y)
 CFLAGS  += -DCONFIG_X86_PAE=1
 ASFLAGS += -DCONFIG_X86_PAE=1
+EXTRA_INC = x86
+EXTRA_SRC = arch/x86
 endif
 
 ifeq ($(TARGET_ARCH),x86_64)
 CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks
 CFLAGS += -fno-asynchronous-unwind-tables
 LDFLAGS += -m elf_x86_64
+EXTRA_INC = x86
+EXTRA_SRC = arch/x86
+endif
+
+ifeq ($(TARGET_ARCH),ia64)
+CFLAGS += -mfixed-range=f12-f15,f32-f127
+ASFLAGS += -x assembler-with-cpp -ansi -Wall
+ASFLAGS += -mfixed-range=f12-f15,f32-f127
 endif
 
 ifeq ($(debug),y)
@@ -39,6 +55,8 @@ CFLAGS += -O3
 CFLAGS += -O3
 endif
 
+override CPPFLAGS := -Iinclude $(CPPFLAGS) -Iinclude/$(TARGET_ARCH) -Iinclude/$(EXTRA_INC)
+
 TARGET := mini-os
 
 HEAD := $(TARGET_ARCH).o
@@ -46,9 +64,20 @@ OBJS += $(patsubst %.c,%.o,$(wildcard li
 OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
+OBJS += $(patsubst %.S,%.o,$(wildcard arch/$(TARGET_ARCH)/*.S))
+OBJS += $(patsubst %.S,%.o,$(wildcard arch/$(TARGET_ARCH)/*.c))
+# For special wanted source directories.
+extra_objs := $(foreach dir,$(EXTRA_SRC),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c)))
+OBJS += $(extra_objs)
+extra_objs := $(foreach dir,$(EXTRA_SRC),$(patsubst %.S,%.o,$(wildcard $(dir)/*.S)))
+OBJS += $(extra_objs)
 
 HDRS := $(wildcard include/*.h)
 HDRS += $(wildcard include/xen/*.h)
+HDRS += $(wildcard include/$(TARGET_ARCH)/*.h)
+# For special wanted header directories.
+extra_heads := $(foreach dir,$(EXTRA_INC),$(wildcard $(dir)/*.h))
+HDRS += $(extra_heads)
 
 .PHONY: default
 default: $(TARGET)
@@ -57,8 +86,8 @@ links:
 links:
 	[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
 
-libminios.a: links $(OBJS) $(HEAD)
-	$(AR) r libminios.a $(HEAD) $(OBJS)
+libminios.a: links $(OBJS)
+	$(AR) r libminios.a $(OBJS)
 
 $(TARGET): libminios.a $(HEAD)
 	$(LD) $(LDFLAGS) $(HEAD) $(LDLIBS) -o [email protected]
extras/mini-os/arch/x86/traps.c new file +229 -0

229 lines not on this page · raw message

extras/mini-os/include/x86/os.h new file +561 -0

561 lines not on this page · raw message

extras/mini-os/include/x86/spinlock.h new file +121 -0

121 lines not on this page · raw message

extras/mini-os/include/x86/traps.h new file +73 -0

73 lines not on this page · raw message

extras/mini-os/include/x86_32/hypercall-x86_32.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/include/x86_64/hypercall-x86_64.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_32.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_64.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/os.h deleted +0 -561

561 lines not on this page · raw message

extras/mini-os/include/spinlock.h deleted +0 -121

71 lines not on this page · raw message

extras/mini-os/include/traps.h deleted +0 -73

73 lines not on this page · raw message

extras/mini-os/traps.c deleted +0 -229

229 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.

#4 lore raw
Quoted 8 lines
Quoted 8 lines

With respect to your patch. I would prefer to see the following directory structure:
mini-os/include/x86
mini-os/include/x86/x86_32
mini-os/include/x86/x86_64
If we find that there is only one file in x86_32/x86_64 it would be better to scrap the two directories and put the files in x86.

Quoted 7 lines
Quoted 5 lines

Continuing, architecture dependent .c files should end up in:
mini-os/arch/x86
mini-os/arch/x86/x86_32
mini-os/arch/x86/x86_64

I moved only few files and changed the Makefile. In the next step I will look into the files for special defines for x86_32 and x86_64. I hope this patch is ok now.

The patch still introduces mini-os/include/x86_32 and mini-os/include/x86_64.

I would prefer both x86_32 and x86_64 to be subdirectories of mini-os/include/x86.

Also, I would replace "=" with "+=" when you assign to EXTRA_INC/SRC in mini-os/Makefile.

Cheers
Gregor

#5 lore raw

Am Montag, 7. August 2006 14:50 schrieb Grzegorz Milos:

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

With respect to your patch. I would prefer to see the following directory structure:
mini-os/include/x86
mini-os/include/x86/x86_32
mini-os/include/x86/x86_64
If we find that there is only one file in x86_32/x86_64 it would be better to scrap the two directories and put the files in x86.

Continuing, architecture dependent .c files should end up in:
mini-os/arch/x86
mini-os/arch/x86/x86_32
mini-os/arch/x86/x86_64

Quoted 6 lines
Quoted 3 lines

I moved only few files and changed the Makefile. In the next step I will look into the files for special defines for x86_32 and x86_64. I hope this patch is ok now.

The patch still introduces mini-os/include/x86_32 and mini-os/include/x86_64.

Sorry I overlooked the right directory hierarchy.

Quoted 3 lines

I would prefer both x86_32 and x86_64 to be subdirectories of mini-os/include/x86.

I hope, now it's correct!

Quoted 3 lines

Also, I would replace "=" with "+=" when you assign to EXTRA_INC/SRC in mini-os/Makefile.

OK I did this.
I also added some lines for creating architecture dependent links. Maybe there are some discussion points about the rules I added.

Quoted 4 lines

Cheers
Gregor

Thanks for understanding.

Dietmar.

# HG changeset patch
# User [email protected]
# Date 1155035565 -7200
# Node ID ab4a99d12220777c4cdc2fe005edb6852919b932
# Parent ffa5b2975dfffa1c3a0b8f6fc8fee877f9bfe295
A first step to re-architecture mini-os for a port to ia64. Create architecture specific directories below mini-os for sources and below mini-os/include for headers.

extras/mini-os/Makefile +51 -2
diff -r ffa5b2975dff -r ab4a99d12220 extras/mini-os/Makefile
@@ -11,26 +11,54 @@ CFLAGS := -fno-builtin -Wall -Werror -Wr
 CFLAGS := -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format
 CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
 
-override CPPFLAGS := -Iinclude $(CPPFLAGS)
 ASFLAGS = -D__ASSEMBLY__
 
 LDLIBS =  -L. -lminios
 LDFLAGS := -N -T minios-$(TARGET_ARCH).lds
 
+# For possible special source directories.
+EXTRA_SRC =
+# For possible special header directories.
+EXTRA_INC =
+
+# Standard name for architecture specific subdirectories.
+TARGET_ARCH_DIR = $(TARGET_ARCH)
+# This is used for architecture specific links.
+ARCH_LINKS =
+
 ifeq ($(TARGET_ARCH),x86_32)
 CFLAGS += -m32 -march=i686
 LDFLAGS += -m elf_i386
+TARGET_ARCH_DIR = x86
+EXTRA_INC += $(TARGET_ARCH_DIR)/$(TARGET_ARCH)
+EXTRA_SRC += arch/$(EXTRA_INC)
 endif
 
 ifeq ($(TARGET_ARCH)$(pae),x86_32y)
 CFLAGS  += -DCONFIG_X86_PAE=1
 ASFLAGS += -DCONFIG_X86_PAE=1
+TARGET_ARCH_DIR = x86
+EXTRA_INC += $(TARGET_ARCH_DIR)/$(TARGET_ARCH)
+EXTRA_SRC += arch/$(EXTRA_INC)
 endif
 
 ifeq ($(TARGET_ARCH),x86_64)
 CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks
 CFLAGS += -fno-asynchronous-unwind-tables
 LDFLAGS += -m elf_x86_64
+TARGET_ARCH_DIR = x86
+EXTRA_INC += $(TARGET_ARCH_DIR)/$(TARGET_ARCH)
+EXTRA_SRC += arch/$(EXTRA_INC)
+endif
+
+ifeq ($(TARGET_ARCH),ia64)
+CFLAGS += -mfixed-range=f12-f15,f32-f127
+ASFLAGS += -x assembler-with-cpp -ansi -Wall
+ASFLAGS += -mfixed-range=f12-f15,f32-f127
+ARCH_LINKS = IA64_LINKS		# Special link on ia64 needed
+define arch_links
+[ -e include/ia64/asm-xsi-offsets.h ] || ln -sf ../../../../xen/include/asm-ia64/asm-xsi-offsets.h include/ia64/asm-xsi-offsets.h
+endef
 endif
 
 ifeq ($(debug),y)
@@ -39,6 +67,10 @@ CFLAGS += -O3
 CFLAGS += -O3
 endif
 
+# Add the special header directories to the include paths.
+extra_incl := $(foreach dir,$(EXTRA_INC),-Iinclude/$(dir))
+override CPPFLAGS := -Iinclude $(CPPFLAGS) -Iinclude/$(TARGET_ARCH_DIR)	$(extra_incl)
+
 TARGET := mini-os
 
 HEAD := $(TARGET_ARCH).o
@@ -46,15 +78,32 @@ OBJS += $(patsubst %.c,%.o,$(wildcard li
 OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
+OBJS += $(patsubst %.S,%.o,$(wildcard arch/$(TARGET_ARCH_DIR)/*.S))
+OBJS += $(patsubst %.c,%.o,$(wildcard arch/$(TARGET_ARCH_DIR)/*.c))
+# For special wanted source directories.
+extra_objs := $(foreach dir,$(EXTRA_SRC),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c)))
+OBJS += $(extra_objs)
+extra_objs := $(foreach dir,$(EXTRA_SRC),$(patsubst %.S,%.o,$(wildcard $(dir)/*.S)))
+OBJS += $(extra_objs)
 
 HDRS := $(wildcard include/*.h)
 HDRS += $(wildcard include/xen/*.h)
+HDRS += $(wildcard include/$(TARGET_ARCH_DIR)/*.h)
+# For special wanted header directories.
+extra_heads := $(foreach dir,$(EXTRA_INC),$(wildcard $(dir)/*.h))
+HDRS += $(extra_heads)
 
 .PHONY: default
 default: $(TARGET)
 
+# Create special architecture specific links.
+ifneq ($(ARCH_LINKS),)
+$(ARCH_LINKS):
+	$(arch_links)
+endif
+
 .PHONY: links
-links:
+links:	$(ARCH_LINKS)
 	[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
 
 libminios.a: links $(OBJS) $(HEAD)
extras/mini-os/include/hypervisor.h +3 -0
diff -r ffa5b2975dff -r ab4a99d12220 extras/mini-os/include/hypervisor.h
@@ -7,6 +7,7 @@
  * Copyright (c) 2002, K A Fraser
  * Copyright (c) 2005, Grzegorz Milos
  * Updates: Aravindh Puthiyaparambil <[email protected]>
+ * Updates: Dietmar Hahn <[email protected]> for ia64
  */
 
 #ifndef _HYPERVISOR_H_
@@ -19,6 +20,8 @@
 #include <hypercall-x86_32.h>
 #elif defined(__x86_64__)
 #include <hypercall-x86_64.h>
+#elif defined(__ia64__)
+#include <hypercall-ia64.h>
 #else
 #error "Unsupported architecture"
 #endif
extras/mini-os/include/types.h +2 -2
diff -r ffa5b2975dff -r ab4a99d12220 extras/mini-os/include/types.h
@@ -29,7 +29,7 @@ typedef unsigned int        u32;
 #ifdef __i386__
 typedef signed long long    s64;
 typedef unsigned long long  u64;
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) || defined(__ia64__)
 typedef signed long         s64;
 typedef unsigned long       u64;
 #endif
@@ -49,7 +49,7 @@ typedef struct { unsigned long pte_low, 
 typedef struct { unsigned long pte_low, pte_high; } pte_t;
 #endif /* CONFIG_X86_PAE */
 
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) || defined(__ia64__)
 typedef long                quad_t;
 typedef unsigned long       u_quad_t;
 typedef unsigned long       uintptr_t;
extras/mini-os/arch/x86/traps.c new file +229 -0

229 lines not on this page · raw message

extras/mini-os/include/x86/os.h new file +561 -0

561 lines not on this page · raw message

extras/mini-os/include/x86/spinlock.h new file +121 -0

121 lines not on this page · raw message

extras/mini-os/include/x86/traps.h new file +73 -0

73 lines not on this page · raw message

extras/mini-os/include/x86/x86_32/hypercall-x86_32.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/include/x86/x86_64/hypercall-x86_64.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_32.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_64.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/os.h deleted +0 -561

561 lines not on this page · raw message

extras/mini-os/include/spinlock.h deleted +0 -121

22 lines not on this page · raw message

extras/mini-os/include/traps.h deleted +0 -73

73 lines not on this page · raw message

extras/mini-os/traps.c deleted +0 -229

229 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.

#6 lore raw

This patch looks fine.

Keir could you apply please?

Cheers
Gregor

# HG changeset patch
# User [email protected]
# Date 1155035565 -7200
# Node ID ab4a99d12220777c4cdc2fe005edb6852919b932
# Parent ffa5b2975dfffa1c3a0b8f6fc8fee877f9bfe295
A first step to re-architecture mini-os for a port to ia64. Create architecture specific directories below mini-os for sources and below mini-os/include for headers.

extras/mini-os/Makefile +51 -2
diff -r ffa5b2975dff -r ab4a99d12220 extras/mini-os/Makefile
@@ -11,26 +11,54 @@ CFLAGS := -fno-builtin -Wall -Werror -Wr
 CFLAGS := -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format
 CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
 
-override CPPFLAGS := -Iinclude $(CPPFLAGS)
 ASFLAGS = -D__ASSEMBLY__
 
 LDLIBS =  -L. -lminios
 LDFLAGS := -N -T minios-$(TARGET_ARCH).lds
 
+# For possible special source directories.
+EXTRA_SRC =
+# For possible special header directories.
+EXTRA_INC =
+
+# Standard name for architecture specific subdirectories.
+TARGET_ARCH_DIR = $(TARGET_ARCH)
+# This is used for architecture specific links.
+ARCH_LINKS =
+
 ifeq ($(TARGET_ARCH),x86_32)
 CFLAGS += -m32 -march=i686
 LDFLAGS += -m elf_i386
+TARGET_ARCH_DIR = x86
+EXTRA_INC += $(TARGET_ARCH_DIR)/$(TARGET_ARCH)
+EXTRA_SRC += arch/$(EXTRA_INC)
 endif
 
 ifeq ($(TARGET_ARCH)$(pae),x86_32y)
 CFLAGS  += -DCONFIG_X86_PAE=1
 ASFLAGS += -DCONFIG_X86_PAE=1
+TARGET_ARCH_DIR = x86
+EXTRA_INC += $(TARGET_ARCH_DIR)/$(TARGET_ARCH)
+EXTRA_SRC += arch/$(EXTRA_INC)
 endif
 
 ifeq ($(TARGET_ARCH),x86_64)
 CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks
 CFLAGS += -fno-asynchronous-unwind-tables
 LDFLAGS += -m elf_x86_64
+TARGET_ARCH_DIR = x86
+EXTRA_INC += $(TARGET_ARCH_DIR)/$(TARGET_ARCH)
+EXTRA_SRC += arch/$(EXTRA_INC)
+endif
+
+ifeq ($(TARGET_ARCH),ia64)
+CFLAGS += -mfixed-range=f12-f15,f32-f127
+ASFLAGS += -x assembler-with-cpp -ansi -Wall
+ASFLAGS += -mfixed-range=f12-f15,f32-f127
+ARCH_LINKS = IA64_LINKS		# Special link on ia64 needed
+define arch_links
+[ -e include/ia64/asm-xsi-offsets.h ] || ln -sf ../../../../xen/include/asm-ia64/asm-xsi-offsets.h include/ia64/asm-xsi-offsets.h
+endef
 endif
 
 ifeq ($(debug),y)
@@ -39,6 +67,10 @@ CFLAGS += -O3
 CFLAGS += -O3
 endif
 
+# Add the special header directories to the include paths.
+extra_incl := $(foreach dir,$(EXTRA_INC),-Iinclude/$(dir))
+override CPPFLAGS := -Iinclude $(CPPFLAGS) -Iinclude/$(TARGET_ARCH_DIR)	$(extra_incl)
+
 TARGET := mini-os
 
 HEAD := $(TARGET_ARCH).o
@@ -46,15 +78,32 @@ OBJS += $(patsubst %.c,%.o,$(wildcard li
 OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
 OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
+OBJS += $(patsubst %.S,%.o,$(wildcard arch/$(TARGET_ARCH_DIR)/*.S))
+OBJS += $(patsubst %.c,%.o,$(wildcard arch/$(TARGET_ARCH_DIR)/*.c))
+# For special wanted source directories.
+extra_objs := $(foreach dir,$(EXTRA_SRC),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c)))
+OBJS += $(extra_objs)
+extra_objs := $(foreach dir,$(EXTRA_SRC),$(patsubst %.S,%.o,$(wildcard $(dir)/*.S)))
+OBJS += $(extra_objs)
 
 HDRS := $(wildcard include/*.h)
 HDRS += $(wildcard include/xen/*.h)
+HDRS += $(wildcard include/$(TARGET_ARCH_DIR)/*.h)
+# For special wanted header directories.
+extra_heads := $(foreach dir,$(EXTRA_INC),$(wildcard $(dir)/*.h))
+HDRS += $(extra_heads)
 
 .PHONY: default
 default: $(TARGET)
 
+# Create special architecture specific links.
+ifneq ($(ARCH_LINKS),)
+$(ARCH_LINKS):
+	$(arch_links)
+endif
+
 .PHONY: links
-links:
+links:	$(ARCH_LINKS)
 	[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
 
 libminios.a: links $(OBJS) $(HEAD)
extras/mini-os/include/hypervisor.h +3 -0
diff -r ffa5b2975dff -r ab4a99d12220 extras/mini-os/include/hypervisor.h
@@ -7,6 +7,7 @@
  * Copyright (c) 2002, K A Fraser
  * Copyright (c) 2005, Grzegorz Milos
  * Updates: Aravindh Puthiyaparambil <[email protected]>
+ * Updates: Dietmar Hahn <[email protected]> for ia64
  */
 
 #ifndef _HYPERVISOR_H_
@@ -19,6 +20,8 @@
 #include <hypercall-x86_32.h>
 #elif defined(__x86_64__)
 #include <hypercall-x86_64.h>
+#elif defined(__ia64__)
+#include <hypercall-ia64.h>
 #else
 #error "Unsupported architecture"
 #endif
extras/mini-os/include/types.h +2 -2
diff -r ffa5b2975dff -r ab4a99d12220 extras/mini-os/include/types.h
@@ -29,7 +29,7 @@ typedef unsigned int        u32;
 #ifdef __i386__
 typedef signed long long    s64;
 typedef unsigned long long  u64;
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) || defined(__ia64__)
 typedef signed long         s64;
 typedef unsigned long       u64;
 #endif
@@ -49,7 +49,7 @@ typedef struct { unsigned long pte_low, 
 typedef struct { unsigned long pte_low, pte_high; } pte_t;
 #endif /* CONFIG_X86_PAE */
 
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) || defined(__ia64__)
 typedef long                quad_t;
 typedef unsigned long       u_quad_t;
 typedef unsigned long       uintptr_t;
extras/mini-os/arch/x86/traps.c new file +229 -0

229 lines not on this page · raw message

extras/mini-os/include/x86/os.h new file +561 -0

561 lines not on this page · raw message

extras/mini-os/include/x86/spinlock.h new file +121 -0

121 lines not on this page · raw message

extras/mini-os/include/x86/traps.h new file +73 -0

73 lines not on this page · raw message

extras/mini-os/include/x86/x86_32/hypercall-x86_32.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/include/x86/x86_64/hypercall-x86_64.h new file +326 -0

326 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_32.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/hypercall-x86_64.h deleted +0 -326

326 lines not on this page · raw message

extras/mini-os/include/os.h deleted +0 -561

561 lines not on this page · raw message

extras/mini-os/include/spinlock.h deleted +0 -121

22 lines not on this page · raw message

extras/mini-os/include/traps.h deleted +0 -73

73 lines not on this page · raw message

extras/mini-os/traps.c deleted +0 -229

229 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Quoted 35 lines · Dietmar Hahn

Am Montag, 7. August 2006 14:50 schrieb Grzegorz Milos:

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

With respect to your patch. I would prefer to see the following directory structure:
mini-os/include/x86
mini-os/include/x86/x86_32
mini-os/include/x86/x86_64
If we find that there is only one file in x86_32/x86_64 it would be better to scrap the two directories and put the files in x86.

Continuing, architecture dependent .c files should end up in:
mini-os/arch/x86
mini-os/arch/x86/x86_32
mini-os/arch/x86/x86_64

Quoted 6 lines
Quoted 3 lines

I moved only few files and changed the Makefile. In the next step I will look into the files for special defines for x86_32 and x86_64. I hope this patch is ok now.

The patch still introduces mini-os/include/x86_32 and mini-os/include/x86_64.

Sorry I overlooked the right directory hierarchy.

Quoted 3 lines

I would prefer both x86_32 and x86_64 to be subdirectories of mini-os/include/x86.

I hope, now it's correct!

Quoted 3 lines

Also, I would replace "=" with "+=" when you assign to EXTRA_INC/SRC in mini-os/Makefile.

OK I did this.
I also added some lines for creating architecture dependent links. Maybe there are some discussion points about the rules I added.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

Cheers
Gregor

Thanks for understanding.

Dietmar.
<mini-os.patch>

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.