mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
As recommended in http://www.gnu.org/licenses/gpl-howto.en.html. This is the result of: $ git grep -El Mass\|Temple\|Franklin | xargs ./fsf.pl Where fsf.pl is: #!/usr/bin/perl -w -pi.bak -0777 my $repl = 'If not, see <http://www.gnu.org/licenses/>.'; my $br = qr/(?:\s*\n\s*(?:[\*\#]|\/\/|\.\\" )?\s*|\s+)/; my $inwt = qr/[Ii]f${br}not,${br}write${br}(?:to${br})?the${br}Free${br}Software${br}Foundation,(?:${br}Inc\.,)?/; my $mass = qr/675${br}Mass${br}Ave,?${br}Cambridge,?${br}MA${br}02139,?${br}USA,?\.?/; my $franklin = qr/51${br}Franklin${br}St(?:reet)?(?:,${br}| - )Fifth${br}Floor,?${br}Boston,?${br}MA,?${br}02110-1301,?${br}USA,?\.?/; my $temple = qr/59${br}Temple${br}Place(?:,${br}| - )Suite${br}330,?${br}Boston,?${br}MA,?${br}021110?-1307,?${br}USA,?\.?/; s|$inwt$br$mass|$repl|m; s|$inwt$br$franklin|$repl|m; s|$inwt$br$temple|$repl|m; The only remaining mentions of these addresses are in COPYING files which I haven't touched. Some of the changed files are imports from elsewhere, however filtering them out is tricky, I think it is tolerable to have these files be modified here and then perhaps reverted on the next sync, since it's only 1-2 lines and obvious what is going on. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
144 lines
3.1 KiB
C
144 lines
3.1 KiB
C
/*
|
|
* Copyright (C) 2009, Mukesh Rathor, Oracle Corp. All rights reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public
|
|
* License v2 as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public
|
|
* License along with this program; If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <stdarg.h>
|
|
|
|
#include "gx.h"
|
|
|
|
|
|
void
|
|
gxprt(const char *fmt, ...)
|
|
{
|
|
char buf[2048];
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
(void)vsnprintf(buf, sizeof(buf), fmt, args);
|
|
va_end(args);
|
|
fprintf(stderr, "%s", buf);
|
|
fflush(stderr);
|
|
}
|
|
|
|
int
|
|
gx_fromhex(int a)
|
|
{
|
|
if (a >= '0' && a <= '9')
|
|
return a - '0';
|
|
else if (a >= 'a' && a <= 'f')
|
|
return a - 'a' + 10;
|
|
else
|
|
gxprt("Reply contains invalid hex digit");
|
|
return 0;
|
|
}
|
|
|
|
int
|
|
gx_tohex(int nib)
|
|
{
|
|
if (nib < 10)
|
|
return '0' + nib;
|
|
else
|
|
return 'a' + nib - 10;
|
|
}
|
|
|
|
|
|
void
|
|
gx_convert_int_to_ascii(char *from, char *to, int n)
|
|
{
|
|
int nib;
|
|
int ch;
|
|
while (n--) {
|
|
ch = *from++;
|
|
nib = ((ch & 0xf0) >> 4) & 0x0f;
|
|
*to++ = gx_tohex(nib);
|
|
nib = ch & 0x0f;
|
|
*to++ = gx_tohex(nib);
|
|
}
|
|
*to = 0;
|
|
}
|
|
|
|
/* input: "70676433206431" output: "pgd3 d1" n == 7 */
|
|
void
|
|
gx_convert_ascii_to_int(char *from, char *to, int n)
|
|
{
|
|
int nib1, nib2;
|
|
while (n--) {
|
|
nib1 = gx_fromhex(*from++);
|
|
nib2 = gx_fromhex(*from++);
|
|
*to++ = (((nib1 & 0x0f) << 4) & 0xf0) | (nib2 & 0x0f);
|
|
}
|
|
*to = 0;
|
|
}
|
|
|
|
void
|
|
gx_decode_zZ_packet(char *from, uint64_t *mem_addr_ptr)
|
|
{
|
|
int i = 0;
|
|
char ch;
|
|
*mem_addr_ptr = 0;
|
|
|
|
while ((ch=from[i++]) != ',') {
|
|
*mem_addr_ptr = *mem_addr_ptr << 4;
|
|
*mem_addr_ptr |= gx_fromhex(ch) & 0x0f;
|
|
}
|
|
}
|
|
|
|
/* Eg: mc0267d3a,1\0 : from points to char after 'm' */
|
|
void
|
|
gx_decode_m_packet(char *from, uint64_t *mem_addr_ptr, int *len_ptr)
|
|
{
|
|
int i = 0, j = 0;
|
|
char ch;
|
|
*mem_addr_ptr = *len_ptr = 0;
|
|
|
|
while ((ch=from[i++]) != ',') {
|
|
*mem_addr_ptr = *mem_addr_ptr << 4;
|
|
*mem_addr_ptr |= gx_fromhex(ch) & 0x0f;
|
|
}
|
|
for (j = 0; j < 4; j++) {
|
|
if ((ch=from[i++]) == 0)
|
|
break;
|
|
*len_ptr = *len_ptr << 4;
|
|
*len_ptr |= gx_fromhex(ch) & 0x0f;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Decode M pkt as in: Mc0267d3a,1:cc\0 where c0267d3a is the guest addr
|
|
* from points to char after 'M'
|
|
* Returns: address of byte after ":", ie, addr of cc in buf
|
|
*/
|
|
char *
|
|
gx_decode_M_packet(char *from, uint64_t *mem_addr_ptr, int *len_ptr)
|
|
{
|
|
int i = 0;
|
|
char ch;
|
|
|
|
*mem_addr_ptr = *len_ptr = 0;
|
|
|
|
while ((ch=from[i++]) != ',') {
|
|
*mem_addr_ptr = *mem_addr_ptr << 4;
|
|
*mem_addr_ptr |= gx_fromhex(ch) & 0x0f;
|
|
}
|
|
while ((ch = from[i++]) != ':') {
|
|
*len_ptr = *len_ptr << 4;
|
|
*len_ptr |= gx_fromhex(ch) & 0x0f;
|
|
}
|
|
return(&from[i]);
|
|
}
|
|
|