This gives a name to the anonymous union introduced in
skas-hold-own-ldt, allowing to build on a wider range of gccs.
It also removes ldt.h, which somehow became real, and replaces it with a
symlink, and creates ldt-x86_64.h as a copy of ldt-i386.h for now.
Signed-off-by: Jeff Dike <[email protected]>
Index: linux-2.6.15/arch/um/Makefile
===================================================================
--- linux-2.6.15.orig/arch/um/Makefile 2005-11-15 18:40:24.000000000 -0500
+++ linux-2.6.15/arch/um/Makefile 2005-11-15 18:40:24.000000000 -0500
@@ -17,7 +17,7 @@ core-y += $(ARCH_DIR)/kernel/ \
# Have to precede the include because the included Makefiles reference them.
SYMLINK_HEADERS := archparam.h system.h sigcontext.h processor.h ptrace.h \
- module.h vm-flags.h elf.h
+ module.h vm-flags.h elf.h ldt.h
SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header))
# XXX: The "os" symlink is only used by arch/um/include/os.h, which includes
Index: linux-2.6.15/arch/um/sys-i386/ldt.c
===================================================================
--- linux-2.6.15.orig/arch/um/sys-i386/ldt.c 2005-11-15 12:56:27.000000000 -0500
+++ linux-2.6.15/arch/um/sys-i386/ldt.c 2005-11-15 18:40:24.000000000 -0500
@@ -228,7 +228,7 @@ static int read_ldt(void __user * ptr, u
size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES;
if(size > bytecount)
size = bytecount;
- if(copy_to_user(ptr, ldt->entries, size))
+ if(copy_to_user(ptr, ldt->u.entries, size))
err = -EFAULT;
bytecount -= size;
ptr += size;
@@ -239,7 +239,7 @@ static int read_ldt(void __user * ptr, u
size = PAGE_SIZE;
if(size > bytecount)
size = bytecount;
- if(copy_to_user(ptr, ldt->pages[i], size)){
+ if(copy_to_user(ptr, ldt->u.pages[i], size)){
err = -EFAULT;
break;
}
@@ -321,10 +321,11 @@ static int write_ldt(void __user * ptr,
i*LDT_ENTRIES_PER_PAGE <= ldt_info.entry_number;
i++){
if(i == 0)
- memcpy(&entry0, ldt->entries, sizeof(entry0));
- ldt->pages[i] = (struct ldt_entry *)
- __get_free_page(GFP_KERNEL|__GFP_ZERO);
- if(!ldt->pages[i]){
+ memcpy(&entry0, ldt->u.entries,
+ sizeof(entry0));
+ ldt->u.pages[i] = (struct ldt_entry *)
+ __get_free_page(GFP_KERNEL|__GFP_ZERO);
+ if(!ldt->u.pages[i]){
err = -ENOMEM;
/* Undo the change in host */
memset(&ldt_info, 0, sizeof(ldt_info));
@@ -332,8 +333,9 @@ static int write_ldt(void __user * ptr,
goto out_unlock;
}
if(i == 0) {
- memcpy(ldt->pages[0], &entry0, sizeof(entry0));
- memcpy(ldt->pages[0]+1, ldt->entries+1,
+ memcpy(ldt->u.pages[0], &entry0,
+ sizeof(entry0));
+ memcpy(ldt->u.pages[0]+1, ldt->u.entries+1,
sizeof(entry0)*(LDT_DIRECT_ENTRIES-1));
}
ldt->entry_count = (i + 1) * LDT_ENTRIES_PER_PAGE;
@@ -343,9 +345,9 @@ static int write_ldt(void __user * ptr,
ldt->entry_count = ldt_info.entry_number + 1;
if(ldt->entry_count <= LDT_DIRECT_ENTRIES)
- ldt_p = ldt->entries + ldt_info.entry_number;
+ ldt_p = ldt->u.entries + ldt_info.entry_number;
else
- ldt_p = ldt->pages[ldt_info.entry_number/LDT_ENTRIES_PER_PAGE] +
+ ldt_p = ldt->u.pages[ldt_info.entry_number/LDT_ENTRIES_PER_PAGE] +
ldt_info.entry_number%LDT_ENTRIES_PER_PAGE;
if(ldt_info.base_addr == 0 && ldt_info.limit == 0 &&
@@ -501,8 +503,8 @@ long init_new_ldt(struct mmu_context_ska
*/
down(&from_mm->ldt.semaphore);
if(from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES){
- memcpy(new_mm->ldt.entries, from_mm->ldt.entries,
- sizeof(new_mm->ldt.entries));
+ memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries,
+ sizeof(new_mm->ldt.u.entries));
}
else{
i = from_mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE;
@@ -512,9 +514,10 @@ long init_new_ldt(struct mmu_context_ska
err = -ENOMEM;
break;
}
- new_mm->ldt.pages[i] = (struct ldt_entry*)page;
- memcpy(new_mm->ldt.pages[i],
- from_mm->ldt.pages[i], PAGE_SIZE);
+ new_mm->ldt.u.pages[i] =
+ (struct ldt_entry *) page;
+ memcpy(new_mm->ldt.u.pages[i],
+ from_mm->ldt.u.pages[i], PAGE_SIZE);
}
}
new_mm->ldt.entry_count = from_mm->ldt.entry_count;
@@ -532,7 +535,7 @@ void free_ldt(struct mmu_context_skas *
if(!ptrace_ldt && mm->ldt.entry_count > LDT_DIRECT_ENTRIES){
i = mm->ldt.entry_count / LDT_ENTRIES_PER_PAGE;
while(i-- > 0){
- free_page((long )mm->ldt.pages[i]);
+ free_page((long )mm->ldt.u.pages[i]);
}
}
mm->ldt.entry_count = 0;
Index: linux-2.6.15/include/asm-um/ldt-i386.h
===================================================================
--- linux-2.6.15.orig/include/asm-um/ldt-i386.h 2005-11-15 12:56:27.000000000 -0500
+++ linux-2.6.15/include/asm-um/ldt-i386.h 2005-11-15 18:40:24.000000000 -0500
@@ -35,7 +35,7 @@ typedef struct uml_ldt {
union {
struct ldt_entry * pages[LDT_PAGES_MAX];
struct ldt_entry entries[LDT_DIRECT_ENTRIES];
- };
+ } u;
} uml_ldt_t;
/*
Index: linux-2.6.15/include/asm-um/ldt-x86_64.h
===================================================================
--- linux-2.6.15.orig/include/asm-um/ldt-x86_64.h 2005-11-15 06:24:03.980487250 -0500
+++ linux-2.6.15/include/asm-um/ldt-x86_64.h 2005-11-15 18:42:26.000000000 -0500
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
+ * Licensed under the GPL
+ *
+ * Author: Bodo Stroesser <[email protected]>
+ */
+
+#ifndef __ASM_LDT_I386_H
+#define __ASM_LDT_I386_H
+
+#include "asm/semaphore.h"
+#include "asm/arch/ldt.h"
+
+struct mmu_context_skas;
+extern void ldt_host_info(void);
+extern long init_new_ldt(struct mmu_context_skas * to_mm,
+ struct mmu_context_skas * from_mm);
+extern void free_ldt(struct mmu_context_skas * mm);
+
+#define LDT_PAGES_MAX \
+ ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
+#define LDT_ENTRIES_PER_PAGE \
+ (PAGE_SIZE/LDT_ENTRY_SIZE)
+#define LDT_DIRECT_ENTRIES \
+ ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
+
+struct ldt_entry {
+ __u32 a;
+ __u32 b;
+};
+
+typedef struct uml_ldt {
+ int entry_count;
+ struct semaphore semaphore;
+ union {
+ struct ldt_entry * pages[LDT_PAGES_MAX];
+ struct ldt_entry entries[LDT_DIRECT_ENTRIES];
+ } u;
+} uml_ldt_t;
+
+/*
+ * macros stolen from include/asm-i386/desc.h
+ */
+#define LDT_entry_a(info) \
+ ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
+
+#define LDT_entry_b(info) \
+ (((info)->base_addr & 0xff000000) | \
+ (((info)->base_addr & 0x00ff0000) >> 16) | \
+ ((info)->limit & 0xf0000) | \
+ (((info)->read_exec_only ^ 1) << 9) | \
+ ((info)->contents << 10) | \
+ (((info)->seg_not_present ^ 1) << 15) | \
+ ((info)->seg_32bit << 22) | \
+ ((info)->limit_in_pages << 23) | \
+ ((info)->useable << 20) | \
+ 0x7000)
+
+#define LDT_empty(info) (\
+ (info)->base_addr == 0 && \
+ (info)->limit == 0 && \
+ (info)->contents == 0 && \
+ (info)->read_exec_only == 1 && \
+ (info)->seg_32bit == 0 && \
+ (info)->limit_in_pages == 0 && \
+ (info)->seg_not_present == 1 && \
+ (info)->useable == 0 )
+
+#endif
Index: linux-2.6.15/include/asm-um/ldt.h
===================================================================
--- linux-2.6.15.orig/include/asm-um/ldt.h 2005-11-15 12:56:27.000000000 -0500
+++ linux-2.6.15/include/asm-um/ldt.h 2005-11-15 06:24:03.980487250 -0500
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
- * Licensed under the GPL
- *
- * Author: Bodo Stroesser <[email protected]>
- */
-
-#ifndef __ASM_LDT_I386_H
-#define __ASM_LDT_I386_H
-
-#include "asm/semaphore.h"
-#include "asm/arch/ldt.h"
-
-struct mmu_context_skas;
-extern void ldt_host_info(void);
-extern long init_new_ldt(struct mmu_context_skas * to_mm,
- struct mmu_context_skas * from_mm);
-extern void free_ldt(struct mmu_context_skas * mm);
-
-#define LDT_PAGES_MAX \
- ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
-#define LDT_ENTRIES_PER_PAGE \
- (PAGE_SIZE/LDT_ENTRY_SIZE)
-#define LDT_DIRECT_ENTRIES \
- ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
-
-struct ldt_entry {
- __u32 a;
- __u32 b;
-};
-
-typedef struct uml_ldt {
- int entry_count;
- struct semaphore semaphore;
- union {
- struct ldt_entry * pages[LDT_PAGES_MAX];
- struct ldt_entry entries[LDT_DIRECT_ENTRIES];
- };
-} uml_ldt_t;
-
-/*
- * macros stolen from include/asm-i386/desc.h
- */
-#define LDT_entry_a(info) \
- ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
-
-#define LDT_entry_b(info) \
- (((info)->base_addr & 0xff000000) | \
- (((info)->base_addr & 0x00ff0000) >> 16) | \
- ((info)->limit & 0xf0000) | \
- (((info)->read_exec_only ^ 1) << 9) | \
- ((info)->contents << 10) | \
- (((info)->seg_not_present ^ 1) << 15) | \
- ((info)->seg_32bit << 22) | \
- ((info)->limit_in_pages << 23) | \
- ((info)->useable << 20) | \
- 0x7000)
-
-#define LDT_empty(info) (\
- (info)->base_addr == 0 && \
- (info)->limit == 0 && \
- (info)->contents == 0 && \
- (info)->read_exec_only == 1 && \
- (info)->seg_32bit == 0 && \
- (info)->limit_in_pages == 0 && \
- (info)->seg_not_present == 1 && \
- (info)->useable == 0 )
-
-#endif
-#ifndef __UM_LDT_H
-#define __UM_LDT_H
-
-#include "asm/arch/ldt.h"
-#endif
On Thursday 17 November 2005 15:10, Jeff Dike wrote:
> This gives a name to the anonymous union introduced in
> skas-hold-own-ldt, allowing to build on a wider range of gccs.
Or narrower range, in the case of Ubuntu "Horny Hedgehog". 2.6.15-rc1 builds
fine by itself, or with just patch 1 in this series, but with patch 2...
CHK include/linux/version.h
UPD include/linux/version.h
SYMLINK include/asm -> include/asm-um
SPLIT include/linux/autoconf.h -> include/config/*
gcc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -ffreestanding -O2 -fomit-frame-pointer -D__arch_um__
-DSUBARCH=\"i386\" -Iarch/um/include
-I/home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/arch/um/include
-I/home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/arch/um/kernel/skas/include
-Dvmap=kernel_vmap -Din6addr_loopback=kernel_in6addr_loopback
-Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask -U__i386__ -Ui386
-march=i686 -mpreferred-stack-boundary=2 -D_LARGEFILE64_SOURCE -nostdinc
-isystem /usr/lib/gcc-lib/i486-linux/3.3.5/include -D__KERNEL__ -Iinclude
-Iinclude2
-I/home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/include -include
include/linux/autoconf.h -S -o
arch/um/kernel-offsets.s /home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/arch/um/sys-i386/kernel-offsets.c
In file included
from /home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/arch/um/include/um_mmu.h:17,
from include2/asm/mmu.h:9,
from /home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/include/linux/sched.h:23,
from /home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/arch/um/sys-i386/kernel-offsets.c:3:
/home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/arch/um/kernel/skas/include/mmu-skas.h:19:
error: syntax error before "uml_ldt_t"
/home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/arch/um/kernel/skas/include/mmu-skas.h:19:
warning: no semicolon at end of struct or union
In file included from include2/asm/mmu.h:9,
from /home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/include/linux/sched.h:23,
from /home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/arch/um/sys-i386/kernel-offsets.c:3:
/home/landley/newbuild/firmware-build/tmpdir/linux-2.6.14/arch/um/include/um_mmu.h:25:
error: field `skas' has incomplete type
make[2]: *** [arch/um/kernel-offsets.s] Error 1
make[1]: *** [_all] Error 2
make: *** [all] Error 2
On Friday 18 November 2005 01:03, Rob Landley wrote:
> On Thursday 17 November 2005 15:10, Jeff Dike wrote:
> > This gives a name to the anonymous union introduced in
> > skas-hold-own-ldt, allowing to build on a wider range of gccs.
>
> Or narrower range, in the case of Ubuntu "Horny Hedgehog". 2.6.15-rc1
> builds fine by itself, or with just patch 1 in this series, but with patch
> 2...
To clarify, 1, 3 and 4 in this series all build fine for me. Only patch 2 is
breaking my build.
Rob