This is more in line with how the function db_user_to_kernel_address() is called. In this way there is one cast less and several GCC warnings are silenced.
* i386/i386/db_interface.c (db_set_hw_watchpoint) (kern_addr): Use vm_offset_t instead of an unsigned int. (db_user_to_kernel_address) (kaddr): Likewise. (db_user_to_kernel_address) (ptetokv): Don't cast return value. (db_read_bytes) (kern_addr): Use vm_offset_t instead of an unsigned int. (db_write_bytes_user_space) (kern_addr): Likewise. (db_task_name) (vaddr, kaddr): Likewise. * i386/i386/db_interface.h (db_user_to_kernel_address) (kaddr): Likewise. --- i386/i386/db_interface.c | 12 ++++++------ i386/i386/db_interface.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c index 15e486b..f07c12c 100644 --- a/i386/i386/db_interface.c +++ b/i386/i386/db_interface.c @@ -177,7 +177,7 @@ db_set_hw_watchpoint( { vm_size_t size = watch->hiaddr - watch->loaddr; db_addr_t addr = watch->loaddr; - unsigned int kern_addr; + vm_offset_t kern_addr; if (num >= 4) return FALSE; @@ -412,7 +412,7 @@ int db_user_to_kernel_address( task_t task, vm_offset_t addr, - unsigned int *kaddr, + vm_offset_t *kaddr, int flag) { pt_entry_t *ptp; @@ -439,7 +439,7 @@ db_user_to_kernel_address( } return(-1); } - *kaddr = (unsigned)ptetokv(*ptp) + (addr & (INTEL_PGBYTES-1)); + *kaddr = ptetokv(*ptp) + (addr & (INTEL_PGBYTES-1)); return(0); } @@ -456,7 +456,7 @@ db_read_bytes( { char *src; int n; - unsigned kern_addr; + vm_offset_t kern_addr; src = (char *)addr; if ((addr >= VM_MIN_KERNEL_ADDRESS && addr < VM_MAX_KERNEL_ADDRESS) || task == TASK_NULL) { @@ -567,7 +567,7 @@ db_write_bytes_user_space( { char *dst; int n; - unsigned kern_addr; + vm_offset_t kern_addr; while (size > 0) { if (db_user_to_kernel_address(task, addr, &kern_addr, 1) < 0) @@ -726,7 +726,7 @@ db_task_name( { char *p; int n; - unsigned vaddr, kaddr; + vm_offset_t vaddr, kaddr; unsigned sp; if (task->map->pmap == kernel_pmap) { diff --git a/i386/i386/db_interface.h b/i386/i386/db_interface.h index 8f27649..d41a97d 100644 --- a/i386/i386/db_interface.h +++ b/i386/i386/db_interface.h @@ -58,7 +58,7 @@ extern boolean_t db_phys_eq ( extern int db_user_to_kernel_address( task_t task, vm_offset_t addr, - unsigned int *kaddr, + vm_offset_t *kaddr, int flag); extern void db_task_name (task_t task); -- 1.8.1.4