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vIHJlYWQgdGhlIGh3IGV2ZW50cyBpbiB1c2VyLXNwYWNlLgorCSAqCisJICogICB1MzIgc2VxOworCSAqICAgczY0IGNvdW50OworCSAqCisJICogICBkbyB7CisJICogICAgIHNlcSA9IHBjLT5sb2NrOworCSAqCisJICogICAgIGJhcnJpZXIoKQorCSAqICAgICBpZiAocGMtPmluZGV4KSB7CisJICogICAgICAgY291bnQgPSBwbWNfcmVhZChwYy0+aW5kZXggLSAxKTsKKwkgKiAgICAgICBjb3VudCArPSBwYy0+b2Zmc2V0OworCSAqICAgICB9IGVsc2UKKwkgKiAgICAgICBnb3RvIHJlZ3VsYXJfcmVhZDsKKwkgKgorCSAqICAgICBiYXJyaWVyKCk7CisJICogICB9IHdoaWxlIChwYy0+bG9jayAhPSBzZXEpOworCSAqCisJICogTk9URTogZm9yIG9idmlvdXMgcmVhc29uIHRoaXMgb25seSB3b3JrcyBvbiBzZWxmLW1vbml0b3JpbmcKKwkgKiAgICAgICBwcm9jZXNzZXMuCisJICovCisJX191MzIJbG9jazsJCQkvKiBzZXFsb2NrIGZvciBzeW5jaHJvbml6YXRpb24gKi8KKwlfX3UzMglpbmRleDsJCQkvKiBoYXJkd2FyZSBldmVudCBpZGVudGlmaWVyICovCisJX19zNjQJb2Zmc2V0OwkJCS8qIGFkZCB0byBoYXJkd2FyZSBldmVudCB2YWx1ZSAqLworCV9fdTY0CXRpbWVfZW5hYmxlZDsJCS8qIHRpbWUgZXZlbnQgYWN0aXZlICovCisJX191NjQJdGltZV9ydW5uaW5nOwkJLyogdGltZSBldmVudCBvbiBjcHUgKi8KKworCQkvKgorCQkgKiBIb2xlIGZvciBleHRlbnNpb24gb2YgdGhlIHNlbGYgbW9uaXRvciBjYXBhYmlsaXRpZXMKKwkJICovCisKKwlfX3U2NAlfX3Jlc2VydmVkWzEyM107CS8qIGFsaWduIHRvIDFrICovCisKKwkvKgorCSAqIENvbnRyb2wgZGF0YSBmb3IgdGhlIG1tYXAoKSBkYXRhIGJ1Zm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hdGljIHZvaWQgcGVyZl9zd2V2ZW50X3VudGhyb3R0bGUoc3RydWN0IHBlcmZfZXZlbnQgKmV2ZW50KQoreworCS8qCisJICogTm90aGluZyB0byBkbywgd2UgYWxyZWFkeSByZXNldCBod2MtPmludGVycnVwdHMuCisJICovCit9CisKK3N0YXRpYyB2b2lkIHBlcmZfc3dldmVudF9hZGQoc3RydWN0IHBlcmZfZXZlbnQgKmV2ZW50LCB1NjQgbnIsCisJCQkgICAgICAgaW50IG5taSwgc3RydWN0IHBlcmZfc2FtcGxlX2RhdGEgKmRhdGEsCisJCQkgICAgICAgc3RydWN0IHB0X3JlZ3MgKnJlZ3MpCit7CisJc3RydWN0IGh3X3BlcmZfZXZlbnQgKmh3YyA9ICZldmVudC0+aHc7CisKKwlhdG9taWM2NF9hZGQobnIsICZldmVudC0+Y291bnQpOworCisJaWYgKCFod2MtPnNhbXBsZV9wZXJpb2QpCisJCXJldHVybjsKKworCWlmICghcmVncykKKwkJcmV0dXJuOworCisJaWYgKCFhdG9taWM2NF9hZGRfbmVnYXRpdmUobnIsICZod2MtPnBlcmlvZF9sZWZ0KSkKKwkJcGVyZl9zd2V2ZW50X292ZXJmbG93KGV2ZW50LCBubWksIGRhdGEsIHJlZ3MpOworfQorCitzdGF0aWMgaW50IHBlcmZfc3dldmVudF9pc19jb3VudGluZyhzdHJ1Y3QgcGVyZl9ldmVudCAqZXZlbnQpCit7CisJLyoKKwkgKiBUaGUgZXZlbnQgaXMgYWN0aXZlLCB3ZSdyZSBnb29kIQorCSAqLworCWlmIChldmVudC0+c3RhdGUgPT0gUEVSRl9FVkVOVF9TVEFURV9BQ1RJVkUpCisJCXJldHVybiAxOworCisJLyoKKwkgKiBUaGUgZXZlbnQgaXMgb2ZmL2Vycm9yLCBub3QgY291bnRpbmcuCisJICovCisJaWYgKGV2ZW50LT5zdGF0ZSAhPSBQRVJGX0VWRU5UX1NUQVRFX0lOQUNUSVZFKQorCQlyZXR1cm4gMDsKKworCS8qCisJICogVG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VudF9pbml0KGV2ZW50KTsKKwkJYnJlYWs7CisKKwljYXNlIFBFUkZfVFlQRV9UUkFDRVBPSU5UOgorCQlwbXUgPSB0cF9wZXJmX2V2ZW50X2luaXQoZXZlbnQpOworCQlicmVhazsKKworCWRlZmF1bHQ6CisJCWJyZWFrOworCX0KK2RvbmU6CisJZXJyID0gMDsKKwlpZiAoIXBtdSkKKwkJZXJyID0gLUVJTlZBTDsKKwllbHNlIGlmIChJU19FUlIocG11KSkKKwkJZXJyID0gUFRSX0VSUihwbXUpOworCisJaWYgKGVycikgeworCQlpZiAoZXZlbnQtPm5zKQorCQkJcHV0X3BpZF9ucyhldmVudC0+bnMpOworCQlrZnJlZShldmVudCk7CisJCXJldHVybiBFUlJfUFRSKGVycik7CisJfQorCisJZXZlbnQtPnBtdSA9IHBtdTsKKworCWlmICghZXZlbnQtPnBhcmVudCkgeworCQlhdG9taWNfaW5jKCZucl9ldmVudHMpOworCQlpZiAoZXZlbnQtPmF0dHIubW1hcCkKKwkJCWF0b21pY19pbmMoJm5yX21tYXBfZXZlbnRzKTsKKwkJaWYgKGV2ZW50LT5hdHRyLmNvbW0pCisJCQlhdG9taWNfaW5jKCZucl9jb21tX2V2ZW50cyk7CisJCWlmIChldmVudC0+YXR0ci50YXNrKQorCQkJYXRvbWljX2luYygmbnJfdGFza19ldmVudHMpOworCX0KKworCXJldHVybiBldmVudDsKK30KKworc3RhdGljIGludCBwZXJmX2NvcHlfYXR0cihzdHJ1Y3QgcGVyZl9ldmVudF9hdHRyIF9fdXNlciAqdWF0dHIsCisJCQkgIHN0cnVjdCBwZXJmX2V2ZW50X2F0dHIgKmF0dHIpCit7CisJdTMyIHNpemU7CisJaW50IHJldDsKKworCWlmICghYWNjZXNzX29rKFZFUklGWV9XUklURSwgdWF0dHIsIFBFUkZfQVRUUl9TSVpFX1ZFUjApKQorCQlyZXR1cm4gLUVGQVVMVDsKKworCS8qCisJICogemVybyB0aGUgZnVsbCBzdHJ1Y3R1cmUsIHNvI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pCisJCXJldHVybiAtRUlOVkFMOworCisJZXJyID0gcGVyZl9jb3B5X2F0dHIoYXR0cl91cHRyLCAmYXR0cik7CisJaWYgKGVycikKKwkJcmV0dXJuIGVycjsKKworCWlmICghYXR0ci5leGNsdWRlX2tlcm5lbCkgeworCQlpZiAocGVyZl9wYXJhbm9pZF9rZXJuZWwoKSAmJiAhY2FwYWJsZShDQVBfU1lTX0FETUlOKSkKKwkJCXJldHVybiAtRUFDQ0VTOworCX0KKworCWlmIChhdHRyLmZyZXEpIHsKKwkJaWYgKGF0dHIuc2FtcGxlX2ZyZXEgPiBzeXNjdGxfcGVyZl9ldmVudF9zYW1wbGVfcmF0ZSkKKwkJCXJldHVybiAtRUlOVkFMOworCX0KKworCS8qCisJICogR2V0IHRoZSB0YXJnZXQgY29udGV4dCAodGFzayBvciBwZXJjcHUpOgorCSAqLworCWN0eCA9IGZpbmRfZ2V0X2NvbnRleHQocGlkLCBjcHUpOworCWlmIChJU19FUlIoY3R4KSkKKwkJcmV0dXJuIFBUUl9FUlIoY3R4KTsKKworCS8qCisJICogTG9vayB1cCB0aGUgZ3JvdXAgbGVhZGVyICh3ZSB3aWxsIGF0dGFjaCB0aGlzIGV2ZW50IHRvIGl0KToKKwkgKi8KKwlncm91cF9sZWFkZXIgPSBOVUxMOworCWlmIChncm91cF9mZCAhPSAtMSAmJiAhKGZsYWdzICYgUEVSRl9GTEFHX0ZEX05PX0dST1VQKSkgeworCQllcnIgPSAtRUlOVkFMOworCQlncm91cF9maWxlID0gZmdldF9saWdodChncm91cF9mZCwgJmZwdXRfbmVlZGVkKTsKKwkJaWYgKCFncm91cF9maWxlKQorCQkJZ290byBlcnJfcHV0X2NvbnRleHQ7CisJCWlmIChncm91cF9maWxlLT5mX29wICE9ICZwZXJmX2ZvcHMpCisJCQlnb3RvIGVycl9wdXRfY29udGV4dDsKKworCQlncm91cF9sZWFkZXIgPSBncm91cF9maWxlLT5wcml2YXRlX2RhdGE7CisJCS8qCisJCSAqIERvIG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fRVZFTlRfTUlTQ19PVkVSRkxPVyAgICAgICAgKDEgPDwgMikKKyNkZWZpbmUgUEVSRl9SRUNPUkRfTUlTQ19LRVJORUwgICAgICAgICAgKDEgPDwgMCkKKyNkZWZpbmUgUEVSRl9SRUNPUkRfTUlTQ19VU0VSICAgICAgICAgICAgKDEgPDwgMSkKKyNkZWZpbmUgUEVSRl9SRUNPUkRfTUlTQ19PVkVSRkxPVyAgICAgICAgKDEgPDwgMikKIAogc3RydWN0IHBlcmZfZXZlbnRfaGVhZGVyIHsKICAgICAgICAgX191MzIgICB0eXBlOwpAQCAtMzUzLDggKzM1Myw4IEBACiAgICAgICAgICAqICAgICAgY2hhciAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlbmFtZVtdOwogICAgICAgICAgKiB9OwogICAgICAgICAgKi8KLSAgICAgICAgUEVSRl9FVkVOVF9NTUFQICAgICAgICAgICAgICAgICA9IDEsCi0gICAgICAgIFBFUkZfRVZFTlRfTVVOTUFQICAgICAgICAgICAgICAgPSAyLAorICAgICAgICBQRVJGX1JFQ09SRF9NTUFQICAgICAgICAgICAgICAgICA9IDEsCisgICAgICAgIFBFUkZfUkVDT1JEX01VTk1BUCAgICAgICAgICAgICAgID0gMiwKIAogICAgICAgICAvKgogICAgICAgICAgKiBzdHJ1Y3QgewpAQCAtMzY0LDEwICszNjQsMTAgQEAKICAgICAgICAgICogICAgICBjaGFyICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1bXTsKICAgICAgICAgICogfTsKICAgICAgICAgICovCi0gICAgICAgIFBFUkZfRVZFTlRfQ09NTSAgICAgICAgICAgICAgICAgPSAzLAorICAgICAgICBQRVJGX1JFQ09SRF9DT01NICAgICAgICAgICAgICAgICA9IDMsCiAKICAgICAgICAgLyoKLSAgICAgICAgICogV2hlbiBoZWFkZXIubWlzYyAmIFBFUkZfRVZFTlRfTUlTQ19PVkVSRkxPVyB0aGUgZXZlbnRfdHlwZSBmaWVsZAorICAgICAgICAgKiBXa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