Merge anywhere
authorStephane Lenclud <tortoisehg@lenclud.com>
Wed, 03 Feb 2010 17:47:37 +0100
branchanywhere
changeset 49 af71d110c717
parent 48 10816385149a (diff)
parent 42 bef462d20cc3 (current diff)
child 50 999bb78c71ac
Merge
kerneltest/e32test/hcr/d_hcrsim.mmp
userlibandfileserver/fileserver/automounter/misc/FS_Automounter_HowTo.doc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/anywhere.txt	Wed Feb 03 17:47:37 2010 +0100
@@ -0,0 +1,1 @@
+Testing branches in Hg.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/CMakeLists.txt	Wed Feb 03 17:47:37 2010 +0100
@@ -0,0 +1,42 @@
+# Copyright (c) 2009-2010 Stéphane Lenclud.
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Stéphane Lenclud.
+#
+
+project (eka)
+
+cmake_minimum_required(VERSION 2.6)
+
+
+#Generate the exec enum using CMAKE custom command
+#perl genexec.pl -i execs.txt -e ../include/exec_enum.h -u ../include/exec_user.h -k ../include/exec_kernel.h
+add_custom_command (
+	OUTPUT ./include/exec_enum.h ./include/exec_user.h ./include/kernel/exec_kernel.h	
+   	COMMAND perl ./kernel/genexec.pl -i ./kernel/execs.txt -e ./include/exec_enum.h -u ./include/exec_user.h -k ./include/kernel/exec_kernel.h
+	WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}	
+   	COMMENT "Generating exec headers..."
+   	DEPENDS ./kernel/genexec.pl ./kernel/execs.txt
+   	VERBATIM
+ 	)
+	
+#Tell cmake those file won't be available until build time
+set_source_files_properties(./include/exec_enum.h PROPERTIES GENERATED 1)
+set_source_files_properties(./include/exec_user.h PROPERTIES GENERATED 1)
+set_source_files_properties(./include/kernel/exec_kernel.h PROPERTIES GENERATED 1)
+
+#Custom target that will generate our exec headers 
+add_custom_target(dogenexec DEPENDS ./include/exec_enum.h ./include/exec_user.h ./include/kernel/exec_kernel.h)
+add_custom_target(genexec)
+
+add_subdirectory(./euser)
+add_subdirectory(./kernel)
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/euser/CMakeLists.txt	Wed Feb 03 17:47:37 2010 +0100
@@ -0,0 +1,158 @@
+# Copyright (c) 2009 Stéphane Lenclud.
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Stéphane Lenclud.
+#
+
+project (euser)
+
+cmake_minimum_required(VERSION 2.6)
+
+#Add the given source files to our source prepending the sourcepath
+macro(add_source)
+	foreach(mySource ${ARGV})
+		string(REGEX REPLACE "(^.+)" "${sourcepath}\\1" newsource ${mySource})
+		set(source ${source} ${newsource})
+	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)
+add_definitions(-D__LEAVE_EQUALS_THROW__)
+add_definitions(-D__WINS__)
+#__CPU_X86 is declared by __WINS__ 
+#add_definitions(-D__CPU_X86)
+#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)
+
+
+#Adding the sources from cbase
+set (sourcepath ../euser/cbase/)
+add_source(
+ub_act.cpp ub_array.cpp ub_bma.cpp ub_buf.cpp
+ub_circ.cpp ub_cln.cpp ub_cons.cpp ub_dtim.cpp
+ub_obj.cpp ub_svr.cpp ub_polsvr.cpp
+ub_tim.cpp ub_utl.cpp ub_tque.cpp
+)
+
+
+#Add euser sources
+set (sourcepath ../euser/)
+add_source(
+us_evnt.cpp locmapping.cpp us_exec.cpp us_func.cpp
+us_graph.cpp us_hand.cpp us_ksvr.cpp us_des.cpp
+us_lex16.cpp us_lex8.cpp us_loc.cpp us_mes.cpp
+us_parse.cpp us_power.cpp us_property.cpp us_que.cpp
+us_ref.cpp us_regn.cpp us_test.cpp us_time.cpp
+us_trp.cpp us_utl.cpp us_mqueue.cpp us_encode.cpp
+us_decode.cpp us_secure.cpp us_htab.cpp us_rwlock.cpp
+us_shbuf.cpp
+)
+
+
+#Adding the sources from common
+set (sourcepath ../common/)
+add_source(
+array.cpp des8.cpp des16.cpp alloc.cpp heap.cpp
+mem.cpp secure.cpp
+)
+
+#Adding the sources from common/win32
+set (sourcepath ../common/win32/)
+add_source(
+atomics.cpp
+)
+
+#Adding the sources from maths
+set (sourcepath ../euser/maths/)
+add_source(
+um_asin.cpp um_atan.cpp um_dtor.cpp um_exp.cpp
+um_frac.cpp um_int.cpp um_ln.cpp um_log.cpp
+um_mod.cpp um_pow.cpp um_pow10.cpp
+um_rand.cpp um_rtod.cpp um_sin.cpp um_spec.cpp
+um_sqrt.cpp um_tan.cpp um_utl.cpp
+)
+
+
+#Adding the sources from epoc/win32
+set (sourcepath ../euser/epoc/win32/)
+add_source(
+uc_i64.cpp uc_realx.cpp
+uc_trp.cpp uc_utl.cpp uc_exec.cpp
+uc_dll.cpp
+)
+
+#Adding the sources from epoc
+set (sourcepath ../euser/epoc/)
+add_source(
+up_lib.cpp up_utl.cpp
+)
+
+#Adding the sources from unicode
+set (sourcepath ../euser/unicode/)
+add_source(
+collate.cpp unicode.cpp unitable.cpp Compare.cpp
+)
+
+#define our target
+
+### EMULATOR: used by euser and kernel for emulation
+add_library (emulator SHARED ../euser/epoc/win32/emulator.cpp) #Compile the KLIB target entry point which is l_entry.cpp:  ../kernel/win32/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)
+target_link_libraries(euser 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)
+
+### 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:_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)
+
+ 
+ 
+#define vs IDE folders
+source_group(Sources REGULAR_EXPRESSION ".+\\.cpp$")
+source_group(Includes REGULAR_EXPRESSION ".+\\.h$") 	
+
+
--- a/kernel/eka/euser/epoc/win32/emulator.cpp	Fri Jan 29 15:07:41 2010 +0000
+++ b/kernel/eka/euser/epoc/win32/emulator.cpp	Wed Feb 03 17:47:37 2010 +0100
@@ -784,7 +784,7 @@
 EXPORT_C TInt Emulator::RImageFile::Open(LPCTSTR aImageFile)
 	{
 	Buf8<MAX_PATH>   nameBuf(aImageFile);
-	char *pName = strrchr(LPCSTR(nameBuf), '\\');
+	char *pName = (char *)strrchr(LPCSTR(nameBuf), '\\');
 	pName ? ++pName : pName = (char *)LPCSTR(nameBuf);
 
 	__LOCK_HOST;
--- a/kernel/eka/euser/epoc/win32/uc_epoc.cpp	Fri Jan 29 15:07:41 2010 +0000
+++ b/kernel/eka/euser/epoc/win32/uc_epoc.cpp	Wed Feb 03 17:47:37 2010 +0100
@@ -14,3 +14,24 @@
 // e32\euser\epoc\win32\uc_epoc.cpp
 // 
 //
+
+#include <e32std.h>
+#include <e32std_private.h>
+#include <e32wins.h>
+
+//SL: Empty on FCL ?
+
+GLDEF_C TInt E32Main()
+	{
+	//What do we do then
+
+	CBase* base=new(ELeave) CBase();
+	delete base;
+
+	return KErrNone;
+	}
+
+TInt main()
+	{
+	return E32Main();
+	}
\ No newline at end of file
--- a/kernel/eka/euser/epoc/win32/uc_utl.cpp	Fri Jan 29 15:07:41 2010 +0000
+++ b/kernel/eka/euser/epoc/win32/uc_utl.cpp	Wed Feb 03 17:47:37 2010 +0100
@@ -98,6 +98,8 @@
    
 EXPORT_C void BootEpoc(TBool aAutoRun)
 	{
+	//SL:
+	//HINSTANCE epoc = LoadLibraryA("ekern.dll");
 	HINSTANCE epoc = LoadLibraryA("ekern.exe");
 	if (epoc)
 		{
--- a/kernel/eka/include/e32cmn.h	Fri Jan 29 15:07:41 2010 +0000
+++ b/kernel/eka/include/e32cmn.h	Wed Feb 03 17:47:37 2010 +0100
@@ -1566,7 +1566,7 @@
 	/**
     @internalComponent
     */
-	typedef TUint16 __TText;
+	typedef wchar_t __TText;
 
 #elif defined(__CW32__)
 
--- a/kernel/eka/include/e32des16.h	Fri Jan 29 15:07:41 2010 +0000
+++ b/kernel/eka/include/e32des16.h	Wed Feb 03 17:47:37 2010 +0100
@@ -688,7 +688,7 @@
     /**
     @internalComponent
     */
-	typedef TUint16 __TText;
+	typedef wchar_t __TText;
 #elif defined(__CW32__)
     /**
     @internalComponent
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/kernel/CMakeLists.txt	Wed Feb 03 17:47:37 2010 +0100
@@ -0,0 +1,157 @@
+# Copyright (c) 2009 Stéphane Lenclud.
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Stéphane Lenclud.
+#
+
+project (kernel)
+
+cmake_minimum_required(VERSION 2.6)
+
+#Add the given source files to our source prepending the sourcepath
+macro(add_source)
+	foreach(mySource ${ARGV})
+		string(REGEX REPLACE "(^.+)" "${sourcepath}\\1" newsource ${mySource})
+		set(source ${source} ${newsource})
+	endforeach(mySource) 
+endmacro(add_source) 
+
+add_definitions(-DUNICODE)
+add_definitions(-D__VC32__)
+add_definitions(-D_UNICODE)
+add_definitions(-D__LEAVE_EQUALS_THROW__)
+add_definitions(-D__WINS__)
+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)
+#add_definitions(-D__DLL__)
+
+include_directories (../euser ../euser/unicode ../include 
+../include/nkern ../include/nkern/win32 ../include/kernel ../include/kernel/win32 ../include/memmodel/emul/win32 ../include/memmodel/emul)
+
+#Define source for ekern
+set (sourcepath ../nkern/)
+add_source(
+nkern.cpp nkerns.cpp sched.cpp dfcs.cpp nk_timer.cpp
+nk_old.cpp
+)
+
+set (sourcepath ../common/win32/)
+add_source(
+atomics.cpp
+)
+
+set (sourcepath ../nkern/win32/)
+add_source(
+vectors.cpp ncsched.cpp nctimer.cpp ncutilf.cpp ncutils.cpp
+ncthrd.cpp ncglob.cpp
+)
+
+set (sourcepath ../common/win32/)
+add_source(
+seh.cpp
+)
+
+set (sourcepath ../kernel/win32/)
+add_source(
+cboot.cpp
+cglobals.cpp cexec.cpp cinit.cpp
+ckernel.cpp csched.cpp
+cutils.cpp cache.cpp
+k_entry.cpp #originally from kc_exe.mmp
+)
+
+
+set (sourcepath ../kernel/)
+add_source(
+sglobals.cpp device.cpp eventq.cpp
+sexec.cpp sinit.cpp skernel.cpp
+scodeseg.cpp sipc.cpp notifier.cpp 
+object.cpp power.cpp server.cpp
+stimer.cpp sutils.cpp random.cpp
+sprocess.cpp sthread.cpp 
+smqueue.cpp
+sproperty.cpp
+ssharedio.cpp
+ssecure.cpp
+emi.cpp
+objectix.cpp
+sbtrace.cpp
+stest.cpp
+sshbuf.cpp smap.cpp
+)
+				
+set (sourcepath ../klib/)
+add_source(
+dbase.cpp kdes8.cpp
+kheap.cpp bma.cpp
+)
+
+#
+set (sourcepath ../common/)
+add_source(
+alloc.cpp array.cpp des8.cpp heap.cpp mem.cpp
+secure.cpp
+)
+
+set (sourcepath ../memmodel/emul/)
+add_source(
+pglobals.cpp
+nvram.cpp
+)
+
+#
+set (sourcepath ../memmodel/emul/win32/)
+add_source(
+zrom.cpp
+mchunk.cpp mglobals.cpp minit.cpp mkernel.cpp
+mcodeseg.cpp mprocess.cpp mutils.cpp mshbuf.cpp
+)
+
+
+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
+##
+
+get_target_property(LIB_NAME ekern LOCATION)
+get_target_property(DEST_NAME epoc LOCATION)
+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})
+
+#message(${DEST_NAME})
+
+add_custom_command (
+ 	TARGET ekern
+   	POST_BUILD
+   	COMMAND ${CMAKE_COMMAND} -E copy ${LIB_NAME} ${DEST_NAME}
+ 	)
+	
+######################
+
+
+#define vs IDE folders
+source_group(Sources REGULAR_EXPRESSION ".+\\.cpp$")
+source_group(Includes REGULAR_EXPRESSION ".+\\.h$") 	
+
+
--- a/kernel/eka/kernel/win32/cinit.cpp	Fri Jan 29 15:07:41 2010 +0000
+++ b/kernel/eka/kernel/win32/cinit.cpp	Wed Feb 03 17:47:37 2010 +0100
@@ -44,7 +44,9 @@
 	HMODULE h=(HMODULE)aHandle;
 	TVariantInitialise f=(TVariantInitialise)Emulator::GetProcAddress(h, (LPCSTR)1);
 	__KTRACE_OPT(KBOOT,Kern::Printf("Calling Initialise %08x",f));
-	Emul::TheAsic=(*f)(EmulRunExe);
+	//SL: Fixed our linkage error
+	//Emul::TheAsic=(*f)(EmulRunExe);
+	Emul::TheAsic=(*f)(EFalse);
 	__KTRACE_OPT(KBOOT,Kern::Printf("Initialise returned %08x",Emul::TheAsic));
 	if (!Emul::TheAsic)
 		return KErrGeneral;
--- a/kernel/eka/kernel/win32/l_entry.cpp	Fri Jan 29 15:07:41 2010 +0000
+++ b/kernel/eka/kernel/win32/l_entry.cpp	Wed Feb 03 17:47:37 2010 +0100
@@ -23,7 +23,7 @@
 	return 0;
 	}
 
-#ifdef __CW32__
+#if defined(__CW32__) || defined(__VC32__)
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
--- a/kernel/eka/memmodel/emul/win32/mcodeseg.cpp	Fri Jan 29 15:07:41 2010 +0000
+++ b/kernel/eka/memmodel/emul/win32/mcodeseg.cpp	Wed Feb 03 17:47:37 2010 +0100
@@ -379,7 +379,7 @@
 				TInt	mainlen;
 				{
 				TUint16 mainBuf[MAX_PATH];
-				mainlen=Emulator::GetModuleFileName(reinterpret_cast<HMODULE>(pM->iModuleHandle),mainBuf);
+				mainlen=Emulator::GetModuleFileName(reinterpret_cast<HMODULE>(pM->iModuleHandle),(LPWSTR)mainBuf);
 				TruncToNarrow(mainBuf8, mainBuf, mainlen);
 				}
 				TPtrC mainp(mainBuf8,mainlen);
@@ -393,7 +393,7 @@
 				TInt	deplen;
 				{
 				TUint16 depBuf[MAX_PATH];
-				deplen=Emulator::GetModuleFileName(reinterpret_cast<HMODULE>(dep.iModuleHandle),depBuf);
+				deplen=Emulator::GetModuleFileName(reinterpret_cast<HMODULE>(dep.iModuleHandle),(LPWSTR)depBuf);
 				TruncToNarrow(depBuf8, depBuf, deplen);
 				}
 				TPtrC depp(depBuf8,deplen);
@@ -729,14 +729,14 @@
 		TUint16 fileNameW[KMaxFileName];
 		ExpandToWide(fileNameW, iFileName->Ptr(), iFileName->Length());
 		fileNameW[iFileName->Length()] = '\0';
-		iWinInstance = Emulator::LoadLibrary(fileNameW);
+		iWinInstance = Emulator::LoadLibrary((LPCWSTR)fileNameW);
 		__KTRACE_OPT(KDLL,Kern::Printf("W32CodeSeg : EKERN %08x", iWinInstance));
 		if (!iWinInstance)
 			return KErrGeneral;
 		if (aInfo.iTotalDataSize)
 			iMark|=EMarkData|EMarkDataPresent;
 		KernelCodeSeg=this;
-		KernelModuleHandle=Emulator::GetModuleHandle(fileNameW);
+		KernelModuleHandle=Emulator::GetModuleHandle((LPCWSTR)fileNameW);
 		return RegisterCodeSeg(KernelModuleHandle);
 		}
 	TWin32Filename w32fn(*iFileName);
@@ -880,7 +880,7 @@
 	if (!r)
 		return Emulator::LastError();
 	TUint8 name8[MAX_PATH+1];
-	TruncToNarrow(name8,name,-1);
+	TruncToNarrow(name8,(const TUint16*)name,-1);
 
 	TPtrC fpptr((const TText*)name8);
 	TInt slash=fpptr.LocateReverse('\\');