sim: fix func call style (space before paren)
Committed this as obvious: -foo(...); +foo (...); Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
1f84b6196b
commit
34b47c3828
24 changed files with 261 additions and 252 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2011-05-11 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
* callback.c, dv-pal.c, dv-sockser.c, hw-base.c, hw-device.c,
|
||||||
|
hw-instances.c, hw-ports.c, hw-properties.c, hw-tree.c, sim-abort.c,
|
||||||
|
sim-arange.c, sim-config.c, sim-core.c, sim-engine.c, sim-events.c,
|
||||||
|
sim-hw.c, sim-io.c, sim-memopt.c, sim-options.c, sim-profile.c,
|
||||||
|
sim-resume.c, sim-stop.c, syscall.c: Add space before parenthesis
|
||||||
|
around function arguments.
|
||||||
|
|
||||||
2011-04-14 Mike Frysinger <vapier@gentoo.org>
|
2011-04-14 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* sim-options.c (complete_option_list, sim_complete_command):
|
* sim-options.c (complete_option_list, sim_complete_command):
|
||||||
|
|
|
@ -231,7 +231,7 @@ os_poll_quit (p)
|
||||||
#endif
|
#endif
|
||||||
#if defined (_MSC_VER)
|
#if defined (_MSC_VER)
|
||||||
/* NB - this will not compile! */
|
/* NB - this will not compile! */
|
||||||
int k = win32pollquit();
|
int k = win32pollquit ();
|
||||||
if (k == 1)
|
if (k == 1)
|
||||||
return 1;
|
return 1;
|
||||||
else if (k == 2)
|
else if (k == 2)
|
||||||
|
|
|
@ -306,7 +306,7 @@ scan_hw_pal (struct hw *me)
|
||||||
hw_pal_device *hw_pal = (hw_pal_device *)hw_data (me);
|
hw_pal_device *hw_pal = (hw_pal_device *)hw_data (me);
|
||||||
char c;
|
char c;
|
||||||
int count;
|
int count;
|
||||||
count = do_hw_poll_read (me, hw_pal->reader, 0/*STDIN*/, &c, sizeof(c));
|
count = do_hw_poll_read (me, hw_pal->reader, 0/*STDIN*/, &c, sizeof (c));
|
||||||
switch (count)
|
switch (count)
|
||||||
{
|
{
|
||||||
case HW_IO_NOT_READY:
|
case HW_IO_NOT_READY:
|
||||||
|
@ -482,7 +482,7 @@ hw_pal_io_write_buffer (struct hw *me,
|
||||||
|
|
||||||
#if NOT_YET
|
#if NOT_YET
|
||||||
static void
|
static void
|
||||||
hw_pal_instance_delete_callback(hw_instance *instance)
|
hw_pal_instance_delete_callback (hw_instance *instance)
|
||||||
{
|
{
|
||||||
/* nothing to delete, the hw_pal is attached to the struct hw */
|
/* nothing to delete, the hw_pal is attached to the struct hw */
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -175,12 +175,12 @@ dv_sockser_init (SIM_DESC sd)
|
||||||
}
|
}
|
||||||
|
|
||||||
sockaddr.sin_family = PF_INET;
|
sockaddr.sin_family = PF_INET;
|
||||||
sockaddr.sin_port = htons(port);
|
sockaddr.sin_port = htons (port);
|
||||||
memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr,
|
memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr,
|
||||||
sizeof (struct in_addr));
|
sizeof (struct in_addr));
|
||||||
|
|
||||||
tmp = 1;
|
tmp = 1;
|
||||||
if (setsockopt (sockser_listen_fd, SOL_SOCKET, SO_REUSEADDR, (void*)& tmp, sizeof(tmp)) < 0)
|
if (setsockopt (sockser_listen_fd, SOL_SOCKET, SO_REUSEADDR, (void*)& tmp, sizeof (tmp)) < 0)
|
||||||
{
|
{
|
||||||
sim_io_eprintf (sd, "sockser init: unable to set SO_REUSEADDR: %s\n",
|
sim_io_eprintf (sd, "sockser init: unable to set SO_REUSEADDR: %s\n",
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
|
|
|
@ -114,13 +114,13 @@ generic_hw_unit_encode (struct hw *bus,
|
||||||
/* don't output anything if empty */
|
/* don't output anything if empty */
|
||||||
if (phys->nr_cells == 0)
|
if (phys->nr_cells == 0)
|
||||||
{
|
{
|
||||||
strcpy(pos, "");
|
strcpy (pos, "");
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
else if (i == phys->nr_cells)
|
else if (i == phys->nr_cells)
|
||||||
{
|
{
|
||||||
/* all zero */
|
/* all zero */
|
||||||
strcpy(pos, "0");
|
strcpy (pos, "0");
|
||||||
len = 1;
|
len = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -129,14 +129,14 @@ generic_hw_unit_encode (struct hw *bus,
|
||||||
{
|
{
|
||||||
if (pos != buf)
|
if (pos != buf)
|
||||||
{
|
{
|
||||||
strcat(pos, ",");
|
strcat (pos, ",");
|
||||||
pos = strchr(pos, '\0');
|
pos = strchr (pos, '\0');
|
||||||
}
|
}
|
||||||
if (phys->cells[i] < 10)
|
if (phys->cells[i] < 10)
|
||||||
sprintf (pos, "%ld", (unsigned long)phys->cells[i]);
|
sprintf (pos, "%ld", (unsigned long)phys->cells[i]);
|
||||||
else
|
else
|
||||||
sprintf (pos, "0x%lx", (unsigned long)phys->cells[i]);
|
sprintf (pos, "0x%lx", (unsigned long)phys->cells[i]);
|
||||||
pos = strchr(pos, '\0');
|
pos = strchr (pos, '\0');
|
||||||
}
|
}
|
||||||
len = pos - buf;
|
len = pos - buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,9 @@ hw_ioctl (struct hw *me,
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, request);
|
va_start (ap, request);
|
||||||
status = me->to_ioctl (me, request, ap);
|
status = me->to_ioctl (me, request, ap);
|
||||||
va_end(ap);
|
va_end (ap);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ hw_instance_delete (struct hw_instance *instance)
|
||||||
struct hw *me = hw_instance_hw (instance);
|
struct hw *me = hw_instance_hw (instance);
|
||||||
if (instance->to_instance_delete == NULL)
|
if (instance->to_instance_delete == NULL)
|
||||||
hw_abort (me, "no delete method");
|
hw_abort (me, "no delete method");
|
||||||
instance->method->delete(instance);
|
instance->method->delete (instance);
|
||||||
if (instance->args != NULL)
|
if (instance->args != NULL)
|
||||||
free (instance->args);
|
free (instance->args);
|
||||||
if (instance->path != NULL)
|
if (instance->path != NULL)
|
||||||
|
@ -109,7 +109,7 @@ hw_instance_delete (struct hw_instance *instance)
|
||||||
struct hw_instance *curr = me->instances;
|
struct hw_instance *curr = me->instances;
|
||||||
while (curr != NULL)
|
while (curr != NULL)
|
||||||
{
|
{
|
||||||
ASSERT(curr != instance);
|
ASSERT (curr != instance);
|
||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
}
|
}
|
||||||
/* unlink the child */
|
/* unlink the child */
|
||||||
|
@ -173,7 +173,7 @@ hw_instance_call_method (struct hw_instance *instance,
|
||||||
}
|
}
|
||||||
while (method->name != NULL)
|
while (method->name != NULL)
|
||||||
{
|
{
|
||||||
if (strcmp(method->name, method_name) == 0)
|
if (strcmp (method->name, method_name) == 0)
|
||||||
{
|
{
|
||||||
return method->method (instance,
|
return method->method (instance,
|
||||||
n_stack_args, stack_args,
|
n_stack_args, stack_args,
|
||||||
|
@ -280,8 +280,8 @@ hw_instance_interceed (struct hw_instance *parent,
|
||||||
*previous = instance;
|
*previous = instance;
|
||||||
}
|
}
|
||||||
instance->data = data;
|
instance->data = data;
|
||||||
instance->args = (args == NULL ? NULL : (char *) strdup(args));
|
instance->args = (args == NULL ? NULL : (char *) strdup (args));
|
||||||
instance->path = (path == NULL ? NULL : (char *) strdup(path));
|
instance->path = (path == NULL ? NULL : (char *) strdup (path));
|
||||||
cap_add (instance->owner->ihandles, instance);
|
cap_add (instance->owner->ihandles, instance);
|
||||||
return instance;
|
return instance;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -246,7 +246,7 @@ hw_port_decode (struct hw *me,
|
||||||
{
|
{
|
||||||
if (port_name == NULL || port_name[0] == '\0')
|
if (port_name == NULL || port_name[0] == '\0')
|
||||||
return 0;
|
return 0;
|
||||||
if (isdigit(port_name[0]))
|
if (isdigit (port_name[0]))
|
||||||
{
|
{
|
||||||
return strtoul (port_name, NULL, 0);
|
return strtoul (port_name, NULL, 0);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ hw_port_decode (struct hw *me,
|
||||||
{
|
{
|
||||||
if (port_name[len] == '\0')
|
if (port_name[len] == '\0')
|
||||||
return ports->number;
|
return ports->number;
|
||||||
else if(isdigit (port_name[len]))
|
else if (isdigit (port_name[len]))
|
||||||
{
|
{
|
||||||
int port = (ports->number
|
int port = (ports->number
|
||||||
+ strtoul (&port_name[len], NULL, 0));
|
+ strtoul (&port_name[len], NULL, 0));
|
||||||
|
@ -313,7 +313,7 @@ hw_port_encode (struct hw *me,
|
||||||
&& port_number < ports->number + ports->nr_ports)
|
&& port_number < ports->number + ports->nr_ports)
|
||||||
{
|
{
|
||||||
strcpy (buf, ports->name);
|
strcpy (buf, ports->name);
|
||||||
sprintf (buf + strlen(buf), "%d", port_number - ports->number);
|
sprintf (buf + strlen (buf), "%d", port_number - ports->number);
|
||||||
if (strlen (buf) >= sizeof_buf)
|
if (strlen (buf) >= sizeof_buf)
|
||||||
hw_abort (me, "hw_port_encode: buffer overflow");
|
hw_abort (me, "hw_port_encode: buffer overflow");
|
||||||
return strlen (buf);
|
return strlen (buf);
|
||||||
|
@ -323,10 +323,10 @@ hw_port_encode (struct hw *me,
|
||||||
{
|
{
|
||||||
if (ports->number == port_number)
|
if (ports->number == port_number)
|
||||||
{
|
{
|
||||||
if (strlen(ports->name) >= sizeof_buf)
|
if (strlen (ports->name) >= sizeof_buf)
|
||||||
hw_abort (me, "hw_port_encode: buffer overflow");
|
hw_abort (me, "hw_port_encode: buffer overflow");
|
||||||
strcpy(buf, ports->name);
|
strcpy (buf, ports->name);
|
||||||
return strlen(buf);
|
return strlen (buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ hw_port_encode (struct hw *me,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf (buf, "%d", port_number);
|
sprintf (buf, "%d", port_number);
|
||||||
if (strlen(buf) >= sizeof_buf)
|
if (strlen (buf) >= sizeof_buf)
|
||||||
hw_abort (me, "hw_port_encode: buffer overflow");
|
hw_abort (me, "hw_port_encode: buffer overflow");
|
||||||
return strlen(buf);
|
return strlen (buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ hw_init_static_properties (SIM_DESC sd,
|
||||||
{
|
{
|
||||||
ASSERT (property->init_array != NULL);
|
ASSERT (property->init_array != NULL);
|
||||||
ASSERT (property->property->array == NULL);
|
ASSERT (property->property->array == NULL);
|
||||||
ASSERT(property->property->disposition == permenant_object);
|
ASSERT (property->property->disposition == permenant_object);
|
||||||
switch (property->property->type)
|
switch (property->property->type)
|
||||||
{
|
{
|
||||||
case array_property:
|
case array_property:
|
||||||
|
@ -373,8 +373,8 @@ hw_add_boolean_property (struct hw *me,
|
||||||
{
|
{
|
||||||
signed32 new_boolean = (boolean ? -1 : 0);
|
signed32 new_boolean = (boolean ? -1 : 0);
|
||||||
hw_add_property (me, property, boolean_property,
|
hw_add_property (me, property, boolean_property,
|
||||||
&new_boolean, sizeof(new_boolean),
|
&new_boolean, sizeof (new_boolean),
|
||||||
&new_boolean, sizeof(new_boolean),
|
&new_boolean, sizeof (new_boolean),
|
||||||
NULL, permenant_object);
|
NULL, permenant_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ hw_add_ihandle_runtime_property (struct hw *me,
|
||||||
{
|
{
|
||||||
/* enter the full path as the init array */
|
/* enter the full path as the init array */
|
||||||
hw_add_property (me, property, ihandle_property,
|
hw_add_property (me, property, ihandle_property,
|
||||||
ihandle->full_path, strlen(ihandle->full_path) + 1,
|
ihandle->full_path, strlen (ihandle->full_path) + 1,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
NULL, permenant_object);
|
NULL, permenant_object);
|
||||||
}
|
}
|
||||||
|
@ -458,13 +458,13 @@ hw_find_ihandle_property (struct hw *me,
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
hw_abort (me, "property \"%s\" not found", property);
|
hw_abort (me, "property \"%s\" not found", property);
|
||||||
if (node->type != ihandle_property)
|
if (node->type != ihandle_property)
|
||||||
hw_abort(me, "property \"%s\" of wrong type (ihandle)", property);
|
hw_abort (me, "property \"%s\" of wrong type (ihandle)", property);
|
||||||
if (node->array == NULL)
|
if (node->array == NULL)
|
||||||
hw_abort(me, "runtime property \"%s\" not yet initialized", property);
|
hw_abort (me, "runtime property \"%s\" not yet initialized", property);
|
||||||
|
|
||||||
ASSERT (sizeof(ihandle) == node->sizeof_array);
|
ASSERT (sizeof (ihandle) == node->sizeof_array);
|
||||||
memcpy (&ihandle, node->array, sizeof(ihandle));
|
memcpy (&ihandle, node->array, sizeof (ihandle));
|
||||||
instance = external_to_hw_instance (me, BE2H_cell(ihandle));
|
instance = external_to_hw_instance (me, BE2H_cell (ihandle));
|
||||||
ASSERT (instance != NULL);
|
ASSERT (instance != NULL);
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -478,8 +478,8 @@ hw_add_integer_property (struct hw *me,
|
||||||
{
|
{
|
||||||
H2BE (integer);
|
H2BE (integer);
|
||||||
hw_add_property (me, property, integer_property,
|
hw_add_property (me, property, integer_property,
|
||||||
&integer, sizeof(integer),
|
&integer, sizeof (integer),
|
||||||
&integer, sizeof(integer),
|
&integer, sizeof (integer),
|
||||||
NULL, permenant_object);
|
NULL, permenant_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ hw_find_integer_property (struct hw *me,
|
||||||
hw_abort (me, "property \"%s\" not found", property);
|
hw_abort (me, "property \"%s\" not found", property);
|
||||||
if (node->type != integer_property)
|
if (node->type != integer_property)
|
||||||
hw_abort (me, "property \"%s\" of wrong type (integer)", property);
|
hw_abort (me, "property \"%s\" of wrong type (integer)", property);
|
||||||
ASSERT (sizeof(integer) == node->sizeof_array);
|
ASSERT (sizeof (integer) == node->sizeof_array);
|
||||||
memcpy (&integer, node->array, sizeof (integer));
|
memcpy (&integer, node->array, sizeof (integer));
|
||||||
return BE2H_cell (integer);
|
return BE2H_cell (integer);
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ unit_address_to_cells (const hw_unit *unit,
|
||||||
int nr_cells)
|
int nr_cells)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
ASSERT(nr_cells == unit->nr_cells);
|
ASSERT (nr_cells == unit->nr_cells);
|
||||||
for (i = 0; i < unit->nr_cells; i++)
|
for (i = 0; i < unit->nr_cells; i++)
|
||||||
{
|
{
|
||||||
*cell = H2BE_cell (unit->cells[i]);
|
*cell = H2BE_cell (unit->cells[i]);
|
||||||
|
@ -553,7 +553,7 @@ cells_to_unit_address (const unsigned_cell *cell,
|
||||||
int nr_cells)
|
int nr_cells)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
memset(unit, 0, sizeof(*unit));
|
memset (unit, 0, sizeof (*unit));
|
||||||
unit->nr_cells = nr_cells;
|
unit->nr_cells = nr_cells;
|
||||||
for (i = 0; i < unit->nr_cells; i++)
|
for (i = 0; i < unit->nr_cells; i++)
|
||||||
{
|
{
|
||||||
|
@ -662,8 +662,8 @@ static unsigned
|
||||||
nr_reg_property_cells (struct hw *me,
|
nr_reg_property_cells (struct hw *me,
|
||||||
int nr_regs)
|
int nr_regs)
|
||||||
{
|
{
|
||||||
return (hw_unit_nr_address_cells (hw_parent(me))
|
return (hw_unit_nr_address_cells (hw_parent (me))
|
||||||
+ hw_unit_nr_size_cells (hw_parent(me))
|
+ hw_unit_nr_size_cells (hw_parent (me))
|
||||||
) * nr_regs;
|
) * nr_regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -750,8 +750,8 @@ hw_add_string_property (struct hw *me,
|
||||||
const char *string)
|
const char *string)
|
||||||
{
|
{
|
||||||
hw_add_property (me, property, string_property,
|
hw_add_property (me, property, string_property,
|
||||||
string, strlen(string) + 1,
|
string, strlen (string) + 1,
|
||||||
string, strlen(string) + 1,
|
string, strlen (string) + 1,
|
||||||
NULL, permenant_object);
|
NULL, permenant_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ hw_find_string_property (struct hw *me,
|
||||||
if (node->type != string_property)
|
if (node->type != string_property)
|
||||||
hw_abort (me, "property \"%s\" of wrong type (string)", property);
|
hw_abort (me, "property \"%s\" of wrong type (string)", property);
|
||||||
string = node->array;
|
string = node->array;
|
||||||
ASSERT (strlen(string) + 1 == node->sizeof_array);
|
ASSERT (strlen (string) + 1 == node->sizeof_array);
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,7 +827,7 @@ hw_find_string_array_property (struct hw *me,
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
*string = node->array;
|
*string = node->array;
|
||||||
ASSERT (strlen(*string) + 1 == node->sizeof_array);
|
ASSERT (strlen (*string) + 1 == node->sizeof_array);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -887,7 +887,7 @@ hw_add_duplicate_property (struct hw *me,
|
||||||
while (master->property != original)
|
while (master->property != original)
|
||||||
{
|
{
|
||||||
master = master->next;
|
master = master->next;
|
||||||
ASSERT(master != NULL);
|
ASSERT (master != NULL);
|
||||||
}
|
}
|
||||||
/* now duplicate it */
|
/* now duplicate it */
|
||||||
hw_add_property (me, property,
|
hw_add_property (me, property,
|
||||||
|
|
|
@ -96,14 +96,14 @@ split_device_specifier (struct hw *current,
|
||||||
{
|
{
|
||||||
alias[len] = device_specifier[len];
|
alias[len] = device_specifier[len];
|
||||||
len++;
|
len++;
|
||||||
if (len >= sizeof(alias))
|
if (len >= sizeof (alias))
|
||||||
hw_abort (NULL, "split_device_specifier: buffer overflow");
|
hw_abort (NULL, "split_device_specifier: buffer overflow");
|
||||||
}
|
}
|
||||||
alias[len] = '\0';
|
alias[len] = '\0';
|
||||||
if (aliases != NULL
|
if (aliases != NULL
|
||||||
&& hw_find_property (aliases, alias))
|
&& hw_find_property (aliases, alias))
|
||||||
{
|
{
|
||||||
strcpy (spec->buf, hw_find_string_property(aliases, alias));
|
strcpy (spec->buf, hw_find_string_property (aliases, alias));
|
||||||
strcat (spec->buf, device_specifier + len);
|
strcat (spec->buf, device_specifier + len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -113,23 +113,23 @@ split_device_specifier (struct hw *current,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(spec->buf, device_specifier);
|
strcpy (spec->buf, device_specifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check no overflow */
|
/* check no overflow */
|
||||||
if (strlen(spec->buf) >= sizeof(spec->buf))
|
if (strlen (spec->buf) >= sizeof (spec->buf))
|
||||||
hw_abort (NULL, "split_device_specifier: buffer overflow\n");
|
hw_abort (NULL, "split_device_specifier: buffer overflow\n");
|
||||||
|
|
||||||
/* strip leading spaces */
|
/* strip leading spaces */
|
||||||
chp = spec->buf;
|
chp = spec->buf;
|
||||||
while (*chp != '\0' && isspace(*chp))
|
while (*chp != '\0' && isspace (*chp))
|
||||||
chp++;
|
chp++;
|
||||||
if (*chp == '\0')
|
if (*chp == '\0')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* find the path and terminate it with null */
|
/* find the path and terminate it with null */
|
||||||
spec->path = chp;
|
spec->path = chp;
|
||||||
while (*chp != '\0' && !isspace(*chp))
|
while (*chp != '\0' && !isspace (*chp))
|
||||||
chp++;
|
chp++;
|
||||||
if (*chp != '\0')
|
if (*chp != '\0')
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ split_device_specifier (struct hw *current,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and any value */
|
/* and any value */
|
||||||
while (*chp != '\0' && isspace(*chp))
|
while (*chp != '\0' && isspace (*chp))
|
||||||
chp++;
|
chp++;
|
||||||
spec->value = chp;
|
spec->value = chp;
|
||||||
|
|
||||||
|
@ -156,11 +156,11 @@ split_device_specifier (struct hw *current,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
chp = strrchr(spec->path, '/');
|
chp = strrchr (spec->path, '/');
|
||||||
if (chp == NULL)
|
if (chp == NULL)
|
||||||
{
|
{
|
||||||
spec->property = spec->path;
|
spec->property = spec->path;
|
||||||
spec->path = strchr(spec->property, '\0');
|
spec->path = strchr (spec->property, '\0');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -250,7 +250,7 @@ split_device_name (name_specifier *spec)
|
||||||
/* break out the base */
|
/* break out the base */
|
||||||
if (spec->name[0] == '(')
|
if (spec->name[0] == '(')
|
||||||
{
|
{
|
||||||
chp = strchr(spec->name, ')');
|
chp = strchr (spec->name, ')');
|
||||||
if (chp == NULL)
|
if (chp == NULL)
|
||||||
{
|
{
|
||||||
spec->family = spec->name;
|
spec->family = spec->name;
|
||||||
|
@ -267,7 +267,7 @@ split_device_name (name_specifier *spec)
|
||||||
spec->family = spec->name;
|
spec->family = spec->name;
|
||||||
}
|
}
|
||||||
/* now break out the unit */
|
/* now break out the unit */
|
||||||
chp = strchr(spec->name, '@');
|
chp = strchr (spec->name, '@');
|
||||||
if (chp == NULL)
|
if (chp == NULL)
|
||||||
{
|
{
|
||||||
spec->unit = NULL;
|
spec->unit = NULL;
|
||||||
|
@ -280,7 +280,7 @@ split_device_name (name_specifier *spec)
|
||||||
spec->unit = chp;
|
spec->unit = chp;
|
||||||
}
|
}
|
||||||
/* finally any args */
|
/* finally any args */
|
||||||
chp = strchr(chp, ':');
|
chp = strchr (chp, ':');
|
||||||
if (chp == NULL)
|
if (chp == NULL)
|
||||||
spec->args = NULL;
|
spec->args = NULL;
|
||||||
else
|
else
|
||||||
|
@ -442,11 +442,11 @@ split_fill_path (struct hw *current,
|
||||||
/* <non-white-space> */
|
/* <non-white-space> */
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
skip_token(const char *chp)
|
skip_token (const char *chp)
|
||||||
{
|
{
|
||||||
while (!isspace(*chp) && *chp != '\0')
|
while (!isspace (*chp) && *chp != '\0')
|
||||||
chp++;
|
chp++;
|
||||||
while (isspace(*chp) && *chp != '\0')
|
while (isspace (*chp) && *chp != '\0')
|
||||||
chp++;
|
chp++;
|
||||||
return chp;
|
return chp;
|
||||||
}
|
}
|
||||||
|
@ -502,7 +502,7 @@ parse_size (struct hw *current,
|
||||||
int i;
|
int i;
|
||||||
int nr;
|
int nr;
|
||||||
const char *curr = chp;
|
const char *curr = chp;
|
||||||
memset(size, 0, sizeof(*size));
|
memset (size, 0, sizeof (*size));
|
||||||
/* parse the numeric list */
|
/* parse the numeric list */
|
||||||
size->nr_cells = hw_unit_nr_size_cells (bus);
|
size->nr_cells = hw_unit_nr_size_cells (bus);
|
||||||
nr = 0;
|
nr = 0;
|
||||||
|
@ -554,9 +554,9 @@ parse_reg_property (struct hw *current,
|
||||||
chp = property_value;
|
chp = property_value;
|
||||||
for (reg_nr = 0; reg_nr < nr_regs; reg_nr++)
|
for (reg_nr = 0; reg_nr < nr_regs; reg_nr++)
|
||||||
{
|
{
|
||||||
chp = parse_address (current, hw_parent(current),
|
chp = parse_address (current, hw_parent (current),
|
||||||
chp, ®s[reg_nr].address);
|
chp, ®s[reg_nr].address);
|
||||||
chp = parse_size (current, hw_parent(current),
|
chp = parse_size (current, hw_parent (current),
|
||||||
chp, ®s[reg_nr].size);
|
chp, ®s[reg_nr].size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ parse_ranges_property (struct hw *current,
|
||||||
nr_ranges = count_entries (current, property_name, property_value, 3);
|
nr_ranges = count_entries (current, property_name, property_value, 3);
|
||||||
|
|
||||||
/* create a property of that size */
|
/* create a property of that size */
|
||||||
ranges = zalloc (nr_ranges * sizeof(*ranges));
|
ranges = zalloc (nr_ranges * sizeof (*ranges));
|
||||||
|
|
||||||
/* fill it in */
|
/* fill it in */
|
||||||
chp = property_value;
|
chp = property_value;
|
||||||
|
@ -592,7 +592,7 @@ parse_ranges_property (struct hw *current,
|
||||||
{
|
{
|
||||||
chp = parse_address (current, current,
|
chp = parse_address (current, current,
|
||||||
chp, &ranges[range_nr].child_address);
|
chp, &ranges[range_nr].child_address);
|
||||||
chp = parse_address (current, hw_parent(current),
|
chp = parse_address (current, hw_parent (current),
|
||||||
chp, &ranges[range_nr].parent_address);
|
chp, &ranges[range_nr].parent_address);
|
||||||
chp = parse_size (current, current,
|
chp = parse_size (current, current,
|
||||||
chp, &ranges[range_nr].size);
|
chp, &ranges[range_nr].size);
|
||||||
|
@ -641,7 +641,7 @@ parse_integer_property (struct hw *current,
|
||||||
}
|
}
|
||||||
/* perhaps integer array property is better */
|
/* perhaps integer array property is better */
|
||||||
hw_add_array_property (current, property_name, words,
|
hw_add_array_property (current, property_name, words,
|
||||||
sizeof(words[0]) * nr_entries);
|
sizeof (words[0]) * nr_entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ parse_string_property (struct hw *current,
|
||||||
approx_nr_strings = (approx_nr_strings) / 2;
|
approx_nr_strings = (approx_nr_strings) / 2;
|
||||||
|
|
||||||
/* create a string buffer for that many (plus a null) */
|
/* create a string buffer for that many (plus a null) */
|
||||||
strings = (char**) zalloc ((approx_nr_strings + 1) * sizeof(char*));
|
strings = (char**) zalloc ((approx_nr_strings + 1) * sizeof (char*));
|
||||||
|
|
||||||
/* now find all the strings */
|
/* now find all the strings */
|
||||||
chp = property_value;
|
chp = property_value;
|
||||||
|
@ -724,10 +724,10 @@ parse_string_property (struct hw *current,
|
||||||
{
|
{
|
||||||
/* copy over a single unquoted token */
|
/* copy over a single unquoted token */
|
||||||
int len = 0;
|
int len = 0;
|
||||||
while (chp[len] != '\0' && !isspace(chp[len]))
|
while (chp[len] != '\0' && !isspace (chp[len]))
|
||||||
len++;
|
len++;
|
||||||
strings[nr_strings] = zalloc(len + 1);
|
strings[nr_strings] = zalloc (len + 1);
|
||||||
strncpy(strings[nr_strings], chp, len);
|
strncpy (strings[nr_strings], chp, len);
|
||||||
strings[nr_strings][len] = '\0';
|
strings[nr_strings][len] = '\0';
|
||||||
chp += len;
|
chp += len;
|
||||||
}
|
}
|
||||||
|
@ -756,7 +756,7 @@ parse_string_property (struct hw *current,
|
||||||
nr_strings--;
|
nr_strings--;
|
||||||
free (strings[nr_strings]);
|
free (strings[nr_strings]);
|
||||||
}
|
}
|
||||||
free(strings);
|
free (strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -901,7 +901,7 @@ hw_tree_vparse (struct hw *current,
|
||||||
nr_words += 1;
|
nr_words += 1;
|
||||||
}
|
}
|
||||||
hw_add_array_property (current, spec.property,
|
hw_add_array_property (current, spec.property,
|
||||||
words, sizeof(words[0]) * nr_words);
|
words, sizeof (words[0]) * nr_words);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case '"':
|
case '"':
|
||||||
|
@ -932,14 +932,14 @@ hw_tree_vparse (struct hw *current,
|
||||||
{
|
{
|
||||||
parse_ranges_property (current, spec.property, spec.value);
|
parse_ranges_property (current, spec.property, spec.value);
|
||||||
}
|
}
|
||||||
else if (isdigit(spec.value[0])
|
else if (isdigit (spec.value[0])
|
||||||
|| (spec.value[0] == '-' && isdigit(spec.value[1]))
|
|| (spec.value[0] == '-' && isdigit (spec.value[1]))
|
||||||
|| (spec.value[0] == '+' && isdigit(spec.value[1])))
|
|| (spec.value[0] == '+' && isdigit (spec.value[1])))
|
||||||
{
|
{
|
||||||
parse_integer_property(current, spec.property, spec.value);
|
parse_integer_property (current, spec.property, spec.value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
parse_string_property(current, spec.property, spec.value);
|
parse_string_property (current, spec.property, spec.value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -998,7 +998,7 @@ print_address (struct hw *bus,
|
||||||
struct printer *p)
|
struct printer *p)
|
||||||
{
|
{
|
||||||
char unit[32];
|
char unit[32];
|
||||||
hw_unit_encode (bus, phys, unit, sizeof(unit));
|
hw_unit_encode (bus, phys, unit, sizeof (unit));
|
||||||
p->print (p->file, " %s", unit);
|
p->print (p->file, " %s", unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1146,7 +1146,7 @@ print_properties (struct hw *me,
|
||||||
}
|
}
|
||||||
case boolean_property:
|
case boolean_property:
|
||||||
{
|
{
|
||||||
int b = hw_find_boolean_property(me, property->name);
|
int b = hw_find_boolean_property (me, property->name);
|
||||||
p->print (p->file, " %s", b ? "true" : "false");
|
p->print (p->file, " %s", b ? "true" : "false");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1156,7 +1156,7 @@ print_properties (struct hw *me,
|
||||||
if (property->array != NULL)
|
if (property->array != NULL)
|
||||||
{
|
{
|
||||||
device_instance *instance = hw_find_ihandle_property (me, property->name);
|
device_instance *instance = hw_find_ihandle_property (me, property->name);
|
||||||
p->print (p->file, " *%s", device_instance_path(instance));
|
p->print (p->file, " *%s", device_instance_path (instance));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1211,8 +1211,8 @@ print_interrupts (struct hw *me,
|
||||||
struct printer *p = data;
|
struct printer *p = data;
|
||||||
char src[32];
|
char src[32];
|
||||||
char dst[32];
|
char dst[32];
|
||||||
hw_port_encode (me, my_port, src, sizeof(src), output_port);
|
hw_port_encode (me, my_port, src, sizeof (src), output_port);
|
||||||
hw_port_encode (dest, dest_port, dst, sizeof(dst), input_port);
|
hw_port_encode (dest, dest_port, dst, sizeof (dst), input_port);
|
||||||
p->print (p->file,
|
p->print (p->file,
|
||||||
"%s > %s %s %s\n",
|
"%s > %s %s %s\n",
|
||||||
hw_path (me),
|
hw_path (me),
|
||||||
|
@ -1247,19 +1247,19 @@ hw_tree_print (struct hw *root,
|
||||||
|
|
||||||
#if NOT_YET
|
#if NOT_YET
|
||||||
device_instance *
|
device_instance *
|
||||||
tree_instance(struct hw *root,
|
tree_instance (struct hw *root,
|
||||||
const char *device_specifier)
|
const char *device_specifier)
|
||||||
{
|
{
|
||||||
/* find the device node */
|
/* find the device node */
|
||||||
struct hw *me;
|
struct hw *me;
|
||||||
name_specifier spec;
|
name_specifier spec;
|
||||||
if (!split_device_specifier(root, device_specifier, &spec))
|
if (!split_device_specifier (root, device_specifier, &spec))
|
||||||
return NULL;
|
return NULL;
|
||||||
me = split_find_device(root, &spec);
|
me = split_find_device (root, &spec);
|
||||||
if (spec.name != NULL)
|
if (spec.name != NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
/* create the instance */
|
/* create the instance */
|
||||||
return device_create_instance(me, device_specifier, spec.last_args);
|
return device_create_instance (me, device_specifier, spec.last_args);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -43,17 +43,17 @@ sim_engine_abort (SIM_DESC sd,
|
||||||
if (sd != NULL)
|
if (sd != NULL)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start (ap, fmt);
|
||||||
sim_io_evprintf (sd, fmt, ap);
|
sim_io_evprintf (sd, fmt, ap);
|
||||||
va_end(ap);
|
va_end (ap);
|
||||||
sim_io_error (sd, "\n");
|
sim_io_error (sd, "\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start (ap, fmt);
|
||||||
vfprintf (stderr, fmt, ap);
|
vfprintf (stderr, fmt, ap);
|
||||||
va_end(ap);
|
va_end (ap);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,9 +194,9 @@ frob_range (ADDR_RANGE *ar, address_word start, address_word end, int delete_p)
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (new_asr)
|
if (new_asr)
|
||||||
free(new_asr);
|
free (new_asr);
|
||||||
if (new_asr2)
|
if (new_asr2)
|
||||||
free(new_asr2);
|
free (new_asr2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free T and all subtrees. */
|
/* Free T and all subtrees. */
|
||||||
|
|
|
@ -151,7 +151,7 @@ sim_config (SIM_DESC sd)
|
||||||
&& !bfd_big_endian (STATE_PROG_BFD (sd))))
|
&& !bfd_big_endian (STATE_PROG_BFD (sd))))
|
||||||
prefered_target_byte_order = 0;
|
prefered_target_byte_order = 0;
|
||||||
else
|
else
|
||||||
prefered_target_byte_order = (bfd_little_endian(STATE_PROG_BFD (sd))
|
prefered_target_byte_order = (bfd_little_endian (STATE_PROG_BFD (sd))
|
||||||
? LITTLE_ENDIAN
|
? LITTLE_ENDIAN
|
||||||
: BIG_ENDIAN);
|
: BIG_ENDIAN);
|
||||||
|
|
||||||
|
@ -241,15 +241,15 @@ sim_config (SIM_DESC sd)
|
||||||
if (STATE_ENVIRONMENT (sd) == ALL_ENVIRONMENT)
|
if (STATE_ENVIRONMENT (sd) == ALL_ENVIRONMENT)
|
||||||
{
|
{
|
||||||
const char *env =
|
const char *env =
|
||||||
tree_find_string_property(root, "/openprom/options/env");
|
tree_find_string_property (root, "/openprom/options/env");
|
||||||
STATE_ENVIRONMENT (sd) = ((strcmp(env, "user") == 0
|
STATE_ENVIRONMENT (sd) = ((strcmp (env, "user") == 0
|
||||||
|| strcmp(env, "uea") == 0)
|
|| strcmp (env, "uea") == 0)
|
||||||
? USER_ENVIRONMENT
|
? USER_ENVIRONMENT
|
||||||
: (strcmp(env, "virtual") == 0
|
: (strcmp (env, "virtual") == 0
|
||||||
|| strcmp(env, "vea") == 0)
|
|| strcmp (env, "vea") == 0)
|
||||||
? VIRTUAL_ENVIRONMENT
|
? VIRTUAL_ENVIRONMENT
|
||||||
: (strcmp(env, "operating") == 0
|
: (strcmp (env, "operating") == 0
|
||||||
|| strcmp(env, "oea") == 0)
|
|| strcmp (env, "oea") == 0)
|
||||||
? OPERATING_ENVIRONMENT
|
? OPERATING_ENVIRONMENT
|
||||||
: ALL_ENVIRONMENT);
|
: ALL_ENVIRONMENT);
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ sim_config (SIM_DESC sd)
|
||||||
#if (WITH_TREE_PROPERTIES)
|
#if (WITH_TREE_PROPERTIES)
|
||||||
if (current_alignment == 0)
|
if (current_alignment == 0)
|
||||||
current_alignment =
|
current_alignment =
|
||||||
(tree_find_boolean_property(root, "/openprom/options/strict-alignment?")
|
(tree_find_boolean_property (root, "/openprom/options/strict-alignment?")
|
||||||
? STRICT_ALIGNMENT
|
? STRICT_ALIGNMENT
|
||||||
: NONSTRICT_ALIGNMENT);
|
: NONSTRICT_ALIGNMENT);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,7 +65,7 @@ sim_core_install (SIM_DESC sd)
|
||||||
static void
|
static void
|
||||||
sim_core_uninstall (SIM_DESC sd)
|
sim_core_uninstall (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
sim_core *core = STATE_CORE(sd);
|
sim_core *core = STATE_CORE (sd);
|
||||||
unsigned map;
|
unsigned map;
|
||||||
/* blow away any mappings */
|
/* blow away any mappings */
|
||||||
for (map = 0; map < nr_maps; map++) {
|
for (map = 0; map < nr_maps; map++) {
|
||||||
|
@ -74,10 +74,10 @@ sim_core_uninstall (SIM_DESC sd)
|
||||||
sim_core_mapping *tbd = curr;
|
sim_core_mapping *tbd = curr;
|
||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
if (tbd->free_buffer != NULL) {
|
if (tbd->free_buffer != NULL) {
|
||||||
SIM_ASSERT(tbd->buffer != NULL);
|
SIM_ASSERT (tbd->buffer != NULL);
|
||||||
free(tbd->free_buffer);
|
free (tbd->free_buffer);
|
||||||
}
|
}
|
||||||
free(tbd);
|
free (tbd);
|
||||||
}
|
}
|
||||||
core->common.map[map].first = NULL;
|
core->common.map[map].first = NULL;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ new_sim_core_mapping (SIM_DESC sd,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
void *free_buffer)
|
void *free_buffer)
|
||||||
{
|
{
|
||||||
sim_core_mapping *new_mapping = ZALLOC(sim_core_mapping);
|
sim_core_mapping *new_mapping = ZALLOC (sim_core_mapping);
|
||||||
/* common */
|
/* common */
|
||||||
new_mapping->level = level;
|
new_mapping->level = level;
|
||||||
new_mapping->space = space;
|
new_mapping->space = space;
|
||||||
|
@ -198,7 +198,7 @@ sim_core_map_attach (SIM_DESC sd,
|
||||||
if (nr_bytes == 0)
|
if (nr_bytes == 0)
|
||||||
{
|
{
|
||||||
#if (WITH_DEVICES)
|
#if (WITH_DEVICES)
|
||||||
device_error(client, "called on sim_core_map_attach with size zero");
|
device_error (client, "called on sim_core_map_attach with size zero");
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_HW)
|
#if (WITH_HW)
|
||||||
sim_hw_abort (sd, client, "called on sim_core_map_attach with size zero");
|
sim_hw_abort (sd, client, "called on sim_core_map_attach with size zero");
|
||||||
|
@ -209,7 +209,7 @@ sim_core_map_attach (SIM_DESC sd,
|
||||||
/* find the insertion point (between last/next) */
|
/* find the insertion point (between last/next) */
|
||||||
next_mapping = access_map->first;
|
next_mapping = access_map->first;
|
||||||
last_mapping = &access_map->first;
|
last_mapping = &access_map->first;
|
||||||
while(next_mapping != NULL
|
while (next_mapping != NULL
|
||||||
&& (next_mapping->level < level
|
&& (next_mapping->level < level
|
||||||
|| (next_mapping->level == level
|
|| (next_mapping->level == level
|
||||||
&& next_mapping->bound < addr)))
|
&& next_mapping->bound < addr)))
|
||||||
|
@ -260,10 +260,10 @@ sim_core_map_attach (SIM_DESC sd,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create/insert the new mapping */
|
/* create/insert the new mapping */
|
||||||
*last_mapping = new_sim_core_mapping(sd,
|
*last_mapping = new_sim_core_mapping (sd,
|
||||||
level,
|
level,
|
||||||
space, addr, nr_bytes, modulo,
|
space, addr, nr_bytes, modulo,
|
||||||
client, buffer, free_buffer);
|
client, buffer, free_buffer);
|
||||||
(*last_mapping)->next = next_mapping;
|
(*last_mapping)->next = next_mapping;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -289,7 +289,7 @@ sim_core_attach (SIM_DESC sd,
|
||||||
#endif
|
#endif
|
||||||
void *optional_buffer)
|
void *optional_buffer)
|
||||||
{
|
{
|
||||||
sim_core *memory = STATE_CORE(sd);
|
sim_core *memory = STATE_CORE (sd);
|
||||||
unsigned map;
|
unsigned map;
|
||||||
void *buffer;
|
void *buffer;
|
||||||
void *free_buffer;
|
void *free_buffer;
|
||||||
|
@ -463,14 +463,14 @@ sim_core_detach (SIM_DESC sd,
|
||||||
|
|
||||||
STATIC_INLINE_SIM_CORE\
|
STATIC_INLINE_SIM_CORE\
|
||||||
(sim_core_mapping *)
|
(sim_core_mapping *)
|
||||||
sim_core_find_mapping(sim_core_common *core,
|
sim_core_find_mapping (sim_core_common *core,
|
||||||
unsigned map,
|
unsigned map,
|
||||||
address_word addr,
|
address_word addr,
|
||||||
unsigned nr_bytes,
|
unsigned nr_bytes,
|
||||||
transfer_type transfer,
|
transfer_type transfer,
|
||||||
int abort, /*either 0 or 1 - hint to inline/-O */
|
int abort, /*either 0 or 1 - hint to inline/-O */
|
||||||
sim_cpu *cpu, /* abort => cpu != NULL */
|
sim_cpu *cpu, /* abort => cpu != NULL */
|
||||||
sim_cia cia)
|
sim_cia cia)
|
||||||
{
|
{
|
||||||
sim_core_mapping *mapping = core->map[map].first;
|
sim_core_mapping *mapping = core->map[map].first;
|
||||||
ASSERT ((addr & (nr_bytes - 1)) == 0); /* must be aligned */
|
ASSERT ((addr & (nr_bytes - 1)) == 0); /* must be aligned */
|
||||||
|
@ -564,7 +564,7 @@ sim_core_read_buffer (SIM_DESC sd,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
((unsigned_1*)buffer)[count] =
|
((unsigned_1*)buffer)[count] =
|
||||||
*(unsigned_1*)sim_core_translate(mapping, raddr);
|
*(unsigned_1*)sim_core_translate (mapping, raddr);
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
@ -631,7 +631,7 @@ sim_core_write_buffer (SIM_DESC sd,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*(unsigned_1*)sim_core_translate(mapping, raddr) =
|
*(unsigned_1*)sim_core_translate (mapping, raddr) =
|
||||||
((unsigned_1*)buffer)[count];
|
((unsigned_1*)buffer)[count];
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
@ -817,7 +817,7 @@ sim_core_trans_addr (SIM_DESC sd,
|
||||||
0 /*dont-abort*/, NULL, NULL_CIA);
|
0 /*dont-abort*/, NULL, NULL_CIA);
|
||||||
if (mapping == NULL)
|
if (mapping == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return sim_core_translate(mapping, addr);
|
return sim_core_translate (mapping, addr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ sim_engine_abort (SIM_DESC sd,
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
ASSERT (sd == NULL || STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
|
ASSERT (sd == NULL || STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
|
||||||
va_start(ap, fmt);
|
va_start (ap, fmt);
|
||||||
sim_engine_vabort (sd, cpu, cia, fmt, ap);
|
sim_engine_vabort (sd, cpu, cia, fmt, ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,7 +279,7 @@ sim_events_zalloc (SIM_DESC sd)
|
||||||
/*-LOCK-*/
|
/*-LOCK-*/
|
||||||
sigset_t old_mask;
|
sigset_t old_mask;
|
||||||
sigset_t new_mask;
|
sigset_t new_mask;
|
||||||
sigfillset(&new_mask);
|
sigfillset (&new_mask);
|
||||||
sigprocmask (SIG_SETMASK, &new_mask, &old_mask);
|
sigprocmask (SIG_SETMASK, &new_mask, &old_mask);
|
||||||
#endif
|
#endif
|
||||||
new = ZALLOC (sim_event);
|
new = ZALLOC (sim_event);
|
||||||
|
@ -523,16 +523,16 @@ sim_events_schedule_vtracef (SIM_DESC sd,
|
||||||
new_event->watching = watch_timer;
|
new_event->watching = watch_timer;
|
||||||
if (fmt == NULL || !ETRACE_P || vasprintf (&new_event->trace, fmt, ap) < 0)
|
if (fmt == NULL || !ETRACE_P || vasprintf (&new_event->trace, fmt, ap) < 0)
|
||||||
new_event->trace = NULL;
|
new_event->trace = NULL;
|
||||||
insert_sim_event(sd, new_event, delta_time);
|
insert_sim_event (sd, new_event, delta_time);
|
||||||
ETRACE((_ETRACE,
|
ETRACE ((_ETRACE,
|
||||||
"event scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx%s%s\n",
|
"event scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx%s%s\n",
|
||||||
(long)sim_events_time(sd),
|
(long)sim_events_time (sd),
|
||||||
(long)new_event,
|
(long)new_event,
|
||||||
(long)new_event->time_of_event,
|
(long)new_event->time_of_event,
|
||||||
(long)new_event->handler,
|
(long)new_event->handler,
|
||||||
(long)new_event->data,
|
(long)new_event->data,
|
||||||
(new_event->trace != NULL) ? ", " : "",
|
(new_event->trace != NULL) ? ", " : "",
|
||||||
(new_event->trace != NULL) ? new_event->trace : ""));
|
(new_event->trace != NULL) ? new_event->trace : ""));
|
||||||
return new_event;
|
return new_event;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -551,7 +551,7 @@ sim_events_schedule_after_signal (SIM_DESC sd,
|
||||||
/*-LOCK-*/
|
/*-LOCK-*/
|
||||||
sigset_t old_mask;
|
sigset_t old_mask;
|
||||||
sigset_t new_mask;
|
sigset_t new_mask;
|
||||||
sigfillset(&new_mask);
|
sigfillset (&new_mask);
|
||||||
sigprocmask (SIG_SETMASK, &new_mask, &old_mask);
|
sigprocmask (SIG_SETMASK, &new_mask, &old_mask);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ sim_events_schedule_after_signal (SIM_DESC sd,
|
||||||
|
|
||||||
ETRACE ((_ETRACE,
|
ETRACE ((_ETRACE,
|
||||||
"signal scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx\n",
|
"signal scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx\n",
|
||||||
(long)sim_events_time(sd),
|
(long)sim_events_time (sd),
|
||||||
(long)new_event,
|
(long)new_event,
|
||||||
(long)new_event->time_of_event,
|
(long)new_event->time_of_event,
|
||||||
(long)new_event->handler,
|
(long)new_event->handler,
|
||||||
|
@ -1069,7 +1069,7 @@ sim_events_preprocess (SIM_DESC sd,
|
||||||
int events_were_last,
|
int events_were_last,
|
||||||
int events_were_next)
|
int events_were_next)
|
||||||
{
|
{
|
||||||
sim_events *events = STATE_EVENTS(sd);
|
sim_events *events = STATE_EVENTS (sd);
|
||||||
if (events_were_last)
|
if (events_were_last)
|
||||||
{
|
{
|
||||||
/* Halted part way through event processing */
|
/* Halted part way through event processing */
|
||||||
|
@ -1092,8 +1092,8 @@ INLINE_SIM_EVENTS\
|
||||||
(void)
|
(void)
|
||||||
sim_events_process (SIM_DESC sd)
|
sim_events_process (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
sim_events *events = STATE_EVENTS(sd);
|
sim_events *events = STATE_EVENTS (sd);
|
||||||
signed64 event_time = sim_events_time(sd);
|
signed64 event_time = sim_events_time (sd);
|
||||||
|
|
||||||
/* Clear work_pending before checking nr_held. Clearing
|
/* Clear work_pending before checking nr_held. Clearing
|
||||||
work_pending after nr_held (with out a lock could loose an
|
work_pending after nr_held (with out a lock could loose an
|
||||||
|
@ -1110,8 +1110,8 @@ sim_events_process (SIM_DESC sd)
|
||||||
/*-LOCK-*/
|
/*-LOCK-*/
|
||||||
sigset_t old_mask;
|
sigset_t old_mask;
|
||||||
sigset_t new_mask;
|
sigset_t new_mask;
|
||||||
sigfillset(&new_mask);
|
sigfillset (&new_mask);
|
||||||
sigprocmask(SIG_SETMASK, &new_mask, &old_mask);
|
sigprocmask (SIG_SETMASK, &new_mask, &old_mask);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < events->nr_held; i++)
|
for (i = 0; i < events->nr_held; i++)
|
||||||
|
@ -1126,7 +1126,7 @@ sim_events_process (SIM_DESC sd)
|
||||||
|
|
||||||
#if defined(HAVE_SIGPROCMASK) && defined(SIG_SETMASK)
|
#if defined(HAVE_SIGPROCMASK) && defined(SIG_SETMASK)
|
||||||
/*-UNLOCK-*/
|
/*-UNLOCK-*/
|
||||||
sigprocmask(SIG_SETMASK, &old_mask, NULL);
|
sigprocmask (SIG_SETMASK, &old_mask, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1145,14 +1145,14 @@ sim_events_process (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
sim_event_handler *handler = to_do->handler;
|
sim_event_handler *handler = to_do->handler;
|
||||||
void *data = to_do->data;
|
void *data = to_do->data;
|
||||||
ETRACE((_ETRACE,
|
ETRACE ((_ETRACE,
|
||||||
"event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
|
"event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
|
||||||
(long) event_time,
|
(long) event_time,
|
||||||
(long) to_do,
|
(long) to_do,
|
||||||
(long) handler,
|
(long) handler,
|
||||||
(long) data,
|
(long) data,
|
||||||
(to_do->trace != NULL) ? ", " : "",
|
(to_do->trace != NULL) ? ", " : "",
|
||||||
(to_do->trace != NULL) ? to_do->trace : ""));
|
(to_do->trace != NULL) ? to_do->trace : ""));
|
||||||
sim_events_free (sd, to_do);
|
sim_events_free (sd, to_do);
|
||||||
handler (sd, data);
|
handler (sd, data);
|
||||||
}
|
}
|
||||||
|
@ -1173,14 +1173,14 @@ sim_events_process (SIM_DESC sd)
|
||||||
void *data = to_do->data;
|
void *data = to_do->data;
|
||||||
events->queue = to_do->next;
|
events->queue = to_do->next;
|
||||||
update_time_from_event (sd);
|
update_time_from_event (sd);
|
||||||
ETRACE((_ETRACE,
|
ETRACE ((_ETRACE,
|
||||||
"event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
|
"event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
|
||||||
(long) event_time,
|
(long) event_time,
|
||||||
(long) to_do,
|
(long) to_do,
|
||||||
(long) handler,
|
(long) handler,
|
||||||
(long) data,
|
(long) data,
|
||||||
(to_do->trace != NULL) ? ", " : "",
|
(to_do->trace != NULL) ? ", " : "",
|
||||||
(to_do->trace != NULL) ? to_do->trace : ""));
|
(to_do->trace != NULL) ? to_do->trace : ""));
|
||||||
sim_events_free (sd, to_do);
|
sim_events_free (sd, to_do);
|
||||||
handler (sd, data);
|
handler (sd, data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ merge_device_file (struct sim_state *sd,
|
||||||
}
|
}
|
||||||
|
|
||||||
line_nr = 0;
|
line_nr = 0;
|
||||||
while (fgets (device_path, sizeof(device_path), description))
|
while (fgets (device_path, sizeof (device_path), description))
|
||||||
{
|
{
|
||||||
char *device;
|
char *device;
|
||||||
/* check that a complete line was read */
|
/* check that a complete line was read */
|
||||||
|
@ -195,13 +195,13 @@ merge_device_file (struct sim_state *sd,
|
||||||
sim_io_eprintf (sd, "%s:%d: unexpected eof", file_name, line_nr);
|
sim_io_eprintf (sd, "%s:%d: unexpected eof", file_name, line_nr);
|
||||||
return SIM_RC_FAIL;
|
return SIM_RC_FAIL;
|
||||||
}
|
}
|
||||||
if (strchr(device_path, '\n') == NULL)
|
if (strchr (device_path, '\n') == NULL)
|
||||||
{
|
{
|
||||||
fclose(description);
|
fclose (description);
|
||||||
sim_io_eprintf (sd, "%s:%d: line to long", file_name, line_nr);
|
sim_io_eprintf (sd, "%s:%d: line to long", file_name, line_nr);
|
||||||
return SIM_RC_FAIL;
|
return SIM_RC_FAIL;
|
||||||
}
|
}
|
||||||
*strchr(device_path, '\n') = '\0';
|
*strchr (device_path, '\n') = '\0';
|
||||||
line_nr++;
|
line_nr++;
|
||||||
}
|
}
|
||||||
/* parse this line */
|
/* parse this line */
|
||||||
|
|
|
@ -45,55 +45,55 @@ static int poll_quit_count = POLL_QUIT_INTERVAL;
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_init(SIM_DESC sd)
|
sim_io_init (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->init (STATE_CALLBACK (sd));
|
return STATE_CALLBACK (sd)->init (STATE_CALLBACK (sd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_shutdown(SIM_DESC sd)
|
sim_io_shutdown (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->shutdown (STATE_CALLBACK (sd));
|
return STATE_CALLBACK (sd)->shutdown (STATE_CALLBACK (sd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_unlink(SIM_DESC sd,
|
sim_io_unlink (SIM_DESC sd,
|
||||||
const char *f1)
|
const char *f1)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->unlink (STATE_CALLBACK (sd), f1);
|
return STATE_CALLBACK (sd)->unlink (STATE_CALLBACK (sd), f1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long
|
long
|
||||||
sim_io_time(SIM_DESC sd,
|
sim_io_time (SIM_DESC sd,
|
||||||
long *t)
|
long *t)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd), t);
|
return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd), t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_system(SIM_DESC sd, const char *s)
|
sim_io_system (SIM_DESC sd, const char *s)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->system (STATE_CALLBACK (sd), s);
|
return STATE_CALLBACK (sd)->system (STATE_CALLBACK (sd), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_rename(SIM_DESC sd,
|
sim_io_rename (SIM_DESC sd,
|
||||||
const char *f1,
|
const char *f1,
|
||||||
const char *f2)
|
const char *f2)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->rename (STATE_CALLBACK (sd), f1, f2);
|
return STATE_CALLBACK (sd)->rename (STATE_CALLBACK (sd), f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_write_stdout(SIM_DESC sd,
|
sim_io_write_stdout (SIM_DESC sd,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
switch (CURRENT_STDIO) {
|
switch (CURRENT_STDIO) {
|
||||||
case DO_USE_STDIO:
|
case DO_USE_STDIO:
|
||||||
|
@ -111,7 +111,7 @@ sim_io_write_stdout(SIM_DESC sd,
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sim_io_flush_stdout(SIM_DESC sd)
|
sim_io_flush_stdout (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
switch (CURRENT_STDIO) {
|
switch (CURRENT_STDIO) {
|
||||||
case DO_USE_STDIO:
|
case DO_USE_STDIO:
|
||||||
|
@ -127,9 +127,9 @@ sim_io_flush_stdout(SIM_DESC sd)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_write_stderr(SIM_DESC sd,
|
sim_io_write_stderr (SIM_DESC sd,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
switch (CURRENT_STDIO) {
|
switch (CURRENT_STDIO) {
|
||||||
case DO_USE_STDIO:
|
case DO_USE_STDIO:
|
||||||
|
@ -147,7 +147,7 @@ sim_io_write_stderr(SIM_DESC sd,
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sim_io_flush_stderr(SIM_DESC sd)
|
sim_io_flush_stderr (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
switch (CURRENT_STDIO) {
|
switch (CURRENT_STDIO) {
|
||||||
case DO_USE_STDIO:
|
case DO_USE_STDIO:
|
||||||
|
@ -163,19 +163,19 @@ sim_io_flush_stderr(SIM_DESC sd)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_write(SIM_DESC sd,
|
sim_io_write (SIM_DESC sd,
|
||||||
int fd,
|
int fd,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->write (STATE_CALLBACK (sd), fd, buf, len);
|
return STATE_CALLBACK (sd)->write (STATE_CALLBACK (sd), fd, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_read_stdin(SIM_DESC sd,
|
sim_io_read_stdin (SIM_DESC sd,
|
||||||
char *buf,
|
char *buf,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
switch (CURRENT_STDIO) {
|
switch (CURRENT_STDIO) {
|
||||||
case DO_USE_STDIO:
|
case DO_USE_STDIO:
|
||||||
|
@ -193,123 +193,123 @@ sim_io_read_stdin(SIM_DESC sd,
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_read(SIM_DESC sd, int fd,
|
sim_io_read (SIM_DESC sd, int fd,
|
||||||
char *buf,
|
char *buf,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->read (STATE_CALLBACK (sd), fd, buf, len);
|
return STATE_CALLBACK (sd)->read (STATE_CALLBACK (sd), fd, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_open(SIM_DESC sd,
|
sim_io_open (SIM_DESC sd,
|
||||||
const char *name,
|
const char *name,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->open (STATE_CALLBACK (sd), name, flags);
|
return STATE_CALLBACK (sd)->open (STATE_CALLBACK (sd), name, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_lseek(SIM_DESC sd,
|
sim_io_lseek (SIM_DESC sd,
|
||||||
int fd,
|
int fd,
|
||||||
long off,
|
long off,
|
||||||
int way)
|
int way)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->lseek (STATE_CALLBACK (sd), fd, off, way);
|
return STATE_CALLBACK (sd)->lseek (STATE_CALLBACK (sd), fd, off, way);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_isatty(SIM_DESC sd,
|
sim_io_isatty (SIM_DESC sd,
|
||||||
int fd)
|
int fd)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->isatty (STATE_CALLBACK (sd), fd);
|
return STATE_CALLBACK (sd)->isatty (STATE_CALLBACK (sd), fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_get_errno(SIM_DESC sd)
|
sim_io_get_errno (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->get_errno (STATE_CALLBACK (sd));
|
return STATE_CALLBACK (sd)->get_errno (STATE_CALLBACK (sd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sim_io_close(SIM_DESC sd,
|
sim_io_close (SIM_DESC sd,
|
||||||
int fd)
|
int fd)
|
||||||
{
|
{
|
||||||
return STATE_CALLBACK (sd)->close (STATE_CALLBACK (sd), fd);
|
return STATE_CALLBACK (sd)->close (STATE_CALLBACK (sd), fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sim_io_printf(SIM_DESC sd,
|
sim_io_printf (SIM_DESC sd,
|
||||||
const char *fmt,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt);
|
|
||||||
STATE_CALLBACK (sd)->vprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
sim_io_vprintf(SIM_DESC sd,
|
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
va_list ap)
|
...)
|
||||||
{
|
|
||||||
STATE_CALLBACK (sd)->vprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
sim_io_eprintf(SIM_DESC sd,
|
|
||||||
const char *fmt,
|
|
||||||
...)
|
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start (ap, fmt);
|
||||||
STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
STATE_CALLBACK (sd)->vprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
||||||
va_end(ap);
|
va_end (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sim_io_evprintf(SIM_DESC sd,
|
sim_io_vprintf (SIM_DESC sd,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
va_list ap)
|
va_list ap)
|
||||||
|
{
|
||||||
|
STATE_CALLBACK (sd)->vprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sim_io_eprintf (SIM_DESC sd,
|
||||||
|
const char *fmt,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start (ap, fmt);
|
||||||
|
STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
||||||
|
va_end (ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sim_io_evprintf (SIM_DESC sd,
|
||||||
|
const char *fmt,
|
||||||
|
va_list ap)
|
||||||
{
|
{
|
||||||
STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sim_io_error(SIM_DESC sd,
|
sim_io_error (SIM_DESC sd,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
if (sd == NULL || STATE_CALLBACK (sd) == NULL) {
|
if (sd == NULL || STATE_CALLBACK (sd) == NULL) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start (ap, fmt);
|
||||||
vfprintf (stderr, fmt, ap);
|
vfprintf (stderr, fmt, ap);
|
||||||
va_end(ap);
|
va_end (ap);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start (ap, fmt);
|
||||||
STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
|
||||||
va_end(ap);
|
va_end (ap);
|
||||||
STATE_CALLBACK (sd)->error (STATE_CALLBACK (sd), "");
|
STATE_CALLBACK (sd)->error (STATE_CALLBACK (sd), "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sim_io_poll_quit(SIM_DESC sd)
|
sim_io_poll_quit (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
if (STATE_CALLBACK (sd)->poll_quit != NULL && poll_quit_count-- < 0)
|
if (STATE_CALLBACK (sd)->poll_quit != NULL && poll_quit_count-- < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -196,7 +196,7 @@ do_memopt_add (SIM_DESC sd,
|
||||||
if (free_buffer == 0 || free_buffer == (char*)-1) /* MAP_FAILED */
|
if (free_buffer == 0 || free_buffer == (char*)-1) /* MAP_FAILED */
|
||||||
{
|
{
|
||||||
sim_io_error (sd, "Error, cannot mmap file (%s).\n",
|
sim_io_error (sd, "Error, cannot mmap file (%s).\n",
|
||||||
strerror(errno));
|
strerror (errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -500,7 +500,7 @@ memory_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
|
||||||
if (mmap_next_fd < 0)
|
if (mmap_next_fd < 0)
|
||||||
{
|
{
|
||||||
sim_io_eprintf (sd, "Cannot open file `%s': %s\n",
|
sim_io_eprintf (sd, "Cannot open file `%s': %s\n",
|
||||||
arg, strerror(errno));
|
arg, strerror (errno));
|
||||||
return SIM_RC_FAIL;
|
return SIM_RC_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
|
||||||
|
|
||||||
case OPTION_ARCHITECTURE_INFO:
|
case OPTION_ARCHITECTURE_INFO:
|
||||||
{
|
{
|
||||||
const char **list = bfd_arch_list();
|
const char **list = bfd_arch_list ();
|
||||||
const char **lp;
|
const char **lp;
|
||||||
if (list == NULL)
|
if (list == NULL)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
|
@ -740,7 +740,7 @@ profile_print_pc (sim_cpu *cpu, int verbose)
|
||||||
}
|
}
|
||||||
if (ok == 0)
|
if (ok == 0)
|
||||||
sim_io_eprintf (sd, "Failed to write to \"gmon.out\" profile file\n");
|
sim_io_eprintf (sd, "Failed to write to \"gmon.out\" profile file\n");
|
||||||
fclose(pf);
|
fclose (pf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ sim_resume (SIM_DESC sd,
|
||||||
#ifdef SIM_CPU_EXCEPTION_RESUME
|
#ifdef SIM_CPU_EXCEPTION_RESUME
|
||||||
{
|
{
|
||||||
sim_cpu* cpu = STATE_CPU (sd, next_cpu_nr);
|
sim_cpu* cpu = STATE_CPU (sd, next_cpu_nr);
|
||||||
SIM_CPU_EXCEPTION_RESUME(sd, cpu, sig_to_deliver);
|
SIM_CPU_EXCEPTION_RESUME (sd, cpu, sig_to_deliver);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,9 @@ int
|
||||||
sim_stop (SIM_DESC sd)
|
sim_stop (SIM_DESC sd)
|
||||||
{
|
{
|
||||||
ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
|
ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
|
||||||
sim_events_schedule_after_signal(sd,
|
sim_events_schedule_after_signal (sd,
|
||||||
0 /*NOW*/,
|
0 /*NOW*/,
|
||||||
control_c_simulation,
|
control_c_simulation,
|
||||||
sd /*data*/);
|
sd /*data*/);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,12 +345,12 @@ cb_syscall (cb, sc)
|
||||||
errcode = EINVAL;
|
errcode = EINVAL;
|
||||||
goto FinishSyscall;
|
goto FinishSyscall;
|
||||||
}
|
}
|
||||||
if (cb_is_stdout(cb, fd))
|
if (cb_is_stdout (cb, fd))
|
||||||
{
|
{
|
||||||
result = (int) (*cb->write_stdout) (cb, buf, bytes_read);
|
result = (int) (*cb->write_stdout) (cb, buf, bytes_read);
|
||||||
(*cb->flush_stdout) (cb);
|
(*cb->flush_stdout) (cb);
|
||||||
}
|
}
|
||||||
else if (cb_is_stderr(cb, fd))
|
else if (cb_is_stderr (cb, fd))
|
||||||
{
|
{
|
||||||
result = (int) (*cb->write_stderr) (cb, buf, bytes_read);
|
result = (int) (*cb->write_stderr) (cb, buf, bytes_read);
|
||||||
(*cb->flush_stderr) (cb);
|
(*cb->flush_stderr) (cb);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue