- 論壇徽章:
- 0
|
我在看2.6.24內(nèi)核,發(fā)現(xiàn)內(nèi)核自解壓的部分和2.6.11不大一樣,滑動窗口不再向輸出數(shù)據(jù)區(qū)刷出數(shù)據(jù)。相關(guān)函數(shù)是arch/x86/boot/compressed/misc_32.c中的flush_window()函數(shù),注釋說由于滑動窗口和輸出緩存是同一個,所以該函數(shù)不用再拷貝窗口數(shù)據(jù)到輸出緩存區(qū)了,只需要計算crc就行。問題是滑動窗口是循環(huán)使用的,寫滿32KB就從頭開始寫覆蓋原數(shù)據(jù),那么最后怎么會得到完整的解壓縮的內(nèi)核呢?我怎么看都不明白,麻煩指點(diǎn)一二。謝謝!
備注:
-----------2.6.11內(nèi)核的arch/i386/boot/compressed/Misc.c----------
static void flush_window_high(void)
{
ulg c = crc; /* temporary variable */
unsigned n;
uch *in, ch;
in = window;
for (n = 0; n < outcnt; n++) {
ch = *output_data++ = *in++; //這是拷貝窗口的解壓數(shù)據(jù)到輸出數(shù)據(jù)區(qū)的代碼,并調(diào)整指針
if ((ulg)output_data == low_buffer_end) output_data=high_buffer_start;
c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> ;
}
crc = c;
bytes_out += (ulg)outcnt;
outcnt = 0;
}
-----------2.6.24內(nèi)核的arch/x86/boot/compressed/Misc_32.c----------
/* ===========================================================================
* Write the output window window[0..outcnt-1] and update crc and bytes_out.
* (Used for the decompressed data only.)
*/
static void flush_window(void)
{
/* With my window equal to my output buffer
* I only need to compute the crc here.
*/
ulg c = crc; /* temporary variable */
unsigned n;
uch *in, ch;
in = window;
for (n = 0; n < outcnt; n++) {
ch = *in++; //這里窗口數(shù)據(jù)不再拷貝到輸出,只檢查crc而已
c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> ;
}
crc = c;
bytes_out += (ulg)outcnt;
outcnt = 0;
}
已知window是指向輸出地址output,即物理內(nèi)存1MB處的 |
|