/* * Copyright (c) 2011, Max Filippov, Open Source and Linux Lab. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Open Source and Linux Lab nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" #include "exec/gdbstub.h" #include "qemu/host-utils.h" #if !defined(CONFIG_USER_ONLY) #include "hw/loader.h" #endif static struct XtensaConfigList *xtensa_cores; static void xtensa_core_class_init(ObjectClass *oc, void *data) { CPUClass *cc = CPU_CLASS(oc); XtensaCPUClass *xcc = XTENSA_CPU_CLASS(oc); const XtensaConfig *config = data; xcc->config = config; /* Use num_core_regs to see only non-privileged registers in an unmodified * gdb. Use num_regs to see all registers. gdb modification is required * for that: reset bit 0 in the 'flags' field of the registers definitions * in the gdb/xtensa-config.c inside gdb source tree or inside gdb overlay. */ cc->gdb_num_core_regs = config->gdb_regmap.num_regs; } void xtensa_finalize_config(XtensaConfig *config) { unsigned i, n = 0; if (config->gdb_regmap.num_regs) { return; } for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) { n += (config->gdb_regmap.reg[i].type != 6); } config->gdb_regmap.num_regs = n; } void xtensa_register_core(XtensaConfigList *node) { TypeInfo type = { .parent = TYPE_XTENSA_CPU, .class_init = xtensa_core_class_init, .class_data = (void *)node->config, }; node->next = xtensa_cores; xtensa_cores = node; type.name = g_strdup_printf("%s-" TYPE_XTENSA_CPU, node->config->name); type_register(&type); g_free((gpointer)type.name); } static uint32_t check_hw_breakpoints(CPUXtensaState *env) { unsigned i; for (i = 0; i < env->config->ndbreak; ++i) { if (env->cpu_watchpoint[i] && env->cpu_watchpoint[i]->flags & BP_WATCHPOINT_HIT) { return DEBUGCAUSE_DB | (i << DEBUGCAUSE_DBNUM_SHIFT); } } return 0; } void xtensa_breakpoint_handler(CPUState *cs) { XtensaCPU *cpu = XTENSA_CPU(cs); CPUXtensaState *env = &cpu->env; if (cs->watchpoint_hit) { if (cs->watchpoint_hit->flags & BP_CPU) { uint32_t cause; cs->watchpoint_hit = NULL; cause = check_hw_breakpoints(env); if (cause) { debug_exception_env(env, cause); } cpu_resume_from_signal(cs, NULL); } } } XtensaCPU *cpu_xtensa_init(const char *cpu_model) { ObjectClass *oc; XtensaCPU *cpu; CPUXtensaState *env; oc = cpu_class_by_name(TYPE_XTENSA_CPU, cpu_model); if (oc == NULL) { return NULL; } cpu = XTENSA_CPU(object_new(object_class_get_name(oc))); env = &cpu->env; xtensa_irq_init(env); object_property_set_bool(OBJECT(cpu), true, "realized", NULL); return cpu; } void xtensa_cpu_list(FILE *f, fprintf_f
#!/bin/bash
set -ex
export PATH=/usr/local/go/bin:$PATH
DIR="$(dirname `readlink -f $0`)"
apt-get update && apt-get install -y git wget gcc
wget -qO- https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
rm -rf plugins
git clone https://github.com/containernetworking/plugins
cd plugins
git checkout 5544d9ced0d6e908fe26e9dbe529c7feb87d21f5
mkdir plugins/main/ovsdpdk
cp $DIR/ovsdpdk.go plugins/main/ovsdpdk
sed -i "s,PLUGINS=.*,PLUGINS=plugins/main/ovsdpdk," build.sh
./build.sh
mkdir -p /opt/cni/bin
cp bin/ovsdpdk /opt/cni/bin
cp $DIR/setup_ovsdpdk.sh $DIR/teardown_ovsdpdk.sh /opt/cni/bin