From 86156357706b3c741c6b5feda1d36d8687c660de Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 29 Mar 2020 13:17:46 +0200 Subject: 64bit: fix warnings * device/net_io.h (net_set_filter, ethernet_priority): Add prototypes. * device/subrs.h: Include . (if_init_queues): Add prototype. * i386/i386/model_dep.h (machine_relax): Add prototype. * i386/i386/trap.c (i386_astintr): Move mycpu variable definition to where it is used. * i386/i386at/model_dep.c (i386at_init): Likewise for nb_direct, addr, delta. * i386/xen/xen.c (return_to_iret): Change type to char[]. * xen/console.c: Include . * xen/evt.c (hyp_evt_handler): Cast NEVNT to int. * xen/grant.c: Include . (hyp_grant_takeback, hyp_grant_init): Fix print format. * xen/net.c: Include . (paranoia): Remove variable. (hyp_net_init, device_close, device_open): Cast nd - vif_data to int. Fix print format. * xen/store.c (store_put): Cast sizeof to int. * xen/time.c: Include "xen.h". * xen/xen.h (hypclock_machine_intr): Add prototype. --- device/net_io.h | 10 ++++++++++ device/subrs.h | 3 +++ i386/i386/model_dep.h | 5 +++++ i386/i386/trap.c | 4 ++-- i386/i386at/model_dep.c | 9 +++++---- i386/xen/xen.c | 2 +- xen/console.c | 1 + xen/evt.c | 2 +- xen/grant.c | 5 +++-- xen/net.c | 16 +++++++--------- xen/store.c | 2 +- xen/time.c | 1 + xen/xen.h | 2 ++ 13 files changed, 42 insertions(+), 20 deletions(-) diff --git a/device/net_io.h b/device/net_io.h index 5baf0678..9468e34b 100644 --- a/device/net_io.h +++ b/device/net_io.h @@ -109,6 +109,14 @@ net_do_filter( unsigned int data_count, const char * header); /* CSPF */ +io_return_t +net_set_filter( + struct ifnet *ifp, + ipc_port_t rcv_port, + int priority, + filter_t *filter, + unsigned int filter_count); + extern int bpf_do_filter( net_rcv_port_t infp, @@ -149,4 +157,6 @@ int bpf_match ( net_hash_entry_t **hash_headpp, net_hash_entry_t *entpp); +boolean_t ethernet_priority(const ipc_kmsg_t kmsg); + #endif /* _DEVICE_NET_IO_H_ */ diff --git a/device/subrs.h b/device/subrs.h index 680aaa6f..60ea6518 100644 --- a/device/subrs.h +++ b/device/subrs.h @@ -27,6 +27,9 @@ #define _SUBRS_H_ #include +#include + +extern void if_init_queues(struct ifnet *ifp); extern void sleep (vm_offset_t channel, int priority); extern void wakeup (vm_offset_t channel); diff --git a/i386/i386/model_dep.h b/i386/i386/model_dep.h index 54aa1ec7..711f07fd 100644 --- a/i386/i386/model_dep.h +++ b/i386/i386/model_dep.h @@ -50,4 +50,9 @@ extern void halt_cpu (void) __attribute__ ((noreturn)); */ extern void halt_all_cpus (boolean_t reboot) __attribute__ ((noreturn)); +/* + * Make cpu pause a bit. + */ +extern void machine_relax (void); + #endif /* _I386AT_MODEL_DEP_H_ */ diff --git a/i386/i386/trap.c b/i386/i386/trap.c index 281594d5..51c0f0a5 100644 --- a/i386/i386/trap.c +++ b/i386/i386/trap.c @@ -573,10 +573,10 @@ int user_trap(struct i386_saved_state *regs) void i386_astintr(void) { - int mycpu = cpu_number(); - (void) splsched(); /* block interrupts to check reasons */ #ifndef MACH_RING1 + int mycpu = cpu_number(); + if (need_ast[mycpu] & AST_I386_FP) { /* * AST was for delayed floating-point exception - diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index 72798fd4..40bc7cdc 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -340,8 +340,7 @@ i386at_init(void) { /* XXX move to intel/pmap.h */ extern pt_entry_t *kernel_page_dir; - int nb_direct, i; - vm_offset_t addr, delta; + int i; /* * Initialize the PIC prior to any possible call to an spl. @@ -365,6 +364,8 @@ i386at_init(void) #ifdef MACH_XEN kernel_cmdline = (char*) boot_info.cmd_line; #else /* MACH_XEN */ + vm_offset_t addr; + /* Copy content pointed by boot_info before losing access to it when it * is too far in physical memory. * Also avoids leaving them in precious areas such as DMA memory. */ @@ -428,10 +429,10 @@ i386at_init(void) * until we start using our new kernel segment descriptors. */ #if INIT_VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS - delta = INIT_VM_MIN_KERNEL_ADDRESS - LINEAR_MIN_KERNEL_ADDRESS; + vm_offset_t delta = INIT_VM_MIN_KERNEL_ADDRESS - LINEAR_MIN_KERNEL_ADDRESS; if ((vm_offset_t)(-delta) < delta) delta = (vm_offset_t)(-delta); - nb_direct = delta >> PDESHIFT; + int nb_direct = delta >> PDESHIFT; for (i = 0; i < nb_direct; i++) kernel_page_dir[lin2pdenum_cont(INIT_VM_MIN_KERNEL_ADDRESS) + i] = kernel_page_dir[lin2pdenum_cont(LINEAR_MIN_KERNEL_ADDRESS) + i]; diff --git a/i386/xen/xen.c b/i386/xen/xen.c index d10ecf39..f2dedfb9 100644 --- a/i386/xen/xen.c +++ b/i386/xen/xen.c @@ -44,7 +44,7 @@ void hyp_failsafe_c_callback(struct failsafe_callback_regs *regs) { panic("failsafe"); } -extern void return_to_iret; +extern char return_to_iret[]; void hypclock_machine_intr(int old_ipl, void *ret_addr, struct i386_interrupt_state *regs, uint64_t delta) { if (ret_addr == &return_to_iret) { diff --git a/xen/console.c b/xen/console.c index e5aeb186..4907903e 100644 --- a/xen/console.c +++ b/xen/console.c @@ -16,6 +16,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include #include #include diff --git a/xen/evt.c b/xen/evt.c index ae7e5d7a..296101aa 100644 --- a/xen/evt.c +++ b/xen/evt.c @@ -106,7 +106,7 @@ void hyp_intrinit() { void hyp_evt_handler(evtchn_port_t port, void (*handler)(), int unit, spl_t spl) { if (port > NEVNT) - panic("event channel port %d > %d not supported\n", port, NEVNT); + panic("event channel port %d > %d not supported\n", port, (int) NEVNT); intpri[port] = spl; iunit[port] = unit; form_int_mask(); diff --git a/xen/grant.c b/xen/grant.c index ae3a7bfc..6715a374 100644 --- a/xen/grant.c +++ b/xen/grant.c @@ -16,6 +16,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include #include #include @@ -99,7 +100,7 @@ void hyp_grant_takeback(grant_ref_t grant) { simple_lock(&lock); if (grants[grant].flags & (GTF_reading|GTF_writing)) - panic("grant %d still in use (%lx)\n", grant, grants[grant].flags); + panic("grant %d still in use (%x)\n", grant, grants[grant].flags); /* Note: this is not safe, a cmpxchg is needed, see grant_table.h */ grants[grant].flags = 0; @@ -128,7 +129,7 @@ void hyp_grant_init(void) { ret = hyp_grant_table_op(GNTTABOP_setup_table, kvtolin(&setup), 1); if (ret) - panic("setup grant table error %d", ret); + panic("setup grant table error %ld", ret); if (setup.status) panic("setup grant table: %d\n", setup.status); diff --git a/xen/net.c b/xen/net.c index 11121387..1dc2209e 100644 --- a/xen/net.c +++ b/xen/net.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -48,9 +49,6 @@ #define ADDRESS_SIZE 6 #define WINDOW __RING_SIZE((netif_rx_sring_t*)0, PAGE_SIZE) -/* Are we paranoid enough to not leak anything to backend? */ -static const int paranoia = 0; - struct net_data { struct device device; struct ifnet ifnet; @@ -458,7 +456,7 @@ void hyp_net_init(void) { c = hyp_store_write(0, hyp_store_state_connected, 5, VIF_PATH, "/", nd->vif, "/", "state"); if (!c) - panic("couldn't store state for eth%d (%s)", nd - vif_data, hyp_store_error); + panic("couldn't store state for eth%d (%s)", (int) (nd - vif_data), hyp_store_error); kfree((vm_offset_t) c, strlen(c)+1); while(1) { @@ -478,7 +476,7 @@ void hyp_net_init(void) { nd->rx_buf_pfn[i] = atop(addr); if (!nd->rx_copy) { if (hyp_do_update_va_mapping(kvtolin(nd->rx_buf[i]), 0, UVMF_INVLPG|UVMF_ALL)) - panic("eth: couldn't clear rx kv buf %d at %p", i, addr); + panic("eth: couldn't clear rx kv buf %d at %lx", i, addr); } /* and enqueue it to backend. */ enqueue_rx_buf(nd, i); @@ -526,8 +524,8 @@ device_close(void *devp) { struct net_data *nd = devp; if (--nd->open_count < 0) - panic("too many closes on eth%d", nd - vif_data); - printf("close, eth%d count %d\n",nd-vif_data,nd->open_count); + panic("too many closes on eth%d", (int) (nd - vif_data)); + printf("close, eth%d count %d\n", (int) (nd - vif_data), nd->open_count); if (nd->open_count) return 0; ipc_kobject_set(nd->port, IKO_NULL, IKOT_NONE); @@ -560,12 +558,12 @@ device_open (ipc_port_t reply_port, mach_msg_type_name_t reply_port_type, if (nd->open_count >= 0) { *devp = &nd->device ; nd->open_count++ ; - printf("re-open, eth%d count %d\n",nd-vif_data,nd->open_count); + printf("re-open, eth%d count %d\n", (int) (nd - vif_data), nd->open_count); return D_SUCCESS; } nd->open_count = 1; - printf("eth%d count %d\n",nd-vif_data,nd->open_count); + printf("eth%d count %d\n", (int) (nd - vif_data), nd->open_count); port = ipc_port_alloc_kernel(); if (port == IP_NULL) { diff --git a/xen/store.c b/xen/store.c index 659a70c7..23cbc223 100644 --- a/xen/store.c +++ b/xen/store.c @@ -62,7 +62,7 @@ static void store_put(hyp_store_transaction_t t, uint32_t type, struct store_req totlen += sizeof(head); if (totlen > sizeof(store->req) - 1) - panic("too big store message %d, max %d", totlen, sizeof(store->req)); + panic("too big store message %d, max %d", totlen, (int) sizeof(store->req)); while (hyp_ring_available(store->req, store->req_prod, store->req_cons) < totlen) hyp_yield(); diff --git a/xen/time.c b/xen/time.c index f2707a82..e8abd56b 100644 --- a/xen/time.c +++ b/xen/time.c @@ -25,6 +25,7 @@ #include #include #include +#include "xen.h" #include "time.h" #include "store.h" diff --git a/xen/xen.h b/xen/xen.h index f0a3abb9..cbb793e2 100644 --- a/xen/xen.h +++ b/xen/xen.h @@ -24,4 +24,6 @@ void hyp_dev_init(void); void hyp_idle(void); void hyp_p2m_init(void); +void hypclock_machine_intr(int old_ipl, void *ret_addr, struct i386_interrupt_state *regs, uint64_t delta); + #endif /* XEN_XEN_H */ -- cgit v1.2.3