ubsan: m10300: shift exponent -4
[deliverable/binutils-gdb.git] / sim / ppc / hw_vm.c
index df861d47ec4e8b73357a46d1d1545a9079ef67db..1bce41cf8a498352e75ff9cb69aefac8ddeaea0f 100644 (file)
@@ -4,7 +4,7 @@
     
     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,
@@ -13,8 +13,7 @@
     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/>.
     
     */
 
@@ -93,7 +92,6 @@ hw_vm_init_address_callback(device *me)
 
   /* 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*/,
@@ -105,13 +103,12 @@ hw_vm_init_address_callback(device *me)
 
 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 */
@@ -121,7 +118,6 @@ hw_vm_attach_address(device *me,
     vm->heap_upper_limit = addr + nr_bytes;
   }
   device_attach_address(device_parent(me),
-                       device_name(me),
                        attach_raw_memory,
                        0 /*address space*/,
                        addr,
@@ -167,7 +163,6 @@ hw_vm_add_space(device *me,
 
   /* 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,
@@ -217,22 +212,33 @@ hw_vm_io_write_buffer_callback(device *me,
 
 
 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;
+    
 }
 
 
@@ -247,15 +253,14 @@ static device_callbacks const hw_vm_callbacks = {
   { 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;
@@ -266,4 +271,4 @@ const device_descriptor hw_vm_device_descriptor[] = {
   { NULL },
 };
 
-#endif _HW_VM_C_
+#endif /* _HW_VM_C_ */
This page took 0.024984 seconds and 4 git commands to generate.