Skip to contentSkip to conversation

Mini-os get_current() fixup

PATCH In review Samuel Thibault 1 participant 3 messages Oct 15, 2007 – Oct 24, 2007 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Mini-os get_current() fixup

Hi,

I'm currently playing with mini-os, and noticed bogus code:

0x00019301 <do_page_fault+81>:  mov    $0x1,%ecx
0x00019306 <do_page_fault+86>:  mov    $0xffffe000,%eax
0x0001930b <do_page_fault+91>:  mov    %ecx,0x32980
0x00019311 <do_page_fault+97>:  and    %esp,%edx
0x00019313 <do_page_fault+99>:  mov    (%edx),%ecx
0x00019315 <do_page_fault+101>: mov    (%ecx),%eax

Which is supposed to approximately correspond to get_current(). It happens that %edx is never set to 0xfffff000. The attached patch fixes that.

Samuel

extras/mini-os/include/x86/arch_sched.h +2 -2
diff -r 3746b3d4f301 extras/mini-os/include/x86/arch_sched.h
@@ -7,9 +7,9 @@ static inline struct thread* get_current
 {
     struct thread **current;
 #ifdef __i386__    
-    __asm__("andl %%esp,%0; ":"=r" (current) : "r" (~8191UL));
+    __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
 #else
-    __asm__("andq %%rsp,%0; ":"=r" (current) : "r" (~8191UL));
+    __asm__("andq %%rsp,%0; ":"=r" (current) : "0" (~8191UL));
 #endif 
     return *current;
 }

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

#1 lore raw
Quoted 9 lines · Samuel Thibault, le Mon 15 Oct 2007 17:23:32 +0100, a écrit :
0x00019301 <do_page_fault+81>:  mov    $0x1,%ecx
0x00019306 <do_page_fault+86>:  mov    $0xffffe000,%eax
0x0001930b <do_page_fault+91>:  mov    %ecx,0x32980
0x00019311 <do_page_fault+97>:  and    %esp,%edx
0x00019313 <do_page_fault+99>:  mov    (%edx),%ecx
0x00019315 <do_page_fault+101>: mov    (%ecx),%eax

Which is supposed to approximately correspond to get_current(). It happens that %edx is never set to 0xfffff000. The attached patch fixes

(I meant 0xffffe000 of course)

Samuel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Re: [PATCH] Mini-os xenbus wait fixup

Hi,

I'm getting spurious wakes and crashes when using xenbus_wake_for_value. It looks to me like the attached patch is needed because else the wait element is kept in the watch queue (just like in the wait_event() macro, and it does fix my issues).

Samuel

extras/mini-os/xenbus/xenbus.c +1 -0
diff -r b28ae5f00553 extras/mini-os/xenbus/xenbus.c
@@ -79,6 +79,7 @@ void wait_for_watch(void)
     schedule();
     remove_waiter(w);
     wake(current);
+    remove_wait_queue(&w);
 }
 
 char* xenbus_wait_for_value(const char* path,const char* value)

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