Author: tkreuzer
Date: Sat Apr 11 14:03:19 2015
New Revision: 67164
URL:
http://svn.reactos.org/svn/reactos?rev=67164&view=rev
Log:
[FREELDR]
Fix ARM build
Modified:
trunk/reactos/CMakeLists.txt
trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt
trunk/reactos/boot/freeldr/freeldr/arch/arm/boot.s
trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
trunk/reactos/boot/freeldr/freeldr/arch/arm/winldr.c
trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h
trunk/reactos/boot/freeldr/freeldr/mm/heap.c
trunk/reactos/boot/freeldr/freeldr/ui/ui.c
trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h
Modified: trunk/reactos/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/CMakeLists.txt?rev=67164&a…
==============================================================================
--- trunk/reactos/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/CMakeLists.txt [iso-8859-1] Sat Apr 11 14:03:19 2015
@@ -158,6 +158,9 @@
elseif(ARCH STREQUAL "arm")
# _M_ARM is already defined by toolchain
add_definitions(-D_ARM_ -D__arm__)
+ if(SARCH STREQUAL "omap-zoom2")
+ add_definitions(-D_ZOOM2_)
+ endif()
endif()
# Other
@@ -166,7 +169,7 @@
elseif(ARCH STREQUAL "amd64")
add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
elseif(ARCH STREQUAL "arm")
- add_definitions(-DUSE_COMPILER_EXCEPTIONS)
+ add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
endif()
# Activate support for assembly source files
Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/CMake…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] Sat Apr 11 14:03:19
2015
@@ -26,10 +26,6 @@
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/elf)
add_definitions(-D_NTHAL_ -D_BLDR_ -D_NTSYSTEM_)
-
-if((ARCH STREQUAL "arm") AND (SARCH STREQUAL "omap-zoom2"))
- add_definitions(-D_ZOOM2_)
-endif()
list(APPEND FREELDR_COMMON_SOURCE
include/freeldr.h
@@ -168,13 +164,10 @@
target_link_libraries(freeldr_common mini_hal)
endif()
-if(ARCH STREQUAL "i386" OR ARCH STREQUAL "amd64")
- list(APPEND FREELDR_BASE_SOURCE windows/setupldr.c)
-endif()
-
list(APPEND FREELDR_BASE_SOURCE
bootmgr.c # This file is compiled with custom definitions
freeldr.c
+ windows/setupldr.c
lib/inffile/inffile.c
lib/rtl/libsupp.c)
@@ -191,8 +184,13 @@
endif()
if(MSVC)
- add_target_link_flags(freeldr_pe "/ignore:4078 /ignore:4254 /DRIVER /FIXED
/ALIGN:0x400 /SECTION:.text,ERW /SECTION:.data,RW /MERGE:.text16=.text /MERGE:.data=.text
/MERGE:.rdata=.text /MERGE:.bss=.text ")
- add_target_link_flags(freeldr_pe_dbg "/ignore:4078 /ignore:4254 /DRIVER /FIXED
/ALIGN:0x400 /SECTION:.text,ERW /SECTION:.data,RW /MERGE:.text16=.text /MERGE:.data=.text
/MERGE:.rdata=.text /MERGE:.bss=.text")
+ if(ARCH STREQUAL "arm")
+ add_target_link_flags(freeldr_pe "/ignore:4078 /ignore:4254 /DRIVER")
+ add_target_link_flags(freeldr_pe_dbg "/ignore:4078 /ignore:4254
/DRIVER")
+ else()
+ add_target_link_flags(freeldr_pe "/ignore:4078 /ignore:4254 /DRIVER /FIXED
/ALIGN:0x400 /SECTION:.text,ERW /SECTION:.data,RW /MERGE:.text16=.text /MERGE:.data=.text
/MERGE:.rdata=.text /MERGE:.bss=.text ")
+ add_target_link_flags(freeldr_pe_dbg "/ignore:4078 /ignore:4254 /DRIVER
/FIXED /ALIGN:0x400 /SECTION:.text,ERW /SECTION:.data,RW /MERGE:.text16=.text
/MERGE:.data=.text /MERGE:.rdata=.text /MERGE:.bss=.text")
+ endif()
else()
add_target_link_flags(freeldr_pe
"-Wl,--strip-all,--exclude-all-symbols,--file-alignment,0x1000,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lds")
add_target_link_flags(freeldr_pe_dbg
"-Wl,--exclude-all-symbols,--file-alignment,0x1000,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lds")
@@ -229,12 +227,17 @@
# Retrieve the full path to the generated file of the 'freeldr_pe' target
get_target_property(_freeldr_pe_output_file freeldr_pe LOCATION)
-concatenate_files(
- ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys
- ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
- ${_freeldr_pe_output_file})
-
-add_custom_target(freeldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys)
+if(NOT ARCH STREQUAL "arm")
+
+ concatenate_files(
+ ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys
+ ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
+ ${_freeldr_pe_output_file})
+
+ add_custom_target(freeldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys)
+else()
+ add_custom_target(freeldr ALL DEPENDS ${_freeldr_pe_output_file})
+endif()
# rename freeldr on livecd to setupldr.sys because isoboot.bin looks for setupldr.sys
add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION
loader NO_CAB FOR bootcd regtest)
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/boot.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/boot.s [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/boot.s [iso-8859-1] Sat Apr 11 14:03:19
2015
@@ -6,7 +6,7 @@
* PROGRAMMERS: ReactOS Portable Systems Group
*/
-#include "ksarm.h"
+#include <ksarm.h>
//.title "ARM FreeLDR Entry Point"
//.include "ntoskrnl/include/internal/arm/kxarm.h"
@@ -16,9 +16,12 @@
NESTED_ENTRY _start
PROLOG_END _start
- b ArmInit
+ //b ArmInit
ENTRY_END _start
-L_ArmInit:
- .long ArmInit
+//L_ArmInit:
+// .long ArmInit
+
+ END
+/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] Sat Apr 11 14:03:19
2015
@@ -105,13 +105,6 @@
/* On ARM platforms, the loader is always in RAM */
strcpy(BootPath, Path);
return TRUE;
-}
-
-BOOLEAN
-ArmInitializeBootDevices(VOID)
-{
- /* Emulate old behavior */
- return (ArmHwDetect() != NULL);
}
PCONFIGURATION_COMPONENT_DATA
@@ -159,11 +152,19 @@
return RootNode;
}
+BOOLEAN
+ArmInitializeBootDevices(VOID)
+{
+ /* Emulate old behavior */
+ return (ArmHwDetect() != NULL);
+}
+
FREELDR_MEMORY_DESCRIPTOR ArmMemoryMap[32];
PFREELDR_MEMORY_DESCRIPTOR
ArmMemGetMemoryMap(OUT ULONG *MemoryMapSize)
{
+ ULONG i;
ASSERT(ArmBoardBlock->MemoryMapEntryCount <= 32);
/* Return whatever the board returned to us (CS0 Base + Size and FLASH0) */
@@ -177,7 +178,10 @@
ArmMemoryMap[i].MemoryType = MemoryFirmwarePermanent;
}
- return ArmBoardBlock->MemoryMapEntryCount;
+ *MemoryMapSize = ArmBoardBlock->MemoryMapEntryCount;
+
+ // FIXME
+ return NULL;
}
VOID
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/winldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/winldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/winldr.c [iso-8859-1] Sat Apr 11 14:03:19
2015
@@ -81,7 +81,8 @@
BOOLEAN
MempSetupPaging(IN PFN_NUMBER StartPage,
- IN PFN_COUNT NumberOfPages)
+ IN PFN_NUMBER NumberOfPages,
+ IN BOOLEAN KernelMapping)
{
return TRUE;
}
@@ -245,9 +246,7 @@
}
VOID
-WinLdrSetProcessorContext(PVOID GdtIdt,
- IN ULONG Pcr,
- IN ULONG Tss)
+WinLdrSetProcessorContext(VOID)
{
ARM_CONTROL_REGISTER ControlRegister;
ARM_TTB_REGISTER TtbRegister;
@@ -272,3 +271,31 @@
ControlRegister.ExtendedPageTables = TRUE;
KeArmControlRegisterSet(ControlRegister);
}
+
+VOID
+WinLdrSetupMachineDependent(
+ PLOADER_PARAMETER_BLOCK LoaderBlock)
+{
+}
+
+VOID DiskStopFloppyMotor(VOID)
+{
+}
+
+VOID
+RealEntryPoint(VOID)
+{
+ BootMain("");
+}
+
+VOID
+NTAPI
+FrLdrBugCheckWithMessage(
+ ULONG BugCode,
+ PCHAR File,
+ ULONG Line,
+ PSTR Format,
+ ...)
+{
+
+}
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h [iso-8859-1]
(original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h [iso-8859-1] Sat Apr 11
14:03:19 2015
@@ -9,11 +9,15 @@
#pragma once
#ifndef __REGISTRY_H
-#include "../../reactos/registry.h"
+//#include "../../reactos/registry.h"
#endif
#include "../../../../../armllb/inc/osloader.h"
#include "../../../../../armllb/inc/machtype.h"
+
+#define FREELDR_BASE 0x0001F000
+#define FREELDR_PE_BASE 0x0001F000
+#define MAX_FREELDR_PE_SIZE 0xFFFFFF
extern PARM_BOARD_CONFIGURATION_BLOCK ArmBoardBlock;
extern ULONG FirstLevelDcacheSize;
@@ -26,4 +30,11 @@
extern ULONG SecondLevelIcacheFillSize;
extern ULONG gDiskReadBuffer, gFileSysBuffer;
-#define DiskReadBuffer gDiskReadBuffer
+#define DiskReadBuffer ((PVOID)gDiskReadBuffer)
+
+#define DriveMapGetBiosDriveNumber(DeviceName) 0
+
+FORCEINLINE VOID Reboot(VOID)
+{
+ DbgBreakPoint();
+}
Modified: trunk/reactos/boot/freeldr/freeldr/mm/heap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/he…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/mm/heap.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/mm/heap.c [iso-8859-1] Sat Apr 11 14:03:19 2015
@@ -322,7 +322,9 @@
PHEAP Heap = HeapHandle;
PHEAP_BLOCK Block, NextBlock;
USHORT BlockSize, Remaining;
+#if DBG && !defined(_M_ARM)
ULONGLONG Time = __rdtsc();
+#endif
#ifdef FREELDR_HEAP_VERIFIER
/* Verify the heap */
@@ -402,8 +404,9 @@
Heap->MaxAllocBytes = max(Heap->MaxAllocBytes,
Heap->CurrentAllocBytes);
Heap->LargestAllocation = max(Heap->LargestAllocation,
Block->Size * sizeof(HEAP_BLOCK));
+#if DBG && !defined(_M_ARM)
Heap->AllocationTime += (__rdtsc() - Time);
-
+#endif
TRACE("HeapAllocate(%p, %ld, %.4s) -> return %p\n",
HeapHandle, ByteSize, &Tag, Block->Data);
@@ -436,7 +439,9 @@
{
PHEAP Heap = HeapHandle;
PHEAP_BLOCK Block, PrevBlock, NextBlock;
+#if DBG && !defined(_M_ARM)
ULONGLONG Time = __rdtsc();
+#endif
TRACE("HeapFree(%p, %p)\n", HeapHandle, Pointer);
ASSERT(Tag != 'dnE#');
@@ -514,8 +519,9 @@
/* Update the next block's back link */
NextBlock->PreviousSize = Block->Size;
-
+#if DBG && !defined(_M_ARM)
Heap->FreeTime += (__rdtsc() - Time);
+#endif
}
@@ -602,3 +608,4 @@
FrLdrHeapFreeEx(FrLdrDefaultHeap, HeapBase, ' ltR');
return TRUE;
}
+
Modified: trunk/reactos/boot/freeldr/freeldr/ui/ui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/ui…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/ui/ui.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/ui/ui.c [iso-8859-1] Sat Apr 11 14:03:19 2015
@@ -476,4 +476,9 @@
return UiVtbl.EditBox(MessageText, EditTextBuffer, Length);
}
+#else
+BOOLEAN UiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
+{
+ return FALSE;
+}
#endif
Modified: trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h [iso-8859-1] Sat Apr 11
14:03:19 2015
@@ -7,7 +7,10 @@
//
// Enter Wait-For-Interrupt Mode
//
+#ifdef _MSC_VER
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c0, 4" : : "r"(0) :
"cc");
+#endif
}
FORCEINLINE
@@ -15,7 +18,11 @@
KeArmControlRegisterGet(VOID)
{
ARM_CONTROL_REGISTER Value;
+#ifdef _MSC_VER
+ Value.AsUlong = 0;
+#else
__asm__ __volatile__ ("mrc p15, 0, %0, c1, c0, 0" :
"=r"(Value.AsUlong) : : "cc");
+#endif
return Value;
}
@@ -24,7 +31,11 @@
KeArmIdCodeRegisterGet(VOID)
{
ARM_ID_CODE_REGISTER Value;
+#ifdef _MSC_VER
+ Value.AsUlong = 0;
+#else
__asm__ __volatile__ ("mrc p15, 0, %0, c0, c0, 0" :
"=r"(Value.AsUlong) : : "cc");
+#endif
return Value;
}
@@ -33,7 +44,11 @@
KeArmFaultStatusRegisterGet(VOID)
{
ULONG Value;
+#ifdef _MSC_VER
+ Value = 0;
+#else
__asm__ __volatile__ ("mrc p15, 0, %0, c5, c0, 0" : "=r"(Value) :
: "cc");
+#endif
return Value;
}
@@ -42,7 +57,11 @@
KeArmInstructionFaultStatusRegisterGet(VOID)
{
ULONG Value;
+#ifdef _MSC_VER
+ Value = 0;
+#else
__asm__ __volatile__ ("mrc p15, 0, %0, c5, c0, 1" : "=r"(Value) :
: "cc");
+#endif
return Value;
}
@@ -51,7 +70,11 @@
KeArmFaultAddressRegisterGet(VOID)
{
ULONG Value;
+#ifdef _MSC_VER
+ Value = 0;
+#else
__asm__ __volatile__ ("mrc p15, 0, %0, c6, c0, 0" : "=r"(Value) :
: "cc");
+#endif
return Value;
}
@@ -60,7 +83,11 @@
KeArmLockdownRegisterGet(VOID)
{
ARM_LOCKDOWN_REGISTER Value;
+#ifdef _MSC_VER
+ Value.AsUlong = 0;
+#else
__asm__ __volatile__ ("mrc p15, 0, %0, c10, c0, 0" :
"=r"(Value.AsUlong) : : "cc");
+#endif
return Value;
}
@@ -69,7 +96,11 @@
KeArmTranslationTableRegisterGet(VOID)
{
ARM_TTB_REGISTER Value;
+#ifdef _MSC_VER
+ Value.AsUlong = 0;
+#else
__asm__ __volatile__ ("mrc p15, 0, %0, c2, c0, 0" :
"=r"(Value.AsUlong) : : "cc");
+#endif
return Value;
}
@@ -78,7 +109,11 @@
KeArmCacheRegisterGet(VOID)
{
ARM_CACHE_REGISTER Value;
+#ifdef _MSC_VER
+ Value.AsUlong = 0;
+#else
__asm__ __volatile__ ("mrc p15, 0, %0, c0, c0, 1" :
"=r"(Value.AsUlong) : : "cc");
+#endif
return Value;
}
@@ -87,69 +122,100 @@
KeArmStatusRegisterGet(VOID)
{
ARM_STATUS_REGISTER Value;
+#ifdef _MSC_VER
+ Value.AsUlong = _ReadStatusReg(0);
+#else
__asm__ __volatile__ ("mrs %0, cpsr" : "=r"(Value.AsUlong) : :
"cc");
- return Value;
+#endif
+ return Value;
}
FORCEINLINE
VOID
KeArmControlRegisterSet(IN ARM_CONTROL_REGISTER ControlRegister)
{
- __asm__ __volatile__ ("mcr p15, 0, %0, c1, c0, 0" : :
"r"(ControlRegister.AsUlong) : "cc");
+#ifdef _MSC_VER
+#else
+ __asm__ __volatile__ ("mcr p15, 0, %0, c1, c0, 0" : :
"r"(ControlRegister.AsUlong) : "cc");
+#endif
}
FORCEINLINE
VOID
KeArmTranslationTableRegisterSet(IN ARM_TTB_REGISTER Ttb)
{
+#ifdef _MSC_VER
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c2, c0, 0" : :
"r"(Ttb.AsUlong) : "cc");
+#endif
}
FORCEINLINE
VOID
KeArmDomainRegisterSet(IN ARM_DOMAIN_REGISTER DomainRegister)
{
+#ifdef _MSC_VER
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c3, c0, 0" : :
"r"(DomainRegister.AsUlong) : "cc");
+#endif
}
FORCEINLINE
VOID
KeArmLockdownRegisterSet(IN ARM_LOCKDOWN_REGISTER LockdownRegister)
{
+#ifdef _MSC_VER
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c10, c0, 0" : :
"r"(LockdownRegister.AsUlong) : "cc");
+#endif
}
FORCEINLINE
VOID
KeArmFlushTlb(VOID)
{
+#ifdef _MSC_VER
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c8, c7, 0" : : "r"(0) :
"cc");
+#endif
}
FORCEINLINE
VOID
KeArmInvalidateTlbEntry(IN PVOID Address)
{
+#ifdef _MSC_VER
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c8, c7, 1" : :
"r"(Address) : "cc");
+#endif
}
FORCEINLINE
VOID
KeArmInvalidateAllCaches(VOID)
{
+#ifdef _MSC_VER
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c7, 0" : : "r"(0) :
"cc");
+#endif
}
FORCEINLINE
VOID
KeArmFlushIcache(VOID)
{
+#ifdef _MSC_VER
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 0" : : "r"(0) :
"cc");
+#endif
}
FORCEINLINE
VOID
KeArmWaitForInterrupt(VOID)
{
+#ifdef _MSC_VER
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c0, 4" : : "r"(0) :
"cc");
-}
+#endif
+}