Discussion:
Using function "_bheapseg" under OS/2 (use of high memory)
(too old to reply)
Lars Erdmann
2015-12-14 06:55:24 UTC
Permalink
I am using the OS/2 version of the compiler.
I am looking for a way to manage a heap in high memory (above the 512 MB
address).

For OS/2, will _bheapseg allocate a heap in the conventional memory
(below 512 MB) or will it attempt to allocate in high memory if possible ?

Is there any way to influence this with an OS/2 specific compiler switch
or some define ?

Thanks,
Lars
Lars Erdmann
2015-12-14 07:03:03 UTC
Permalink
Forgot to ask:

how do you convert (under OS/2 and using high memory if possible) a
based address (which _bmalloc returns) into a full 32-bit linear address ?
I would appreciate if someone could provide a small code snippet ...
If all of this does not work under 32-bit OS/2, does anyone know any
other functions in the Watcom RTL that would allow me to manage a heap
in high memory ?


Lars
Post by Lars Erdmann
I am using the OS/2 version of the compiler.
I am looking for a way to manage a heap in high memory (above the 512 MB
address).
For OS/2, will _bheapseg allocate a heap in the conventional memory
(below 512 MB) or will it attempt to allocate in high memory if possible ?
Is there any way to influence this with an OS/2 specific compiler switch
or some define ?
Thanks,
Lars
Steven Levine
2015-12-14 15:07:06 UTC
Permalink
On Mon, 14 Dec 2015 07:03:03 UTC, Lars Erdmann <***@arcor.de>
wrote:

Hi Lars,
Post by Lars Erdmann
how do you convert (under OS/2 and using high memory if possible) a
based address (which _bmalloc returns) into a full 32-bit linear address ?
You don't. _bmalloc is supported only by wcc. Check the docs or the
malloc.h #ifdefs.
Post by Lars Erdmann
If all of this does not work under 32-bit OS/2, does anyone know any
other functions in the Watcom RTL that would allow me to manage a heap
in high memory ?
I implemented high memory support so that we could link the Mozilla
apps.

See malloc.h for:

#if defined(__OS2__) && defined(__386__)
_WCRTLINK int _use_os2_high_mem( int fUseHighMem ); /* Returns prior
setting */
_WCRTLINK void *_os2lmalloc( size_t amount );
_WCRTLINK void *_os2hmalloc( size_t amount );
#endif

It's on my list to update the runtime library docs. That said, usage
is pretty straightforward. _use_os2_high_mem sets the global
allocation strategy used by malloc and friends. The default is low
memory only for backwards compatibility. _os2lmalloc and _os2hmalloc
override the global strategy for the current call.

This all works similar to the gcc libc implementation. However, there
are no os2safe wrappers yet.

Of course you will need an OpenWatcom built from the current depot
sources to use these functions.

Have fun,

Steven
--
---------------------------------------------------------------------
Steven Levine <***@earthlink.bogus.net>
DIY/Warp/eCS etc. www.scoug.com
---------------------------------------------------------------------
Frank Beythien
2015-12-14 08:51:36 UTC
Permalink
Post by Steven Levine
Hi Lars,
Post by Lars Erdmann
how do you convert (under OS/2 and using high memory if possible) a
based address (which _bmalloc returns) into a full 32-bit linear address ?
You don't. _bmalloc is supported only by wcc. Check the docs or the
malloc.h #ifdefs.
Post by Lars Erdmann
If all of this does not work under 32-bit OS/2, does anyone know any
other functions in the Watcom RTL that would allow me to manage a heap
in high memory ?
I implemented high memory support so that we could link the Mozilla
apps.
#if defined(__OS2__) && defined(__386__)
_WCRTLINK int _use_os2_high_mem( int fUseHighMem ); /* Returns prior
setting */
_WCRTLINK void *_os2lmalloc( size_t amount );
_WCRTLINK void *_os2hmalloc( size_t amount );
#endif
It's on my list to update the runtime library docs. That said, usage
is pretty straightforward. _use_os2_high_mem sets the global
allocation strategy used by malloc and friends. The default is low
memory only for backwards compatibility. _os2lmalloc and _os2hmalloc
override the global strategy for the current call.
This all works similar to the gcc libc implementation. However, there
are no os2safe wrappers yet.
Of course you will need an OpenWatcom built from the current depot
sources to use these functions.
You can try http://efbe.musca.uberspace.de for an OS/2 build from
current perforce data.
Post by Steven Levine
Have fun,
Steven
CU/2
Frank
Lars Erdmann
2015-12-14 19:36:35 UTC
Permalink
Post by Frank Beythien
Post by Steven Levine
Of course you will need an OpenWatcom built from the current depot
sources to use these functions.
You can try http://efbe.musca.uberspace.de for an OS/2 build from
current perforce data.
Post by Steven Levine
Have fun,
Steven
CU/2
Frank
Great. Thanks ! I am downloading right now ...

Lars

Lars Erdmann
2015-12-14 19:34:43 UTC
Permalink
Post by Steven Levine
Hi Lars,
I implemented high memory support so that we could link the Mozilla
apps.
#if defined(__OS2__) && defined(__386__)
_WCRTLINK int _use_os2_high_mem( int fUseHighMem ); /* Returns prior
setting */
_WCRTLINK void *_os2lmalloc( size_t amount );
_WCRTLINK void *_os2hmalloc( size_t amount );
#endif
It's on my list to update the runtime library docs. That said, usage
is pretty straightforward. _use_os2_high_mem sets the global
allocation strategy used by malloc and friends. The default is low
memory only for backwards compatibility. _os2lmalloc and _os2hmalloc
override the global strategy for the current call.
This all works similar to the gcc libc implementation. However, there
are no os2safe wrappers yet.
Of course you will need an OpenWatcom built from the current depot
sources to use these functions.
Have fun,
Steven
Ok. Thanks for the info. Currently I am at OpenWatcom 1.9 which does not
have that included yet. I'll pick it up if it becomes available or if I
get the current OpenWatcom sources downloaded and built.

Lars
Loading...