[Vm-dev] [commit][3708]
Add code to generate some of the accessors for the GdbARMAlien.
commits at squeakvm.org
commits at squeakvm.org
Tue May 10 18:02:54 UTC 2016
Revision: 3708
Author: eliot
Date: 2016-05-10 11:02:52 -0700 (Tue, 10 May 2016)
Log Message:
-----------
Add code to generate some of the accessors for the GdbARMAlien.
Modified Paths:
--------------
branches/Cog/processors/ARM/exploration/Makefile
branches/Cog/processors/ARM/exploration/printcpu.c
Added Paths:
-----------
branches/Cog/processors/ARM/exploration/
branches/Cog/processors/ARM/exploration/printcpuvfp.c
Removed Paths:
-------------
branches/Cog/processors/ARM/exploration/printcpucr.c
branches/Cog/processors/ARM/exploration/printcpuxmm.c
Modified: branches/Cog/processors/ARM/exploration/Makefile
===================================================================
--- branches/Cog/processors/IA32/bochs/exploration/Makefile 2016-05-06 20:37:49 UTC (rev 3704)
+++ branches/Cog/processors/ARM/exploration/Makefile 2016-05-10 18:02:52 UTC (rev 3708)
@@ -1,41 +1,31 @@
-#LIBDEPS=../../bochs/cpu/libcpu.a
-#BOCHS=../../bochs
-#BOCHSEXP=../../bochs/exploration
LIBDEPS=../cpu/libcpu.a
-BOCHS=../../../processors/IA32/bochs
-BOCHSEXP=.
-CFLAGS=-m32 -I.. -I$(BOCHS) -I$(BOCHS)/cpu -I$(BOCHS)/instrument/stubs -L../cpu -lcpu
+GDBARM=../../../processors/ARM/gdb-7.10
+GDBARMEXP=.
+INCLUDES := -I$(GDBARM)/include \
+ -I$(GDBARM)/sim/arm \
+ -I$(GDBARM)/bfd \
+ -I../bfd
+LIBS:=-L../bfd -L../libiberty -L../opcodes -L../sim/arm -L../zlib \
+ -lbfd -liberty -lopcodes -lopcodes -lsim -lz
+CFLAGS=-m32 $(INCLUDES) $(LIBS)
.PHONY: $(LIBDEPS)
-#all: bxcpu.txt BochsIA32Alien-regs.st BochsIA32Alien-cr.st BochsIA32Alien-xmm.st
-all: BochsIA32Alien-regs.st BochsIA32Alien-cr.st BochsIA32Alien-xmm.st
+all: GdbARMAlien-regs.st GdbARMAlien-vfp.st
-bxcpu.txt: printbxcpu
- ./printbxcpu >bxcpu.txt
+GdbARMAlien-regs.st: printcpu
+ ./printcpu >GdbARMAlien-regs.st
-BochsIA32Alien-regs.st: printcpu
- ./printcpu >BochsIA32Alien-regs.st
+GdbARMAlien-vfp.st: printcpuvfp
+ ./printcpuvfp >GdbARMAlien-vfp.st
-BochsIA32Alien-cr.st: printcpucr
- ./printcpucr >BochsIA32Alien-cr.st
-
-BochsIA32Alien-xmm.st: printcpuxmm
- ./printcpuxmm >BochsIA32Alien-xmm.st
-
clean:
- rm -f BochsIA32Alien-regs.st BochsIA32Alien-cr.st BochsIA32Alien-xmm.st
- rm -f printcpu printcpucr printcpuxmm
- rm -f printcpu.exe printcpucr.exe printcpuxmm.exe
+ rm -f GdbARMAlien-regs.st GdbARMAlien-vfp.st
+ rm -f printcpu printcpuvfp
+ rm -f printcpu.exe printcpuvfp.exe
-printbxcpu: $(BOCHSEXP)/printbxcpu.cpp $(LIBDEPS)
- g++ -o $@ $< $(CFLAGS)
+printcpu: $(GDBARMEXP)/printcpu.c $(LIBDEPS)
+ $(CC) -o $@ $< $(CFLAGS)
-printcpu: $(BOCHSEXP)/printcpu.c $(LIBDEPS)
- g++ -o $@ $< $(CFLAGS)
-
-printcpucr: $(BOCHSEXP)/printcpucr.c $(LIBDEPS)
- g++ -o $@ $< $(CFLAGS)
-
-printcpuxmm: $(BOCHSEXP)/printcpuxmm.c $(LIBDEPS)
- g++ -o $@ $< $(CFLAGS)
+printcpuvfp: $(GDBARMEXP)/printcpuvfp.c $(LIBDEPS)
+ $(CC) -o $@ $< $(CFLAGS)
Modified: branches/Cog/processors/ARM/exploration/printcpu.c
===================================================================
--- branches/Cog/processors/IA32/bochs/exploration/printcpu.c 2016-05-06 20:37:49 UTC (rev 3704)
+++ branches/Cog/processors/ARM/exploration/printcpu.c 2016-05-10 18:02:52 UTC (rev 3708)
@@ -1,17 +1,13 @@
-/*
-% g++ -I.. -I../cpu -I../instrument/stubs -Wno-invalid-offsetof @ -o #
- */
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <time.h>
-#include <stddef.h>
-
#define COG 1
+#define FOR_COG_PLUGIN 1
-#include <bochs.h>
+#include <armdefs.h>
-#define NEED_CPU_REG_SHORTCUTS
-
-#include <cpu.h>
-
static char buf[10];
char *
@@ -27,20 +23,15 @@
int
main()
{
+#define offsetof(type,field) (long)(&(((type *)0)->field))
#define stoffsetof(type,field) (offsetof(type,field)+1)
-#define print(r,n,b) \
-printf("!BochsIA32Alien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
+#define print(n,r) \
+printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
"%s\r\t^self unsignedLongAt: %ld! !\r", m,d,y,h,i, lower(#r), \
- stoffsetof(BX_CPU_C,gen_reg[n].dword.erx));\
-printf("!BochsIA32Alien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
+ stoffsetof(ARMul_State,Reg[n]));\
+printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
"%s: anUnsignedInteger\r\t^self unsignedLongAt: %ld put: anUnsignedInteger! !\r", m,d,y,h,i, lower(#r), \
- stoffsetof(BX_CPU_C,gen_reg[n].dword.erx));\
-printf("!BochsIA32Alien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
- "%s\r\t^self unsignedByteAt: %ld! !\r", m,d,y,h,i, lower(#b), \
- stoffsetof(BX_CPU_C,gen_reg[n].dword.erx));\
-printf("!BochsIA32Alien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
- "%s: anUnsignedInteger\r\t^self unsignedByteAt: %ld put: anUnsignedInteger! !\r", m,d,y,h,i, lower(#b), \
- stoffsetof(BX_CPU_C,gen_reg[n].dword.erx))
+ stoffsetof(ARMul_State,Reg[n]))
time_t nowsecs = time(0);
struct tm now = *localtime(&nowsecs);
@@ -51,22 +42,25 @@
int i = now.tm_min;
printf("\"Hello world!!\"!\r");
- printf("!BochsIA32Alien class methodsFor: 'instance creation' stamp: 'eem %d/%d/%d %d:%02d'!\r"
- "dataSize\r\t^%ld! !\r", m,d,y,h,i, sizeof(BX_CPU_C));
+ printf("!GdbARMAlien class methodsFor: 'instance creation' stamp: 'eem %d/%d/%d %d:%02d'!\r"
+ "dataSize\r\t^%ld! !\r", m,d,y,h,i, sizeof(ARMul_State));
- printf("!BochsIA32Alien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"
- "eflags\r\t^self unsignedLongAt: %ld! !\r", m,d,y,h,i,
- stoffsetof(BX_CPU_C,eflags));
+ print(0,0);
+ print(1,1);
+ print(2,2);
+ print(3,3);
+ print(4,4);
+ print(5,5);
+ print(6,6);
+ print(7,7);
+ print(8,8);
+ print(9,9);
+ print(10,10);
+ print(11,11);
+ print(12,12);
+ print(13,SP);
+ print(14,LR);
+ print(15,PC);
- print(EAX,BX_32BIT_REG_EAX,al);
- print(EBX,BX_32BIT_REG_EBX,bl);
- print(ECX,BX_32BIT_REG_ECX,cl);
- print(EDX,BX_32BIT_REG_EDX,dl);
- print(ESP,BX_32BIT_REG_ESP,spl);
- print(EBP,BX_32BIT_REG_EBP,bpl);
- print(ESI,BX_32BIT_REG_ESI,sil);
- print(EDI,BX_32BIT_REG_EDI,dil);
- print(EIP,BX_32BIT_REG_EIP,ipl); /* the ipl: method should be discarded */
-
return 0;
}
Deleted: branches/Cog/processors/ARM/exploration/printcpucr.c
===================================================================
--- branches/Cog/processors/IA32/bochs/exploration/printcpucr.c 2016-05-06 20:37:49 UTC (rev 3704)
+++ branches/Cog/processors/ARM/exploration/printcpucr.c 2016-05-10 18:02:52 UTC (rev 3708)
@@ -1,62 +0,0 @@
-/*
-% g++ -I.. -I../cpu -I../instrument/stubs -Wno-invalid-offsetof @ -o #
- */
-
-#include <stddef.h>
-
-#define COG 1
-
-#include <bochs.h>
-
-#define NEED_CPU_REG_SHORTCUTS
-
-#include <cpu.h>
-
-static char buf[10];
-
-char *
-munge(char *s)
-{
- int i, d;
- for (i = 0, d = 0; i + d < strlen(s); i++)
- buf[i] = (s[i+d] == '_' && s[i+d+1])
- ? toupper(s[++d+i])
- : tolower(s[i+d]);
- buf[i] = 0;
- return buf;
-}
-
-int
-main()
-{
-#define stoffsetof(type,field) (offsetof(type,field)+1)
-#define print(r,ra,len) \
-printf("!BochsIA32Alien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
- "%s\r\t^self unsigned" #len "At: %ld! !\r", m,d,y,h,i, munge(#r), \
- stoffsetof(BX_CPU_C,ra));\
-printf("!BochsIA32Alien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
- "%s: anUnsignedInteger\r\t^self unsigned" #len "At: %ld put: anUnsignedInteger! !\r", m,d,y,h,i, munge(#r), \
- stoffsetof(BX_CPU_C,ra));
-
- time_t nowsecs = time(0);
- struct tm now = *localtime(&nowsecs);
- int m = now.tm_mon + 1; /* strange but true */
- int d = now.tm_mday;
- int y = now.tm_year + 1900;
- int h = now.tm_hour;
- int i = now.tm_min;
-
- printf("\"Hello world!!\"!\r");
-
- print(cr0,cr0.val32,LongLong);
- print(cr1,cr1,LongLong);
- print(cr2,cr2,LongLong);
- print(cr3,cr3,LongLong);
- print(cr4,cr4.val32,LongLong);
-
- print(stop_reason,stop_reason,Byte);
- print(save_eip,save_eip,Long);
- print(save_esp,save_esp,Long);
-
- return 0;
-}
Copied: branches/Cog/processors/ARM/exploration/printcpuvfp.c (from rev 3704, branches/Cog/processors/IA32/bochs/exploration/printcpuxmm.c)
===================================================================
--- branches/Cog/processors/ARM/exploration/printcpuvfp.c (rev 0)
+++ branches/Cog/processors/ARM/exploration/printcpuvfp.c 2016-05-10 18:02:52 UTC (rev 3708)
@@ -0,0 +1,82 @@
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <time.h>
+
+#define COG 1
+#define FOR_COG_PLUGIN 1
+
+#include <armdefs.h>
+
+static char buf[10];
+
+char *
+lower(char *s)
+{
+ int i;
+ for (i = 0; i < strlen(s); i++)
+ buf[i] = tolower(s[i]);
+ buf[i] = 0;
+ return buf;
+}
+
+int
+main()
+{
+#define offsetof(type,field) (long)(&(((type *)0)->field))
+#define stoffsetof(type,field) (offsetof(type,field)+1)
+#define print(n,r) \
+printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
+ "%s\r\t^self unsignedLongLongAt: %ld! !\r", m,d,y,h,i, lower(#r), \
+ stoffsetof(ARMul_State,VFP_Reg[n].dword));\
+printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
+ "%s: anUnsignedInteger\r\t^self unsignedLongLongAt: %ld put: anUnsignedInteger! !\r", m,d,y,h,i, lower(#r), \
+ stoffsetof(ARMul_State,VFP_Reg[n].dword))
+
+ time_t nowsecs = time(0);
+ struct tm now = *localtime(&nowsecs);
+ int m = now.tm_mon + 1; /* strange but true */
+ int d = now.tm_mday;
+ int y = now.tm_year + 1900;
+ int h = now.tm_hour;
+ int i = now.tm_min;
+
+ printf("\"Hello world!!\"!\r");
+ printf("!GdbARMAlien class methodsFor: 'instance creation' stamp: 'eem %d/%d/%d %d:%02d'!\r"
+ "dataSize\r\t^%ld! !\r", m,d,y,h,i, sizeof(ARMul_State));
+
+ print(0,d0);
+ print(1,d1);
+ print(2,d2);
+ print(3,d3);
+ print(4,d4);
+ print(5,d5);
+ print(6,d6);
+ print(7,d7);
+ print(8,d8);
+ print(9,d9);
+ print(10,d10);
+ print(11,d11);
+ print(12,d12);
+ print(13,d13);
+ print(14,d14);
+ print(15,d15);
+ print(16,d16);
+ print(17,d17);
+ print(18,d18);
+ print(19,d19);
+ print(20,d20);
+ print(21,d21);
+ print(22,d22);
+ print(23,d23);
+ print(24,d24);
+ print(25,d25);
+ print(26,d26);
+ print(27,d27);
+ print(28,d28);
+ print(29,d29);
+ print(30,d30);
+ print(31,d31);
+
+ return 0;
+}
Deleted: branches/Cog/processors/ARM/exploration/printcpuxmm.c
===================================================================
--- branches/Cog/processors/IA32/bochs/exploration/printcpuxmm.c 2016-05-06 20:37:49 UTC (rev 3704)
+++ branches/Cog/processors/ARM/exploration/printcpuxmm.c 2016-05-10 18:02:52 UTC (rev 3708)
@@ -1,68 +0,0 @@
-/*
-% g++ -I.. -I../cpu -I../instrument/stubs -Wno-invalid-offsetof @ -o #
- */
-
-#include <stddef.h>
-
-#define COG 1
-
-#include <bochs.h>
-
-#define NEED_CPU_REG_SHORTCUTS
-
-#include <cpu.h>
-
-static char buf[10];
-
-char *
-lower(char *s)
-{
- int i;
- for (i = 0; i < strlen(s); i++)
- buf[i] = tolower(s[i]);
- buf[i] = 0;
- return buf;
-}
-
-int
-main()
-{
-#define stoffsetof(type,field) (offsetof(type,field)+1)
-#define print(r,n,lh) \
-printf("!BochsIA32Alien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
- "%s\r\t^self unsignedLongLongAt: %ld! !\r", m,d,y,h,i, lower(#r), \
- stoffsetof(BX_CPU_C,xmm[n]._u64[lh]));\
-printf("!BochsIA32Alien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
- "%s: anUnsignedInteger\r\t^self unsignedLongLongAt: %ld put: anUnsignedInteger! !\r", m,d,y,h,i, lower(#r), \
- stoffsetof(BX_CPU_C,xmm[n]._u64[lh]));\
-
- time_t nowsecs = time(0);
- struct tm now = *localtime(&nowsecs);
- int m = now.tm_mon + 1; /* strange but true */
- int d = now.tm_mday;
- int y = now.tm_year + 1900;
- int h = now.tm_hour;
- int i = now.tm_min;
-
- printf("\"Hello world!!\"!\r");
-
- print(XMM0Low,0,0);
- print(XMM1Low,1,0);
- print(XMM2Low,2,0);
- print(XMM3Low,3,0);
- print(XMM4Low,4,0);
- print(XMM5Low,5,0);
- print(XMM6Low,6,0);
- print(XMM7Low,7,0);
-
- print(XMM0High,0,1);
- print(XMM1High,1,1);
- print(XMM2High,2,1);
- print(XMM3High,3,1);
- print(XMM4High,4,1);
- print(XMM5High,5,1);
- print(XMM6High,6,1);
- print(XMM7High,7,1);
-
- return 0;
-}
More information about the Vm-dev
mailing list