Article View: comp.sys.amiga.tech
Article #2880Re: realloc() missing from Manx c.lib ?
From: Frank J. Edwards
Date: Sat, 20 Jan 1990 15:06
Date: Sat, 20 Jan 1990 15:06
58 lines
2911 bytes
2911 bytes
Ross, Don't feel bad -- it took me awhile to find it also! I had actually decoded how the malloc() call worked, and written my own realloc()! The file you need is called "heapmem.o" (or it's other various flavors, depending on what memory model you're using). It can be included in the link list by just specifying its name, i.e. ln -o indian chief.o big.o mem.o heapmem.o -lc The Manx linker will automagically search the CLIB environment variable for a list of directories to look in to find `heapmem.o' and `c.lib'. So that's what's missing from the link line. However, there's a bug in the Version 3.6a `heapmem.o' for which I have included my patches. Before explaining the patches, this is the file I'm working with. First of all, this bug DOES NOT apply to the 32-bit integer mode. (Another good reason to always use 32-bit ints :-). Here is the file I patched: Lib/heapmem.o ----rwed 992 2 <date> <time> In the following descriptions, realloc+<nn> is the location of the instruction <nn> bytes after the realloc symbol AFTER linking. However, there should only be one instance of each of the `from' patterns given below, so a simple search for a binary value should find only one match. Use <insert_favorite_file_editor_here> to locate and patch each bug. At or near location realloc+84, patch the following: from $2F2DFFFC ; move.l -4(a5),-(a7) to $3F2DFFFE ; move.w -2(a5),-(a7) This fixes a call to movmem() which expects (char *, char *, int) and was being called as (char *, char *, long)!!! Similarly, the stack will need to be cleaned up by 10 bytes now, instead of 12. At or near location realloc+100: from $4FEF000C ; lea 12(a7),a7 to $4FEF000A ; lea 10(a7),a7 Well, I hope this hasn't confused too many Manx users out there. Maybe it will explain to a few people why their code doesn't work!! Of course, I've never told Manx about any of this... would someone care to do that? Personally I think Amiga programmers _NEED_ a challenge like this to keep'em on their toes :-) :-) :-) ----- Kirk: "Spock, where's that power you promised?!" Spock: "One *damn* minute, Admiral!" ----- Please use "uunet!pdn!boake2!ckctpa!crash" as "ckctpa" does not (yet :-) appear in the USEnet maps. (Sheeesh! I just sent it yesterday!) ----- Frank J. Edwards ComputerKnowledge Corp 2677 Arjay Court 12740 Hillcrest, Suite 212 Palm Harbor, FL 34684-4505 Dallas, TX 75230 Phone: (813) 786-3675 (214) 385-9700 / (800) 227-9700
Technical Details
Message-ID:
<365@ckctpa.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ukma!uflorida!usfvax2!tscs!pdn!boake2!ckctpaShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ukma!uflorida!usfvax2!tscs!pdn!boake2!ckctpa From: ckctpa!crash@boake2 (Frank J. Edwards) Newsgroups: comp.sys.amiga.tech Subject: Re: realloc() missing from Manx c.lib ? Message-ID: <365@ckctpa.UUCP> Date: 20 Jan 90 15:06:05 GMT Organization: ComputerKnowledge Corp, Clearwater FL Lines: 58