Hi Mansur,

> I added following lines In Makefile:
> ...
>     ifeq ($(MAKECMDGOALS), x86-64.freeBsd)
> ...
> ifeq ($(UNAME), FreeBSD)
> ...

This looks all right.

> (.text+0x459): undefined reference to `stderr'

So this looks like 'stderr' etc. are not direct global variables, but
macros of some kind. For SunOS we have a similar case, so that
"x86-64.sunOs.defs.l" defines

   (equ stdin  "$__iob")
   (equ stdout "$__iob+128")
   (equ stderr "$__iob+256")

Can you find out how 'stderr' is defined in the stdio includes?

> I don't know how to change x86-64.freeBsd.code.l
> I found this in "man errno":
> extern int * __error();
> #define errno (* __error())

The Pil64 assembly code used the convention that the registers of the
arguments and return values of a function are encoded into the name. A
function 'fooAE_CXY' would expect arguments in 'A' and 'E', and return
values in 'C', 'X' and 'Y'.

Thus, the function 'errno_A' should return the error code in 'A'. From
your "man errno" above I would suspect that the correct implementation

   (code 'errno_A 0)    
      call __errno  # Get address of 'errno'
      ld4 (A)  # Load value

I.e. '__error()' corresponds to 'call __errno', and 'ld4' then fetches
an 'int' (a 4-byte value).

♪♫ Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to