diff --git a/src/sys/include/misc/kernel_string_pool.h b/src/sys/include/misc/kernel_string_pool.h index f0f4043..df44f70 100755 --- a/src/sys/include/misc/kernel_string_pool.h +++ b/src/sys/include/misc/kernel_string_pool.h @@ -28,30 +28,43 @@ ---------------------------------------------------- 'ID' - [DWORD]: - - 'num-words' - bits [0,7] - - number of 'KRNWORD's in the string is 'num-words' + 1 - - bits [8,32] BYTE offset inside pool where the 'KRNSTR' - (kernel string) is stored + - BYTE offset inside pool where the 'KRNSTR' + (kernel string) is stored 'KRNSTR's (kernel strings) are specified as an array of continuous BYTEs ------------------------------------------------------------------------ 'KRNSTR': - - [KRNWORD] x 'num-words' (given by ID) + - 'num-bytes' - [BYTE] + - total number of bytes in kernel string + - [KRNWORD] x ??? + - 'KRNWORD's follow for 'num-bytes' bytes 'KRNWORD': - [BYTE] 'key1' - - if key1 == [0,254]: + - if key1 == [0,63]: - key1 is the index of the 'sub-string' in the pool - - otherwise key1 is an escape sequence and implies: - - [BYTE] 'key2' - - [BYTE] 'key3' - - the index of the 'sub-string' in the pool is key2*256 + key3 + 255 + - otherwise + - if key1 has bit 7 set + - [BYTE] 'key2' + - [BYTE] 'key3' + - the index of the 'sub-string' in the pool is: + (key1&0x7F) * 65536 + + key2 * 256 + + key3 + - (index is in [16384,(2^23-1)] - - NOTE: the reason for using two extra 8-bit keys instead of a 16-bit - value is in case we port to platform with data alignment exceptions + - otherwise + - [BYTE] 'key2' + - the index of the 'sub-string' in the pool is: + (key1&0x3F) * 256 + + key2 + - (index is in [64,16383]) + + - NOTE: the reason for using only extra 8-bit keys + is in case we port to platform with data alignment exceptions and this stuff is left dormant and never changed - NOTE: a 'space' (0x20) is implied between each 'KRNWORD', therefore @@ -59,8 +72,9 @@ A & B if AB does not contain any spaces - a 'sub-string' is found by using the the index of the - 'sub-string' in the pool to get an offset into an array - of continuous BYTEs via lookup + 'sub-string' and scanning through the whole + substring pool (a little slow) + (lookup table was ditched to save memory) 'sub-string's are specified as an array of continuous BYTEs ----------------------------------------------------------- @@ -85,9 +99,6 @@ /* pointer to where the sub strings are stored */ const BYTEg * p_substrs; - - /* lookup table for substring offsets */ - const unsigned int * p_substr_off; } KSTR_POOL;