X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_usr%2Fv3_ctrl.c;h=54e8df71fe2c033aff0f69c694c6e4c5f94a2434;hb=4e43946f01f687361197dc9571b7df02ae20de30;hp=0183a95923ece36019a9eedf33d1c576165c3b37;hpb=008fdde9a6a6ec65b7647d9eec487448094d7f18;p=palacios.git diff --git a/linux_usr/v3_ctrl.c b/linux_usr/v3_ctrl.c index 0183a95..54e8df7 100644 --- a/linux_usr/v3_ctrl.c +++ b/linux_usr/v3_ctrl.c @@ -150,3 +150,24 @@ int stop_vm (const char * filename) { return 0; } + + +/* + * generic ELF header buffer hash function. + * Mirrors internal Palacios implementation + */ +unsigned long v3_hash_buffer (unsigned char * msg, unsigned int len) { + unsigned long hash = 0; + unsigned long temp = 0; + unsigned int i; + + for (i = 0; i < len; i++) { + hash = (hash << 4) + *(msg + i) + i; + if ((temp = (hash & 0xF0000000))) { + hash ^= (temp >> 24); + } + hash &= ~temp; + } + return hash; +} +