delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/06/10/21:37:16

Date: Wed, 11 Jun 1997 13:35:06 -0700
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: stubinfo_minkeep patches
To: djgpp-workers AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <339F0BFA.23CD@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <339EFC8F DOT 33C3 AT blackmagic DOT tait DOT co DOT nz>

This is a multi-part message in MIME format.

--------------4C07336D4EB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Bill Currie wrote:
> 
> Here are the patches to convert stubinfo_minkeep from bytes to
> paragraphs (to allow larger transfer buffers).  Full backwards
> compatability is maintained in both stubedit and libc.

Opps, didn't mean to include djasm patches, they were meant to be
separate.


> Known problems:
> o  getchar() (or printf after printing) aborts if minkeep==64k (65k ok)
> o  v2load.c still has the older stubinfo hardcoded.
> 
> I'll be looking into the first problem, and I don't know if the second
> is worth fixing.

Found the problem, see my other post for details

> Bill
> --
> Leave others their otherness.

Here is a replacement patch for stubedit (if my patches are applied at
all, which I now doubt) that fixes a problem with older stubinfos for
minkeep (was adding 15 to the size in bytes for 2.00 stubs).   

Bill
-- 
Leave others their otherness.

--------------4C07336D4EB
Content-Type: text/plain; charset=us-ascii; name="STUBEDIT.PAT"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="STUBEDIT.PAT"

*** stubedit.c.~	Sat Oct 26 10:09:48 1996
--- stubedit.c	Wed Jun 11 13:28:00 1997
***************
*** 13,18 ****
--- 13,19 ----
  
  unsigned long size_of_stubinfo = 0;
  char *client_stub_info;
+ unsigned short stubinfo_version=0;
  
  void find_info(char *filename)
  {  
***************
*** 37,42 ****
--- 38,51 ----
      exit(1);
    }
  
+   stubinfo_version=(test_magic[12]-'0')*0x0100+
+ 	       (test_magic[14]-'0')*0x0010+
+ 	       (test_magic[15]-'0')*0x0001;
+   if (isdigit(test_magic[11]))
+   {
+     stubinfo_version+=(test_magic[11]-'0')*0x1000;
+   }
+ 
    fread(header, 4, 1, f);
    size_of_stubinfo = (header[0]) | (header[1]<<8)
                     | (header[2])<<16 | (header[3]<<24);
***************
*** 126,131 ****
--- 135,146 ----
    sprintf(buf, "%#lx (%dk)", v, v / 1024L);
  }
  
+ void num_p2s(void *addr, char *buf)
+ {
+   unsigned long v = (*(unsigned short *)addr)*(stubinfo_version>=0x201?16:1);
+   sprintf(buf, "%#lx (%dk)", v, v / 1024L);
+ }
+ 
  void num_s2v(void *addr, char *buf)
  {
    unsigned long r = 0;
***************
*** 145,150 ****
--- 160,191 ----
    *(unsigned long *)addr = r;
  }
  
+ void num_s2p(void *addr, char *buf)
+ {
+   unsigned long r = 0;
+   char s = 0;
+   sscanf(buf, "%i%c", &r, &s);
+   switch (s)
+   {
+     case 'k':
+     case 'K':
+       r *= 1024L;
+       break;
+     case 'm':
+     case 'M':
+       r *= 1048576L;
+       break;
+   }
+   if (stubinfo_version>=0x201)
+   {
+ 	*(unsigned short *)addr = (r+15)/16;
+   }
+   else
+   {
+ 	*(unsigned short *)addr = r;
+   }
+ }
+ 
  struct {
    char *short_name;
    char *long_name;
***************
*** 162,168 ****
      "bufsize",
      "Size of real-memory transfer buffer (bytes/K/M)",
      STUBINFO_MINKEEP,
!     num_v2s, num_s2v
    },
    {
      "runfile",
--- 203,209 ----
      "bufsize",
      "Size of real-memory transfer buffer (bytes/K/M)",
      STUBINFO_MINKEEP,
!     num_p2s, num_s2p
    },
    {
      "runfile",
***************
*** 220,225 ****
--- 261,269 ----
      give_help();
  
    find_info(argv[1]);
+   if (argc <= 2)
+ 	fprintf(stderr, "stubinfo version %x.%02x\n",stubinfo_version>>8,
+ 						     stubinfo_version&0xff);
  
    if (view_only)
    {

--------------4C07336D4EB--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019