All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Mini-os get_current() fixup
@ 2007-10-15 16:23 Samuel Thibault
  2007-10-15 16:30 ` Samuel Thibault
       [not found] ` <20071018145006.GM4003@implementation.uk.xensource.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Samuel Thibault @ 2007-10-15 16:23 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

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

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 623 bytes --]

diff -r 3746b3d4f301 extras/mini-os/include/x86/arch_sched.h
--- a/extras/mini-os/include/x86/arch_sched.h	Thu Feb 22 15:26:21 2007 +0000
+++ b/extras/mini-os/include/x86/arch_sched.h	Mon Oct 15 17:23:01 2007 +0100
@@ -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;
 }

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Mini-os get_current() fixup
  2007-10-15 16:23 [PATCH] Mini-os get_current() fixup Samuel Thibault
@ 2007-10-15 16:30 ` Samuel Thibault
       [not found] ` <20071018145006.GM4003@implementation.uk.xensource.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2007-10-15 16:30 UTC (permalink / raw)
  To: xen-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Mini-os xenbus wait fixup
       [not found] ` <20071018145006.GM4003@implementation.uk.xensource.com>
@ 2007-10-24 13:31   ` Samuel Thibault
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2007-10-24 13:31 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

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

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 390 bytes --]

diff -r b28ae5f00553 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c	Tue Oct 23 09:26:43 2007 +0100
+++ b/extras/mini-os/xenbus/xenbus.c	Wed Oct 24 14:27:10 2007 +0100
@@ -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)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-24 13:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-15 16:23 [PATCH] Mini-os get_current() fixup Samuel Thibault
2007-10-15 16:30 ` Samuel Thibault
     [not found] ` <20071018145006.GM4003@implementation.uk.xensource.com>
2007-10-24 13:31   ` [PATCH] Mini-os xenbus wait fixup Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.