cvs commit: src/lib/libc/i386/sys getcontext.S

Peter Wemm peter at
Wed Sep 3 17:20:42 PDT 2003

peter       2003/09/03 17:20:40 PDT

  FreeBSD src repository

  Modified files:
  Added files:
    lib/libc/i386/sys    getcontext.S 
  Make getcontext(2) work on i386.  It needs a small wrapper in libc
  otherwise the return from the syscall stub for getcontext will pop off
  the return value for the caller to the getcontext stub and it will appear
  as though the setcontext() syscall returned instead of the getcontext().
  The same bug exists on amd64, a fix is coming there too.
  The bug can be demonstrated with this test code fragment:
          ucontext_t top;
          if (getcontext(&top) == 0) {
                  write(2, "PING!\n", 6);
                  /* Cause a return value of 1 from getcontext this time */
                  top.uc_mcontext.mc_eax = 1;
                  err(1, "setcontext() returned");
          write(2, "PONG!\n", 6);
  Revision  Changes    Path
  1.27      +2 -2      src/lib/libc/i386/sys/
  1.1       +50 -0     src/lib/libc/i386/sys/getcontext.S (new)

More information about the cvs-src mailing list