commit-hurd
[Top][All Lists]
Advanced

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

Re: gnumach ChangeLog i386/i386/gdt.h i386/i386/pcb... [gnumach-1-branch


From: Thomas Schwinge
Subject: Re: gnumach ChangeLog i386/i386/gdt.h i386/i386/pcb... [gnumach-1-branch]
Date: Sun, 5 Nov 2006 22:34:56 +0100
User-agent: Mutt/1.5.6+20040907i

Hello!

> CVSROOT:      /cvsroot/hurd
> Module name:  gnumach
> Branch:               gnumach-1-branch
> Changes by:   Samuel Thibault <sthibaul>      06/11/05 20:39:25
> 
> [...]
>       2006-11-05  Barry deFreese  <address@hidden>
>       
>               [task #5878 --- ``Backport code from GNU Mach's trunk to
>               gnumach-1-branch: i386_set_gdt, i386_get_gdt'']
>       
> [...]
>               * i386/i386/user_ldt.c (i386_set_gdt, i386_get_gdt): New 
> functions.

Since this is a back-port from OSKit Mach's code, it might be interesting
to explain the following divergences from the OSKit code --- perhaps
Roland would like to have these changes explained, as he's written the
original code, if I recall correctly:

#v+
@@ -221,16 +223,16 @@ i386_set_ldt(thread, first_selector, des
[...]
-           else if (thread == current_thread()) {
-               struct x86_desc template = {0, 0, 0, ACC_P, 0, 0 ,0};
+           else {
+               struct real_descriptor template = {0, 0, 0, ACC_P, 0, 0 ,0};
#v-

The following differences might be caused simply by the OSKit Mach code
being different from the GNU Mach one, but you can confirm that more
easily than I could do right now.

#v+
@@ -411,46 +413,45 @@ i386_set_gdt (thread_t thread, int *sele

   if (*selector == -1)
     {
-      for (idx = sel_idx (USER_GDT); idx < sel_idx (USER_GDT) + USER_GDT_SLOTS;
-          ++idx)
+      for (idx = 0; idx < USER_GDT_SLOTS; ++idx)
        if ((thread->pcb->ims.user_gdt[idx].access & ACC_P) == 0)
          {
-           *selector = (idx << 3) | SEL_PL_U;
+            *selector = ((idx + sel_idx(USER_GDT)) << 3) | SEL_PL_U;
            break;
          }
-      if (idx == sel_idx (USER_GDT) + USER_GDT_SLOTS)
+      if (idx == USER_GDT_SLOTS)
        return KERN_NO_SPACE;   /* ? */
     }
   else if ((*selector & (SEL_LDT|SEL_PL)) != SEL_PL_U
-          || sel_idx (*selector) < USER_GDT
-          || sel_idx (*selector) >= USER_GDT + USER_GDT_SLOTS)
+           || sel_idx (*selector) < sel_idx(USER_GDT)
+           || sel_idx (*selector) >= sel_idx(USER_GDT) + USER_GDT_SLOTS)
     return KERN_INVALID_ARGUMENT;
   else
-    idx = sel_idx (*selector);
+    idx = sel_idx (*selector) - sel_idx(USER_GDT);

-  if ((desc->access & ACC_P) == 0)
+  if ((desc.access & ACC_P) == 0)
     memset (&thread->pcb->ims.user_gdt[idx], 0,
            sizeof thread->pcb->ims.user_gdt[idx]);
-  else if ((desc->access & (ACC_TYPE|ACC_PL)) != (ACC_TYPE_USER|ACC_PL_U))
+  else if ((desc.access & (ACC_TYPE_USER|ACC_PL)) != (ACC_TYPE_USER|ACC_PL_U))
     return KERN_INVALID_ARGUMENT;
   else
-    thread->pcb->ims.user_gdt[idx] = *desc;
+    thread->pcb->ims.user_gdt[idx] = desc;

   return KERN_SUCCESS;
 }
[...]
[i386_get_gdt]
   if ((selector & (SEL_LDT|SEL_PL)) != SEL_PL_U
-      || sel_idx (selector) < USER_GDT
-      || sel_idx (selector) >= USER_GDT + USER_GDT_SLOTS)
+      || sel_idx (selector) < sel_idx(USER_GDT)
+      || sel_idx (selector) >= sel_idx(USER_GDT) + USER_GDT_SLOTS)
     return KERN_INVALID_ARGUMENT;

-  *desc = thread->pcb->ims.user_gdt[sel_idx (selector)];
+  *desc = thread->pcb->ims.user_gdt[sel_idx (selector) - sel_idx(USER_GDT)];
#v-


Please also add a note to the ChangeLog that this commit is a back-port,
see the Roland McGrath ChangeLog entry from 2006-05-14 for an idea how
this might look like.


>               * linux/dev/include/linux/head.h: New file.

Please move that file to `linux/src/include/linux/head.h' (and then add a
proper ChangeLog entry for that file).  I'm not going to follow the `src'
vs. `dev' distinction any further.


Thanks for completing this task!


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


reply via email to

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