[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:12 May 2005 19:26:04 -0700 
Subject:Porting problems 
From:Pete Goodeve 
Volume-ID: 


Hi all.  I've finally [after several years!] got round to a serious
effort to port poplog (15.53) to the Be OS.  However, progress is
painful, and I'm hoping soemone here may have a pointer or two.

As a basis, BeOS on the x86 machines uses a standard ELF object format
and the gcc compiler, so the linux files are a good start.  Of course
the executables do not actually execute, becuase libraries don't match.

I first tried poplink_cmnd to see if I could create runnable files,
but got a lot of undefined references.  The next step was to go into
the .../extern/lib directory and run mklibpop. This threw up a few
incompatibilities, which I've tried to write some patches for (see below),
I finally got to where I can run poplink_cmnd without errors and actually
get a newpop11 that "runs".  Only it doesn't... (:-/)  It simply comes
back to the shell with no messages at all.

I've tried to get some inkling of what's happening by using the Be debugger,
but unfortunately that doesn't work very well if things weren't compiled
for the debugger, and that's hard as (as far as I can see) a lot of the
build process reaaly needs pop11 to work.  I can certainly see it going
through a lot of the initialization, but eventually (somewhere) it just
quits.

It's quite likely that one of my patches is actually the problem (though
it could equally well not be...) and I don't really understand the
functions of a lot of the things I changed, so let me go through them
and see if someone can clarify.  (I added a couple of items to c_core.h
and wrote a "dummy.c" to provide some unix system calls that BeOS
doesn't have.)

First, there is '___brk_addr' in 'aextern.s'.  I've actually scoured
my linux system to see if I could find any reference to this, but failed,
so I really have no idea whther something like it is needed or not.
I gather it has something to do with available stack, and I know that
stack space is completely different on Be from Linux (but I don't
remember how!)  I assumed for now that it *is* unused, and provided
a dummy address (containing 0).

There were some signals that BeOS doesn't know about so I added some
values for these into c_core.h.  'SIGEMT' became 'SIGTRAP', and the
others -- SIGURG, SIGIO, and SIGVTALARM -- were assigned available
spare numbers.  I would guess that these are not relevant to initialization,
so are probably not the problem.

To bypass some other undefined symbols, I forced SIM_ASYNC_IO true.
Not sure if this was correct, but again probably not relevant at
this point.

Other patches -- probably more relevant -- were needed for getpagesize()
and getrlimit(...), neither of which is available.  The first I simply
replaced with the system constant 'B_PAGE_SIZE', which I believe should
be correct.  The second needed a dummy function that fills in the 'rlimit'
structure.  I'm just supplying large (INT_MAX) values here, assuming that
it might be wrong but wouldn't cause an immedate crash.  I did establish
with the debugger that this function is being called, and tried setting
smaller limits (64K) but it made no difference.

I also had to provide a dummy 'gethostid()', but as far as I can see
this doesn't even get invoked (yet).

Finally, BeOS doesn't have the unix 'real' and 'virtual' interval timers,
so I actually added my own in pop_timer.c (using threads), but again
I don't imagine this is affecting anything yet.

--------------

So, does anyone have a suggestion as to where I might go from here?
I can probably compile anything to object module on linux and then
bring it over to BeOS to link.  As long as I don't have to change pop11
source, I suppose I could handle assembly of '.s' files on BeOS too,
but I'm not sure if that's sufficient.

Thanks,
					-- Pete --