[28813] trunk/dports/net
source_changes at macosforge.org
source_changes at macosforge.org
Sun Sep 9 05:53:11 PDT 2007
Revision: 28813
http://trac.macosforge.org/projects/macports/changeset/28813
Author: simon at macports.org
Date: 2007-09-09 05:53:11 -0700 (Sun, 09 Sep 2007)
Log Message:
-----------
net/dynamips: New port, closes #12606. Thanks to jstrine at vexate.net.
Added Paths:
-----------
trunk/dports/net/dynamips/
trunk/dports/net/dynamips/Portfile
trunk/dports/net/dynamips/files/
trunk/dports/net/dynamips/files/Makefile.diff
trunk/dports/net/dynamips/files/idle_pcs.diff
Added: trunk/dports/net/dynamips/Portfile
===================================================================
--- trunk/dports/net/dynamips/Portfile (rev 0)
+++ trunk/dports/net/dynamips/Portfile 2007-09-09 12:53:11 UTC (rev 28813)
@@ -0,0 +1,59 @@
+# $Id$
+PortSystem 1.0
+
+name dynamips
+version 0.2.7
+categories net
+maintainers jstrine at vexate.net
+description Cisco router emulator
+homepage http://www.ipflow.utc.fr/index.php/Cisco_7200_Simulator
+platforms darwin
+
+long_description \
+ Dynamips emulates a variety of Cisco routers on a \
+ traditional PC. It supports the emulation of select 7200, \
+ 3600, 3700, and 2600 series routers. It uses real Cisco \
+ IOS images (which are not part of this package). Of \
+ course, this emulator cannot replace a real router. It is \
+ simply a complementary tool to real labs for administrators \
+ of Cisco networks or people wanting to pass their \
+ CCNA/CCNP/CCIE exams.
+
+master_sites http://www.ipflow.utc.fr/dynamips
+distname dynamips-${version}
+checksums md5 0fe1875bb4e7e3624ca420dd75c85279 \
+ sha1 6f65a2e92f5d27aca9d8608369cb20c9539a8121
+
+depends_lib port:libelf \
+ port:libpcap
+
+patchfiles Makefile.diff
+configure {}
+
+# patch.pre_args set to allow use of unmodified idle_pcs patch from developer
+patch.pre_args -p1
+
+build.pre_args-append PREFIX=${prefix}
+destroot.pre_args-append PREFIX=${prefix}
+
+# compile using nojit if on PowerPC platform
+if {${os.arch} == "powerpc"} {
+ build.pre_args-append DYNAMIPS_ARCH=nojit
+}
+
+default_variants +idle_pcs
+
+variant no_pcap \
+ description {Without support to send/receive external traffic} {
+
+ depends_lib-delete port:libpcap
+ build.pre_args-append HAS_PCAP=0
+}
+
+variant idle_pcs \
+ description {With support for multiple idle-pcs. Uses patch
+ written by Yannick Le Teigner available at
+ http://dynagui.sourceforge.net.} {
+
+ patchfiles-append idle_pcs.diff
+}
Property changes on: trunk/dports/net/dynamips/Portfile
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/dports/net/dynamips/files/Makefile.diff
===================================================================
--- trunk/dports/net/dynamips/files/Makefile.diff (rev 0)
+++ trunk/dports/net/dynamips/files/Makefile.diff 2007-09-09 12:53:11 UTC (rev 28813)
@@ -0,0 +1,81 @@
+diff -ur ../dynamips-0.2.7.orig/Makefile ./Makefile
+--- ../dynamips-0.2.7.orig/Makefile 2007-09-01 12:42:48.000000000 -0400
++++ ./Makefile 2007-09-01 13:28:37.000000000 -0400
+@@ -20,7 +20,6 @@
+ VERSION_DEV=$(VERSION_TRAIN)-$(shell date +%Y%m%d-%H)
+
+ # Executable binary extension
+-DESTDIR?=/usr
+ BIN_EXT?=
+
+ CC?=gcc
+@@ -40,45 +39,15 @@
+ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
+ -DHAS_RFC2553=$(HAS_RFC2553)
+
+-PCAP_LIB=/usr/local/lib/libpcap.a
++PCAP_LIB=$(PREFIX)/lib/libpcap.a
+ #PCAP_LIB=-lpcap
+
+-ifeq ($(shell uname), FreeBSD)
+- PTHREAD_LIBS?=-pthread
+- CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf $(PTHREAD_CFLAGS) \
+- -D_FILE_OFFSET_BITS=64
+- LIBS=-L/usr/local/lib -L. -lelf $(PTHREAD_LIBS)
+-else
+-ifeq ($(shell uname), Linux)
+- PTHREAD_LIBS?=-lpthread
+-# PCAP_LIB=-lpcap
+- CFLAGS+=-I/usr/include -I. $(PTHREAD_CFLAGS)
+- LIBS=-L/usr/lib -L. /usr/lib/libelf.a $(PTHREAD_LIBS)
+- DESTDIR=/usr
+-else
+ ifeq ($(shell uname -s), Darwin)
+- CFLAGS+=-I/usr/local/include -mdynamic-no-pic -D_FILE_OFFSET_BITS=64
+- LIBS=-L/usr/local/lib -L. -lelf -lpthread
+-else
+-ifeq ($(shell uname -s), SunOS)
+- CFLAGS+=-I/usr/local/include -DINADDR_NONE=0xFFFFFFFF \
+- -I /opt/csw/include -DSUNOS
+- LIBS=-L/usr/local/lib -L. -lelf -lpthread -L/opt/csw/lib \
+- -lsocket -lnsl -lresolv
+- PCAP_LIB=/opt/csw/lib/libpcap.a
+-else
+-ifeq ($(shell uname -o), Cygwin)
+- CFLAGS+=-I/usr/local/include -I/usr/local/include/libelf -DCYGWIN \
+- -D_FILE_OFFSET_BITS=64
+- LIBS=-L/usr/local/lib -L. -lelf -lpthread
+- PCAP_LIB=-lpacket -lwpcap
++ CFLAGS+=-I$(PREFIX)/include -mdynamic-no-pic -D_FILE_OFFSET_BITS=64
++ LIBS=-L$(PREFIX)/lib -L. -lelf -lpthread
+ else
+- CFLAGS+=-I/usr/include/libelf -D_FILE_OFFSET_BITS=64
+- LIBS=-L. /usr/lib/libelf.a -lpthread
+-endif
+-endif
+-endif
+-endif
++ CFLAGS+=-I$(PREFIX)/include/libelf -D_FILE_OFFSET_BITS=64
++ LIBS=-L. $(PREFIX)/lib/libelf.a -lpthread
+ endif
+
+ PROG=dynamips$(BIN_EXT)
+@@ -231,12 +200,12 @@
+
+ install: $(PROG) nvram_export
+ @echo "Installing"
+- install -d $(DESTDIR)/bin $(DESTDIR)/man/man1 $(DESTDIR)/man/man7 $(DESTDIR)/etc
+- install dynamips nvram_export $(DESTDIR)/bin
+- install -m644 dynamips.1 $(DESTDIR)/man/man1
+- install -m644 nvram_export.1 $(DESTDIR)/man/man1
+- install -m644 hypervisor_mode.7 $(DESTDIR)/man/man7
+-# install -m644 example $(DESTDIR)/etc/dynamips
++ install -d $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1 $(DESTDIR)$(PREFIX)/share/man/man7 $(DESTDIR)$(PREFIX)/etc
++ install dynamips nvram_export $(DESTDIR)$(PREFIX)/bin
++ install -m644 dynamips.1 $(DESTDIR)$(PREFIX)/share/man/man1
++ install -m644 nvram_export.1 $(DESTDIR)$(PREFIX)/share/man/man1
++ install -m644 hypervisor_mode.7 $(DESTDIR)$(PREFIX)/share/man/man7
++# install -m644 example $(DESTDIR)$(PREFIX)/etc/dynamips
+
+
+ .PHONY: clean
Added: trunk/dports/net/dynamips/files/idle_pcs.diff
===================================================================
--- trunk/dports/net/dynamips/files/idle_pcs.diff (rev 0)
+++ trunk/dports/net/dynamips/files/idle_pcs.diff 2007-09-09 12:53:11 UTC (rev 28813)
@@ -0,0 +1,531 @@
+diff -Naur dynamips-0.2.7/cpu.h dynamips-0.2.7-YLT/cpu.h
+--- dynamips-0.2.7/cpu.h 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/cpu.h 2007-05-16 14:17:13.000000000 -0400
+@@ -90,7 +90,7 @@
+ void (*mmu_raw_dump)(cpu_gen_t *cpu);
+ void (*add_breakpoint)(cpu_gen_t *cpu,m_uint64_t addr);
+ void (*remove_breakpoint)(cpu_gen_t *cpu,m_uint64_t addr);
+- void (*set_idle_pc)(cpu_gen_t *cpu,m_uint64_t addr);
++ void (*set_idle_pc)(cpu_gen_t *cpu,char* addr);
+ void (*get_idling_pc)(cpu_gen_t *cpu);
+ void (*mts_rebuild)(cpu_gen_t *cpu);
+ void (*mts_show_stats)(cpu_gen_t *cpu);
+diff -Naur dynamips-0.2.7/dev_c2600.c dynamips-0.2.7-YLT/dev_c2600.c
+--- dynamips-0.2.7/dev_c2600.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/dev_c2600.c 2007-05-16 13:45:28.000000000 -0400
+@@ -1360,6 +1360,7 @@
+
+ /* Copy some parameters from VM to CPU (idle PC, ...) */
+ cpu->idle_pc = vm->idle_pc;
++ cpu->num_idle_pc = vm->num_idle_pc;
+
+ if (vm->timer_irq_check_itv)
+ cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
+@@ -1503,8 +1504,8 @@
+ vm->name,cpu->ia,vm->jit_use ? "en":"dis");
+
+ vm_log(vm,"C2600_BOOT",
+- "starting instance (CPU0 PC=0x%8.8x,idle_pc=0x%8.8x,JIT %s)\n",
+- cpu->ia,cpu->idle_pc,vm->jit_use ? "on":"off");
++ "starting instance (CPU0 PC=0x%8.8x,JIT %s)\n",
++ cpu->ia,vm->jit_use ? "on":"off");
+
+ /* Start main CPU */
+ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
+diff -Naur dynamips-0.2.7/dev_c2691.c dynamips-0.2.7-YLT/dev_c2691.c
+--- dynamips-0.2.7/dev_c2691.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/dev_c2691.c 2007-05-16 13:46:09.000000000 -0400
+@@ -1153,6 +1153,7 @@
+
+ /* Copy some parameters from VM to CPU (idle PC, ...) */
+ cpu->idle_pc = vm->idle_pc;
++ cpu->num_idle_pc = vm->num_idle_pc;
+
+ if (vm->timer_irq_check_itv)
+ cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
+@@ -1263,8 +1264,8 @@
+ vm->name,cpu->pc,vm->jit_use ? "en":"dis");
+
+ vm_log(vm,"C2691_BOOT",
+- "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
+- cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
++ "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
++ cpu->pc,vm->jit_use ? "on":"off");
+
+ /* Start main CPU */
+ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
+diff -Naur dynamips-0.2.7/dev_c3600.c dynamips-0.2.7-YLT/dev_c3600.c
+--- dynamips-0.2.7/dev_c3600.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/dev_c3600.c 2007-05-16 13:44:34.000000000 -0400
+@@ -1323,6 +1323,7 @@
+
+ /* Copy some parameters from VM to CPU (idle PC, ...) */
+ cpu->idle_pc = vm->idle_pc;
++ cpu->num_idle_pc = vm->num_idle_pc;
+
+ if (vm->timer_irq_check_itv)
+ cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
+@@ -1440,8 +1441,8 @@
+ vm->name,cpu->pc,vm->jit_use ? "en":"dis");
+
+ vm_log(vm,"C3600_BOOT",
+- "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
+- cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
++ "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
++ cpu->pc,vm->jit_use ? "on":"off");
+
+ /* Start main CPU */
+ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
+diff -Naur dynamips-0.2.7/dev_c3725.c dynamips-0.2.7-YLT/dev_c3725.c
+--- dynamips-0.2.7/dev_c3725.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/dev_c3725.c 2007-05-16 13:46:53.000000000 -0400
+@@ -1167,6 +1167,7 @@
+
+ /* Copy some parameters from VM to CPU (idle PC, ...) */
+ cpu->idle_pc = vm->idle_pc;
++ cpu->num_idle_pc = vm->num_idle_pc;
+
+ if (vm->timer_irq_check_itv)
+ cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
+@@ -1277,8 +1278,8 @@
+ vm->name,cpu->pc,vm->jit_use ? "en":"dis");
+
+ vm_log(vm,"C3725_BOOT",
+- "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
+- cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
++ "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
++ cpu->pc,vm->jit_use ? "on":"off");
+
+ /* Start main CPU */
+ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
+diff -Naur dynamips-0.2.7/dev_c3745.c dynamips-0.2.7-YLT/dev_c3745.c
+--- dynamips-0.2.7/dev_c3745.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/dev_c3745.c 2007-05-16 13:47:31.000000000 -0400
+@@ -1207,6 +1207,7 @@
+
+ /* Copy some parameters from VM to CPU (idle PC, ...) */
+ cpu->idle_pc = vm->idle_pc;
++ cpu->num_idle_pc = vm->num_idle_pc;
+
+ if (vm->timer_irq_check_itv)
+ cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
+@@ -1317,8 +1318,8 @@
+ vm->name,cpu->pc,vm->jit_use ? "en":"dis");
+
+ vm_log(vm,"C3745_BOOT",
+- "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
+- cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
++ "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
++ cpu->pc,vm->jit_use ? "on":"off");
+
+ /* Start main CPU */
+ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
+diff -Naur dynamips-0.2.7/dev_c7200.c dynamips-0.2.7-YLT/dev_c7200.c
+--- dynamips-0.2.7/dev_c7200.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/dev_c7200.c 2007-05-16 13:44:17.000000000 -0400
+@@ -2072,6 +2072,7 @@
+
+ /* Copy some parameters from VM to CPU0 (idle PC, ...) */
+ cpu0->idle_pc = vm->idle_pc;
++ cpu0->num_idle_pc = vm->num_idle_pc;
+
+ if (vm->timer_irq_check_itv)
+ cpu0->timer_irq_check_itv = vm->timer_irq_check_itv;
+@@ -2193,6 +2194,7 @@
+
+ /* Copy some parameters from VM to CPU0 (idle PC, ...) */
+ cpu0->idle_pc = vm->idle_pc;
++ cpu0->num_idle_pc = vm->num_idle_pc;
+
+ if (vm->timer_irq_check_itv)
+ cpu0->timer_irq_check_itv = vm->timer_irq_check_itv;
+@@ -2314,8 +2316,8 @@
+ vm->name,cpu->pc,vm->jit_use ? "en":"dis");
+
+ vm_log(vm,"C7200_BOOT",
+- "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
+- cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
++ "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
++ cpu->pc,vm->jit_use ? "on":"off");
+
+ /* Start main CPU */
+ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
+@@ -2364,8 +2366,8 @@
+ vm->name,cpu->ia,vm->jit_use ? "en":"dis");
+
+ vm_log(vm,"C7200P_BOOT",
+- "starting instance (CPU0 IA=0x%8.8x,idle_pc=0x%8.8x,JIT %s)\n",
+- cpu->ia,cpu->idle_pc,vm->jit_use ? "on":"off");
++ "starting instance (CPU0 IA=0x%8.8x,JIT %s)\n",
++ cpu->ia,vm->jit_use ? "on":"off");
+
+ /* Start main CPU */
+ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
+diff -Naur dynamips-0.2.7/dev_msfc1.c dynamips-0.2.7-YLT/dev_msfc1.c
+--- dynamips-0.2.7/dev_msfc1.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/dev_msfc1.c 2007-05-16 14:18:08.000000000 -0400
+@@ -1220,6 +1220,7 @@
+
+ /* Copy some parameters from VM to CPU0 (idle PC, ...) */
+ cpu0->idle_pc = vm->idle_pc;
++ cpu0->num_idle_pc = vm->num_idle_pc;
+
+ if (vm->timer_irq_check_itv)
+ cpu0->timer_irq_check_itv = vm->timer_irq_check_itv;
+@@ -1326,8 +1327,8 @@
+ vm->name,cpu->pc,vm->jit_use ? "en":"dis");
+
+ vm_log(vm,"MSFC1_BOOT",
+- "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
+- cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
++ "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
++ cpu->pc,vm->jit_use ? "on":"off");
+
+ /* Start main CPU */
+ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
+diff -Naur dynamips-0.2.7/dynamips.c dynamips-0.2.7-YLT/dynamips.c
+--- dynamips-0.2.7/dynamips.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/dynamips.c 2007-05-16 14:20:23.000000000 -0400
+@@ -818,6 +818,44 @@
+ }
+ }
+
++/* slices the val values into idle_pc values, and set them to the vm */
++static void set_idle_pc(vm_instance_t *vm, char *val) {
++ char *tmp_val;
++ int len = 0;
++ /* find out how many the string length */
++ while (val[len] != '\0')
++ len += 1;
++ int i = 0;
++ int num_val = 1;
++ /* find out how many idle_pc values we have in the string */
++ while (i < len) {
++ if (val[i] == ',')
++ num_val += 1;
++ i += 1;
++ }
++ vm->num_idle_pc = num_val;
++ vm->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int));
++
++ i = 0;
++ int current_val_idx = 0;
++ /* slice the string, and assign each individual idle_pc values */
++ while (i < len) {
++ tmp_val = (char *) malloc((len+1)*sizeof(char));
++ int j = 0;
++ while ((i < len)&&(val[i] != ',')) {
++ tmp_val[j] = val[i];
++ i += 1;
++ j += 1;
++ }
++ tmp_val[j] = '\0';
++ vm->idle_pc[current_val_idx] = strtoull(tmp_val, NULL, 0);
++ current_val_idx += 1;
++ i += 1;
++ free(tmp_val);
++ }
++}
++
++
+ /* Parse the command line */
+ static int parse_std_cmd_line(int argc,char *argv[],int *platform)
+ {
+@@ -941,8 +979,7 @@
+
+ /* Idle PC */
+ case OPT_IDLE_PC:
+- vm->idle_pc = strtoull(optarg,NULL,0);
+- printf("Idle PC set to 0x%llx.\n",vm->idle_pc);
++ set_idle_pc(vm, optarg);
+ break;
+
+ /* Timer IRQ check interval */
+diff -Naur dynamips-0.2.7/hv_vm.c dynamips-0.2.7-YLT/hv_vm.c
+--- dynamips-0.2.7/hv_vm.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/hv_vm.c 2007-05-16 14:14:56.000000000 -0400
+@@ -219,7 +219,39 @@
+ if (!(vm = hypervisor_find_object(conn,argv[0],OBJ_TYPE_VM)))
+ return(-1);
+
+- vm->idle_pc = strtoull(argv[1],NULL,0);
++ char *tmp_val;
++ int len = 0;
++ /* find out how many the string length */
++ while (argv[1][len] != '\0')
++ len += 1;
++ int i = 0;
++ int num_val = 1;
++ /* find out how many idle_pc values we have in the string */
++ while (i < len) {
++ if (argv[1][i] == ',')
++ num_val += 1;
++ i += 1;
++ }
++ vm->num_idle_pc = num_val;
++ vm->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int));
++
++ i = 0;
++ int current_val_idx = 0;
++ while (i < len) {
++ tmp_val = (char *) malloc((len+1)*sizeof(char));
++ int j = 0;
++ while ((i < len)&&(argv[1][i] != ',')) {
++ tmp_val[j] = argv[1][i];
++ i += 1;
++ j += 1;
++ }
++ tmp_val[j] = '\0';
++ vm->idle_pc[current_val_idx] = strtoull(tmp_val, NULL, 0);
++ current_val_idx += 1;
++ i += 1;
++ free(tmp_val);
++ }
++
+
+ vm_release(vm);
+ hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK");
+@@ -239,13 +271,14 @@
+ if (!(cpu = find_cpu(conn,vm,atoi(argv[1]))))
+ return(-1);
+
+- cpu->set_idle_pc(cpu,strtoull(argv[2],NULL,0));
++ cpu->set_idle_pc(cpu,argv[2]);
+
+ vm_release(vm);
+ hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK");
+ return(0);
+ }
+
++
+ /* Get the idle PC proposals */
+ static int cmd_get_idle_pc_prop(hypervisor_conn_t *conn,int argc,char *argv[])
+ {
+diff -Naur dynamips-0.2.7/mips64.c dynamips-0.2.7-YLT/mips64.c
+--- dynamips-0.2.7/mips64.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/mips64.c 2007-05-16 14:21:42.000000000 -0400
+@@ -138,9 +138,41 @@
+ }
+
+ /* Set idle PC value */
+-void mips64_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr)
++void mips64_set_idle_pc(cpu_gen_t *cpu,char* addr)
+ {
+- CPU_MIPS64(cpu)->idle_pc = addr;
++ char *tmp_val;
++ int len = 0;
++ /* find out how many the string length */
++ while (addr[len] != '\0')
++ len += 1;
++ int i = 0;
++ int num_val = 1;
++ /* find out how many idle_pc values we have in the string */
++ while (i < len) {
++ if (addr[i] == ',')
++ num_val += 1;
++ i += 1;
++ }
++ CPU_MIPS64(cpu)->num_idle_pc = num_val;
++ CPU_MIPS64(cpu)->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int));
++
++ i = 0;
++ int current_val_idx = 0;
++ /* slice the string, and assign each individual idle_pc values */
++ while (i < len) {
++ tmp_val = (char *) malloc((len+1)*sizeof(char));
++ int j = 0;
++ while ((i < len)&&(addr[i] != ',')) {
++ tmp_val[j] = addr[i];
++ i += 1;
++ j += 1;
++ }
++ tmp_val[j] = '\0';
++ CPU_MIPS64(cpu)->idle_pc[current_val_idx] = (m_uint32_t) strtoull(tmp_val, NULL, 0);
++ current_val_idx += 1;
++ i += 1;
++ free(tmp_val);
++ }
+ }
+
+ /* Timer IRQ */
+diff -Naur dynamips-0.2.7/mips64.h dynamips-0.2.7-YLT/mips64.h
+--- dynamips-0.2.7/mips64.h 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/mips64.h 2007-05-16 14:06:03.000000000 -0400
+@@ -389,8 +389,11 @@
+ insn_exec_page_t *exec_page_free_list;
+ insn_exec_page_t *exec_page_array;
+
+- /* Idle PC value */
+- volatile m_uint64_t idle_pc;
++ /* Idle PC value array */
++ volatile m_uint64_t* idle_pc;
++
++ /* Number of Idle PC value */
++ volatile int num_idle_pc;
+
+ /* Timer IRQs */
+ volatile u_int timer_irq_pending;
+@@ -479,7 +482,7 @@
+ void mips64_set_prid(cpu_mips_t *cpu,m_uint32_t prid);
+
+ /* Set idle PC value */
+-void mips64_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr);
++void mips64_set_idle_pc(cpu_gen_t *cpu,char* addr);
+
+ /* Timer IRQ */
+ void *mips64_timer_irq_run(cpu_mips_t *cpu);
+diff -Naur dynamips-0.2.7/mips64_jit.c dynamips-0.2.7-YLT/mips64_jit.c
+--- dynamips-0.2.7/mips64_jit.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/mips64_jit.c 2007-05-16 14:15:28.000000000 -0400
+@@ -748,11 +748,14 @@
+ cpu->perf_counter++;
+ #endif
+ /* Handle virtual idle loop */
+- if (unlikely(cpu->pc == cpu->idle_pc)) {
+- if (++gen->idle_count == gen->idle_max) {
+- cpu_idle_loop(gen);
+- gen->idle_count = 0;
+- }
++ int i;
++ for (i = 0; i < cpu->num_idle_pc; i++) {
++ if (unlikely(cpu->pc == cpu->idle_pc[i])) {
++ if (++gen->idle_count == gen->idle_max) {
++ cpu_idle_loop(gen);
++ gen->idle_count = 0;
++ }
++ }
+ }
+
+ /* Handle the virtual CPU clock */
+diff -Naur dynamips-0.2.7/ppc32.c dynamips-0.2.7-YLT/ppc32.c
+--- dynamips-0.2.7/ppc32.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/ppc32.c 2007-05-16 14:22:19.000000000 -0400
+@@ -92,9 +92,41 @@
+ }
+
+ /* Set idle PC value */
+-void ppc32_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr)
++void ppc32_set_idle_pc(cpu_gen_t *cpu, char* addr)
+ {
+- CPU_PPC32(cpu)->idle_pc = (m_uint32_t)addr;
++ char *tmp_val;
++ int len = 0;
++ /* find out how many the string length */
++ while (addr[len] != '\0')
++ len += 1;
++ int i = 0;
++ int num_val = 1;
++ /* find out how many idle_pc values we have in the string */
++ while (i < len) {
++ if (addr[i] == ',')
++ num_val += 1;
++ i += 1;
++ }
++ CPU_PPC32(cpu)->num_idle_pc = num_val;
++ CPU_PPC32(cpu)->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int));
++
++ i = 0;
++ int current_val_idx = 0;
++ /* slice the string, and assign each individual idle_pc values */
++ while (i < len) {
++ tmp_val = (char *) malloc((len+1)*sizeof(char));
++ int j = 0;
++ while ((i < len)&&(addr[i] != ',')) {
++ tmp_val[j] = addr[i];
++ i += 1;
++ j += 1;
++ }
++ tmp_val[j] = '\0';
++ CPU_PPC32(cpu)->idle_pc[current_val_idx] = (m_uint32_t) strtoull(tmp_val, NULL, 0);
++ current_val_idx += 1;
++ i += 1;
++ free(tmp_val);
++ }
+ }
+
+ /* Timer IRQ */
+diff -Naur dynamips-0.2.7/ppc32.h dynamips-0.2.7-YLT/ppc32.h
+--- dynamips-0.2.7/ppc32.h 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/ppc32.h 2007-05-16 14:02:26.000000000 -0400
+@@ -336,8 +336,11 @@
+ insn_exec_page_t *exec_page_free_list;
+ insn_exec_page_t *exec_page_array;
+
+- /* Idle PC value */
+- volatile m_uint32_t idle_pc;
++ /* Array Idle PC value */
++ volatile m_uint32_t* idle_pc;
++
++ /* Number of idle_pc values */
++ volatile int num_idle_pc;
+
+ /* Timer IRQs */
+ volatile u_int timer_irq_pending,timer_irq_armed;
+@@ -489,7 +492,7 @@
+ void ppc32_set_pvr(cpu_ppc_t *cpu,m_uint32_t pvr);
+
+ /* Set idle PC value */
+-void ppc32_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr);
++void ppc32_set_idle_pc(cpu_gen_t *cpu, char* addr);
+
+ /* Timer IRQ */
+ void *ppc32_timer_irq_run(cpu_ppc_t *cpu);
+diff -Naur dynamips-0.2.7/ppc32_jit.c dynamips-0.2.7-YLT/ppc32_jit.c
+--- dynamips-0.2.7/ppc32_jit.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/ppc32_jit.c 2007-05-16 14:16:00.000000000 -0400
+@@ -1239,11 +1239,14 @@
+ cpu->perf_counter++;
+ #endif
+ /* Handle virtual idle loop */
+- if (unlikely(cpu->ia == cpu->idle_pc)) {
+- if (++gen->idle_count == gen->idle_max) {
+- cpu_idle_loop(gen);
+- gen->idle_count = 0;
+- }
++ int i;
++ for (i = 0; i < cpu->num_idle_pc; i++) {
++ if (unlikely(cpu->ia == cpu->idle_pc[i])) {
++ if (++gen->idle_count == gen->idle_max) {
++ cpu_idle_loop(gen);
++ gen->idle_count = 0;
++ }
++ }
+ }
+
+ /* Handle the virtual CPU clock */
+diff -Naur dynamips-0.2.7/vm.c dynamips-0.2.7-YLT/vm.c
+--- dynamips-0.2.7/vm.c 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/vm.c 2007-05-16 13:55:20.000000000 -0400
+@@ -396,6 +396,7 @@
+ vm->vtty_aux_type = VTTY_TYPE_NONE;
+ vm->timer_irq_check_itv = VM_TIMER_IRQ_CHECK_ITV;
+ vm->log_file_enabled = TRUE;
++ vm->num_idle_pc = 0;
+
+ if (!(vm->name = strdup(name))) {
+ fprintf(stderr,"VM %s: unable to store instance name!\n",name);
+diff -Naur dynamips-0.2.7/vm.h dynamips-0.2.7-YLT/vm.h
+--- dynamips-0.2.7/vm.h 2007-04-27 09:30:53.000000000 -0400
++++ dynamips-0.2.7-YLT/vm.h 2007-05-16 13:55:02.000000000 -0400
+@@ -148,8 +148,11 @@
+ /* Timer IRQ interval check */
+ u_int timer_irq_check_itv;
+
+- /* "idling" pointer counter */
+- m_uint64_t idle_pc;
++ /* "idling" pointer counter array*/
++ m_uint64_t* idle_pc;
++
++ /* number of idle_pc values */
++ int num_idle_pc;
+
+ /* JIT block direct jumps */
+ int exec_blk_direct_jump;
+@@ -180,6 +183,7 @@
+
+ /* VM objects */
+ struct vm_obj *vm_object_list;
++
+ };
+
+ #define VM_C7200(vm) ((c7200_t *)vm->hw_data)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070909/80cda7e2/attachment.html
More information about the macports-changes
mailing list