l4-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] More libl4 updates


From: Peter Bruin
Subject: [PATCH] More libl4 updates
Date: Wed, 4 Aug 2004 23:35:56 +0200
User-agent: Internet Messaging Program (IMP) 3.2.1

Hi,

Here is an update for libl4 to conform to the latest L4 specification
from l4ka.org.  The only machine-independent changes are the removal
of the parameter `control' of the processor_control system call and a
small bugfix in schedule.h; the rest is PowerPC-specific.  I've
compared the libl4 code to the specification, and also the powerpc
code to the ia32 code.  All these things seems to be consistent now.

Thanks,
Peter

P.S.  The fix for a bug in l4/gnu/misc.h in a previous patch seems to
have been inadvertently omitted (the rest of the patch was applied).
It is again in this patch.


2004-08-04  Peter Bruin  <address@hidden>

        * l4/schedule.h (_L4_set_priority): Use mask consisting of
        lower 8 bits instead of lower 16.
        (_L4_set_processor_no): Use mask consisting of lower 16 bits
        instead of lower 8.

        * powerpc/l4/bits/syscall.h (__L4_PPC_XCLOB): Move r18 and r19
        to ...
        (__L4_PPC_CLOB): ... here.
        (_L4_system_clock): Interchange registers used for TIME_LOW and
        TIME_HIGH.
        (_L4_unmap): Pass the first 10 message registers in physical
        registers to comply with L4 ABI change.
        (_L4_memory_control): Likewise.
        (_L4_ipc): Add r18 and r19 to list of clobbered registers.
        (_L4_lipc): Likewise.

        * ia32/l4/bits/syscall.h (_L4_processor_control): Remove parameter
        CONTROL to comply with L4 API change.
        * l4/compat/misc.h (L4_ProcessorControl): Likewise.
        * l4/gnu/misc.h: Likewise.


Index: libl4/ia32/l4/bits/syscall.h
===================================================================
RCS file: /cvsroot/hurd/hurd-l4/libl4/ia32/l4/bits/syscall.h,v
retrieving revision 1.6
diff -u -r1.6 syscall.h
--- libl4/ia32/l4/bits/syscall.h        1 Apr 2004 00:59:55 -0000       1.6
+++ libl4/ia32/l4/bits/syscall.h        4 Aug 2004 18:54:42 -0000
@@ -276,9 +276,8 @@
 
 static inline _L4_word_t
 _L4_attribute_always_inline
-_L4_processor_control (_L4_word_t proc, _L4_word_t control,
-                      _L4_word_t int_freq, _L4_word_t ext_freq,
-                      _L4_word_t voltage)
+_L4_processor_control (_L4_word_t proc, _L4_word_t int_freq,
+                      _L4_word_t ext_freq, _L4_word_t voltage)
 {
   _L4_word_t result;
   _L4_word_t dummy;
@@ -287,10 +286,10 @@
                        "call *__l4_processor_control\n"
                        "pop %%ebp\n"
                        : "=a" (result), "=c" (dummy),
-                       "=d" (dummy), "=S" (dummy), "=D" (dummy)
-                       : "a" (proc), "c" (control), "d" (int_freq),
-                       "S" (ext_freq), "D" (voltage)
-                       : "ebx");
+                       "=d" (dummy), "=S" (dummy)
+                       : "a" (proc), "c" (int_freq), "d" (ext_freq),
+                       "S" (voltage)
+                       : "edi", "ebx");
   return result;
 }
 
Index: libl4/l4/compat/misc.h
===================================================================
RCS file: /cvsroot/hurd/hurd-l4/libl4/l4/compat/misc.h,v
retrieving revision 1.1
diff -u -r1.1 misc.h
--- libl4/l4/compat/misc.h      16 Mar 2004 03:34:03 -0000      1.1
+++ libl4/l4/compat/misc.h      4 Aug 2004 18:54:42 -0000
@@ -29,11 +29,10 @@
 /* Generic Programming Interface.  */
 static inline L4_Word_t
 _L4_attribute_always_inline
-L4_ProcessorControl (L4_Word_t ProcessorNo, L4_Word_t control,
-                    L4_Word_t InternalFrequency,
+L4_ProcessorControl (L4_Word_t ProcessorNo, L4_Word_t InternalFrequency,
                     L4_Word_t ExternalFrequency, L4_Word_t voltage)
 {
-  return _L4_processor_control (ProcessorNo, control, InternalFrequency,
+  return _L4_processor_control (ProcessorNo, InternalFrequency,
                                ExternalFrequency, voltage);
 }
 
Index: libl4/l4/gnu/misc.h
===================================================================
RCS file: /cvsroot/hurd/hurd-l4/libl4/l4/gnu/misc.h,v
retrieving revision 1.1
diff -u -r1.1 misc.h
--- libl4/l4/gnu/misc.h 16 Mar 2004 03:34:03 -0000      1.1
+++ libl4/l4/gnu/misc.h 4 Aug 2004 18:54:42 -0000
@@ -25,11 +25,10 @@
 
 static inline l4_word_t
 _L4_attribute_always_inline
-l4_processor_control (l4_word_t proc, l4_word_t control,
-                     l4_word_t internal_freq, l4_word_t external_freq,
-                     l4_word_t voltage)
+l4_processor_control (l4_word_t proc, l4_word_t internal_freq,
+                     l4_word_t external_freq, l4_word_t voltage)
 {
-  return _L4_processor_control (proc, control, internal_freq, external_freq,
+  return _L4_processor_control (proc, internal_freq, external_freq,
                                voltage);
 }
 
Index: libl4/l4/gnu/thread.h
===================================================================
RCS file: /cvsroot/hurd/hurd-l4/libl4/l4/gnu/thread.h,v
retrieving revision 1.2
diff -u -r1.2 thread.h
--- libl4/l4/gnu/thread.h       10 Apr 2004 16:51:44 -0000      1.2
+++ libl4/l4/gnu/thread.h       4 Aug 2004 18:54:42 -0000
@@ -271,7 +271,7 @@
 _L4_attribute_always_inline
 l4_set_xfer_timeouts (l4_word_t timeouts)
 {
-  return _L4_set_xfer_timeouts (timeouts);
+  _L4_set_xfer_timeouts (timeouts);
 }
 
 
Index: libl4/powerpc/l4/bits/syscall.h
===================================================================
RCS file: /cvsroot/hurd/hurd-l4/libl4/powerpc/l4/bits/syscall.h,v
retrieving revision 1.7
diff -u -r1.7 syscall.h
--- libl4/powerpc/l4/bits/syscall.h     3 Aug 2004 11:48:56 -0000       1.7
+++ libl4/powerpc/l4/bits/syscall.h     4 Aug 2004 18:54:43 -0000
@@ -31,14 +31,14 @@
 
 /* These are the clobber registers.  R1, R2, R30, R31, and all
    floating point registers are preserved.  R3 to R10 are used in
-   system calls and thus are not in this list.  Up to R17 is used in
-   the IPC system calls.  */
-#define __L4_PPC_XCLOB "r18", "r19",                                   \
+   system calls and thus are not in this list.  Up to R19 is used in
+   the memory_control system call.  */
+#define __L4_PPC_XCLOB                                                 \
   "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29",        
\
   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", "xer",        \
   "ctr", "lr", "memory"
 #define __L4_PPC_CLOB "r0", "r11", "r12", "r13", "r14", "r15", "r16",  \
-  "r17", __L4_PPC_XCLOB
+  "r17", "r18", "r19", __L4_PPC_XCLOB
 
 
 /* Return the pointer to the kernel interface page, the API version,
@@ -127,12 +127,12 @@
 _L4_attribute_always_inline
 _L4_system_clock (void)
 {
-  register _L4_word_t time_low asm ("r3");
-  register _L4_word_t time_high asm ("r4");
+  register _L4_word_t time_high asm ("r3");
+  register _L4_word_t time_low asm ("r4");
 
   __asm__ __volatile__ ("mtctr %[addr]\n"
                        "bctrl\n"
-                       : "=r" (time_low), "=r" (time_high)
+                       : "=r" (time_high), "=r" (time_low)
                        : [addr] "r" (__l4_system_clock)
                        : "r5", "r6", "r7", "r8", "r9", "r10",
                        __L4_PPC_CLOB);
@@ -151,7 +151,8 @@
                        "bctrl\n"
                        :
                        : "r" (dest_raw), [addr] "r" (__l4_thread_switch)
-                       : __L4_PPC_CLOB);
+                       : "r4", "r5", "r6", "r7", "r8", "r9", "r10",
+                       __L4_PPC_CLOB);
 }
 
 
@@ -183,14 +184,38 @@
 _L4_attribute_always_inline
 _L4_unmap (_L4_word_t control)
 {
-  register _L4_word_t ctrl asm ("r3") = control;
+  _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0;
+  register _L4_word_t mr9 asm ("r0") = mr[9];
+  register _L4_word_t mr1 asm ("r3") = mr[1];
+  register _L4_word_t mr2 asm ("r4") = mr[2];
+  register _L4_word_t mr3 asm ("r5") = mr[3];
+  register _L4_word_t mr4 asm ("r6") = mr[4];
+  register _L4_word_t mr5 asm ("r7") = mr[5];
+  register _L4_word_t mr6 asm ("r8") = mr[6];
+  register _L4_word_t mr7 asm ("r9") = mr[7];
+  register _L4_word_t mr8 asm ("r10") = mr[8];
+  register _L4_word_t mr0 asm ("r14") = mr[0];
+  register _L4_word_t ctrl asm ("r15") = control;
 
   __asm__ __volatile__ ("mtctr %[addr]\n"
                        "bctrl\n"
-                       :
+                       : "+r" (mr9), "+r" (mr1), "+r" (mr2), "+r" (mr3),
+                       "+r" (mr4), "+r" (mr5), "+r" (mr6), "+r" (mr7),
+                       "+r" (mr8), "+r" (mr0)
                        : "r" (ctrl), [addr] "r" (__l4_unmap)
-                       : "r4", "r5", "r6", "r7", "r8", "r9", "r10",
-                       __L4_PPC_CLOB);
+                       : "r11", "r12", "r13", "r16", "r17", "r18", "r19",
+                       __L4_PPC_XCLOB);
+
+  mr[0] = mr0;
+  mr[1] = mr1;
+  mr[2] = mr2;
+  mr[3] = mr3;
+  mr[4] = mr4;
+  mr[5] = mr5;
+  mr[6] = mr6;
+  mr[7] = mr7;
+  mr[8] = mr8;
+  mr[9] = mr9;
 }
 
 
@@ -245,7 +270,8 @@
                        "+r" (mr8), "+r" (mr0), "+r" (from_spec_raw)
                        : "r" (to_raw), "r" (time_outs),
                        [addr] "r" (__l4_ipc)
-                       : "r11", "r12", "r13", __L4_PPC_XCLOB);
+                       : "r11", "r12", "r13", "r18", "r19",
+                       __L4_PPC_XCLOB);
 
   /* FIXME: Make it so that we can use l4_is_nilthread?  */
   if (from_spec_raw)
@@ -292,7 +318,8 @@
                        "+r" (mr8), "+r" (mr0), "+r" (from_spec_raw)
                        : "r" (to_raw), "r" (time_outs),
                        [addr] "r" (__l4_lipc)
-                       : "r11", "r12", "r13", __L4_PPC_XCLOB);
+                       : "r11", "r12", "r13", "r18", "r19",
+                       __L4_PPC_XCLOB);
 
   /* FIXME: Make it so that we can use l4_is_nilthread?  */
   if (from_spec_raw)
@@ -338,19 +365,32 @@
 _L4_attribute_always_inline
 _L4_memory_control (_L4_word_t control, _L4_word_t *attributes)
 {
-  register _L4_word_t ctrl_result asm ("r3") = control;
-  register _L4_word_t attr0 asm ("r4") = attributes[0];
-  register _L4_word_t attr1 asm ("r5") = attributes[1];
-  register _L4_word_t attr2 asm ("r6") = attributes[2];
-  register _L4_word_t attr3 asm ("r7") = attributes[3];
+  _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0;
+  register _L4_word_t mr9 asm ("r0")  = mr[9];
+  register _L4_word_t mr1_result asm ("r3") = mr[1];
+  register _L4_word_t mr2 asm ("r4") = mr[2];
+  register _L4_word_t mr3 asm ("r5") = mr[3];
+  register _L4_word_t mr4 asm ("r6") = mr[4];
+  register _L4_word_t mr5 asm ("r7") = mr[5];
+  register _L4_word_t mr6 asm ("r8") = mr[6];
+  register _L4_word_t mr7 asm ("r9") = mr[7];
+  register _L4_word_t mr8 asm ("r10") = mr[8];
+  register _L4_word_t mr0 asm ("r14") = mr[0];
+  register _L4_word_t ctrl asm ("r15") = control;
+  register _L4_word_t attr0 asm ("r16") = attributes[0];
+  register _L4_word_t attr1 asm ("r17") = attributes[1];
+  register _L4_word_t attr2 asm ("r18") = attributes[2];
+  register _L4_word_t attr3 asm ("r19") = attributes[3];
 
   __asm__ __volatile__ ("mtctr %[addr]\n"
                        "bctrl\n"
-                       : "+r" (ctrl_result)
-                       : "r" (ctrl_result), "r" (attr0), "r" (attr1),
+                       : "+r" (mr1_result)
+                       : "r" (mr9), "r" (mr2), "r" (mr3), "r" (mr4),
+                       "r" (mr5), "r" (mr6), "r" (mr7), "r" (mr8),
+                       "r" (mr0), "r" (ctrl), "r" (attr0), "r" (attr1),
                        "r" (attr2), "r" (attr3),
                        [addr] "r" (__l4_memory_control)
-                       : "r8", "r9", "r10", __L4_PPC_CLOB);
+                       : __L4_PPC_XCLOB);
 
-  return ctrl_result;
+  return mr1_result;
 }
Index: libl4/l4/schedule.h
===================================================================
RCS file: /cvsroot/hurd/hurd-l4/libl4/l4/schedule.h,v
retrieving revision 1.4
diff -u -r1.4 schedule.h
--- libl4/l4/schedule.h 18 Mar 2004 02:13:31 -0000      1.4
+++ libl4/l4/schedule.h 4 Aug 2004 21:21:08 -0000
@@ -182,7 +182,7 @@
 _L4_attribute_always_inline
 _L4_set_priority (_L4_thread_id_t dest, _L4_word_t priority)
 {
-  _L4_word_t prio = priority & ((1 << 16) - 1);
+  _L4_word_t prio = priority & ((1 << 8) - 1);
   _L4_word_t dummy;
   return _L4_schedule (dest, -1, -1, prio, -1, &dummy);
 }
@@ -192,7 +192,7 @@
 _L4_attribute_always_inline
 _L4_set_processor_no (_L4_thread_id_t dest, _L4_word_t proc_num)
 {
-  _L4_word_t proc = proc_num & ((1 << 8) - 1);
+  _L4_word_t proc = proc_num & ((1 << 16) - 1);
   _L4_word_t dummy;
   return _L4_schedule (dest, -1, proc, -1, -1, &dummy);
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]