changeset 46:9647d79fe97e

merge
author one
date Sun, 03 Mar 2019 17:39:45 +0900
parents 5f19e9554c30 (diff) 94ca6db2ee9c (current diff)
children 233a68a261fe
files src/gearsTools/generate_context.pl src/gearsTools/generate_stub.pl
diffstat 3 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/CMakeLists.txt	Sat Mar 02 21:05:26 2019 +0900
+++ b/src/CMakeLists.txt	Sun Mar 03 17:39:45 2019 +0900
@@ -8,10 +8,12 @@
 set(CMAKE_C_COMPILER $ENV{CBC_COMPILER})
 add_definitions("-Wall -g -arch arm -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Werror -I. -g -O0 
          -Wno-macro-redefined -Wno-gnu-designator -Wno-sometimes-uninitialized -Wno-tautological-compare 
-         -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include")
+         -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include
+         -Wno-nullability-completeness -Wno-expansion-to-defined")
 
 # -DCMAKE_BUILD_TYPE=Debug
 set(CMAKE_C_FLAGS_DEBUG "-O0")
+set(CMAKE_EXE_LINKER_FLAGS "-L. -arch armv7 -T  kernel.ld -o  kernel.elf ")
 
 if (${USE_CUDA})
     include_directories("/usr/local/cuda/include")
@@ -72,7 +74,7 @@
   TARGET
       kernel
   SOURCES
-	lib/string.c arm.c asm.S bio.c buddy.c console.cbc exec.c file.c fs.c log.c main.c memide.c pipe.c proc.c spinlock.c
+	lib/string.c arm.c asm.S bio.c buddy.c console.c exec.c file.c fs.c log.c main.c memide.c pipe.c proc.c spinlock.c
 	start.c swtch.S syscall.c sysfile.c sysproc.c trap_asm.S trap.c vm.c device/picirq.c device/timer.c device/uart.c
         entry-osx.S 
 )
--- a/src/gearsTools/generate_context.pl	Sat Mar 02 21:05:26 2019 +0900
+++ b/src/gearsTools/generate_context.pl	Sun Mar 03 17:39:45 2019 +0900
@@ -169,9 +169,10 @@
 my $meta_call = <<"EOFEOF";
 __code meta(struct Context* context, enum Code next) {
     // printf("meta %d\\n",next);
-    if (context->task == NULL) {
-      goto (context->code[next])(context);
-    }
+    goto (context->code[next])(context);
+}
+
+__code parGotoMeta(struct Context* context, enum Code next) {
     context->task     = NULL;
     context->taskList = NULL;
     goto (context->code[Gearef(context, TaskManager)->taskManager->TaskManager.spawnTasks])(context);
--- a/src/gearsTools/generate_stub.pl	Sat Mar 02 21:05:26 2019 +0900
+++ b/src/gearsTools/generate_stub.pl	Sun Mar 03 17:39:45 2019 +0900
@@ -330,7 +330,7 @@
     my $prevCodeGearName;
     my $inTypedef = 0;
     my $inStub = 0;
-    my $inParGoto = 0;
+    my $hasParGoto = 0;
     my $inMain = 0 ;
     my %stub;
     my $codeGearName;
@@ -489,6 +489,7 @@
                     }
                     $i++;
                 }
+                print $fd "${prev}context->before = C_$codeGearName;\n";
                 print $fd "${prev}goto meta(context, $next->$method);\n";
                 next;
             } elsif(/^(.*)par goto (\w+)\((.*)\);/) {
@@ -509,8 +510,8 @@
                 $args =~ s/iterate\((.*)?\),//;
                 my @dataGears = split(/,\s*/, $args);
                 my $nextCodeGear = pop(@dataGears);
-                if (! $inParGoto) {
-                    $inParGoto = 1;
+                if (! $hasParGoto) {
+                    $hasParGoto = 1;
                     print $fd "${prev}struct Element* element;\n";
                 }
                 my $initTask = << "EOFEOF";
@@ -570,24 +571,26 @@
                         my $v = shift(@args);
                         print $fd "\t*O_$arg = $v;\n";
                     }
-                    if ($inParGoto) {
+                    if ($hasParGoto) {
                         print $fd "${prev}Gearef(context, TaskManager)->taskList = context->taskList;\n";
                         print $fd "${prev}Gearef(context, TaskManager)->next1 = C_$next;\n";
                         print $fd "${prev}goto meta(context, C_$next);\n";
                     } else {
+                        print $fd "${prev}context->before = C_$codeGearName;\n";
                         print $fd "${prev}goto meta(context, $next);\n";
                     }
                     next;
                 }
-                if ($inParGoto) {
+                if ($hasParGoto) {
                     print $fd "${prev}Gearef(context, TaskManager)->taskList = context->taskList;\n";
                     print $fd "${prev}Gearef(context, TaskManager)->next1 = C_$next;\n";
-                    print $fd "${prev}goto meta(context, C_$next);\n";
+                    print $fd "${prev}goto parGotoMeta(context, C_$next);\n";
                     next;
                 } elsif ($next eq "meta") {
                     print $fd $_;
                     next;
                 } else {
+                    print $fd "${prev}context->before = C_$codeGearName;\n";
                     print $fd "${prev}goto meta(context, C_$next);\n";
                     next;
                 }
@@ -597,7 +600,7 @@
                 $localVarType{$varName} = $type;
                 s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g;   # replacing new
             } elsif(/^}/) {
-                $inParGoto = 0;
+                $hasParGoto = 0;
             } else {
                 s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g;   # replacing new
             }