Update L4ka::Pistachio, fix gcc-4.7 problem

With the update to L4ka::Pistachio, we no longer need to patch the
contrib sources. Our patch went upstream in the meanwhile.

Apparently, gcc-4.7 is picky about specifying the '-melf_i386' argument
at the command line of the GCC frontend. We need to make sure to use the
'-Wl,' prefix.
This commit is contained in:
Norman Feske 2012-10-31 18:47:43 +01:00
parent 05e60691cb
commit 2a03c78dfb
3 changed files with 4 additions and 303 deletions

View File

@ -7,8 +7,9 @@
VERBOSE = @
ECHO = @echo
GIT_URI = https://github.com/l4ka/pistachio.git
GIT_REV = 5c1b29b9c77fbd4760f35507da3d2f548f4364bd
GIT_REV = 76bac3d926dc707c6a3243b38c1505d2b5b6537b
CONTRIB_DIR = contrib
SHELL = bash
PATCHES = $(shell find patches -name *.patch)
#
@ -54,8 +55,8 @@ prepare: $(CONTRIB_DIR)
$(VERBOSE)cd $(CONTRIB_DIR); git fetch; git reset --hard $(GIT_REV)
@# use GCC front end for as linker for the pistachio user land
$(VERBOSE)sed -i "/LD=/s/^.*$$/LD=\$$(CC)/" $(CONTRIB_DIR)/user/config.mk.in
$(ECHO) "applying patches to '$(CONTRIB_DIR)/'"
$(VERBOSE)for i in $(PATCHES); do patch -d $(CONTRIB_DIR) -p1 < $$i; done
@# add '-Wl,' prefix to '-melf_*' linker options
$(VERBOSE)sed -i "s/-melf_/-Wl,-melf_/" `grep -rl melf_ $(CONTRIB_DIR)/user`
$(VERBOSE)for i in cmlcompile.py cmlconfigure.py configtrans.py; do \
sed -i "s/env python/env $(PYTHON2)/" $(CONTRIB_DIR)/contrib/cml2/$$i; done
$(VERBOSE)cd $(CONTRIB_DIR)/user; autoheader; autoconf;

View File

@ -1,20 +0,0 @@
This directory contains patches for the Pistachio microkernel
:'syscalls_ia32.patch':
GCC 4.6 switches from base-pointer-relative addressing to stack-pointer-
relative addressing for memory-input constraints of inline assembler. Therefore
the syscall bindings are adapted to these requirements.
Applying the patches
--------------------
To apply a patch to the Pistachio kernel, use the 'patch' command. First check
the directory given at the header of the patch. It may contain a directory
prefix (such as 'a/'), which does not actually exist. This prefix is usually
generated by the tool used to create the patch. In this case, use the '-p'
option of the patch command. To apply the patch with the first part of the
path stripped, issue the following command (make sure that you changed to
the base directory of the Pistachio kernel):
! patch -p1 < /path/to/utcb.patch

View File

@ -1,280 +0,0 @@
diff --git a/user/include/l4/ia32/syscalls.h b/user/include/l4/ia32/syscalls.h
index 56820e3..2307ed9 100644
--- a/user/include/l4/ia32/syscalls.h
+++ b/user/include/l4/ia32/syscalls.h
@@ -47,6 +47,13 @@
# define __L4_CLOBBER_REGS "ebx", "cc"
#endif
+/*
+ * This expects the '__L4_indirect' struct in 'edi'
+ */
+#define __L4_INDIRECT_CALL " movl 4(%%edi), %%ebx \n" \
+ " movl (%%edi), %%edi \n" \
+ " call *%%ebx \n"
+
#ifdef __cplusplus
#define _C_ "C"
#else
@@ -70,6 +77,13 @@ extern _C_ void __L4_SpaceControl(void);
extern _C_ void __L4_ProcessorControl(void);
extern _C_ void __L4_MemoryControl(void);
+typedef struct __L4_indirect
+{
+ L4_Word_t edi;
+ void (*sys_call)();
+} __L4_indirect;
+
+
L4_INLINE void * L4_KernelInterface (L4_Word_t *ApiVersion,
L4_Word_t *ApiFlags,
L4_Word_t *KernelId)
@@ -163,12 +177,14 @@ L4_INLINE L4_Word_t L4_ThreadControl (L4_ThreadId_t dest,
L4_Word_t result;
L4_Word_t dummy;
+ __L4_indirect in;
+ in.edi = (L4_Word_t)UtcbLocation;
+ in.sys_call = __L4_ThreadControl;
+
__asm__ __volatile__ (
"/* L4_ThreadControl() */ \n"
__L4_SAVE_REGS
- " movl %%edi, %%ebx \n"
- " movl %9, %%edi \n"
- " call *%%ebx \n"
+ __L4_INDIRECT_CALL
__L4_RESTORE_REGS
: /* outputs */
@@ -183,11 +199,10 @@ L4_INLINE L4_Word_t L4_ThreadControl (L4_ThreadId_t dest,
"1" (Pager),
"2" (Scheduler),
"3" (SpaceSpecifier),
- "m" (UtcbLocation),
- "D" (__L4_ThreadControl)
+ "4" (&in)
: /* clobbers */
- __L4_CLOBBER_REGS);
+ __L4_CLOBBER_REGS, "memory");
return result;
}
@@ -239,12 +254,14 @@ L4_INLINE L4_Word_t L4_Schedule (L4_ThreadId_t dest,
L4_Word_t result;
L4_Word_t dummy;
+ __L4_indirect in;
+ in.edi = PreemptionControl;
+ in.sys_call = __L4_Schedule;
+
__asm__ __volatile__ (
"/* L4_Schedule() */ \n"
__L4_SAVE_REGS
- " movl %%edi, %%ebx \n"
- " movl %9, %%edi \n"
- " call *%%ebx \n"
+ __L4_INDIRECT_CALL
__L4_RESTORE_REGS
: /* outputs */
@@ -259,11 +276,11 @@ L4_INLINE L4_Word_t L4_Schedule (L4_ThreadId_t dest,
"1" (PrioControl),
"2" (TimeControl),
"3" (ProcessorControl),
- "m" (PreemptionControl),
- "D" (__L4_Schedule)
+ "4" (&in)
: /* clobbers */
- __L4_CLOBBER_REGS);
+ __L4_CLOBBER_REGS, "memory");
+
return result;
}
@@ -278,14 +295,15 @@ L4_INLINE L4_MsgTag_t L4_Ipc (L4_ThreadId_t to,
L4_Word_t * utcb = __L4_X86_Utcb ();
#if defined(__pic__)
+ __L4_indirect in;
+ in.edi = (L4_Word_t)utcb;
+ in.sys_call = __L4_Ipc;
__asm__ __volatile__ (
"/* L4_Ipc() */ \n"
__L4_SAVE_REGS
- " movl %%eax, %%ebx \n"
- " movl %5, %%eax \n"
- " call *%%ebx \n"
- " movl %%ebp, %%ecx \n"
+ __L4_INDIRECT_CALL
+ " movl %%ebp, %%ecx \n"
" movl %%ebx, %%edx \n"
__L4_RESTORE_REGS
@@ -297,12 +315,12 @@ L4_INLINE L4_MsgTag_t L4_Ipc (L4_ThreadId_t to,
: /* inputs */
"S" (utcb[0]),
- "m" (to.raw),
- "D" (utcb),
+ "a" (to.raw),
+ "D" (&in),
"c" (Timeouts),
- "d" (FromSpecifier),
- "a" (__L4_Ipc)
- );
+ "d" (FromSpecifier)
+
+ : "memory");
#else
L4_Word_t dummy;
@@ -319,7 +337,7 @@ L4_INLINE L4_MsgTag_t L4_Ipc (L4_ThreadId_t to,
"=a" (result),
"=b" (mr1),
"=c" (mr2),
- "=d" (dummy)
+ "=d" (dummy)
: /* inputs */
"S" (utcb[0]),
@@ -351,12 +369,15 @@ L4_INLINE L4_MsgTag_t L4_Lipc (L4_ThreadId_t to,
L4_Word_t * utcb = __L4_X86_Utcb ();
#if defined(__pic__)
+
+ __L4_indirect in;
+ in.edi = (L4_Word_t)utcb;
+ in.sys_call = __L4_Lipc;
+
__asm__ __volatile__ (
"/* L4_Lipc() */ \n"
__L4_SAVE_REGS
- " movl %%eax, %%ebx \n"
- " movl %5, %%eax \n"
- " call *%%ebx \n"
+ __L4_INDIRECT_CALL
" movl %%ebp, %%ecx \n"
" movl %%ebx, %%edx \n"
__L4_RESTORE_REGS
@@ -366,15 +387,15 @@ L4_INLINE L4_MsgTag_t L4_Lipc (L4_ThreadId_t to,
"=a" (result),
"=d" (mr1),
"=c" (mr2)
-
+
: /* inputs */
"S" (utcb[0]),
- "m" (to.raw),
- "D" (utcb),
+ "a" (to.raw),
+ "D" (&in),
"c" (Timeouts),
- "d" (FromSpecifier),
- "a" (__L4_Lipc)
- );
+ "d" (FromSpecifier)
+
+ : "memory");
#else
L4_Word_t dummy;
@@ -382,7 +403,7 @@ L4_INLINE L4_MsgTag_t L4_Lipc (L4_ThreadId_t to,
"/* L4_Lipc() */ \n"
__L4_SAVE_REGS
" call __L4_Lipc \n"
- " movl %%ebp, %%ecx \n"
+ " movl %%ebp, %%ecx \n"
__L4_RESTORE_REGS
: /* outputs */
@@ -390,8 +411,8 @@ L4_INLINE L4_MsgTag_t L4_Lipc (L4_ThreadId_t to,
"=a" (result),
"=b" (mr1),
"=c" (mr2),
- "=d" (dummy)
-
+ "=d" (dummy)
+
: /* inputs */
"S" (utcb[0]),
"a" (to.raw),
@@ -446,12 +467,14 @@ L4_INLINE L4_Word_t L4_SpaceControl (L4_ThreadId_t SpaceSpecifier,
{
L4_Word_t result, dummy;
+ __L4_indirect in;
+ in.edi = redirector.raw;
+ in.sys_call = __L4_SpaceControl;
+
__asm__ __volatile__ (
"/* L4_SpaceControl() */ \n"
__L4_SAVE_REGS
- " movl %%edi, %%ebx \n"
- " movl %9, %%edi \n"
- " call *%%ebx \n"
+ __L4_INDIRECT_CALL
__L4_RESTORE_REGS
: /* outputs */
@@ -466,11 +489,10 @@ L4_INLINE L4_Word_t L4_SpaceControl (L4_ThreadId_t SpaceSpecifier,
"1" (control),
"2" (KernelInterfacePageArea),
"3" (UtcbArea),
- "m" (redirector),
- "D" (__L4_SpaceControl)
+ "4" (&in)
: /* clobbers */
- __L4_CLOBBER_REGS);
+ __L4_CLOBBER_REGS, "memory");
return result;
}
@@ -516,22 +538,23 @@ L4_INLINE L4_Word_t L4_MemoryControl (L4_Word_t control,
L4_Word_t result, dummy;
L4_Word_t * utcb = __L4_X86_Utcb ();
+ __L4_indirect in;
+ in.edi = (L4_Word_t)utcb;
+ in.sys_call = __L4_MemoryControl;
+
__asm__ __volatile__ (
"/* L4_MemoryControl() */ \n"
__L4_SAVE_REGS
- " pushl %%edi \n"
- " movl %8, %%edi \n"
" movl 12(%6), %%ebp \n"
" movl 8(%6), %%ebx \n"
" movl 4(%6), %%edx \n"
" movl (%6), %%ecx \n"
- " call *(%%esp) \n"
- " popl %%edi \n"
+ __L4_INDIRECT_CALL
__L4_RESTORE_REGS
: /* outputs */
"=a" (result),
- "=c" (dummy),
+ "=c" (dummy),
"=d" (dummy),
"=S" (dummy),
"=D" (dummy)
@@ -540,11 +563,10 @@ L4_INLINE L4_Word_t L4_MemoryControl (L4_Word_t control,
"0" (control),
"1" (attributes),
"3" (utcb[0]),
- "m" (utcb),
- "4" (__L4_MemoryControl)
+ "4" (&in)
: /* clobbers */
- __L4_CLOBBER_REGS);
+ __L4_CLOBBER_REGS, "memory");
return result;
}