+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>
* sim-options.c (complete_option_list, sim_complete_command):
#endif
#if defined (_MSC_VER)
/* NB - this will not compile! */
- int k = win32pollquit();
+ int k = win32pollquit ();
if (k == 1)
return 1;
else if (k == 2)
hw_pal_device *hw_pal = (hw_pal_device *)hw_data (me);
char c;
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)
{
case HW_IO_NOT_READY:
#if NOT_YET
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 */
return;
}
sockaddr.sin_family = PF_INET;
- sockaddr.sin_port = htons(port);
+ sockaddr.sin_port = htons (port);
memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr,
sizeof (struct in_addr));
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",
strerror (errno));
/* don't output anything if empty */
if (phys->nr_cells == 0)
{
- strcpy(pos, "");
+ strcpy (pos, "");
len = 0;
}
else if (i == phys->nr_cells)
{
/* all zero */
- strcpy(pos, "0");
+ strcpy (pos, "0");
len = 1;
}
else
{
if (pos != buf)
{
- strcat(pos, ",");
- pos = strchr(pos, '\0');
+ strcat (pos, ",");
+ pos = strchr (pos, '\0');
}
if (phys->cells[i] < 10)
sprintf (pos, "%ld", (unsigned long)phys->cells[i]);
else
sprintf (pos, "0x%lx", (unsigned long)phys->cells[i]);
- pos = strchr(pos, '\0');
+ pos = strchr (pos, '\0');
}
len = pos - buf;
}
{
int status;
va_list ap;
- va_start(ap, request);
+ va_start (ap, request);
status = me->to_ioctl (me, request, ap);
- va_end(ap);
+ va_end (ap);
return status;
}
struct hw *me = hw_instance_hw (instance);
if (instance->to_instance_delete == NULL)
hw_abort (me, "no delete method");
- instance->method->delete(instance);
+ instance->method->delete (instance);
if (instance->args != NULL)
free (instance->args);
if (instance->path != NULL)
struct hw_instance *curr = me->instances;
while (curr != NULL)
{
- ASSERT(curr != instance);
+ ASSERT (curr != instance);
curr = curr->next;
}
/* unlink the child */
}
while (method->name != NULL)
{
- if (strcmp(method->name, method_name) == 0)
+ if (strcmp (method->name, method_name) == 0)
{
return method->method (instance,
n_stack_args, stack_args,
*previous = instance;
}
instance->data = data;
- instance->args = (args == NULL ? NULL : (char *) strdup(args));
- instance->path = (path == NULL ? NULL : (char *) strdup(path));
+ instance->args = (args == NULL ? NULL : (char *) strdup (args));
+ instance->path = (path == NULL ? NULL : (char *) strdup (path));
cap_add (instance->owner->ihandles, instance);
return instance;
#endif
{
if (port_name == NULL || port_name[0] == '\0')
return 0;
- if (isdigit(port_name[0]))
+ if (isdigit (port_name[0]))
{
return strtoul (port_name, NULL, 0);
}
{
if (port_name[len] == '\0')
return ports->number;
- else if(isdigit (port_name[len]))
+ else if (isdigit (port_name[len]))
{
int port = (ports->number
+ strtoul (&port_name[len], NULL, 0));
&& port_number < ports->number + ports->nr_ports)
{
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)
hw_abort (me, "hw_port_encode: buffer overflow");
return strlen (buf);
{
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");
- strcpy(buf, ports->name);
- return strlen(buf);
+ strcpy (buf, ports->name);
+ return strlen (buf);
}
}
}
}
}
sprintf (buf, "%d", port_number);
- if (strlen(buf) >= sizeof_buf)
+ if (strlen (buf) >= sizeof_buf)
hw_abort (me, "hw_port_encode: buffer overflow");
- return strlen(buf);
+ return strlen (buf);
}
{
ASSERT (property->init_array != NULL);
ASSERT (property->property->array == NULL);
- ASSERT(property->property->disposition == permenant_object);
+ ASSERT (property->property->disposition == permenant_object);
switch (property->property->type)
{
case array_property:
{
signed32 new_boolean = (boolean ? -1 : 0);
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);
}
{
/* enter the full path as the init array */
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, permenant_object);
}
if (node == NULL)
hw_abort (me, "property \"%s\" not found", 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)
- 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);
- memcpy (&ihandle, node->array, sizeof(ihandle));
- instance = external_to_hw_instance (me, BE2H_cell(ihandle));
+ ASSERT (sizeof (ihandle) == node->sizeof_array);
+ memcpy (&ihandle, node->array, sizeof (ihandle));
+ instance = external_to_hw_instance (me, BE2H_cell (ihandle));
ASSERT (instance != NULL);
return instance;
}
{
H2BE (integer);
hw_add_property (me, property, integer_property,
- &integer, sizeof(integer),
- &integer, sizeof(integer),
+ &integer, sizeof (integer),
+ &integer, sizeof (integer),
NULL, permenant_object);
}
hw_abort (me, "property \"%s\" not found", property);
if (node->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));
return BE2H_cell (integer);
}
int nr_cells)
{
int i;
- ASSERT(nr_cells == unit->nr_cells);
+ ASSERT (nr_cells == unit->nr_cells);
for (i = 0; i < unit->nr_cells; i++)
{
*cell = H2BE_cell (unit->cells[i]);
int nr_cells)
{
int i;
- memset(unit, 0, sizeof(*unit));
+ memset (unit, 0, sizeof (*unit));
unit->nr_cells = nr_cells;
for (i = 0; i < unit->nr_cells; i++)
{
nr_reg_property_cells (struct hw *me,
int nr_regs)
{
- return (hw_unit_nr_address_cells (hw_parent(me))
- + hw_unit_nr_size_cells (hw_parent(me))
+ return (hw_unit_nr_address_cells (hw_parent (me))
+ + hw_unit_nr_size_cells (hw_parent (me))
) * nr_regs;
}
const char *string)
{
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);
}
if (node->type != string_property)
hw_abort (me, "property \"%s\" of wrong type (string)", property);
string = node->array;
- ASSERT (strlen(string) + 1 == node->sizeof_array);
+ ASSERT (strlen (string) + 1 == node->sizeof_array);
return string;
}
if (index == 0)
{
*string = node->array;
- ASSERT (strlen(*string) + 1 == node->sizeof_array);
+ ASSERT (strlen (*string) + 1 == node->sizeof_array);
return 1;
}
break;
while (master->property != original)
{
master = master->next;
- ASSERT(master != NULL);
+ ASSERT (master != NULL);
}
/* now duplicate it */
hw_add_property (me, property,
{
alias[len] = device_specifier[len];
len++;
- if (len >= sizeof(alias))
+ if (len >= sizeof (alias))
hw_abort (NULL, "split_device_specifier: buffer overflow");
}
alias[len] = '\0';
if (aliases != NULL
&& 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);
}
else
}
else
{
- strcpy(spec->buf, device_specifier);
+ strcpy (spec->buf, device_specifier);
}
/* 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");
/* strip leading spaces */
chp = spec->buf;
- while (*chp != '\0' && isspace(*chp))
+ while (*chp != '\0' && isspace (*chp))
chp++;
if (*chp == '\0')
return 0;
/* find the path and terminate it with null */
spec->path = chp;
- while (*chp != '\0' && !isspace(*chp))
+ while (*chp != '\0' && !isspace (*chp))
chp++;
if (*chp != '\0')
{
}
/* and any value */
- while (*chp != '\0' && isspace(*chp))
+ while (*chp != '\0' && isspace (*chp))
chp++;
spec->value = chp;
}
else
{
- chp = strrchr(spec->path, '/');
+ chp = strrchr (spec->path, '/');
if (chp == NULL)
{
spec->property = spec->path;
- spec->path = strchr(spec->property, '\0');
+ spec->path = strchr (spec->property, '\0');
}
else
{
/* break out the base */
if (spec->name[0] == '(')
{
- chp = strchr(spec->name, ')');
+ chp = strchr (spec->name, ')');
if (chp == NULL)
{
spec->family = spec->name;
spec->family = spec->name;
}
/* now break out the unit */
- chp = strchr(spec->name, '@');
+ chp = strchr (spec->name, '@');
if (chp == NULL)
{
spec->unit = NULL;
spec->unit = chp;
}
/* finally any args */
- chp = strchr(chp, ':');
+ chp = strchr (chp, ':');
if (chp == NULL)
spec->args = NULL;
else
/* <non-white-space> */
static const char *
-skip_token(const char *chp)
+skip_token (const char *chp)
{
- while (!isspace(*chp) && *chp != '\0')
+ while (!isspace (*chp) && *chp != '\0')
chp++;
- while (isspace(*chp) && *chp != '\0')
+ while (isspace (*chp) && *chp != '\0')
chp++;
return chp;
}
int i;
int nr;
const char *curr = chp;
- memset(size, 0, sizeof(*size));
+ memset (size, 0, sizeof (*size));
/* parse the numeric list */
size->nr_cells = hw_unit_nr_size_cells (bus);
nr = 0;
chp = property_value;
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 = parse_size (current, hw_parent(current),
+ chp = parse_size (current, hw_parent (current),
chp, ®s[reg_nr].size);
}
nr_ranges = count_entries (current, property_name, property_value, 3);
/* create a property of that size */
- ranges = zalloc (nr_ranges * sizeof(*ranges));
+ ranges = zalloc (nr_ranges * sizeof (*ranges));
/* fill it in */
chp = property_value;
{
chp = parse_address (current, current,
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 = parse_size (current, current,
chp, &ranges[range_nr].size);
}
/* perhaps integer array property is better */
hw_add_array_property (current, property_name, words,
- sizeof(words[0]) * nr_entries);
+ sizeof (words[0]) * nr_entries);
}
}
approx_nr_strings = (approx_nr_strings) / 2;
/* 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 */
chp = property_value;
{
/* copy over a single unquoted token */
int len = 0;
- while (chp[len] != '\0' && !isspace(chp[len]))
+ while (chp[len] != '\0' && !isspace (chp[len]))
len++;
- strings[nr_strings] = zalloc(len + 1);
- strncpy(strings[nr_strings], chp, len);
+ strings[nr_strings] = zalloc (len + 1);
+ strncpy (strings[nr_strings], chp, len);
strings[nr_strings][len] = '\0';
chp += len;
}
nr_strings--;
free (strings[nr_strings]);
}
- free(strings);
+ free (strings);
}
nr_words += 1;
}
hw_add_array_property (current, spec.property,
- words, sizeof(words[0]) * nr_words);
+ words, sizeof (words[0]) * nr_words);
break;
}
case '"':
{
parse_ranges_property (current, spec.property, spec.value);
}
- else if (isdigit(spec.value[0])
- || (spec.value[0] == '-' && isdigit(spec.value[1]))
- || (spec.value[0] == '+' && isdigit(spec.value[1])))
+ else if (isdigit (spec.value[0])
+ || (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
- parse_string_property(current, spec.property, spec.value);
+ parse_string_property (current, spec.property, spec.value);
break;
}
}
struct printer *p)
{
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);
}
}
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");
break;
}
if (property->array != NULL)
{
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
{
struct printer *p = data;
char src[32];
char dst[32];
- 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 (me, my_port, src, sizeof (src), output_port);
+ hw_port_encode (dest, dest_port, dst, sizeof (dst), input_port);
p->print (p->file,
"%s > %s %s %s\n",
hw_path (me),
\f
#if NOT_YET
device_instance *
-tree_instance(struct hw *root,
- const char *device_specifier)
+tree_instance (struct hw *root,
+ const char *device_specifier)
{
/* find the device node */
struct hw *me;
name_specifier spec;
- if (!split_device_specifier(root, device_specifier, &spec))
+ if (!split_device_specifier (root, device_specifier, &spec))
return NULL;
- me = split_find_device(root, &spec);
+ me = split_find_device (root, &spec);
if (spec.name != NULL)
return NULL;
/* create the instance */
- return device_create_instance(me, device_specifier, spec.last_args);
+ return device_create_instance (me, device_specifier, spec.last_args);
}
#endif
if (sd != NULL)
{
va_list ap;
- va_start(ap, fmt);
+ va_start (ap, fmt);
sim_io_evprintf (sd, fmt, ap);
- va_end(ap);
+ va_end (ap);
sim_io_error (sd, "\n");
}
else
{
va_list ap;
- va_start(ap, fmt);
+ va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
- va_end(ap);
+ va_end (ap);
fprintf (stderr, "\n");
abort ();
}
out:
if (new_asr)
- free(new_asr);
+ free (new_asr);
if (new_asr2)
- free(new_asr2);
+ free (new_asr2);
}
/* Free T and all subtrees. */
&& !bfd_big_endian (STATE_PROG_BFD (sd))))
prefered_target_byte_order = 0;
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
: BIG_ENDIAN);
if (STATE_ENVIRONMENT (sd) == ALL_ENVIRONMENT)
{
const char *env =
- tree_find_string_property(root, "/openprom/options/env");
- STATE_ENVIRONMENT (sd) = ((strcmp(env, "user") == 0
- || strcmp(env, "uea") == 0)
+ tree_find_string_property (root, "/openprom/options/env");
+ STATE_ENVIRONMENT (sd) = ((strcmp (env, "user") == 0
+ || strcmp (env, "uea") == 0)
? USER_ENVIRONMENT
- : (strcmp(env, "virtual") == 0
- || strcmp(env, "vea") == 0)
+ : (strcmp (env, "virtual") == 0
+ || strcmp (env, "vea") == 0)
? VIRTUAL_ENVIRONMENT
- : (strcmp(env, "operating") == 0
- || strcmp(env, "oea") == 0)
+ : (strcmp (env, "operating") == 0
+ || strcmp (env, "oea") == 0)
? OPERATING_ENVIRONMENT
: ALL_ENVIRONMENT);
}
#if (WITH_TREE_PROPERTIES)
if (current_alignment == 0)
current_alignment =
- (tree_find_boolean_property(root, "/openprom/options/strict-alignment?")
+ (tree_find_boolean_property (root, "/openprom/options/strict-alignment?")
? STRICT_ALIGNMENT
: NONSTRICT_ALIGNMENT);
#endif
static void
sim_core_uninstall (SIM_DESC sd)
{
- sim_core *core = STATE_CORE(sd);
+ sim_core *core = STATE_CORE (sd);
unsigned map;
/* blow away any mappings */
for (map = 0; map < nr_maps; map++) {
sim_core_mapping *tbd = curr;
curr = curr->next;
if (tbd->free_buffer != NULL) {
- SIM_ASSERT(tbd->buffer != NULL);
- free(tbd->free_buffer);
+ SIM_ASSERT (tbd->buffer != NULL);
+ free (tbd->free_buffer);
}
- free(tbd);
+ free (tbd);
}
core->common.map[map].first = NULL;
}
void *buffer,
void *free_buffer)
{
- sim_core_mapping *new_mapping = ZALLOC(sim_core_mapping);
+ sim_core_mapping *new_mapping = ZALLOC (sim_core_mapping);
/* common */
new_mapping->level = level;
new_mapping->space = space;
if (nr_bytes == 0)
{
#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
#if (WITH_HW)
sim_hw_abort (sd, client, "called on sim_core_map_attach with size zero");
/* find the insertion point (between last/next) */
next_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->bound < addr)))
}
/* create/insert the new mapping */
- *last_mapping = new_sim_core_mapping(sd,
- level,
- space, addr, nr_bytes, modulo,
- client, buffer, free_buffer);
+ *last_mapping = new_sim_core_mapping (sd,
+ level,
+ space, addr, nr_bytes, modulo,
+ client, buffer, free_buffer);
(*last_mapping)->next = next_mapping;
}
#endif
#endif
void *optional_buffer)
{
- sim_core *memory = STATE_CORE(sd);
+ sim_core *memory = STATE_CORE (sd);
unsigned map;
void *buffer;
void *free_buffer;
STATIC_INLINE_SIM_CORE\
(sim_core_mapping *)
-sim_core_find_mapping(sim_core_common *core,
- unsigned map,
- address_word addr,
- unsigned nr_bytes,
- transfer_type transfer,
- int abort, /*either 0 or 1 - hint to inline/-O */
- sim_cpu *cpu, /* abort => cpu != NULL */
- sim_cia cia)
+sim_core_find_mapping (sim_core_common *core,
+ unsigned map,
+ address_word addr,
+ unsigned nr_bytes,
+ transfer_type transfer,
+ int abort, /*either 0 or 1 - hint to inline/-O */
+ sim_cpu *cpu, /* abort => cpu != NULL */
+ sim_cia cia)
{
sim_core_mapping *mapping = core->map[map].first;
ASSERT ((addr & (nr_bytes - 1)) == 0); /* must be aligned */
}
#endif
((unsigned_1*)buffer)[count] =
- *(unsigned_1*)sim_core_translate(mapping, raddr);
+ *(unsigned_1*)sim_core_translate (mapping, raddr);
count += 1;
}
return count;
continue;
}
#endif
- *(unsigned_1*)sim_core_translate(mapping, raddr) =
+ *(unsigned_1*)sim_core_translate (mapping, raddr) =
((unsigned_1*)buffer)[count];
count += 1;
}
0 /*dont-abort*/, NULL, NULL_CIA);
if (mapping == NULL)
return NULL;
- return sim_core_translate(mapping, addr);
+ return sim_core_translate (mapping, addr);
}
#endif
{
va_list ap;
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);
va_end (ap);
}
/*-LOCK-*/
sigset_t old_mask;
sigset_t new_mask;
- sigfillset(&new_mask);
+ sigfillset (&new_mask);
sigprocmask (SIG_SETMASK, &new_mask, &old_mask);
#endif
new = ZALLOC (sim_event);
new_event->watching = watch_timer;
if (fmt == NULL || !ETRACE_P || vasprintf (&new_event->trace, fmt, ap) < 0)
new_event->trace = NULL;
- insert_sim_event(sd, new_event, delta_time);
- ETRACE((_ETRACE,
- "event scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx%s%s\n",
- (long)sim_events_time(sd),
- (long)new_event,
- (long)new_event->time_of_event,
- (long)new_event->handler,
- (long)new_event->data,
- (new_event->trace != NULL) ? ", " : "",
- (new_event->trace != NULL) ? new_event->trace : ""));
+ insert_sim_event (sd, new_event, delta_time);
+ ETRACE ((_ETRACE,
+ "event scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx%s%s\n",
+ (long)sim_events_time (sd),
+ (long)new_event,
+ (long)new_event->time_of_event,
+ (long)new_event->handler,
+ (long)new_event->data,
+ (new_event->trace != NULL) ? ", " : "",
+ (new_event->trace != NULL) ? new_event->trace : ""));
return new_event;
}
#endif
/*-LOCK-*/
sigset_t old_mask;
sigset_t new_mask;
- sigfillset(&new_mask);
+ sigfillset (&new_mask);
sigprocmask (SIG_SETMASK, &new_mask, &old_mask);
#endif
ETRACE ((_ETRACE,
"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->time_of_event,
(long)new_event->handler,
int events_were_last,
int events_were_next)
{
- sim_events *events = STATE_EVENTS(sd);
+ sim_events *events = STATE_EVENTS (sd);
if (events_were_last)
{
/* Halted part way through event processing */
(void)
sim_events_process (SIM_DESC sd)
{
- sim_events *events = STATE_EVENTS(sd);
- signed64 event_time = sim_events_time(sd);
+ sim_events *events = STATE_EVENTS (sd);
+ signed64 event_time = sim_events_time (sd);
/* Clear work_pending before checking nr_held. Clearing
work_pending after nr_held (with out a lock could loose an
/*-LOCK-*/
sigset_t old_mask;
sigset_t new_mask;
- sigfillset(&new_mask);
- sigprocmask(SIG_SETMASK, &new_mask, &old_mask);
+ sigfillset (&new_mask);
+ sigprocmask (SIG_SETMASK, &new_mask, &old_mask);
#endif
for (i = 0; i < events->nr_held; i++)
#if defined(HAVE_SIGPROCMASK) && defined(SIG_SETMASK)
/*-UNLOCK-*/
- sigprocmask(SIG_SETMASK, &old_mask, NULL);
+ sigprocmask (SIG_SETMASK, &old_mask, NULL);
#endif
}
{
sim_event_handler *handler = to_do->handler;
void *data = to_do->data;
- ETRACE((_ETRACE,
- "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
- (long) event_time,
- (long) to_do,
- (long) handler,
- (long) data,
- (to_do->trace != NULL) ? ", " : "",
- (to_do->trace != NULL) ? to_do->trace : ""));
+ ETRACE ((_ETRACE,
+ "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
+ (long) event_time,
+ (long) to_do,
+ (long) handler,
+ (long) data,
+ (to_do->trace != NULL) ? ", " : "",
+ (to_do->trace != NULL) ? to_do->trace : ""));
sim_events_free (sd, to_do);
handler (sd, data);
}
void *data = to_do->data;
events->queue = to_do->next;
update_time_from_event (sd);
- ETRACE((_ETRACE,
- "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
- (long) event_time,
- (long) to_do,
- (long) handler,
- (long) data,
- (to_do->trace != NULL) ? ", " : "",
- (to_do->trace != NULL) ? to_do->trace : ""));
+ ETRACE ((_ETRACE,
+ "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
+ (long) event_time,
+ (long) to_do,
+ (long) handler,
+ (long) data,
+ (to_do->trace != NULL) ? ", " : "",
+ (to_do->trace != NULL) ? to_do->trace : ""));
sim_events_free (sd, to_do);
handler (sd, data);
}
}
line_nr = 0;
- while (fgets (device_path, sizeof(device_path), description))
+ while (fgets (device_path, sizeof (device_path), description))
{
char *device;
/* check that a complete line was read */
sim_io_eprintf (sd, "%s:%d: unexpected eof", file_name, line_nr);
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);
return SIM_RC_FAIL;
}
- *strchr(device_path, '\n') = '\0';
+ *strchr (device_path, '\n') = '\0';
line_nr++;
}
/* parse this line */
int
-sim_io_init(SIM_DESC sd)
+sim_io_init (SIM_DESC sd)
{
return STATE_CALLBACK (sd)->init (STATE_CALLBACK (sd));
}
int
-sim_io_shutdown(SIM_DESC sd)
+sim_io_shutdown (SIM_DESC sd)
{
return STATE_CALLBACK (sd)->shutdown (STATE_CALLBACK (sd));
}
int
-sim_io_unlink(SIM_DESC sd,
- const char *f1)
+sim_io_unlink (SIM_DESC sd,
+ const char *f1)
{
return STATE_CALLBACK (sd)->unlink (STATE_CALLBACK (sd), f1);
}
long
-sim_io_time(SIM_DESC sd,
- long *t)
+sim_io_time (SIM_DESC sd,
+ long *t)
{
return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd), t);
}
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);
}
int
-sim_io_rename(SIM_DESC sd,
- const char *f1,
- const char *f2)
+sim_io_rename (SIM_DESC sd,
+ const char *f1,
+ const char *f2)
{
return STATE_CALLBACK (sd)->rename (STATE_CALLBACK (sd), f1, f2);
}
int
-sim_io_write_stdout(SIM_DESC sd,
- const char *buf,
- int len)
+sim_io_write_stdout (SIM_DESC sd,
+ const char *buf,
+ int len)
{
switch (CURRENT_STDIO) {
case DO_USE_STDIO:
void
-sim_io_flush_stdout(SIM_DESC sd)
+sim_io_flush_stdout (SIM_DESC sd)
{
switch (CURRENT_STDIO) {
case DO_USE_STDIO:
int
-sim_io_write_stderr(SIM_DESC sd,
- const char *buf,
- int len)
+sim_io_write_stderr (SIM_DESC sd,
+ const char *buf,
+ int len)
{
switch (CURRENT_STDIO) {
case DO_USE_STDIO:
void
-sim_io_flush_stderr(SIM_DESC sd)
+sim_io_flush_stderr (SIM_DESC sd)
{
switch (CURRENT_STDIO) {
case DO_USE_STDIO:
int
-sim_io_write(SIM_DESC sd,
- int fd,
- const char *buf,
- int len)
+sim_io_write (SIM_DESC sd,
+ int fd,
+ const char *buf,
+ int len)
{
return STATE_CALLBACK (sd)->write (STATE_CALLBACK (sd), fd, buf, len);
}
int
-sim_io_read_stdin(SIM_DESC sd,
- char *buf,
- int len)
+sim_io_read_stdin (SIM_DESC sd,
+ char *buf,
+ int len)
{
switch (CURRENT_STDIO) {
case DO_USE_STDIO:
int
-sim_io_read(SIM_DESC sd, int fd,
- char *buf,
- int len)
+sim_io_read (SIM_DESC sd, int fd,
+ char *buf,
+ int len)
{
return STATE_CALLBACK (sd)->read (STATE_CALLBACK (sd), fd, buf, len);
}
int
-sim_io_open(SIM_DESC sd,
- const char *name,
- int flags)
+sim_io_open (SIM_DESC sd,
+ const char *name,
+ int flags)
{
return STATE_CALLBACK (sd)->open (STATE_CALLBACK (sd), name, flags);
}
int
-sim_io_lseek(SIM_DESC sd,
- int fd,
- long off,
- int way)
+sim_io_lseek (SIM_DESC sd,
+ int fd,
+ long off,
+ int way)
{
return STATE_CALLBACK (sd)->lseek (STATE_CALLBACK (sd), fd, off, way);
}
int
-sim_io_isatty(SIM_DESC sd,
- int fd)
+sim_io_isatty (SIM_DESC sd,
+ int fd)
{
return STATE_CALLBACK (sd)->isatty (STATE_CALLBACK (sd), fd);
}
int
-sim_io_get_errno(SIM_DESC sd)
+sim_io_get_errno (SIM_DESC sd)
{
return STATE_CALLBACK (sd)->get_errno (STATE_CALLBACK (sd));
}
int
-sim_io_close(SIM_DESC sd,
- int fd)
+sim_io_close (SIM_DESC sd,
+ int fd)
{
return STATE_CALLBACK (sd)->close (STATE_CALLBACK (sd), fd);
}
void
-sim_io_printf(SIM_DESC sd,
- const char *fmt,
- ...)
+sim_io_printf (SIM_DESC sd,
+ const char *fmt,
+ ...)
{
va_list ap;
- va_start(ap, fmt);
+ va_start (ap, fmt);
STATE_CALLBACK (sd)->vprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
- va_end(ap);
+ va_end (ap);
}
void
-sim_io_vprintf(SIM_DESC sd,
- const char *fmt,
- va_list ap)
+sim_io_vprintf (SIM_DESC sd,
+ 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,
- ...)
+sim_io_eprintf (SIM_DESC sd,
+ const char *fmt,
+ ...)
{
va_list ap;
- va_start(ap, fmt);
+ va_start (ap, fmt);
STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
- va_end(ap);
+ va_end (ap);
}
void
-sim_io_evprintf(SIM_DESC sd,
- const char *fmt,
- va_list ap)
+sim_io_evprintf (SIM_DESC sd,
+ const char *fmt,
+ va_list ap)
{
STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
}
void
-sim_io_error(SIM_DESC sd,
- const char *fmt,
- ...)
+sim_io_error (SIM_DESC sd,
+ const char *fmt,
+ ...)
{
if (sd == NULL || STATE_CALLBACK (sd) == NULL) {
va_list ap;
- va_start(ap, fmt);
+ va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
- va_end(ap);
+ va_end (ap);
fprintf (stderr, "\n");
abort ();
}
else {
va_list ap;
- va_start(ap, fmt);
+ va_start (ap, fmt);
STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap);
- va_end(ap);
+ va_end (ap);
STATE_CALLBACK (sd)->error (STATE_CALLBACK (sd), "");
}
}
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 (free_buffer == 0 || free_buffer == (char*)-1) /* MAP_FAILED */
{
sim_io_error (sd, "Error, cannot mmap file (%s).\n",
- strerror(errno));
+ strerror (errno));
}
}
#endif
if (mmap_next_fd < 0)
{
sim_io_eprintf (sd, "Cannot open file `%s': %s\n",
- arg, strerror(errno));
+ arg, strerror (errno));
return SIM_RC_FAIL;
}
case OPTION_ARCHITECTURE_INFO:
{
- const char **list = bfd_arch_list();
+ const char **list = bfd_arch_list ();
const char **lp;
if (list == NULL)
abort ();
}
if (ok == 0)
sim_io_eprintf (sd, "Failed to write to \"gmon.out\" profile file\n");
- fclose(pf);
+ fclose (pf);
}
}
#ifdef SIM_CPU_EXCEPTION_RESUME
{
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
sim_stop (SIM_DESC sd)
{
ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- sim_events_schedule_after_signal(sd,
- 0 /*NOW*/,
- control_c_simulation,
- sd /*data*/);
+ sim_events_schedule_after_signal (sd,
+ 0 /*NOW*/,
+ control_c_simulation,
+ sd /*data*/);
return 1;
}
errcode = EINVAL;
goto FinishSyscall;
}
- if (cb_is_stdout(cb, fd))
+ if (cb_is_stdout (cb, fd))
{
result = (int) (*cb->write_stdout) (cb, buf, bytes_read);
(*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);
(*cb->flush_stderr) (cb);