Date: Wed, 11 Jun 1997 17:23:33 -0700 From: Bill Currie Subject: more patches for minkeep issures To: djgpp-workers AT delorie DOT com Reply-to: billc AT blackmagic DOT tait DOT co DOT nz Message-id: <339F4185.4F94@blackmagic.tait.co.nz> Organization: Tait Electronics NZ MIME-version: 1.0 Content-type: multipart/mixed; boundary="------------33ED56C2BE3" Precedence: bulk This is a multi-part message in MIME format. --------------33ED56C2BE3 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Ok, here are some more patchs for my translation of stubinfo.minkeep. The patches to go32.h and crt1.h (relative to my previous patches) allow the transfer buffer to be >=64k without causing any problems to the rest of libc. The addition buffer size can be use by application code for, say, a separate transfer buffer. Also, the tb is forced to have a sector aligned size. Unfortunatly, the tb has to be >63.5k for there to be any free space for application code. The patch for v2load.c allows the debuggers to work correctly with the new stubinfo format. Heck, I hope that's it (other than the expected critisizms:). Bill -- Leave others their otherness. --------------33ED56C2BE3 Content-Type: text/plain; charset=us-ascii; name="CRT1CPAT.2" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="CRT1CPAT.2" *** crt1.c.~~ Wed Jun 11 17:09:02 1997 --- crt1.c Wed Jun 11 16:37:16 1997 *************** *** 84,94 **** _go32_info_block.stubinfo_version+=(_stubinfo->magic[11]-'0')*0x1000; } __tb = _stubinfo->ds_segment * 16; ! _go32_info_block.size_of_transfer_buffer = _stubinfo->minkeep; if (_go32_info_block.stubinfo_version>=0x0201) { /* convert from paragraphs to bytes */ ! _go32_info_block.size_of_transfer_buffer<<=4; } _go32_info_block.pid = _stubinfo->psp_selector; _go32_info_block.master_interrupt_controller_base = ver.master_pic; --- 84,109 ---- _go32_info_block.stubinfo_version+=(_stubinfo->magic[11]-'0')*0x1000; } __tb = _stubinfo->ds_segment * 16; ! _go32_info_block.true_size_of_transfer_buffer = _stubinfo->minkeep; if (_go32_info_block.stubinfo_version>=0x0201) { /* convert from paragraphs to bytes */ ! _go32_info_block.true_size_of_transfer_buffer<<=4; ! } ! if (_go32_info_block.true_size_of_transfer_buffer>65024) /* 63.5k */ ! { ! /* the maximum dos-usable transfer buffer size is 63.5k as that is the ! * largest sector aligned size below 64k (dos cannot read more than ! * 65535 (64k-1) bytes at a time). ! */ ! _go32_info_block.size_of_transfer_buffer=65024; ! } else { ! /* force the effective transfer buffer size to be a multiple of 512 ! * (sector aligned) so that large transfers are always the fastest ! * possible. ! */ ! _go32_info_block.size_of_transfer_buffer= ! _go32_info_block.true_size_of_transfer_buffer&~511; } _go32_info_block.pid = _stubinfo->psp_selector; _go32_info_block.master_interrupt_controller_base = ver.master_pic; --------------33ED56C2BE3 Content-Type: text/plain; charset=us-ascii; name="GO32HPAT.2" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="GO32HPAT.2" *** go32.h.~~ Wed Jun 11 17:13:12 1997 --- go32.h Wed Jun 11 16:26:30 1997 *************** *** 33,38 **** --- 33,39 ---- unsigned short run_mode; unsigned short run_mode_info; unsigned short stubinfo_version; + unsigned long true_size_of_transfer_buffer; } __Go32_Info_Block; extern __Go32_Info_Block _go32_info_block; --------------33ED56C2BE3 Content-Type: text/plain; charset=us-ascii; name="V2LOADC.PAT" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="V2LOADC.PAT" *** src/debug.old/common/v2load.c Tue Jul 23 22:57:48 1996 --- src/debug/common/v2load.c Wed Jun 11 17:02:16 1997 *************** *** 18,23 **** --- 18,24 ---- #include #include #include + #include #define SIMAGIC "go32stub" AREAS areas[MAX_AREA]; *************** *** 61,66 **** --- 62,69 ---- __dpmi_meminfo memblock; unsigned new_env_selector; char true_name[FILENAME_MAX]; + unsigned short stubinfo_version; + unsigned long minkeep; _truename(program, true_name); *************** *** 91,96 **** --- 94,106 ---- si.minkeep = 16384; /* transfer buffer size */ memset(&si.basename, 0, 24); /* Asciiz strings */ } + stubinfo_version=(si.magic[12]-'0')*0x0100+ + (si.magic[14]-'0')*0x0010+ + (si.magic[15]-'0')*0x0001; + if (isdigit(si.magic[11])) + { + stubinfo_version+=(si.magic[11]-'0')*0x1000; + } if (header[0] != 0x014c) { /* COFF? */ close(pf); return -1; /* Not V2 image, show failure */ *************** *** 152,158 **** /* Allocate the dos memory for the transfer buffer. This nukes si.cs_selector, but that's OK since we set it next. */ ! i = __dpmi_allocate_dos_memory((si.minkeep + 256) / 16, (int *)&si.psp_selector); if(i == -1) return -1; si.ds_segment = i + (256/16); --- 162,171 ---- /* Allocate the dos memory for the transfer buffer. This nukes si.cs_selector, but that's OK since we set it next. */ ! minkeep=si.minkeep; ! if (stubinfo_version>=0x201) ! minkeep<<=4; ! i = __dpmi_allocate_dos_memory((minkeep + 256) / 16, (int *)&si.psp_selector); if(i == -1) return -1; si.ds_segment = i + (256/16); --------------33ED56C2BE3--