|
Message
From: György 'nog' Jeney<nog@s...>
Date: Wed Mar 30 18:54:56 CEST 2005
Subject: [openrisc] or1ksim patches #34, #43, #53-2, #64, #68-#73
> #72 accepted with warning, how difficult would it be to add the 'not > working' > functionality when using recompiler. For now, please add a printf which will > complain if somebody uses recompiler and tries to patch a register or do > something else that is not supported in recompiler mode. (this will reduce > the number of support questions)
Not that hard. I'll tend to them in due course. For the time being (shouldn't be too long), the attached patch should do what you ask.
> i just got idea about the exec-schield,... just adding > > __attribute__ ((__section__ (".text"))) > > to the static definition of variable should fix it. i don't know how > convinient is to do this, but it would remove the need for disabling > security (i'm guessing all distributions will migrate to > exec-protection, especialy with x86-64 extensions...)
That doesn't appear to work. Even on a non exec-shield enabled kernel the attached `execs.c' fails, since pfoo_call goes into a write protected section, don't know why. Even FC2 comes with this feature enabled by default...
> well, i went over this patch very quickly, looking at it mostly from > maintaniability point of view. right now i'm very happy with it, but i'm > sure some issues will arise later. i'd also appriciate if more people tried > it and gave some feedback. so let's put this beast into cvs and see what > happens ;)...
Cool! I'd love some more feedback. Some limitations that I forgot to mention last time (again, only in the recompiler): - The debug unit does not work. - The sim crashes when running `ls' in proc/net. - Running the `test' program (in the initrd) fails, same as vi, and some others.
> one more thing, there is a typo in user visible output, so this should > really be corrected: > > diff -urp --unidirectional-new-file /home/nog/or1ksim-split/configure.in > ./configure.in > --- /home/nog/or1ksim-split/configure.in 2005-03-24 > 18:29:09.000000000 +0100 > +++ ./configure.in 2005-03-21 18:40:30.000000000 +0100 > @@ -111,7 +111,7 @@ execution="1" > INCLUDES="-I\${top_builddir}/cpu/$CPU_ARCH" > AC_MSG_CHECKING(which execution style to use) > AC_ARG_ENABLE(execution, > - [ --enable-execution Executeion style to use (simple/complex)], > + [ --enable-execution Execution style to use (simple/complex/dynamic)],
Ok, I'll fix it up.
Before I go and commint > 40 patches to cvs in one go, is the cvs-checkins list going to work anytime soon? It is much easier to do regression tests if the commit logs are availible.
nog. -------------- next part --------------
#include <stdio.h> #include <string.h> #include <stdlib.h>
static void *pfoo_call __attribute__((section(".text")));
void foo(void) { printf("Hello World!\n"); }
void foo_call(void);
asm( ".section .text\n" ".globl foo_call\n" "\t.type foo_call,@function\n" "foo_call:\n" "\tmov $foo, %eax\n" "\tjmp *%eax\n" );
int main() { /* foo_call is 8 bytes long */ pfoo_call = malloc(8); memcpy(pfoo_call, foo_call, 8); asm volatile ("movl %0, %%eax\n" "call *%%eax\n" : : "m" (pfoo_call) : "eax"); return 0; }
-------------- next part -------------- --- debug/debug_unit.c 2005-03-26 11:30:54.000000000 +0100 +++ /home/nog/or1ksim-ac/debug/debug_unit.c 2005-03-30 18:40:53.000000000 +0200 @@ -66,6 +66,9 @@ void set_stall_state(int state) { +#if DYNAMIC_EXECUTION + PRINTF("FIXME: Emulating a stalled cpu not implemented (in the dynamic execution model)\n"); +#endif
development.riscop &= ~RISCOP_STALL;
development.riscop |= state ? RISCOP_STALL : 0;
if(testsprbits(SPR_DMR1, SPR_DMR1_DXFW)) /* If debugger disabled */
--- sim-cmd.c 2005-03-29 17:22:31.000000000 +0200
+++ /home/nog/or1ksim-ac/sim-cmd.c 2005-03-30 18:45:13.000000000 +0200
@@ -298,11 +298,17 @@
return 0;
}
setsim_reg(strtoul(argv[1], NULL,0), strtoul(argv[2], NULL, 0));
+#if DYNAMIC_EXECUTION
+ PRINTF("WARNING: Patching registers may not work with the dynamic execution model\n");
+#endif
return 0;
}
static int sim_cmd_pc(int argc, char **argv) /* patch PC */
{
+#if DYNAMIC_EXECUTION
+ PRINTF("Patching the pc in the dynamic execution model doesn't work\n");
+#else
if(argc != 2) {
PRINTF("pc <value>\n");
return 0;
@@ -310,6 +316,7 @@
cpu_state.pc = strtoul(argv[1], NULL, 0);
pcnext = cpu_state.pc + 4;
+#endif
return 0;
}
|
 |