/* This file is part of the program psim.
- Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
+ Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
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, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
if (old_edge->disposition == permenant_object)
device_error(me, "attempt to delete permenant interrupt");
*list = old_edge->next;
- zfree(old_edge);
+ free(old_edge);
return;
}
}
break;
case tempoary_object:
*list = old_edge->next;
- zfree(old_edge);
+ free(old_edge);
break;
}
}
device_error(me, "no delete method");
instance->callback->delete(instance);
if (instance->args != NULL)
- zfree(instance->args);
+ free(instance->args);
if (instance->path != NULL)
- zfree(instance->path);
+ free(instance->path);
if (instance->child == NULL) {
/* only remove leaf nodes */
device_instance **curr = &me->instances;
instance->child->parent = NULL;
}
cap_remove(me->ihandles, instance);
- zfree(instance);
+ free(instance);
}
INLINE_DEVICE\
new_entry->sizeof_init_array = sizeof_init_array;
}
new_entry->value = new_value;
-
}
device_error(me, "conflict between type of new and old value for property %s", property);
/* replace its value */
if (value->array != NULL)
- zfree((void*)value->array);
+ free((void*)value->array);
new_array = (sizeof_array > 0
? zalloc(sizeof_array)
: (void*)0);
/* zap the current value, will be initialized later */
ASSERT(current->init_array != NULL);
if (current->value->array != NULL) {
- zfree((void*)current->value->array);
+ free((void*)current->value->array);
current->value->array = NULL;
}
delete_point = &(*delete_point)->next;
ASSERT(current->init_array == NULL);
*delete_point = current->next;
if (current->value->array != NULL)
- zfree((void*)current->value->array);
- zfree(current->value);
- zfree(current);
+ free((void*)current->value->array);
+ free(current->value);
+ free(current);
break;
}
}
ASSERT(property->init_array != NULL);
ASSERT(property->value->array == NULL);
device_find_ihandle_runtime_property(me, property->value->name, &spec);
- ihandle = device_create_instance(spec.phandle,
- spec.full_path,
- spec.args);
+ ihandle = tree_instance(me, spec.full_path);
device_set_ihandle_property(me, property->value->name, ihandle);
break;
}
const char *property,
const ihandle_runtime_property_spec *ihandle)
{
- unsigned_cell *cells;
- char *chp;
- unsigned sizeof_cells = (sizeof(unsigned_cell) * 3
- + (strlen(ihandle->full_path) + 1)
- + (ihandle->args != NULL
- ? (strlen(ihandle->args) + 1)
- : 0));
-
- /* the basics */
- cells = zalloc(sizeof_cells);
- cells[0] = H2BE_cell(device_to_external(ihandle->phandle));
- cells[1] = (ihandle->full_path == NULL ? 0 : -1);
- cells[2] = (ihandle->args == NULL ? 0 : -1);
- chp = (char*)&cells[3];
-
- /* the full path (if present) */
- if (ihandle->full_path != NULL) {
- strcpy(chp, ihandle->full_path);
- chp += strlen(ihandle->full_path) + 1;
- }
-
- /* the args (if present) */
- if (ihandle->args != NULL) {
- strcpy(chp, ihandle->args);
- chp += strlen(ihandle->args) + 1;
- }
-
- /* add it */
- ASSERT(sizeof_cells == (chp - (char*)cells));
+ /* enter the full path as the init array */
device_add_property(me, property, ihandle_property,
- cells, sizeof_cells,
+ ihandle->full_path, strlen(ihandle->full_path) + 1,
NULL, 0,
NULL, permenant_object);
}
const char *property,
ihandle_runtime_property_spec *ihandle)
{
- const unsigned_cell *cells;
- const char *chp;
device_property_entry *entry = find_property_entry(me, property);
TRACE(trace_devices,
("device_find_ihandle_runtime_property(me=0x%lx, property=%s)\n",
|| entry->value->type != ihandle_property
|| entry->value->disposition != permenant_object)
device_error(me, "property %s not found or of wrong type", property);
- cells = entry->init_array;
- chp = (char*)&cells[3];
ASSERT(entry->init_array != NULL);
- /* the device to be opened */
- ihandle->phandle = external_to_device(me, BE2H_cell(cells[0]));
/* the full path */
- if (cells[1] != 0) {
- ihandle->full_path = chp;
- chp += strlen(ihandle->full_path) + 1;
- }
- else
- ihandle->full_path = NULL;
- /* the args */
- if (cells[2] != 0) {
- ihandle->args = chp;
- chp += strlen(ihandle->args) + 1;
- }
- else
- ihandle->args = NULL;
- /* reached the end? */
- ASSERT(entry->sizeof_init_array
- == (chp - (char*)cells));
- return;
+ ihandle->full_path = entry->init_array;
}
cells, sizeof_cells,
NULL, permenant_object);
- zfree(cells);
+ free(cells);
}
INLINE_DEVICE\
cells, sizeof_cells,
NULL, permenant_object);
- zfree(cells);
+ free(cells);
}
INLINE_DEVICE\
/* I/O */
EXTERN_DEVICE\
-(void volatile)
+(void)
device_error(device *me,
const char *fmt,
...)