summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-09 01:04:52 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-09 01:04:52 +0100
commit4ae07e7e07cf77f1b7ce06bebf1057bfe4a16c54 (patch)
treeb36ddbd87707b330069c83f1298e6b8e6015e2cb
parentdfb4a89ba3bee1c4c000f8e6b54fb92ed25fb2b7 (diff)
Use unsigned long for addresses and sizes
TODO: remonter formats * i386/include/mach/i386/vm_types.h (vm_offset_t): Define to unsigned long. (signed32_t): Define to signed int. (unsigned32_t): Define to unsigned int. * i386/include/mach/sa/stdarg.h (__va_size): Use sizeof(unsigned long)-1 instead of 3. * include/mach/port.h (mach_port_t): Define to vm_offset_t instead of natural_t. * include/sys/types.h (size_t): Define to unsigned long instead of natural_t. * linux/src/include/asm-i386/posix_types.h (__kernel_size_t): Define to unsigned long. (__kernel_ssize_t): Define to long. * linux/src/include/linux/stddef.h (size_t): Define to unsigned long. * device/dev_pager.c (dev_pager_hash): Cast port to vm_offset_t insted of natural_t. (device_pager_data_request): Fix format. * device/ds_routines.c (ds_no_senders): Fix format. * i386/i386/io_map.c (io_map): Likewise. * i386/i386at/autoconf.c (take_dev_irq): Likewise. * i386/i386at/com.c (comattach): Likewise. * i386/i386at/lpr.c (lprattach): Likewise. * i386/i386at/model_dep.c (mem_size_init, mem_size_init, c_boot_entry): Likewise. * i386/intel/pmap.c (pmap_enter): Likewise. * ipc/ipc_notify.c (ipc_notify_port_deleted, ipc_notify_msg_accepted, ipc_notify_dead_name): Likewise. * ipc/mach_port.c (mach_port_destroy, mach_port_deallocate): Likewise. * kern/ipc_kobject.c (ipc_kobject_destroy): Likewise. * kern/slab.c (kalloc_init): Likewise. * vm/vm_fault.c (vm_fault_page): Likewise. * vm/vm_map.c (vm_map_pmap_enter): Likewise. * xen/block.c (device_read): Likewise. * device/net_io.c (bpf_match): Take unsigned long * instead of unsigned int *. (bpf_do_filter): Make mem unsigned long instead of long. * i386/i386/ktss.c (ktss_init): Cast pointer to unsigned long instead of unsigned. * i386/i386/pcb.c (stack_attach, switch_ktss): Cast pointers to long instead of int. * i386/i386/trap.c (dump_ss): Likewise. * ipc/ipc_hash.c (IH_LOCAL_HASH): Cast object to vm_offset_t. * ipc/mach_msg.c (mach_msg_receive, mach_msg_receive_continue): Cast kmsg to vm_offset_t instead of natural_t. * kern/pc_sample.c (take_pc_sample): Cast to vm_offset_t instead of natural_t. * kern/boot_script.c (sym, arg): Set type of `val' field to long instead of int. (create_task, builtin_symbols, boot_script_parse_line, boot_script_define_function): Cast to long instead of int. * kern/bootstrap.c (bootstrap_create): Likewise. * kern/sched_prim.c (decl_simple_lock_data): Likewise. * kern/printf.c (vsnprintf): Set size type to size_t. * kern/printf.h (vsnprintf): Likewise. * vm/vm_map.h (kentry_data_size): Fix type to vm_size_t. * vm/vm_object.c (vm_object_pmap_protect_by_page): Fix size parameter type to vm_size_t.
-rw-r--r--device/dev_pager.c4
-rw-r--r--device/ds_routines.c2
-rw-r--r--device/net_io.c6
-rw-r--r--i386/i386/io_map.c2
-rw-r--r--i386/i386/ktss.c2
-rw-r--r--i386/i386/pcb.c12
-rw-r--r--i386/i386/trap.c4
-rw-r--r--i386/i386at/autoconf.c2
-rw-r--r--i386/i386at/com.c2
-rw-r--r--i386/i386at/lpr.c2
-rw-r--r--i386/i386at/model_dep.c6
-rw-r--r--i386/include/mach/i386/vm_types.h6
-rw-r--r--i386/include/mach/sa/stdarg.h2
-rw-r--r--i386/intel/pmap.c2
-rw-r--r--include/mach/port.h2
-rw-r--r--include/sys/types.h2
-rw-r--r--ipc/ipc_hash.c2
-rw-r--r--ipc/ipc_notify.c6
-rw-r--r--ipc/mach_msg.c4
-rw-r--r--ipc/mach_port.c4
-rw-r--r--kern/boot_script.c21
-rw-r--r--kern/bootstrap.c12
-rw-r--r--kern/ipc_kobject.c2
-rw-r--r--kern/pc_sample.c2
-rw-r--r--kern/printf.c2
-rw-r--r--kern/printf.h2
-rw-r--r--kern/sched_prim.c2
-rw-r--r--kern/slab.c2
-rw-r--r--linux/src/include/asm-i386/posix_types.h4
-rw-r--r--linux/src/include/linux/stddef.h2
-rw-r--r--vm/vm_fault.c2
-rw-r--r--vm/vm_map.c2
-rw-r--r--vm/vm_map.h2
-rw-r--r--vm/vm_object.c2
-rw-r--r--xen/block.c2
35 files changed, 68 insertions, 67 deletions
diff --git a/device/dev_pager.c b/device/dev_pager.c
index bc58a15..e0ca2c7 100644
--- a/device/dev_pager.c
+++ b/device/dev_pager.c
@@ -165,7 +165,7 @@ decl_simple_lock_data(,
dev_pager_hash_lock)
#define dev_pager_hash(name_port) \
- (((natural_t)(name_port) & 0xffffff) % DEV_PAGER_HASH_COUNT)
+ (((vm_offset_t)(name_port) & 0xffffff) % DEV_PAGER_HASH_COUNT)
void dev_pager_hash_init(void)
{
@@ -336,7 +336,7 @@ kern_return_t device_pager_data_request(
#endif /* lint */
if (device_pager_debug)
- printf("(device_pager)data_request: pager=%p, offset=0x%x, length=0x%x\n",
+ printf("(device_pager)data_request: pager=%p, offset=0x%lx, length=0x%x\n",
pager, offset, length);
ds = dev_pager_hash_lookup((ipc_port_t)pager);
diff --git a/device/ds_routines.c b/device/ds_routines.c
index 5a6fdd2..68589de 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -1449,7 +1449,7 @@ static void
ds_no_senders(notification)
mach_no_senders_notification_t *notification;
{
- printf("ds_no_senders called! device_port=0x%x count=%d\n",
+ printf("ds_no_senders called! device_port=0x%lx count=%d\n",
notification->not_header.msgh_remote_port,
notification->not_count);
}
diff --git a/device/net_io.c b/device/net_io.c
index 52a0716..4ebf996 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -394,7 +394,7 @@ int net_add_q_info (ipc_port_t rcv_port);
int bpf_match (
net_hash_header_t hash,
int n_keys,
- unsigned int *keys,
+ unsigned long *keys,
net_hash_entry_t **hash_headpp,
net_hash_entry_t *entpp);
@@ -1638,7 +1638,7 @@ bpf_do_filter(infp, p, wirelen, header, hlen, hash_headpp, entpp)
register unsigned long A, X;
register int k;
- long mem[BPF_MEMWORDS];
+ unsigned long mem[BPF_MEMWORDS];
/* Generic pointer to either HEADER or P according to the specified offset. */
char *data = NULL;
@@ -2032,7 +2032,7 @@ int
bpf_match (hash, n_keys, keys, hash_headpp, entpp)
net_hash_header_t hash;
register int n_keys;
- register unsigned int *keys;
+ register unsigned long *keys;
net_hash_entry_t **hash_headpp, *entpp;
{
register net_hash_entry_t head, entp;
diff --git a/i386/i386/io_map.c b/i386/i386/io_map.c
index 5b77552..b095f22 100644
--- a/i386/i386/io_map.c
+++ b/i386/i386/io_map.c
@@ -49,7 +49,7 @@ io_map(phys_addr, size)
*/
start = kernel_virtual_start;
kernel_virtual_start += round_page(size);
- printf("stealing kernel virtual addresses %08x-%08x\n", start, kernel_virtual_start);
+ printf("stealing kernel virtual addresses %08lx-%08lx\n", start, kernel_virtual_start);
}
else {
(void) kmem_alloc_pageable(kernel_map, &start, round_page(size));
diff --git a/i386/i386/ktss.c b/i386/i386/ktss.c
index 66432f3..e2c4425 100644
--- a/i386/i386/ktss.c
+++ b/i386/i386/ktss.c
@@ -48,7 +48,7 @@ ktss_init()
#ifdef MACH_XEN
/* Xen won't allow us to do any I/O by default anyway, just register
* exception stack */
- if (hyp_stack_switch(KERNEL_DS, (unsigned)(exception_stack+1024)))
+ if (hyp_stack_switch(KERNEL_DS, (unsigned long)(exception_stack+1024)))
panic("couldn't register exception stack\n");
#else /* MACH_XEN */
/* Initialize the master TSS descriptor. */
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
index e065dbb..dfe0444 100644
--- a/i386/i386/pcb.c
+++ b/i386/i386/pcb.c
@@ -93,10 +93,10 @@ void stack_attach(thread, stack, continuation)
* This function will not return normally,
* so we don`t have to worry about a return address.
*/
- STACK_IKS(stack)->k_eip = (int) Thread_continue;
- STACK_IKS(stack)->k_ebx = (int) continuation;
- STACK_IKS(stack)->k_esp = (int) STACK_IEL(stack);
- STACK_IKS(stack)->k_ebp = (int) 0;
+ STACK_IKS(stack)->k_eip = (long) Thread_continue;
+ STACK_IKS(stack)->k_ebx = (long) continuation;
+ STACK_IKS(stack)->k_esp = (long) STACK_IEL(stack);
+ STACK_IKS(stack)->k_ebp = (long) 0;
/*
* Point top of kernel stack to user`s registers.
@@ -152,8 +152,8 @@ void switch_ktss(pcb)
*/
pcb_stack_top = (pcb->iss.efl & EFL_VM)
- ? (int) (&pcb->iss + 1)
- : (int) (&pcb->iss.v86_segs);
+ ? (long) (&pcb->iss + 1)
+ : (long) (&pcb->iss.v86_segs);
#ifdef MACH_XEN
/* No IO mask here */
diff --git a/i386/i386/trap.c b/i386/i386/trap.c
index 01c83f5..d594907 100644
--- a/i386/i386/trap.c
+++ b/i386/i386/trap.c
@@ -217,8 +217,8 @@ dump_ss(regs);
printf("now %08x\n", subcode);
#endif
if (trunc_page(subcode) == 0
- || (subcode >= (int)_start
- && subcode < (int)etext)) {
+ || (subcode >= (long)_start
+ && subcode < (long)etext)) {
printf("Kernel page fault at address 0x%x, "
"eip = 0x%x\n",
subcode, regs->eip);
diff --git a/i386/i386at/autoconf.c b/i386/i386at/autoconf.c
index d1f2863..93c7141 100644
--- a/i386/i386at/autoconf.c
+++ b/i386/i386at/autoconf.c
@@ -135,7 +135,7 @@ void take_dev_irq(
printf("The device below will clobber IRQ %d.\n", pic);
printf("You have two devices at the same IRQ.\n");
printf("This won't work. Reconfigure your hardware and try again.\n");
- printf("%s%d: port = %x, spl = %d, pic = %d.\n",
+ printf("%s%d: port = %lx, spl = %ld, pic = %d.\n",
dev->name, dev->unit, dev->address,
dev->sysdep, dev->sysdep1);
while (1);
diff --git a/i386/i386at/com.c b/i386/i386at/com.c
index f02c7f8..165b0fa 100644
--- a/i386/i386at/com.c
+++ b/i386/i386at/com.c
@@ -229,7 +229,7 @@ comattach(struct bus_device *dev)
u_short addr = dev->address;
take_dev_irq(dev);
- printf(", port = %x, spl = %d, pic = %d. (DOS COM%d)",
+ printf(", port = %lx, spl = %ld, pic = %d. (DOS COM%d)",
dev->address, dev->sysdep, dev->sysdep1, unit+1);
/* comcarrier[unit] = addr->flags;*/
diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c
index 468608c..b69e813 100644
--- a/i386/i386at/lpr.c
+++ b/i386/i386at/lpr.c
@@ -102,7 +102,7 @@ void lprattach(struct bus_device *dev)
u_short addr = (u_short) dev->address;
take_dev_irq(dev);
- printf(", port = %x, spl = %d, pic = %d.",
+ printf(", port = %lx, spl = %ld, pic = %d.",
dev->address, dev->sysdep, dev->sysdep1);
lprinfo[unit] = dev;
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 980708c..2f78520 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -284,7 +284,7 @@ mem_size_init(void)
phys_last_addr = phys_last_kb * 0x400;
#endif /* MACH_HYP */
- printf("AT386 boot: physical memory from 0x%x to 0x%x\n",
+ printf("AT386 boot: physical memory from 0x%lx to 0x%lx\n",
phys_first_addr, phys_last_addr);
/* Reserve room for virtual mappings.
@@ -292,7 +292,7 @@ mem_size_init(void)
max_phys_size = VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS - VM_KERNEL_MAP_SIZE;
if (phys_last_addr - phys_first_addr > max_phys_size) {
phys_last_addr = phys_first_addr + max_phys_size;
- printf("Truncating memory size to %dMiB\n", (phys_last_addr - phys_first_addr) / (1024 * 1024));
+ printf("Truncating memory size to %luMiB\n", (phys_last_addr - phys_first_addr) / (1024 * 1024));
/* TODO Xen: be nice, free lost memory */
}
@@ -514,7 +514,7 @@ void c_boot_entry(vm_offset_t bi)
strtab_size = (vm_offset_t)phystokv(boot_info.syms.a.strsize);
kern_sym_end = kern_sym_start + 4 + symtab_size + strtab_size;
- printf("kernel symbol table at %08x-%08x (%d,%d)\n",
+ printf("kernel symbol table at %08lx-%08lx (%d,%d)\n",
kern_sym_start, kern_sym_end,
symtab_size, strtab_size);
}
diff --git a/i386/include/mach/i386/vm_types.h b/i386/include/mach/i386/vm_types.h
index d54008e..1439940 100644
--- a/i386/include/mach/i386/vm_types.h
+++ b/i386/include/mach/i386/vm_types.h
@@ -73,7 +73,7 @@ typedef unsigned int uint32;
* A vm_offset_t is a type-neutral pointer,
* e.g. an offset into a virtual memory space.
*/
-typedef natural_t vm_offset_t;
+typedef unsigned long vm_offset_t;
typedef vm_offset_t * vm_offset_array_t;
/*
@@ -88,11 +88,11 @@ typedef natural_t vm_size_t;
*/
typedef signed char signed8_t;
typedef signed short signed16_t;
-typedef signed long signed32_t;
+typedef signed int signed32_t;
typedef signed long long signed64_t;
typedef unsigned char unsigned8_t;
typedef unsigned short unsigned16_t;
-typedef unsigned long unsigned32_t;
+typedef unsigned int unsigned32_t;
typedef unsigned long long unsigned64_t;
typedef float float32_t;
typedef double float64_t;
diff --git a/i386/include/mach/sa/stdarg.h b/i386/include/mach/sa/stdarg.h
index ba0f78a..550fec4 100644
--- a/i386/include/mach/sa/stdarg.h
+++ b/i386/include/mach/sa/stdarg.h
@@ -39,7 +39,7 @@ typedef __builtin_va_list va_list;
#else
-#define __va_size(type) ((sizeof(type)+3) & ~0x3)
+#define __va_size(type) ((sizeof(type)+sizeof(unsigned long)-1) & ~(sizeof(unsigned long)-1))
#ifndef _VA_LIST_
#define _VA_LIST_
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index d6e18e5..86d2415 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -1747,7 +1747,7 @@ void pmap_enter(pmap, v, pa, prot, wired)
vm_offset_t old_pa;
assert(pa != vm_page_fictitious_addr);
-if (pmap_debug) printf("pmap(%x, %x)\n", v, pa);
+if (pmap_debug) printf("pmap(%lx, %lx)\n", v, pa);
if (pmap == PMAP_NULL)
return;
diff --git a/include/mach/port.h b/include/mach/port.h
index 6dafb2f..53f6071 100644
--- a/include/mach/port.h
+++ b/include/mach/port.h
@@ -39,7 +39,7 @@
#include <mach/machine/vm_types.h>
-typedef natural_t mach_port_t;
+typedef vm_offset_t mach_port_t;
typedef mach_port_t *mach_port_array_t;
typedef int *rpc_signature_info_t;
diff --git a/include/sys/types.h b/include/sys/types.h
index d79e077..19e7b24 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -30,7 +30,7 @@
#ifndef _SIZE_T
#define _SIZE_T
-typedef natural_t size_t;
+typedef unsigned long size_t;
#endif
#ifndef _SSIZE_T
diff --git a/ipc/ipc_hash.c b/ipc/ipc_hash.c
index ad05016..5eec58c 100644
--- a/ipc/ipc_hash.c
+++ b/ipc/ipc_hash.c
@@ -326,7 +326,7 @@ ipc_hash_global_delete(
*/
#define IH_LOCAL_HASH(obj, size) \
- ((((mach_port_index_t) (obj)) >> 6) % (size))
+ ((((mach_port_index_t) (vm_offset_t) (obj)) >> 6) % (size))
/*
* Routine: ipc_hash_local_lookup
diff --git a/ipc/ipc_notify.c b/ipc/ipc_notify.c
index d06346e..25fa421 100644
--- a/ipc/ipc_notify.c
+++ b/ipc/ipc_notify.c
@@ -264,7 +264,7 @@ ipc_notify_port_deleted(port, name)
kmsg = ikm_alloc(sizeof *n);
if (kmsg == IKM_NULL) {
- printf("dropped port-deleted (0x%p, 0x%x)\n", port, name);
+ printf("dropped port-deleted (0x%p, 0x%lx)\n", port, name);
ipc_port_release_sonce(port);
return;
}
@@ -298,7 +298,7 @@ ipc_notify_msg_accepted(port, name)
kmsg = ikm_alloc(sizeof *n);
if (kmsg == IKM_NULL) {
- printf("dropped msg-accepted (0x%p, 0x%x)\n", port, name);
+ printf("dropped msg-accepted (0x%p, 0x%lx)\n", port, name);
ipc_port_release_sonce(port);
return;
}
@@ -437,7 +437,7 @@ ipc_notify_dead_name(port, name)
kmsg = ikm_alloc(sizeof *n);
if (kmsg == IKM_NULL) {
- printf("dropped dead-name (0x%p, 0x%x)\n", port, name);
+ printf("dropped dead-name (0x%p, 0x%lx)\n", port, name);
ipc_port_release_sonce(port);
return;
}
diff --git a/ipc/mach_msg.c b/ipc/mach_msg.c
index 43ae918..00ab085 100644
--- a/ipc/mach_msg.c
+++ b/ipc/mach_msg.c
@@ -218,7 +218,7 @@ mach_msg_receive(msg, option, rcv_size, rcv_name, time_out, notify)
if (mr != MACH_MSG_SUCCESS) {
if (mr == MACH_RCV_TOO_LARGE) {
mach_msg_size_t real_size =
- (mach_msg_size_t) (natural_t) kmsg;
+ (mach_msg_size_t) (vm_offset_t) kmsg;
assert(real_size > rcv_size);
@@ -309,7 +309,7 @@ mach_msg_receive_continue(void)
if (mr != MACH_MSG_SUCCESS) {
if (mr == MACH_RCV_TOO_LARGE) {
mach_msg_size_t real_size =
- (mach_msg_size_t) (natural_t) kmsg;
+ (mach_msg_size_t) (vm_offset_t) kmsg;
assert(real_size > rcv_size);
diff --git a/ipc/mach_port.c b/ipc/mach_port.c
index c5688c9..d0310b5 100644
--- a/ipc/mach_port.c
+++ b/ipc/mach_port.c
@@ -571,7 +571,7 @@ mach_port_destroy(
kr = ipc_right_lookup_write(space, name, &entry);
if (kr != KERN_SUCCESS) {
if (name != MACH_PORT_NULL && name != MACH_PORT_DEAD && space == current_space()) {
- printf("task %p destroying an invalid port %u, most probably a bug.\n", current_task(), name);
+ printf("task %p destroying an invalid port %lu, most probably a bug.\n", current_task(), name);
if (mach_port_deallocate_debug)
SoftDebugger("mach_port_deallocate");
}
@@ -615,7 +615,7 @@ mach_port_deallocate(
kr = ipc_right_lookup_write(space, name, &entry);
if (kr != KERN_SUCCESS) {
if (name != MACH_PORT_NULL && name != MACH_PORT_DEAD && space == current_space()) {
- printf("task %p deallocating an invalid port %u, most probably a bug.\n", current_task(), name);
+ printf("task %p deallocating an invalid port %lu, most probably a bug.\n", current_task(), name);
if (mach_port_deallocate_debug)
SoftDebugger("mach_port_deallocate");
}
diff --git a/kern/boot_script.c b/kern/boot_script.c
index 9349126..aa6833b 100644
--- a/kern/boot_script.c
+++ b/kern/boot_script.c
@@ -17,7 +17,7 @@ struct sym
int type;
/* Symbol value. */
- int val;
+ long val;
/* For function symbols; type of value returned by function. */
int ret_type;
@@ -44,7 +44,7 @@ struct arg
int type;
/* Argument value. */
- int val;
+ long val;
};
/* List of commands. */
@@ -70,7 +70,7 @@ static int
create_task (struct cmd *cmd, int *val)
{
int err = boot_script_task_create (cmd);
- *val = (int) cmd->task;
+ *val = (long) cmd->task;
return err;
}
@@ -91,9 +91,9 @@ prompt_resume_task (struct cmd *cmd, int *val)
/* List of builtin symbols. */
static struct sym builtin_symbols[] =
{
- { "task-create", VAL_FUNC, (int) create_task, VAL_TASK, 0 },
- { "task-resume", VAL_FUNC, (int) resume_task, VAL_NONE, 1 },
- { "prompt-task-resume", VAL_FUNC, (int) prompt_resume_task, VAL_NONE, 1 },
+ { "task-create", VAL_FUNC, (long) create_task, VAL_TASK, 0 },
+ { "task-resume", VAL_FUNC, (long) resume_task, VAL_NONE, 1 },
+ { "prompt-task-resume", VAL_FUNC, (long) prompt_resume_task, VAL_NONE, 1 },
};
#define NUM_BUILTIN (sizeof (builtin_symbols) / sizeof (builtin_symbols[0]))
@@ -294,7 +294,8 @@ boot_script_parse_line (void *hook, char *cmdline)
for (p += 2;;)
{
char c;
- int i, val, type;
+ int i, type;
+ long val;
struct sym *s;
/* Parse symbol name. */
@@ -349,7 +350,7 @@ boot_script_parse_line (void *hook, char *cmdline)
if (! s->run_on_exec)
{
(error
- = ((*((int (*) (struct cmd *, int *)) s->val))
+ = ((*((int (*) (struct cmd *, long *)) s->val))
(cmd, &val)));
if (error)
goto bad;
@@ -371,7 +372,7 @@ boot_script_parse_line (void *hook, char *cmdline)
else if (s->type == VAL_NONE)
{
type = VAL_SYM;
- val = (int) s;
+ val = (long) s;
}
else
{
@@ -681,7 +682,7 @@ boot_script_define_function (const char *name, int ret_type,
if (sym)
{
sym->type = VAL_FUNC;
- sym->val = (int) func;
+ sym->val = (long) func;
sym->ret_type = ret_type;
sym->run_on_exec = ret_type == VAL_NONE;
}
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 68f40b4..2b74073 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -154,19 +154,19 @@ void bootstrap_create()
/* Initialize boot script variables. We leak these send rights. */
losers = boot_script_set_variable
("host-port", VAL_PORT,
- (int)ipc_port_make_send(realhost.host_priv_self));
+ (long)ipc_port_make_send(realhost.host_priv_self));
if (losers)
panic ("cannot set boot-script variable host-port: %s",
boot_script_error_string (losers));
losers = boot_script_set_variable
("device-port", VAL_PORT,
- (int) ipc_port_make_send(master_device_port));
+ (long) ipc_port_make_send(master_device_port));
if (losers)
panic ("cannot set boot-script variable device-port: %s",
boot_script_error_string (losers));
losers = boot_script_set_variable ("kernel-command-line", VAL_STR,
- (int) kernel_cmdline);
+ (long) kernel_cmdline);
if (losers)
panic ("cannot set boot-script variable %s: %s",
"kernel-command-line", boot_script_error_string (losers));
@@ -185,12 +185,12 @@ void bootstrap_create()
get_compat_strings(flag_string, root_string);
losers = boot_script_set_variable ("boot-args", VAL_STR,
- (int) flag_string);
+ (long) flag_string);
if (losers)
panic ("cannot set boot-script variable %s: %s",
"boot-args", boot_script_error_string (losers));
losers = boot_script_set_variable ("root-device", VAL_STR,
- (int) root_string);
+ (long) root_string);
if (losers)
panic ("cannot set boot-script variable %s: %s",
"root-device", boot_script_error_string (losers));
@@ -232,7 +232,7 @@ void bootstrap_create()
if (eq == 0)
continue;
*eq++ = '\0';
- losers = boot_script_set_variable (word, VAL_STR, (int) eq);
+ losers = boot_script_set_variable (word, VAL_STR, (long) eq);
if (losers)
panic ("cannot set boot-script variable %s: %s",
word, boot_script_error_string (losers));
diff --git a/kern/ipc_kobject.c b/kern/ipc_kobject.c
index bd171a7..c922d7f 100644
--- a/kern/ipc_kobject.c
+++ b/kern/ipc_kobject.c
@@ -319,7 +319,7 @@ ipc_kobject_destroy(
default:
#if MACH_ASSERT
- printf("ipc_kobject_destroy: port 0x%p, kobj 0x%x, type %d\n",
+ printf("ipc_kobject_destroy: port 0x%p, kobj 0x%lx, type %d\n",
port, port->ip_kobject, ip_kotype(port));
#endif /* MACH_ASSERT */
break;
diff --git a/kern/pc_sample.c b/kern/pc_sample.c
index 2cec907..5700258 100644
--- a/kern/pc_sample.c
+++ b/kern/pc_sample.c
@@ -57,7 +57,7 @@ void take_pc_sample(
pc = interrupted_pc(t);
cp->seqno++;
sample = &((sampled_pc_t *)cp->buffer)[cp->seqno % MAX_PC_SAMPLES];
- sample->id = (natural_t)t;
+ sample->id = (vm_offset_t)t;
sample->pc = pc;
sample->sampletype = flavor;
}
diff --git a/kern/printf.c b/kern/printf.c
index 88a527b..658493c 100644
--- a/kern/printf.c
+++ b/kern/printf.c
@@ -601,7 +601,7 @@ snputc(char c, vm_offset_t arg)
}
int
-vsnprintf(char *buf, int size, const char *fmt, va_list args)
+vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
{
struct vsnprintf_cookie cookie
= { .buf = buf, .index = 0, .max_len = size };
diff --git a/kern/printf.h b/kern/printf.h
index 2268111..fcf2b3b 100644
--- a/kern/printf.h
+++ b/kern/printf.h
@@ -40,7 +40,7 @@ extern void printnum (unsigned long u, int base,
vm_offset_t putc_arg);
extern int sprintf (char *buf, const char *fmt, ...);
-extern int vsnprintf (char *buf, int size, const char *fmt, va_list args);
+extern int vsnprintf (char *buf, size_t size, const char *fmt, va_list args);
extern int printf (const char *fmt, ...);
diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index 9d4e8af..a7b7a4e 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -146,7 +146,7 @@ decl_simple_lock_data(, wait_lock[NUMQUEUES])
/* NOTE: we want a small positive integer out of this */
#define wait_hash(event) \
- ((((int)(event) < 0) ? ~(int)(event) : (int)(event)) % NUMQUEUES)
+ ((((long)(event) < 0) ? ~(long)(event) : (long)(event)) % NUMQUEUES)
void wait_queue_init(void)
{
diff --git a/kern/slab.c b/kern/slab.c
index 38413e8..f95ec0b 100644
--- a/kern/slab.c
+++ b/kern/slab.c
@@ -1381,7 +1381,7 @@ void kalloc_init(void)
size = 1 << KALLOC_FIRST_SHIFT;
for (i = 0; i < ARRAY_SIZE(kalloc_caches); i++) {
- sprintf(name, "kalloc_%u", size);
+ sprintf(name, "kalloc_%lu", size);
kmem_cache_init(&kalloc_caches[i], name, size, 0, NULL,
kalloc_pagealloc, kalloc_pagefree, 0);
size <<= 1;
diff --git a/linux/src/include/asm-i386/posix_types.h b/linux/src/include/asm-i386/posix_types.h
index 712ef70..6a04605 100644
--- a/linux/src/include/asm-i386/posix_types.h
+++ b/linux/src/include/asm-i386/posix_types.h
@@ -15,8 +15,8 @@ typedef long __kernel_off_t;
typedef int __kernel_pid_t;
typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;
-typedef unsigned int __kernel_size_t;
-typedef int __kernel_ssize_t;
+typedef unsigned long __kernel_size_t;
+typedef long __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
typedef long __kernel_time_t;
typedef long __kernel_clock_t;
diff --git a/linux/src/include/linux/stddef.h b/linux/src/include/linux/stddef.h
index c6221e7..488d49c 100644
--- a/linux/src/include/linux/stddef.h
+++ b/linux/src/include/linux/stddef.h
@@ -3,7 +3,7 @@
#ifndef _SIZE_T
#define _SIZE_T
-typedef unsigned int size_t;
+typedef unsigned long size_t;
#endif
#undef NULL
diff --git a/vm/vm_fault.c b/vm/vm_fault.c
index 10955ed..178f307 100644
--- a/vm/vm_fault.c
+++ b/vm/vm_fault.c
@@ -657,7 +657,7 @@ vm_fault_return_t vm_fault_page(first_object, first_offset,
m->offset + object->paging_offset,
PAGE_SIZE, access_required)) != KERN_SUCCESS) {
if (rc != MACH_SEND_INTERRUPTED)
- printf("%s(0x%p, 0x%p, 0x%x, 0x%x, 0x%x) failed, %x\n",
+ printf("%s(0x%p, 0x%p, 0x%lx, 0x%x, 0x%x) failed, %x\n",
"memory_object_data_request",
object->pager,
object->pager_request,
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 1f06275..8012bcf 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -711,7 +711,7 @@ vm_map_pmap_enter(map, addr, end_addr, object, offset, protection)
if (vm_map_pmap_enter_print) {
printf("vm_map_pmap_enter:");
- printf("map: %p, addr: %x, object: %p, offset: %x\n",
+ printf("map: %p, addr: %lx, object: %p, offset: %lx\n",
map, addr, object, offset);
}
diff --git a/vm/vm_map.h b/vm/vm_map.h
index 17de5db..381c7cf 100644
--- a/vm/vm_map.h
+++ b/vm/vm_map.h
@@ -354,7 +354,7 @@ MACRO_END
*/
extern vm_offset_t kentry_data;
-extern vm_offset_t kentry_data_size;
+extern vm_size_t kentry_data_size;
extern int kentry_count;
/* Initialize the module */
extern void vm_map_init(void);
diff --git a/vm/vm_object.c b/vm/vm_object.c
index d80124a..f101708 100644
--- a/vm/vm_object.c
+++ b/vm/vm_object.c
@@ -919,7 +919,7 @@ boolean_t vm_object_pmap_protect_by_page = FALSE;
void vm_object_pmap_protect(
register vm_object_t object,
register vm_offset_t offset,
- vm_offset_t size,
+ vm_size_t size,
pmap_t pmap,
vm_offset_t pmap_start,
vm_prot_t prot)
diff --git a/xen/block.c b/xen/block.c
index fb18b67..4253ef0 100644
--- a/xen/block.c
+++ b/xen/block.c
@@ -517,7 +517,7 @@ device_read (void *d, ipc_port_t reply_port,
thread_block(NULL);
if (err)
- printf("error reading %d bytes at sector %d\n", amt,
+ printf("error reading %d bytes at sector %ld\n", amt,
bn + offset / 512);
for (i = 0; i < nbpages; i++)