changeset 53:435bfab09924

fix cmakefiles
author kono
date Mon, 03 Jun 2019 19:39:11 +0900
parents 214d21c891c7
children aa0095c4c2b0
files src/CMakeLists.txt src/context.h src/fs.h src/gearsTools/generate_context.pl
diffstat 4 files changed, 28 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/CMakeLists.txt	Mon Jun 03 18:12:44 2019 +0900
+++ b/src/CMakeLists.txt	Mon Jun 03 19:39:11 2019 +0900
@@ -11,15 +11,19 @@
              -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
              -Wno-nullability-completeness -Wno-expansion-to-defined")
+    set(CMAKE_EXE_LINKER_FLAGS "-L. -arch armv7 -T  kernel.ld -o  kernel.elf ")
 else (APPLE)
     set(CMAKE_C_COMPILER /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-gcc)
-    add_definitions("-B/mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi- 
+    set(CMAKE_ASM_COMPILER /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-gcc)
+    add_definitions("-B/mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-  
              -DCBCXV6=1 -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0")
+    set(CMAKE_EXE_LINKER_FLAGS "-L.  -T  kernel.ld  -o  kernel.elf -nostdlib ")
+
+
 endif (APPLE)
 
 # -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")
@@ -71,18 +75,18 @@
           DEPENDS   ${_Gears_CBC_SOURCES}
           COMMAND  "perl" "gearsTools/generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CBC_SOURCES}
     )
-    add_executable(${_Gears_TARGET} ${_Gears_CBC_SOURCES} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c)
-    target_link_libraries(${_Gears_TARGET} m pthread)
+    add_executable(${_Gears_TARGET} ${_Gears_CBC_SOURCES} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c )
+    #  target_link_libraries(${_Gears_TARGET} m pthread)
 endmacro()
 
 
-GearsCommand(
+GearsCommand (
   TARGET
       kernel
   SOURCES
 	lib/string.c arm.c asm.S bio.c buddy.c console.cbc exec.c file.cbc fs.c log.c main.c memide.c pipe.cbc proc.cbc spinlock.cbc
 	start.c swtch.S syscall.cbc sysfile.cbc sysproc.c trap_asm.S trap.c vm.c device/picirq.c device/timer.c device/uart.c
-        entry-osx.S 
+         entry.S 
 )
 
 
--- a/src/context.h	Mon Jun 03 18:12:44 2019 +0900
+++ b/src/context.h	Mon Jun 03 19:39:11 2019 +0900
@@ -10,7 +10,13 @@
 #include "helper_cuda.h"
 #endif
 
-// #include "use_context_numbers.h"
+#include "types.h"
+#include "use_context_numbers.h"
+#include "fs.h"
+#include "defs.h"
+
+#define calloc(a,b)  kmalloc((a)*(b))
+#define free(a)  kfree(a)
 
 #define ALLOCATE_SIZE 20000000
 #define NEW(type) (type*)(calloc(1, sizeof(type)))
--- a/src/fs.h	Mon Jun 03 18:12:44 2019 +0900
+++ b/src/fs.h	Mon Jun 03 19:39:11 2019 +0900
@@ -8,6 +8,10 @@
 // Then sb.nblocks data blocks.
 // Then sb.nlog log blocks.
 
+
+#ifndef FS_H
+#define FS_H
+
 #define ROOTINO 1  // root i-number
 #define BSIZE 512  // block size
 
@@ -53,3 +57,4 @@
     char    name[DIRSIZ];
 };
 
+#endif
--- a/src/gearsTools/generate_context.pl	Mon Jun 03 18:12:44 2019 +0900
+++ b/src/gearsTools/generate_context.pl	Mon Jun 03 19:39:11 2019 +0900
@@ -177,11 +177,11 @@
 __code parGotoMeta(struct Context* cbc_context, enum Code next) {
     cbc_context->task     = NULL;
     cbc_context->taskList = NULL;
-    goto (cbc_context->code[Gearef(context, TaskManager)->taskManager->TaskManager.spawnTasks])(cbc_context);
+    goto (cbc_context->code[Gearef(cbc_context, TaskManager)->taskManager->TaskManager.spawnTasks])(cbc_context);
 }
 
 __code start_code(struct Context* cbc_context) {
-    goto meta(context, cbc_context->next);
+    goto meta(cbc_context, cbc_context->next);
 }
 
 __code start_code_stub(struct Context* cbc_context) {
@@ -189,10 +189,10 @@
 }
 
 __code exit_code(struct Context* cbc_context) {
-    free(cbc_context->code);
-    free(cbc_context->data);
-    free(cbc_context->heapStart);
-    goto exit(0);
+    // free(cbc_context->code);
+    // free(cbc_context->data);
+    // free(cbc_context->heapStart);
+    goto exit_code(cbc_context);
 }
 
 __code exit_code_stub(struct Context* cbc_context) {