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/>.
*/
/* establish this device as the default memory handler */
device_attach_address(device_parent(me),
- device_name(me),
attach_callback + 1,
0 /*address space - ignore*/,
0 /*addr - ignore*/,
static void
hw_vm_attach_address(device *me,
- const char *name,
- attach_type attach,
- int space,
- unsigned_word addr,
- unsigned nr_bytes,
- access_type access,
- device *who) /*callback/default*/
+ attach_type attach,
+ int space,
+ unsigned_word addr,
+ unsigned nr_bytes,
+ access_type access,
+ device *client) /*callback/default*/
{
hw_vm_device *vm = (hw_vm_device*)device_data(me);
/* update end of bss if necessary */
vm->heap_upper_limit = addr + nr_bytes;
}
device_attach_address(device_parent(me),
- device_name(me),
attach_raw_memory,
0 /*address space*/,
addr,
/* got the parameters, allocate the space */
device_attach_address(device_parent(me),
- "vm@0x0,0", /* stop remap */
attach_raw_memory,
0 /*address space*/,
block_addr,
static int
-hw_vm_ioctl_callback(device *me,
- cpu *processor,
- unsigned_word cia,
- va_list ap)
+hw_vm_ioctl(device *me,
+ cpu *processor,
+ unsigned_word cia,
+ device_ioctl_request request,
+ va_list ap)
{
/* While the caller is notified that the heap has grown by the
requested amount, the heap is actually extended out to a page
boundary. */
hw_vm_device *vm = (hw_vm_device*)device_data(me);
- unsigned_word requested_break = va_arg(ap, unsigned_word);
- unsigned_word new_break = ALIGN_8(requested_break);
- unsigned_word old_break = vm->heap_bound;
- signed_word delta = new_break - old_break;
- if (delta > 0)
- vm->heap_bound = ALIGN_PAGE(new_break);
+ switch (request) {
+ case device_ioctl_break:
+ {
+ unsigned_word requested_break = va_arg(ap, unsigned_word);
+ unsigned_word new_break = ALIGN_8(requested_break);
+ unsigned_word old_break = vm->heap_bound;
+ signed_word delta = new_break - old_break;
+ if (delta > 0)
+ vm->heap_bound = ALIGN_PAGE(new_break);
+ break;
+ }
+ default:
+ device_error(me, "Unsupported ioctl request");
+ break;
+ }
return 0;
+
}
{ generic_device_unit_decode,
generic_device_unit_encode, },
NULL, /* instance */
- hw_vm_ioctl_callback,
+ hw_vm_ioctl,
};
static void *
hw_vm_create(const char *name,
- const device_unit *address,
- const char *args,
- device *parent)
+ const device_unit *address,
+ const char *args)
{
hw_vm_device *vm = ZALLOC(hw_vm_device);
return vm;
{ NULL },
};
-#endif _HW_VM_C_
+#endif /* _HW_VM_C_ */