El lun, 13-09-2004 a las 12:36, Luchezar Georgiev escribió: 
> Eduardo, couldn't we divide the work between ourselves? If you do the 
> changes in nls_hc.asm for the third option you offered (make enough room), 
> I will add the necessary code in config.c ;-)

Hi Lucho,

I don't mind adding the changes to nls_hc.asm, but I'm not sure that I
like that option.

In a private mail, Eric suggested a fourth option: Check if there is
enough room for loading the package and, if not, allocate extra memory
only for the additional tables.

This will keep the kernel size unchanged and optimze the memory useage,
as only a percentage of NLS packages are bigger than the default.

I've been thinking about how to implement this, and I've come up with
this:

We could insert a null pointer for subfunction 0 just before subfunction
1 (CTYINFO) into nls_hc.asm, which will be ignored by NLS functions as
subfunction 0 does not exist (example patch below). This will add just 5
bytes to the tables and can be used as a placeholder for subfunction 3
(LCASE). This maintains all the pointers into predictable indexes and
prevents moving the CTYINFO table when loading a package with LCASE.

When loading a package from COUNTRY.SYS, we should do something like the
following pseudocode before actually reading the data:

extra_memory = 0;

if (LCASE_is_present)
    extra_memory += 258; /* sizeof(WORD) + actual length */

if (UCASE_offset != FUCASE_offset)
    extra_memory += 130;

if (DBCS_length != 0)
    extra_memory += 2 + DBCS_length; /* sizeof(WORD) + actual_length */ 

allocate(extra_memory);

And then, read the info overwriting the harcoded tables for UCASE,
FCHAR, CTYINFO, YESNO and COLLATE and into the allocated memory for
LCASE, FUCASE (if different than UCASE) and DBCS (if non-empty.)

Comments?

Eduardo.


--- unstable/kernel/kernel/nls_hc.asm 2002-12-09 01:17:14.000000000
+0100
+++ unstable.new/kernel/kernel/nls_hc.asm 2004-09-13 16:29:08.831007552
+0200
@@ -12,7 +12,7 @@
GLOBAL _nlsPackageHardcoded
_nlsPackageHardcoded:
DB  000h, 000h, 000h, 000h, 001h, 000h, 0b5h, 001h
- DB  00fh, 000h, 059h, 000h, 04eh, 000h, 006h, 000h
+ DB  00fh, 000h, 059h, 000h, 04eh, 000h, 007h, 000h
DB  002h
DW ?table2, SEG ?table2
DB  004h
@@ -23,6 +23,8 @@
DW ?table6, SEG ?table6
DB  007h
DW ?table7, SEG ?table7
+ DB  000h
+ DW  000h  , 000h ; Placeholder for table3 (LCASE)
GLOBAL _nlsCountryInfoHardcoded
_nlsCountryInfoHardcoded:
DB  001h




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to