Can't get the kernel start-up code to work using VC8 compiler. It crashes while trying to run constructStatics. Maybe I will try my luck with GCC from MinGW, that should also make the Linux port much easier. anywhere
authorSlion
Sat, 09 Jan 2010 02:16:07 +0100
branchanywhere
changeset 28 9642313072c3
parent 27 cf41e127747a
child 38 422372aa20a3
Can't get the kernel start-up code to work using VC8 compiler. It crashes while trying to run constructStatics. Maybe I will try my luck with GCC from MinGW, that should also make the Linux port much easier.
kernel/eka/euser/CMakeLists.txt
kernel/eka/euser/epoc/win32/uc_epoc.cpp
kernel/eka/euser/epoc/win32/uc_utl.cpp
kernel/eka/kernel/CMakeLists.txt
kernel/eka/kernel/win32/l_entry.cpp
--- a/kernel/eka/euser/CMakeLists.txt	Thu Jan 07 02:37:41 2010 +0100
+++ b/kernel/eka/euser/CMakeLists.txt	Sat Jan 09 02:16:07 2010 +0100
@@ -21,6 +21,8 @@
 	endforeach(mySource) 
 endmacro(add_source) 
 
+#Set common definitions using add_definitions
+#Target specific definitions will be add using set_target_properties
 #add_definitions(-DUNICODE)
 add_definitions(-D__VC32__)
 add_definitions(-D_UNICODE)
@@ -28,7 +30,13 @@
 add_definitions(-D__WINS__)
 #__CPU_X86 is declared by __WINS__ 
 #add_definitions(-D__CPU_X86)
-add_definitions(-D__DLL__)
+#add_definitions(-D__DLL__)
+
+
+#set(commonDefines "__VC32__; _UNICODE;")
+
+
+
 
 include_directories (../euser ../euser/unicode ../include 
 ../include/nkern ../include/nkern/win32 ../include/kernel ../include/kernel/win32 ../include/memmodel/emul/win32 ../include/memmodel/emul)
@@ -102,26 +110,44 @@
 collate.cpp unicode.cpp unitable.cpp Compare.cpp
 )
 
-#define our library
-add_library (emulator SHARED ../euser/epoc/win32/emulator.cpp)
-target_link_libraries(emulator kernel32)
+#define our target
 
+### EMULATOR: used by euser and kernel for emulation
+add_library (emulator SHARED ../kernel/win32/l_entry.cpp ../euser/epoc/win32/emulator.cpp) #Compile the KLIB target entry point which is l_entry.cpp 
+target_link_libraries(emulator kernel32) #kernel32
+#set_target_properties(emulator PROPERTIES COMPILE_FLAGS "/Zl") #No default library
+set_target_properties(emulator PROPERTIES LINK_FLAGS "/ENTRY:_Win32DllMain") #Change the entry point
+
+### EUSER: many user library
 add_library (euser SHARED ${source})
 add_dependencies(euser genexec emulator)
+set_target_properties(euser PROPERTIES COMPILE_DEFINITIONS "__DLL__")
 
+
+### ESTUB: not sure why need that yet
 add_library (estub STATIC ../euser/epoc/win32/uc_stub.cpp)
 #set_target_properties(estub PROPERTIES LINK_FLAGS /ENTRY:E32Bootstrap)
 
-add_executable(epoc ../euser/epoc/win32/uc_epoc.cpp)
+### SCPPNWDL_KERN: used by kernel. It contains new operators override.
+#To be linked by kernel
+add_library (scppnwdl_kern STATIC ../euser/epoc/win32/scppnwdl.cpp)
+add_dependencies(scppnwdl_kern euser)
+
+### EPOC: emulator executable
+add_executable(epoc ../euser/epoc/win32/uc_exe.cpp ../euser/epoc/win32/uc_epoc.cpp) #Compile the EXE target entry point which is uc_exe.cpp 
 add_dependencies(epoc estub euser)
-set_target_properties(epoc PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup /SUBSYSTEM:WINDOWS")
-#set_target_properties(epoc PROPERTIES LINK_FLAGS "/ENTRY:_E32Bootstrap /SUBSYSTEM:WINDOWS /NODEFAULTLIB /NOASSEMBLY")
+set_target_properties(epoc PROPERTIES LINK_FLAGS "/ENTRY:_E32Bootstrap /SUBSYSTEM:WINDOWS /NODEFAULTLIB")
+target_link_libraries(epoc msvcrt)
+#set_target_properties(epoc PROPERTIES COMPILE_FLAGS "/Zl")
+#set_target_properties(epoc PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup /SUBSYSTEM:WINDOWS")
+#set_target_properties(epoc PROPERTIES LINK_FLAGS "/NODEFAULTLIB")
+
  #set_target_properties(target1 target2 ... PROPERTIES prop1 value1 prop2 value2 ...)
 
 
 #No need for emulator here
 #add_executable(epoc ./euser/epoc/win32/uc_epoc.cpp)
-#target_link_libraries(epoc estub euser)
+
  
  
 #define vs IDE folders
--- a/kernel/eka/euser/epoc/win32/uc_epoc.cpp	Thu Jan 07 02:37:41 2010 +0100
+++ b/kernel/eka/euser/epoc/win32/uc_epoc.cpp	Sat Jan 09 02:16:07 2010 +0100
@@ -14,34 +14,16 @@
 // e32\euser\epoc\win32\uc_epoc.cpp
 // 
 //
+
 #include <e32std.h>
 #include <e32std_private.h>
 #include <e32wins.h>
 
-
-//SL: this file is empty on FCL
-
-/*
-extern "C"
-GLDEF_C TInt _E32Startup()
-//
-// Unused in the stub
-//
-	{
-	return KErrNone;
-	}
+//SL: Empty on FCL ?
 
-GLDEF_C void __stdcall _E32Bootstrap()
-//
-// stub for bootstrapping EPOC
-//
+GLDEF_C TInt E32Main()
 	{
-	BootEpoc(EFalse);
-	}
-*/
+	//What do we do then
 
-
-int main(int argc, char* argv[])
-	{
-	BootEpoc(EFalse);
-	}
+	return KErrNone;
+	}
\ No newline at end of file
--- a/kernel/eka/euser/epoc/win32/uc_utl.cpp	Thu Jan 07 02:37:41 2010 +0100
+++ b/kernel/eka/euser/epoc/win32/uc_utl.cpp	Sat Jan 09 02:16:07 2010 +0100
@@ -99,8 +99,8 @@
 EXPORT_C void BootEpoc(TBool aAutoRun)
 	{
 	//SL:
-	HINSTANCE epoc = LoadLibraryA("ekern.dll");
-	//HINSTANCE epoc = LoadLibraryA("ekern.exe");
+	//HINSTANCE epoc = LoadLibraryA("ekern.dll");
+	HINSTANCE epoc = LoadLibraryA("ekern.exe");
 	if (epoc)
 		{
 		TBootEpoc ep = (TBootEpoc)GetProcAddress(epoc, "_E32Startup");
--- a/kernel/eka/kernel/CMakeLists.txt	Thu Jan 07 02:37:41 2010 +0100
+++ b/kernel/eka/kernel/CMakeLists.txt	Sat Jan 09 02:16:07 2010 +0100
@@ -29,6 +29,7 @@
 add_definitions(-D__EXPORT_MEMCPY__)				
 add_definitions(-D__IN_KERNEL__)
 add_definitions(-D__KERNEL_MODE__)
+add_definitions(-D__MEMMODEL_EMUL_SINGLE_HOST_PROCESS__)
 
 #__CPU_X86 is declared by __WINS__ 
 #add_definitions(-D__CPU_X86)
@@ -66,8 +67,8 @@
 cglobals.cpp cexec.cpp cinit.cpp
 ckernel.cpp csched.cpp
 cutils.cpp cache.cpp
+k_entry.cpp #originally from kc_exe.mmp
 )
-#k_entry.cpp
 
 
 set (sourcepath ../kernel/)
@@ -116,20 +117,24 @@
 mcodeseg.cpp mprocess.cpp mutils.cpp mshbuf.cpp
 )
 
-#add_executable(ekern ${source})
-add_library(ekern SHARED ${source})
-add_dependencies(ekern genexec emulator)
+
+add_executable(ekern ${source}) 
+#add_library(ekern SHARED ${source})
+add_dependencies(ekern genexec emulator scppnwdl_kern)
+set_target_properties(ekern PROPERTIES LINK_FLAGS "/ENTRY:KernelMain /NODEFAULTLIB")
+target_link_libraries(ekern kernel32 msvcrt)
+#set_target_properties(ekern PROPERTIES COMPILE_FLAGS "/Zl")
 #install(TARGETS ekern DESTINATION ./symbian/bin)
 
 
 
-#
-#Copy ekern.dll to be next to epoc.exe
-#
+##
+##Copy ekern.dll to be next to epoc.exe
+##
 
 get_target_property(LIB_NAME ekern LOCATION)
 get_target_property(DEST_NAME epoc LOCATION)
-set(target_suffix .dll)
+set(target_suffix .exe)
 #Extract path from full filename
 string(REGEX REPLACE "(^.+)/epoc.exe" "\\1" DEST_NAME ${DEST_NAME})
 set(DEST_NAME ${DEST_NAME}/ekern${target_suffix})
@@ -141,7 +146,8 @@
    	POST_BUILD
    	COMMAND ${CMAKE_COMMAND} -E copy ${LIB_NAME} ${DEST_NAME}
  	)
-
+	
+######################
 
 
 #define vs IDE folders
--- a/kernel/eka/kernel/win32/l_entry.cpp	Thu Jan 07 02:37:41 2010 +0100
+++ b/kernel/eka/kernel/win32/l_entry.cpp	Sat Jan 09 02:16:07 2010 +0100
@@ -23,7 +23,7 @@
 	return 0;
 	}
 
-#ifdef __CW32__
+#if defined(__CW32__) || defined(__VC32__)
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>