Index: tools/rbuild/backend/mingw/modulehandler.cpp =================================================================== --- tools/rbuild/backend/mingw/modulehandler.cpp (revision 52511) +++ tools/rbuild/backend/mingw/modulehandler.cpp (working copy) @@ -2439,65 +2439,56 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget () { fprintf ( fMakefile, "# BOOT LOADER MODULE TARGET\n" ); + string targetName ( module.output->name ); string targetMacro ( GetTargetMacro (module) ); + string workingDirectory = GetWorkingDirectory (); + FileLocation junk_tmp ( TemporaryDirectory, + "", + module.name + ".junk.tmp" ); + CLEAN_FILE ( junk_tmp ); string objectsMacro = GetObjectsMacro ( module ); string libsMacro = GetLibsMacro (); GenerateRules (); - - string objectsDir = "${call RBUILD_intermediate_dir,$(" + module.name + "_TARGET)}"; - string rspFile = objectsDir + "$(SEP)" + module.name + "_objs.rsp"; - /* Generate the rsp rule */ - fprintf(fMakefile, "%s: $(%s_OBJS) %s | %s\n" - "\t$(ECHO_RSP)\n" - "\t-@${rm} $@ 2>$(NUL)\n" - "\t${cp} $(NUL) $@ >$(NUL)\n" - "\t$(foreach obj,$(%s_LIBS),$(Q)echo $(QUOTE)$(subst \\,\\\\,$(obj))$(QUOTE)>>$@$(NL))\n\n", - rspFile.c_str(), - module.name.c_str(), - module.xmlbuildFile.c_str(), - objectsDir.c_str(), - module.name.c_str()); - const FileLocation *target_file = GetTargetFilename ( module, NULL ); fprintf ( fMakefile, "%s: %s %s | %s\n", targetMacro.c_str (), - rspFile.c_str(), + objectsMacro.c_str (), libsMacro.c_str (), backend->GetFullPath ( *target_file ).c_str () ); fprintf ( fMakefile, "\t$(ECHO_LD)\n" ); - string linkerScriptArgument; - if ( module.linkerScript != NULL ) { - linkerScriptArgument = ssprintf(" -T %s", backend->GetFullName(*module.linkerScript->file).c_str()); + if (Environment::GetArch() == "arm") + { + fprintf ( fMakefile, + "\t${gcc} -Wl,--subsystem,native -o %s %s %s %s -nostartfiles -nostdlib\n", + backend->GetFullName ( junk_tmp ).c_str (), + objectsMacro.c_str (), + libsMacro.c_str (), + GetLinkerMacro ().c_str ()); } + else + { + fprintf ( fMakefile, + "\t${gcc} -Wl,--subsystem,native -Wl,-Ttext,0x8000 -o %s %s %s %s -nostartfiles -nostdlib\n", + backend->GetFullName ( junk_tmp ).c_str (), + objectsMacro.c_str (), + libsMacro.c_str (), + GetLinkerMacro ().c_str ()); + } + fprintf ( fMakefile, + "\t${objcopy} -O binary %s $@\n", + backend->GetFullName ( junk_tmp ).c_str () ); + GenerateBuildMapCode ( &junk_tmp ); + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + backend->GetFullName ( junk_tmp ).c_str () ); - /* Link the stripped booloader */ - fprintf(fMakefile, - "\t${ld} --strip-all --subsystem native --entry=%s --image-base=%s @%s $(PROJECT_CCLIBS) " - "$(BUILTIN_LDFLAGS) $(PROJECT_LDFLAGS) $(LDFLAG_DRIVER) %s -o $@\n", - module.GetEntryPoint().c_str(), - module.baseaddress.c_str(), - rspFile.c_str(), - linkerScriptArgument.c_str() ); - - /* Link an unstripped version */ - fprintf(fMakefile, - "ifeq ($(ROS_BUILDNOSTRIP),yes)\n" - "\t${ld} --subsystem native --entry=%s --image-base=%s @%s $(PROJECT_CCLIBS) " - "$(BUILTIN_LDFLAGS) $(PROJECT_LDFLAGS) $(LDFLAG_DRIVER) %s -o %s$(SEP)%s.nostrip.sys\n" - "endif\n", - module.GetEntryPoint().c_str(), - module.baseaddress.c_str(), - rspFile.c_str(), - linkerScriptArgument.c_str(), - backend->GetFullPath(*target_file).c_str(), - module.name.c_str()); + delete target_file; } - MingwBootProgramModuleHandler::MingwBootProgramModuleHandler ( const Module& module_ ) : MingwModuleHandler ( module_ ) Index: tools/nandflash/main.c =================================================================== --- tools/nandflash/main.c (revision 52511) +++ tools/nandflash/main.c (working copy) @@ -14,8 +14,8 @@ /* File Names */ PCHAR NandImageName = "reactos.bin"; -PCHAR LlbImageName = "./output-arm/boot/armllb/armllb.bin"; -PCHAR BootLdrImageName = "./output-arm/boot/freeldr/freeldr/freeldr.sys"; +PCHAR LlbImageName = ".\\output-arm\\boot\\armllb\\armllb.bin"; +PCHAR BootLdrImageName = ".\\output-arm\\boot\\freeldr\\freeldr\\freeldr.sys"; PCHAR FsImageName = "ramdisk.img"; PCHAR RamImageName = "ramdisk.bin"; @@ -29,26 +29,27 @@ /* FUNCTIONS ******************************************************************/ -INT +FILE* NTAPI CreateFlashFile(VOID) { - INT FileDescriptor, i; + FILE *FileDescriptor; + INT i; CHAR Buffer[NAND_PAGE_SIZE + NAND_OOB_SIZE]; /* Try open NAND image */ - FileDescriptor = open(NandImageName, O_RDWR); - if (FileDescriptor) + FileDescriptor = fopen(NandImageName, "rb+"); + if (!FileDescriptor) { /* Create NAND image */ - FileDescriptor = open(NandImageName, O_RDWR | O_CREAT); + FileDescriptor = fopen(NandImageName, "wb+"); if (FileDescriptor) return FileDescriptor; /* Create zero buffer */ memset(Buffer, 0xff, sizeof(Buffer)); /* Write zero buffer */ - for (i = 0; i < NAND_PAGES; i++) write(FileDescriptor, Buffer, sizeof(Buffer)); + for (i = 0; i < NAND_PAGES; i++) fwrite(Buffer,1, sizeof(Buffer), FileDescriptor); } /* Return NAND descriptor */ @@ -57,111 +58,124 @@ VOID NTAPI -WriteToFlash(IN INT NandImageFile, - IN INT ImageFile, +WriteToFlash(IN FILE *NandImageFile, + IN FILE *ImageFile, IN ULONG ImageStart, IN ULONG ImageEnd) { CHAR Data[NAND_PAGE_SIZE], Oob[NAND_OOB_SIZE]; ULONG StartPage, EndPage, i, OobSize = 0; BOOLEAN KeepGoing = TRUE; - + INT WrittenBytes = 0; + /* Offset to NAND Page convert */ StartPage = ImageStart / NAND_PAGE_SIZE; EndPage = ImageEnd / NAND_PAGE_SIZE; - + printf("startpage: %d, endpage: %d (%d bytes)\n", StartPage, EndPage, (EndPage - StartPage) * NAND_PAGE_SIZE); + /* Jump to NAND offset */ if (NeedsOob) OobSize = NAND_OOB_SIZE; - lseek(NandImageFile, StartPage * (NAND_PAGE_SIZE + OobSize), SEEK_SET); + fseek(NandImageFile, StartPage * (NAND_PAGE_SIZE + OobSize), SEEK_SET); /* Set input image offset */ - lseek(ImageFile, 0, SEEK_SET); + fseek(ImageFile, 0, SEEK_SET); /* Create zero buffer */ memset(Data, 0xff, NAND_PAGE_SIZE); memset(Oob, 0xff, NAND_OOB_SIZE); - /* Parse NAND Pages */ for (i = StartPage; i < EndPage; i++) { /* Read NAND page from input image */ - if (read(ImageFile, Data, NAND_PAGE_SIZE) < NAND_PAGE_SIZE) + if (fread(Data, 1, NAND_PAGE_SIZE, ImageFile) < NAND_PAGE_SIZE) { /* Do last write and quit after */ KeepGoing = FALSE; - } - + } + printf("wrote %d bytes\r", WrittenBytes*2048); + /* Write OOB and NAND Data */ - write(NandImageFile, Data, NAND_PAGE_SIZE); - if (NeedsOob) write(NandImageFile, Oob, NAND_OOB_SIZE); + WrittenBytes += fwrite(Data, NAND_PAGE_SIZE, 1, NandImageFile); + if (NeedsOob) fwrite(Oob, NAND_OOB_SIZE, 1, NandImageFile); /* Next page if data continues */ if (!KeepGoing) break; } + printf("\n"); + while(WrittenBytes < (EndPage - StartPage)) { + memset(Data, 0xff, NAND_PAGE_SIZE); + fwrite(Data, NAND_PAGE_SIZE, 1, NandImageFile); + WrittenBytes++; + } } VOID NTAPI -WriteLlb(IN INT NandImageFile) +WriteLlb(IN FILE *NandImageFile) { - INT FileDescriptor; - + FILE *FileDescriptor; + printf("writing llb to file at %p\n", FileDescriptor); /* Open LLB and write it */ - FileDescriptor = open(LlbImageName, O_RDWR); + FileDescriptor = fopen(LlbImageName, "rb"); WriteToFlash(NandImageFile, FileDescriptor, LlbStart, LlbEnd); - close(FileDescriptor); + fclose(FileDescriptor); } VOID NTAPI -WriteBootLdr(IN INT NandImageFile) +WriteBootLdr(IN FILE *NandImageFile) { - INT FileDescriptor; - + FILE *FileDescriptor; + printf("writing bootldr to file at %p\n", FileDescriptor); + /* Open FreeLDR and write it */ - FileDescriptor = open(BootLdrImageName, O_RDWR); + FileDescriptor = fopen(BootLdrImageName, "rb"); WriteToFlash(NandImageFile, FileDescriptor, BootLdrStart, BootLdrEnd); - close(FileDescriptor); + fclose(FileDescriptor); } VOID NTAPI -WriteFileSystem(IN INT NandImageFile) +WriteFileSystem(IN FILE *NandImageFile) { - INT FileDescriptor; - + FILE *FileDescriptor; + printf("writing fs to file at %p\n", FileDescriptor); + /* Open FS image and write it */ - FileDescriptor = open(FsImageName, O_RDWR); + FileDescriptor = fopen(FsImageName, "rb"); WriteToFlash(NandImageFile, FileDescriptor, FsStart, FsEnd); - close(FileDescriptor); + fclose(FileDescriptor); } VOID NTAPI -WriteRamDisk(IN INT RamDiskFile) +WriteRamDisk(IN FILE *RamDiskFile) { - INT FileDescriptor; - + FILE *FileDescriptor; + printf("writing ramdisk to file at %p\n", FileDescriptor); + /* Open FS image and write it 16MB later */ - FileDescriptor = open(FsImageName, O_RDWR); + FileDescriptor = fopen(FsImageName, "rb"); WriteToFlash(RamDiskFile, FileDescriptor, 16 * 1024 * 1024, (32 + 16) * 1024 * 1024); - close(FileDescriptor); + fclose(FileDescriptor); } int main(ULONG argc, char **argv) { - INT NandImageFile, RamDiskFile; + FILE *NandImageFile, *RamDiskFile; /* Flat NAND, no OOB */ if (argc == 2) NeedsOob = FALSE; /* Open or create NAND Image File */ + printf("creating flash file...\n"); NandImageFile = CreateFlashFile(); if (!NandImageFile) exit(-1); /* Write components */ + printf("writing components!\n"); WriteLlb(NandImageFile); WriteBootLdr(NandImageFile); if (NeedsOob) @@ -172,20 +186,20 @@ else { /* Open a new file for the ramdisk */ - RamDiskFile = open(RamImageName, O_RDWR | O_CREAT); + RamDiskFile = fopen(RamImageName, "wb+"); if (!RamDiskFile) exit(-1); /* Write it */ WriteRamDisk(RamDiskFile); /* Close */ - close(RamDiskFile); + fclose(RamDiskFile); } /* Close and return */ - close(NandImageFile); + fclose(NandImageFile); return 0; } -/* EOF */ +/* EOF */ \ No newline at end of file Index: boot/freeldr/freeldr/machine.c =================================================================== --- boot/freeldr/freeldr/machine.c (revision 52511) +++ boot/freeldr/freeldr/machine.c (working copy) @@ -22,6 +22,7 @@ #undef MachConsPutChar #undef MachConsKbHit #undef MachConsGetCh +#undef MachUartPutChar #undef MachVideoClearScreen #undef MachVideoSetDisplayMode #undef MachVideoGetDisplaySize @@ -49,6 +50,12 @@ MachVtbl.ConsPutChar(Ch); } +VOID +MachUartPutChar(int Ch) +{ + MachVtbl.UartPutChar(Ch); +} + BOOLEAN MachConsKbHit() { Index: boot/freeldr/freeldr/windows/arm/wlmemory.c =================================================================== --- boot/freeldr/freeldr/windows/arm/wlmemory.c (revision 45526) +++ boot/freeldr/freeldr/windows/arm/wlmemory.c (working copy) @@ -185,7 +185,7 @@ PFN_NUMBER Pfn; /* Setup templates */ - TempPte.Accessed = TempPte.Valid = TempLargePte.LargePage = TempLargePte.Accessed = TempPde.Valid = 1; + TempPte.Sbo = TempPte.Valid = TempLargePte.LargePage = TempLargePte.Sbo = TempPde.Valid = 1; /* Allocate the 1MB "PDR" (Processor Data Region). Must be 1MB aligned */ PdrPage = MmAllocateMemoryAtAddress(sizeof(KPDR_PAGE), (PVOID)0x700000, LoaderMemoryData); Index: boot/freeldr/freeldr/freeldr.rbuild =================================================================== --- boot/freeldr/freeldr/freeldr.rbuild (revision 52511) +++ boot/freeldr/freeldr/freeldr.rbuild (working copy) @@ -17,8 +17,7 @@ - - freeldr_$(ARCH).lnk + freeldr_startup freeldr_base64k @@ -29,6 +28,16 @@ cmlib rtl libcntpr + + -static + -lgcc + + -Wl,--image-base=0x80FFF000 + + + -Wl,--image-base=0x0001F000 + + Index: boot/freeldr/freeldr/fs/fs.c =================================================================== --- boot/freeldr/freeldr/fs/fs.c (revision 45526) +++ boot/freeldr/freeldr/fs/fs.c (working copy) @@ -291,6 +291,8 @@ else DeviceName = Path; + DPRINTM(DPRINT_FILESYSTEM, "Searching for device.\n"); + /* Search for the device */ pEntry = DeviceListHead.Flink; if (OpenMode == OpenReadOnly || OpenMode == OpenWriteOnly) @@ -305,7 +307,8 @@ /* OK, device found. It is already opened? */ if (pDevice->ReferenceCount == 0) { - /* Search some room for the device */ + DPRINTM(DPRINT_FILESYSTEM, "Device found.\n"); + /* Search some room for the device */ for (DeviceId = 0; DeviceId < MAX_FDS; DeviceId++) if (!FileData[DeviceId].FuncTable) break; @@ -325,6 +328,7 @@ FileData[DeviceId].FileFuncTable = IsoMount(DeviceId); if (!FileData[DeviceId].FileFuncTable) #endif + DPRINTM(DPRINT_FILESYSTEM, "Attempting to mount FS!.\n"); FileData[DeviceId].FileFuncTable = FatMount(DeviceId); #ifndef _M_ARM if (!FileData[DeviceId].FileFuncTable) @@ -334,6 +338,7 @@ #endif if (!FileData[DeviceId].FileFuncTable) { + DPRINTM(DPRINT_FILESYSTEM, "We failed at it :(. Returning ENODEV :(.\n"); /* Error, unable to detect file system */ pDevice->FuncTable->Close(DeviceId); FileData[DeviceId].FuncTable = NULL; Index: boot/freeldr/freeldr/fs/fat.c =================================================================== --- boot/freeldr/freeldr/fs/fat.c (revision 45526) +++ boot/freeldr/freeldr/fs/fat.c (working copy) @@ -1451,7 +1451,8 @@ ULONG Count; ULARGE_INTEGER SectorCount; LONG ret; - + //ULONG Count2; + // // Allocate data for volume information // @@ -1459,7 +1460,15 @@ if (!Volume) return NULL; RtlZeroMemory(Volume, sizeof(FAT_VOLUME_INFO)); - + /*for(Count2=0;Count2<(50*1024*1024);Count2++) { + LARGE_INTEGER Pos; + Pos.QuadPart = Count2; + ArcSeek(DeviceId, &Pos, SeekAbsolute); + ArcRead(DeviceId, Buffer, 1, &Count); + if(Count2 % 16 == 0) + TuiPrintf(" <- 0x%08x\n", Count2); + TuiPrintf("%02x ", Buffer[0]); + }*/ // // Read the BootSector // @@ -1477,7 +1486,8 @@ MmHeapFree(Volume); return NULL; } - + DPRINTM(DPRINT_FILESYSTEM, "looking for fat bootsector.\n"); + // // Check if BootSector is valid. If no, return early // @@ -1489,6 +1499,7 @@ MmHeapFree(Volume); return NULL; } + DPRINTM(DPRINT_FILESYSTEM, "got one.\n"); // // Determine sector count Index: boot/freeldr/freeldr/arch/arm/macharm.c =================================================================== --- boot/freeldr/freeldr/arch/arm/macharm.c (revision 52511) +++ boot/freeldr/freeldr/arch/arm/macharm.c (working copy) @@ -161,6 +161,7 @@ MachVtbl.ConsPutChar = ArmBoardBlock->ConsPutChar; MachVtbl.ConsKbHit = ArmBoardBlock->ConsKbHit; MachVtbl.ConsGetCh = ArmBoardBlock->ConsGetCh; + MachVtbl.UartPutChar = ArmBoardBlock->UartPutChar; MachVtbl.VideoClearScreen = ArmBoardBlock->VideoClearScreen; MachVtbl.VideoSetDisplayMode = ArmBoardBlock->VideoSetDisplayMode; MachVtbl.VideoGetDisplaySize = ArmBoardBlock->VideoGetDisplaySize; Index: boot/freeldr/freeldr/include/machine.h =================================================================== --- boot/freeldr/freeldr/include/machine.h (revision 52511) +++ boot/freeldr/freeldr/include/machine.h (working copy) @@ -42,7 +42,7 @@ VOID (*ConsPutChar)(int Ch); BOOLEAN (*ConsKbHit)(VOID); int (*ConsGetCh)(VOID); - + VOID (*UartPutChar)(int Ch); VOID (*VideoClearScreen)(UCHAR Attr); VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init); VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth); @@ -77,6 +77,7 @@ extern MACHVTBL MachVtbl; VOID MachConsPutChar(int Ch); +VOID MachUartPutChar(int Ch); BOOLEAN MachConsKbHit(VOID); int MachConsGetCh(VOID); VOID MachVideoClearScreen(UCHAR Attr); @@ -102,6 +103,7 @@ #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch) #define MachConsKbHit() MachVtbl.ConsKbHit() #define MachConsGetCh() MachVtbl.ConsGetCh() +#define MachUartPutChar(Ch) MachVtbl.UartPutChar(Ch) #define MachVideoClearScreen(Attr) MachVtbl.VideoClearScreen(Attr) #define MachVideoSetDisplayMode(Mode, Init) MachVtbl.VideoSetDisplayMode((Mode), (Init)) #define MachVideoGetDisplaySize(W, H, D) MachVtbl.VideoGetDisplaySize((W), (H), (D)) Index: boot/freeldr/freeldr/include/debug.h =================================================================== --- boot/freeldr/freeldr/include/debug.h (revision 52511) +++ boot/freeldr/freeldr/include/debug.h (working copy) @@ -81,10 +81,20 @@ #else +#ifdef _M_ARM + +INT DebugPrintf(ULONG Mask, const char *Format, ...); +#define DPRINTM DebugPrintf(0, "(%s:%s:%d) ", __FILE__, __FUNCTION__, __LINE__), DebugPrintf +#define DebugInit(x) +#define BugCheck(_x_) +#define DbgDumpBuffer(_x_, _y_, _z_) + +#else #define DebugInit(x) - #define DPRINTM(_x_, ...) + #define DPRINTM(_x_,...) #define BugCheck(_x_) #define DbgDumpBuffer(_x_, _y_, _z_) +#endif #endif // DBG Index: boot/freeldr/freeldr/include/arcemul.h =================================================================== --- boot/freeldr/freeldr/include/arcemul.h (revision 52511) +++ boot/freeldr/freeldr/include/arcemul.h (working copy) @@ -35,8 +35,8 @@ CONFIGURATION_COMPONENT* Component); /* mm.c */ -const MEMORY_DESCRIPTOR* -ArcGetMemoryDescriptor(const MEMORY_DESCRIPTOR* Current); +MEMORY_DESCRIPTOR* +ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current); /* time.c */ TIMEINFO* ArcGetTime(VOID); Index: boot/freeldr/freeldr/mm/mm.c =================================================================== --- boot/freeldr/freeldr/mm/mm.c (revision 45526) +++ boot/freeldr/freeldr/mm/mm.c (working copy) @@ -345,3 +345,33 @@ return RealPageLookupTable; } + + +PVOID +NTAPI +RtlAllocateHeap( + IN PVOID HeapHandle, + IN ULONG Flags, + IN SIZE_T Size) +{ + PVOID ptr; + + ptr = MmHeapAlloc(Size); + if (ptr && (Flags & HEAP_ZERO_MEMORY)) + { + RtlZeroMemory(ptr, Size); + } + + return ptr; +} + +BOOLEAN +NTAPI +RtlFreeHeap( + IN PVOID HeapHandle, + IN ULONG Flags, + IN PVOID HeapBase) +{ + MmHeapFree(HeapBase); + return TRUE; +} Index: boot/freeldr/freeldr/ui/directui.c =================================================================== --- boot/freeldr/freeldr/ui/directui.c (revision 52511) +++ boot/freeldr/freeldr/ui/directui.c (working copy) @@ -25,6 +25,27 @@ UCHAR UiSelectedTextBgColor = COLOR_GRAY; CHAR UiTimeText[260] = "Seconds until highlighted choice will be started automatically: "; +INT DebugPrintf(ULONG Mask, const char *Format, ...) +{ + int i; + int Length; + va_list ap; + CHAR Buffer[512]; + + va_start(ap, Format); + Length = _vsnprintf(Buffer, sizeof(Buffer), Format, ap); + va_end(ap); + + if (Length == -1) Length = sizeof(Buffer); + + for (i = 0; i < Length; i++) + { + MachUartPutChar(Buffer[i]); + } + + return Length; +} + INT TuiPrintf(const char *Format, ...) Index: boot/armllb/os/loader.c =================================================================== --- boot/armllb/os/loader.c (revision 52511) +++ boot/armllb/os/loader.c (working copy) @@ -78,6 +78,7 @@ ArmBlock.VideoGetDisplaySize = LlbFwVideoGetDisplaySize; ArmBlock.VideoPutChar = LlbFwVideoPutChar; ArmBlock.GetTime = LlbFwGetTime; + ArmBlock.UartPutChar = LlbSerialPutChar; } VOID @@ -150,8 +151,6 @@ { //todo } - - LoaderInit = (PVOID)0x80000000; #ifdef _ZOOM2_ // need something better than this... LoaderInit = (PVOID)0x81070000; #endif Index: boot/armllb/crtsupp.c =================================================================== --- boot/armllb/crtsupp.c (revision 52511) +++ boot/armllb/crtsupp.c (working copy) @@ -40,6 +40,40 @@ return puts(printbuffer); } +void* memcpy(void* dest, const void* src, size_t count) +{ + char *char_dest = (char *)dest; + char *char_src = (char *)src; + + if ((char_dest <= char_src) || (char_dest >= (char_src+count))) + { + /* non-overlapping buffers */ + while(count > 0) + { + *char_dest = *char_src; + char_dest++; + char_src++; + count--; + } + } + else + { + /* overlaping buffers */ + char_dest = (char *)dest + count - 1; + char_src = (char *)src + count - 1; + + while(count > 0) + { + *char_dest = *char_src; + char_dest--; + char_src--; + count--; + } + } + + return dest; +} + ULONG DbgPrint(const char *fmt, ...) { Index: boot/armllb/boot.s =================================================================== --- boot/armllb/boot.s (revision 52511) +++ boot/armllb/boot.s (working copy) @@ -68,7 +68,7 @@ #elif _ZOOM2_ // On ZOOM2 RAM starts at 0x80000000, not 0 .long 0x81014000 #else -#error Stack Address Not Defined + .long 0x00010000 #endif L_LlbStartup: Index: boot/armllb/inc/osloader.h =================================================================== --- boot/armllb/inc/osloader.h (revision 52511) +++ boot/armllb/inc/osloader.h (working copy) @@ -41,8 +41,8 @@ // // Information sent from LLB to OS Loader // -#define ARM_BOARD_CONFIGURATION_MAJOR_VERSION 1 -#define ARM_BOARD_CONFIGURATION_MINOR_VERSION 4 +#define ARM_BOARD_CONFIGURATION_MAJOR_VERSION 2 +#define ARM_BOARD_CONFIGURATION_MINOR_VERSION 0 typedef struct _ARM_BOARD_CONFIGURATION_BLOCK { ULONG MajorVersion; @@ -57,6 +57,7 @@ PVOID ConsPutChar; PVOID ConsKbHit; PVOID ConsGetCh; + PVOID UartPutChar; PVOID VideoClearScreen; PVOID VideoSetDisplayMode; PVOID VideoGetDisplaySize; Index: boot/armllb/armllb.rbuild =================================================================== --- boot/armllb/armllb.rbuild (revision 52511) +++ boot/armllb/armllb.rbuild (working copy) @@ -1,7 +1,7 @@ - + libcntpr rtl @@ -74,7 +74,9 @@ -fno-inline -fno-zero-initialized-in-bss -Os - + + -lgcc + Index: boot/armllb/hw/video.c =================================================================== --- boot/armllb/hw/video.c (revision 52511) +++ boot/armllb/hw/video.c (working copy) @@ -326,11 +326,7 @@ else { /* Deep blue */ -#ifdef BLUE_SCREEN BackColor = LlbHwVideoCreateColor(14, 0, 82); -#else - BackColor = LlbHwVideoCreateColor(0, 0, 0); -#endif BackColor = (BackColor << 16) | BackColor; } @@ -351,11 +347,7 @@ ULONG cx, cy, CharsPerLine, BackColor, ScreenWidth; /* Backcolor on this machine */ -#ifdef BLUE_SCREEN - BackColor = LlbHwVideoCreateColor(14, 0, 82); -#else - BackColor = LlbHwVideoCreateColor(0, 0, 0); -#endif + BackColor = LlbHwVideoCreateColor(14, 0, 82); /* Amount of characters in a line */ ScreenWidth = LlbHwGetScreenWidth(); Index: boot/armllb/hw/versatile/hwinit.c =================================================================== --- boot/armllb/hw/versatile/hwinit.c (revision 52511) +++ boot/armllb/hw/versatile/hwinit.c (working copy) @@ -22,33 +22,6 @@ LlbHwVersaKmiInitialize(); } -// -// Should go to hwdev.c -// -POSLOADER_INIT -NTAPI -LlbHwLoadOsLoaderFromRam(VOID) -{ - ULONG Base, RootFs, Size; - PCHAR Offset; - CHAR CommandLine[64]; - - /* On versatile we load the RAMDISK with initrd */ - LlbEnvGetRamDiskInformation(&RootFs, &Size); - - /* The OS Loader is at 0x20000, always */ - Base = 0x20000; - - /* Read image offset */ - Offset = LlbEnvRead("rdoffset"); - - /* Set parameters for the OS loader */ - sprintf(CommandLine, "rdbase=0x%x rdsize=0x%x rdoffset=%s", RootFs, Size, Offset); - LlbSetCommandLine(CommandLine); - - /* Return the OS loader base address */ - return (POSLOADER_INIT)Base; -} /* EOF */ Index: boot/armllb/hw/versatile/hwclcd.c =================================================================== --- boot/armllb/hw/versatile/hwclcd.c (revision 52511) +++ boot/armllb/hw/versatile/hwclcd.c (working copy) @@ -48,14 +48,14 @@ NTAPI LlbHwGetScreenWidth(VOID) { - return 720; + return 800; } ULONG NTAPI LlbHwGetScreenHeight(VOID) { - return 400; + return 600; } PVOID Index: lib/sdk/crt/printf/streamout.c =================================================================== --- lib/sdk/crt/printf/streamout.c (revision 52511) +++ lib/sdk/crt/printf/streamout.c (working copy) @@ -70,6 +70,11 @@ #define get_exp(f) floor(f == 0 ? 0 : (f >= 0 ? log10(f) : log10(-f))) #define round(x) floor((x) + 0.5) +#ifdef _M_ARM +#define floor(x) 0 +#define pow(x,y) 0 +#endif + #ifndef _USER32_WSPRINTF void Index: lib/rtl/largeint.c =================================================================== --- lib/rtl/largeint.c (revision 52511) +++ lib/rtl/largeint.c (working copy) @@ -19,6 +19,12 @@ #undef RtlUshortByteSwap /* + * hack-o-ramma for arm: there is no gcc native byteswap, so don't use it. + * fixme: write a replacement byteswap, or implement RtlUlong/UlonglongByteSwap + * in C. + */ + +/* * @implemented */ USHORT @@ -35,7 +41,12 @@ FASTCALL RtlUlongByteSwap(IN ULONG Source) { +#ifndef _M_ARM return _byteswap_ulong(Source); +#else + UNIMPLEMENTED; + return Source; +#endif } /* @@ -45,7 +56,12 @@ FASTCALL RtlUlonglongByteSwap(IN ULONGLONG Source) { +#ifndef _M_ARM return _byteswap_uint64(Source); +#else + UNIMPLEMENTED; + return Source; +#endif } /* Index: lib/rtl/interlck.c =================================================================== --- lib/rtl/interlck.c (revision 52511) +++ lib/rtl/interlck.c (working copy) @@ -35,3 +35,6 @@ /* Just call the intrinsic */ return _InterlockedCompareExchange64(Destination, Exchange, Comparand); } + +#ifdef _M_ARM +#endif \ No newline at end of file Index: lib/rtl/rtlp.h =================================================================== --- lib/rtl/rtlp.h (revision 52511) +++ lib/rtl/rtlp.h (working copy) @@ -8,6 +8,15 @@ /* INCLUDES ******************************************************************/ +#ifdef _M_ARM +// +// do not remove these please! +// +#define InterlockedExchange _InterlockedExchange +#define InterlockedExchangeAdd _InterlockedExchangeAdd +#define InterlockedCompareExchange _InterlockedCompareExchange +#endif + /* PAGED_CODE equivalent for user-mode RTL */ #if DBG extern VOID FASTCALL CHECK_PAGED_CODE_RTL(char *file, int line); Index: lib/rtl/nls.c =================================================================== --- lib/rtl/nls.c (revision 52511) +++ lib/rtl/nls.c (working copy) @@ -235,8 +235,6 @@ ULONG Size = 0; ULONG i; - PAGED_CODE_RTL(); - if (NlsMbCodePageTag == FALSE) { /* single-byte code page */ @@ -302,8 +300,6 @@ { ULONG Length = 0; - PAGED_CODE_RTL(); - if (!NlsMbCodePageTag) { /* single-byte code page */ @@ -508,8 +504,6 @@ ULONG Size = 0; ULONG i; - PAGED_CODE_RTL(); - if (NlsMbCodePageTag == FALSE) { /* single-byte code page */ Index: include/reactos/asm.inc =================================================================== --- include/reactos/asm.inc (revision 52511) +++ include/reactos/asm.inc (working copy) @@ -7,7 +7,7 @@ */ #ifndef _ASM_INC_ #define _ASM_INC_ - +#ifdef _M_X86 #ifdef _USE_ML /* Allow ".name" identifiers */ @@ -125,8 +125,10 @@ #else /***********************************************************************/ + /* Force intel syntax */ .intel_syntax noprefix +#endif .altmacro @@ -258,5 +260,58 @@ #define elseif .elseif #endif +#ifdef _M_ARM + +/* Hex numbers need to be in 0x1AB format */ +#define HEX(y) 0x##y + +/* Macro values need to be marked */ +#define VAL(x) \x + +/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ +#define MACRO(...) .macro __VA_ARGS__ +#define ENDM .endm + +/* ... and .ENDP, replacing ENDP */ +.macro .ENDP name + .cfi_endproc + .endfunc +.endm + +/* MASM compatible PUBLIC */ +.macro PUBLIC symbol + .global \symbol +.endm + +/* Dummy ASSUME */ +.macro ASSUME p1 p2 p3 p4 p5 p6 p7 p8 +.endm + +/* MASM needs an end tag for segments */ +.macro .endcode16 +.endm + +/* MASM compatible ALIGN */ +#define ALIGN .align + +/* MASM compatible REPEAT, additional ENDR */ +#define REPEAT .rept +#define ENDR .endr + +//.macro ljmp segment, offset +// jmp far ptr \segment:\offset +//.endm + +/* MASM compatible EXTERN */ +.macro EXTERN name +.endm + +/* MASM needs an END tag */ +#define END + +.macro .MODEL model +.endm + +#endif #endif /* _ASM_INC_ */ Index: ntoskrnl/ntdll.S =================================================================== --- ntoskrnl/ntdll.S (revision 52511) +++ ntoskrnl/ntdll.S (working copy) @@ -2,7 +2,11 @@ #include #include +#ifndef _M_ARM .code +#else +.text +#endif SyscallId = 0 #define SVC_(name, argcount) STUB_U name, argcount Index: ntoskrnl/include/internal/ex.h =================================================================== --- ntoskrnl/include/internal/ex.h (revision 52511) +++ ntoskrnl/include/internal/ex.h (working copy) @@ -839,11 +839,13 @@ VOID _ExRundownCompleted(IN PEX_RUNDOWN_REF RunRef) { +#ifndef _M_ARM /* Sanity check */ ASSERT((RunRef->Count & EX_RUNDOWN_ACTIVE) != 0); /* Mark the counter as active */ ExpSetRundown(RunRef, EX_RUNDOWN_ACTIVE); +#endif } /* PUSHLOCKS *****************************************************************/ Index: ntoskrnl/include/internal/spinlock.h =================================================================== --- ntoskrnl/include/internal/spinlock.h (revision 52511) +++ ntoskrnl/include/internal/spinlock.h (working copy) @@ -19,12 +19,14 @@ VOID KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock) { +#ifndef _M_ARM /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */ UNREFERENCED_PARAMETER(SpinLock); /* Add an explicit memory barrier to prevent the compiler from reordering memory accesses across the borders of spinlocks */ KeMemoryBarrierWithoutFence(); +#endif } // @@ -34,12 +36,14 @@ VOID KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock) { +#ifndef _M_ARM /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */ UNREFERENCED_PARAMETER(SpinLock); /* Add an explicit memory barrier to prevent the compiler from reordering memory accesses across the borders of spinlocks */ KeMemoryBarrierWithoutFence(); +#endif } #else Index: ntoskrnl/kd/kdmain.c =================================================================== --- ntoskrnl/kd/kdmain.c (revision 52511) +++ ntoskrnl/kd/kdmain.c (working copy) @@ -87,6 +87,7 @@ { switch (Buffer1Length) { +#ifndef _M_ARM case ID_Win32PreServiceHook: KeWin32PreServiceHook = Buffer1; break; @@ -94,7 +95,7 @@ case ID_Win32PostServiceHook: KeWin32PostServiceHook = Buffer1; break; - +#endif } break; } Index: ntoskrnl/ke/thrdschd.c =================================================================== --- ntoskrnl/ke/thrdschd.c (revision 52511) +++ ntoskrnl/ke/thrdschd.c (working copy) @@ -715,7 +715,7 @@ #elif _M_AMD64 #define KiGetCurrentReadySummary() __readgsdword(FIELD_OFFSET(KIPCR, Prcb.ReadySummary)) #else -#error Implement me! +#define KiGetCurrentReadySummary() Prcb->ReadySummary #endif /* @@ -727,7 +727,7 @@ { NTSTATUS Status; KIRQL OldIrql; - PKPRCB Prcb; + PKPRCB Prcb = KeGetCurrentPrcb(); PKTHREAD Thread, NextThread; /* NB: No instructions (other than entry code) should preceed this line */ Index: ntoskrnl/mm/ARM3/pool.c =================================================================== --- ntoskrnl/mm/ARM3/pool.c (revision 52511) +++ ntoskrnl/mm/ARM3/pool.c (working copy) @@ -15,6 +15,7 @@ #define MODULE_INVOLVED_IN_ARM3 #include "../ARM3/miarm.h" + /* GLOBALS ********************************************************************/ LIST_ENTRY MmNonPagedPoolFreeListHead[MI_MAX_FREE_PAGE_LISTS]; Index: ntoskrnl/mm/ARM3/miarm.h =================================================================== --- ntoskrnl/mm/ARM3/miarm.h (revision 52511) +++ ntoskrnl/mm/ARM3/miarm.h (working copy) @@ -278,6 +278,11 @@ #define BASE_POOL_TYPE_MASK 1 #define POOL_MAX_ALLOC (PAGE_SIZE - (sizeof(POOL_HEADER) + POOL_BLOCK_SIZE)) +#ifdef _M_ARM +#define MiPdeToPte(PDE) ((PMMPTE)MiPteToAddress(PDE)) +#endif + + typedef struct _POOL_DESCRIPTOR { POOL_TYPE PoolType; Index: ntoskrnl/ex/rundown.c =================================================================== --- ntoskrnl/ex/rundown.c (revision 52511) +++ ntoskrnl/ex/rundown.c (working copy) @@ -139,13 +139,14 @@ FASTCALL ExfReInitializeRundownProtection(IN PEX_RUNDOWN_REF RunRef) { +#ifndef _M_ARM PAGED_CODE(); - /* Sanity check */ ASSERT((RunRef->Count & EX_RUNDOWN_ACTIVE) != 0); /* Reset the count */ ExpSetRundown(RunRef, 0); +#endif } /*++ @@ -167,13 +168,14 @@ FASTCALL ExfRundownCompleted(IN PEX_RUNDOWN_REF RunRef) { +#ifndef _M_ARM PAGED_CODE(); - /* Sanity check */ ASSERT((RunRef->Count & EX_RUNDOWN_ACTIVE) != 0); /* Mark the counter as active */ ExpSetRundown(RunRef, EX_RUNDOWN_ACTIVE); +#endif } /*++ Index: ntoskrnl/ex/zw.S =================================================================== --- ntoskrnl/ex/zw.S (revision 52511) +++ ntoskrnl/ex/zw.S (working copy) @@ -8,7 +8,11 @@ EXTERN KiSystemService:PROC #endif +#ifndef _M_ARM .code +#else +.text +#endif SyscallId = 0 #define SVC_(name, argcount) STUB_K name, argcount Index: dll/ntdll/ldr/ldrutils.c =================================================================== --- dll/ntdll/ldr/ldrutils.c (revision 52511) +++ dll/ntdll/ldr/ldrutils.c (working copy) @@ -118,7 +118,7 @@ Entry->LoadCount--; break; case LDRP_UPDATE_PIN: - Entry->LoadCount == -1; + Entry->LoadCount = -1; break; } @@ -162,7 +162,7 @@ Entry->LoadCount--; break; case LDRP_UPDATE_PIN: - Entry->LoadCount == -1; + Entry->LoadCount = -1; break; } @@ -231,7 +231,7 @@ Entry->LoadCount--; break; case LDRP_UPDATE_PIN: - Entry->LoadCount == -1; + Entry->LoadCount = -1; break; } Index: config-arm.template.rbuild =================================================================== --- config-arm.template.rbuild (revision 52511) +++ config-arm.template.rbuild (working copy) @@ -18,7 +18,7 @@ kurobox versatile omap3-zoom2 omap3-beagle --> - +