# HG changeset patch # User tobaru # Date 1571060919 -32400 # Node ID a4307abefd0b0991911e9912ba2671f2d62bb2ff # Parent d4e22a45a575468d39a59ebc4d8fefba0c2d3aa4 include context.h on proc.h and ajastment directory on CMakeList.txt diff -r d4e22a45a575 -r a4307abefd0b src/CMakeLists.txt --- a/src/CMakeLists.txt Sat Oct 12 15:22:33 2019 +0900 +++ b/src/CMakeLists.txt Mon Oct 14 22:48:39 2019 +0900 @@ -34,8 +34,6 @@ endif() set(CMAKE_BEFORE_PROJECT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}") -include_directories(".") -include_directories(${CMAKE_SOURCE_DIR}) configure_file("${CMAKE_SOURCE_DIR}/kernel-cmake.ld" "${CMAKE_CURRENT_BINARY_DIR}/kernel-cmake.ld" COPYONLY) macro( GearsCommand ) @@ -47,19 +45,21 @@ set( _ONE_VALUE_ARGS TARGET ) set( _MULTI_VALUE_ARGS SOURCES ) cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} ) - set(CMAKE_KERNEL_DIR "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${_Gears_TARGET}.dir") + set(CMAKE_KERNEL_DIR "${CMAKE_BINARY_DIR}") + set(CMAKE_KERNEL_DIR_C "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${_Gears_TARGET}.dir") set (_Gears_CBC_SOURCES) set (_Gears_CSOURCES) + include_directories("${CMAKE_BINARY_DIR}" ".") foreach(i ${_Gears_SOURCES}) if (${i} MATCHES "\\.cbc") string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i}) add_custom_command ( - OUTPUT ${CMAKE_KERNEL_DIR}/${j} + OUTPUT ${CMAKE_KERNEL_DIR_C}/${j} DEPENDS ${i} - COMMAND "cd" "${CMAKE_KERNEL_DIR}" ";" "perl" "${CMAKE_SOURCE_DIR}/gearsTools/generate_stub.pl" "-o" ${j} ${CMAKE_SOURCE_DIR}/${i} + COMMAND "cd" "${CMAKE_KERNEL_DIR_C}" ";" "perl" "${CMAKE_SOURCE_DIR}/gearsTools/generate_stub.pl" "-o" ${j} ${CMAKE_SOURCE_DIR}/${i} ) - list(APPEND _Gears_CBC_SOURCES "${CMAKE_KERNEL_DIR}/${j}") + list(APPEND _Gears_CBC_SOURCES "${CMAKE_KERNEL_DIR_C}/${j}") #list(APPEND _Gears_CBC_SOURCES ${j}) elseif (${i} MATCHES "\\.cu") string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i}) @@ -77,14 +77,15 @@ endforeach(i) #target_link_libraries(syslib) - file(COPY "${CMAKE_SOURCE_DIR}/interface/" DESTINATION ${CMAKE_KERNEL_DIR}) - file(COPY "${CMAKE_SOURCE_DIR}/context.h" DESTINATION ${CMAKE_KERNEL_DIR}) + file(COPY "${CMAKE_SOURCE_DIR}/interface/" DESTINATION ${CMAKE_KERNEL_DIR_C}) + file(COPY "${CMAKE_SOURCE_DIR}/context.h" DESTINATION ${CMAKE_KERNEL_DIR_C}) add_custom_command ( OUTPUT ${CMAKE_KERNEL_DIR}/c/${_Gears_TARGET}-context.c DEPENDS ${_Gears_CBC_SOURCES} fs.img initcode COMMAND "cd" "CMakeFiles/kernel.dir" ";" "perl" "${CMAKE_SOURCE_DIR}/gearsTools/generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CBC_SOURCES} ) - add_executable(${_Gears_TARGET} ${_Gears_CBC_SOURCES} ${_Gears_CSOURCES} ${CMAKE_KERNEL_DIR}/c/${_Gears_TARGET}-context.c ) + # add_executable(${_Gears_TARGET} ${_Gears_CBC_SOURCES} ${_Gears_CSOURCES} ${CMAKE_KERNEL_DIR}/c/${_Gears_TARGET}-context.c ) + add_executable(${_Gears_TARGET} ${CMAKE_KERNEL_DIR_C} ${_Gears_CBC_SOURCES} ${_Gears_CSOURCES} ${CMAKE_KERNEL_DIR}/c/${_Gears_TARGET}-context.c ) # target_link_libraries(${_Gears_TARGET} m pthread) endmacro() diff -r d4e22a45a575 -r a4307abefd0b src/proc.h --- a/src/proc.h Sat Oct 12 15:22:33 2019 +0900 +++ b/src/proc.h Mon Oct 14 22:48:39 2019 +0900 @@ -1,6 +1,7 @@ #include "typedefData.h" #ifndef PROC_INCLUDE_ #define PROC_INCLUDE_ +#include "context.h" // Per-CPU state, now we only support one CPU struct cpu { @@ -68,6 +69,7 @@ struct file* ofile[NOFILE]; // Open files struct inode* cwd; // Current directory char name[16]; // Process name (debugging) + struct Context cbc_context; union cbc_arg { struct cbc_console_arg { int n;