On Thu, May 12, 2011 at 7:12 PM, Blue Swirl <blauwir...@gmail.com> wrote: > On Thu, May 12, 2011 at 12:54 PM, Stefan Hajnoczi > <stefa...@linux.vnet.ibm.com> wrote: >> diff --git a/coroutine-ucontext.c b/coroutine-ucontext.c >> new file mode 100644 >> index 0000000..3b14ebf >> --- /dev/null >> +++ b/coroutine-ucontext.c >> @@ -0,0 +1,73 @@ >> +/* >> + * ucontext coroutine initialization code >> + * >> + * Copyright (C) 2006 Anthony Liguori <anth...@codemonkey.ws> >> + * Copyright (C) 2011 Kevin Wolf <kw...@redhat.com> >> + * >> + * This library is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU Lesser General Public >> + * License as published by the Free Software Foundation; either >> + * version 2.0 of the License, or (at your option) any later version. >> + * >> + * This library is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + * Lesser General Public License for more details. >> + * >> + * You should have received a copy of the GNU Lesser General Public >> + * License along with this library; if not, write to the Free Software >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >> 02110-1301 USA > > Please use the web link version.
Will update in v3. >> + */ >> + >> +/* XXX Is there a nicer way to disable glibc's stack check for longjmp? */ > > What is the problem? Kevin? >> +static __thread Coroutine leader; > > $ cat thread.c > static __thread int sigusr1_wfd; > $ gcc thread.c -c -pthread > thread.c:1: error: thread-local storage not supported for this target > $ gcc -v > Reading specs from > /usr/bin/../lib/gcc-lib/sparc64-unknown-openbsd4.9/4.2.1/specs > Target: sparc64-unknown-openbsd4.9 > Configured with: OpenBSD/sparc64 system compiler > Thread model: posix > gcc version 4.2.1 20070719 We had the thread-local variables in as part of the gtk-vnc history of this code. In QEMU we don't need it: "Note that coroutines never execute concurrently and should only be used from threads which hold the global mutex." So I will remove the thread-local attribute. Thank you for testing that platform. >> diff --git a/trace-events b/trace-events >> index 4f965e2..2d4db05 100644 >> --- a/trace-events >> +++ b/trace-events >> @@ -361,3 +361,8 @@ disable milkymist_uart_pulse_irq_tx(void) "Pulse IRQ TX" >> # hw/milkymist-vgafb.c >> disable milkymist_vgafb_memory_read(uint32_t addr, uint32_t value) "addr >> %08x value %08x" >> disable milkymist_vgafb_memory_write(uint32_t addr, uint32_t value) "addr >> %08x value %08x" >> + >> +# qemu-coroutine.c >> +qemu_coroutine_enter(void *from, void *to, void *opaque) "from %p to %p >> opaque %p" >> +qemu_coroutine_yield(void *from, void *to) "from %p to %p" >> +qemu_coroutine_terminate(void *co) "self %p" > > Not disabled? Good catch. Stefan