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

Re: glibc on kfreebsd-amd64 (was: Re: segfaults on amd64, one more update)

> > More complex programs like grep work fine, too.  I'm running glibc testsuite
> > now, and will run coreutils testsuite within a few minutes.
> Strange.  It seems even though you fixed it for dynamicaly linked binaries,
> static ones do still exhibit this problem (segfault in exit.c:60).
> Any idea why?

Can you try to add to kernel sources, into file sys/amd64/amd64/machdep.c
function exec_setregs(td, entry, stack, ps_strings)
somewhere at the end

	pcb->pcb_flags |= PCB_FULLCTX;

The definition of argument passing into _startup is in ABI
since draft 0.94 (January 2005).

%rsp - 16-byte aligned pointer to stack, on top of stack is argc
%rdx - destructor function or zero for none

It was probably too late for FreeBSD to conform :-(

It uses 8-byte aligned %rdi for argc, %rsp is aligned %rdi.
All other registers are cleared, but without PCB_FULLCTX,
some are used internally for context switch.

Other solution without changing FreeBSD sources is to use %rsi 
instead of %rdx. It is cleared also without PCB_FULLCTX.
It might be better - non-threaded application will work also on stock 

Should I prepare changes for 2nd variant ?


Reply to: