Forráskód Böngészése

Build fixes to build on Cygwin.

As a curiosity, the OS now builds in Cygwin.
Evan Green 7 éve
szülő
commit
473d97e9d9
63 módosított fájl, 187 hozzáadás és 137 törlés
  1. 1 1
      apps/ck/app/build/Makefile
  2. 1 1
      apps/ck/app/ckwin32.c
  3. 1 1
      apps/ck/lib/build/Makefile
  4. 1 1
      apps/ck/lib/build/dynamic/Makefile
  5. 1 1
      apps/ck/lib/ckcore.S
  6. 1 1
      apps/ck/modules/bundle/bundle.c
  7. 1 1
      apps/ck/modules/os/build/Makefile
  8. 1 1
      apps/ck/modules/os/build/dynamic/Makefile
  9. 2 2
      apps/ck/modules/os/oswin32.c
  10. 1 1
      apps/debug/client/dbgapi.c
  11. 4 4
      apps/debug/client/dbgrcomm.c
  12. 1 1
      apps/debug/client/dbgrcomm.h
  13. 18 18
      apps/debug/client/dbgsym.c
  14. 5 5
      apps/debug/client/tdwarf/tdwarf.c
  15. 5 0
      apps/debug/client/win32/cmdln/ntcmdln.c
  16. 6 1
      apps/debug/client/win32/ntcomm.c
  17. 2 0
      apps/lib/lzma/util/lzma.c
  18. 1 1
      apps/libc/dynamic/time.c
  19. 11 11
      apps/osbase/time.c
  20. 2 2
      apps/setup/steps.c
  21. 2 2
      apps/swiss/ps.c
  22. 2 1
      apps/swiss/swlib/uos.c
  23. 6 0
      apps/swiss/swlibos.h
  24. 3 3
      apps/swiss/time.c
  25. 2 0
      apps/swiss/uos/Makefile
  26. 1 1
      apps/swiss/uos/uoscmds.c
  27. 2 2
      boot/loader/loader.c
  28. 1 1
      drivers/net/netcore/igmp.c
  29. 1 1
      drivers/plat/ti/am3soc/am3cm3fw.S
  30. 1 1
      include/minoca/kernel/bootload.h
  31. 1 1
      include/minoca/kernel/knet.h
  32. 2 2
      include/minoca/kernel/ps.h
  33. 1 1
      include/minoca/kernel/x86.inc
  34. 2 2
      include/minoca/lib/minocaos.h
  35. 13 4
      include/minoca/lib/rtl.h
  36. 6 2
      include/minoca/lib/types.h
  37. 6 2
      include/minoca/uefi/arm/procdef.h
  38. 6 2
      include/minoca/uefi/x64/procdef.h
  39. 6 2
      include/minoca/uefi/x86/procdef.h
  40. 1 1
      kernel/io/mount.c
  41. 1 1
      kernel/io/unsocket.c
  42. 1 1
      kernel/io/userio.c
  43. 1 1
      kernel/ke/crashdmp.c
  44. 1 1
      kernel/mm/mmp.h
  45. 2 2
      kernel/mm/physical.c
  46. 8 8
      kernel/ps/process.c
  47. 2 2
      kernel/sp/profiler.c
  48. 1 1
      lib/fatlib/fattest/fattest.c
  49. 7 7
      lib/rtl/testrtl/testrtl.c
  50. 5 1
      minoca.mk
  51. 2 2
      uefi/dev/ns16550/ns16550.c
  52. 1 1
      uefi/plat/beagbone/bbonefwv.S
  53. 1 1
      uefi/plat/beagbone/ramdisk.S
  54. 1 1
      uefi/plat/bios/biosfwv.S
  55. 1 1
      uefi/plat/integcp/integfwv.S
  56. 1 1
      uefi/plat/integcp/ramdisk.S
  57. 1 1
      uefi/plat/panda/pandafwv.S
  58. 1 1
      uefi/plat/panda/ramdisk.S
  59. 1 1
      uefi/plat/rpi/rpifwv.S
  60. 1 1
      uefi/plat/rpi2/rpi2fwv.S
  61. 1 1
      uefi/plat/veyron/veyronfwv.S
  62. 7 7
      uefi/tools/genfv/genfv.c
  63. 8 8
      uefi/tools/mkuboot/mkuboot.c

+ 1 - 1
apps/ck/app/build/Makefile

@@ -42,7 +42,7 @@ include $(SRCDIR)/../sources
 TARGETLIBS = $(OBJROOT)/os/apps/ck/modules/app/build/app.a       \
              $(OBJROOT)/os/apps/ck/modules/bundle/build/bundle.a \
 
-ifeq ($(OS),Windows_NT)
+ifeq ($(OS),$(filter Windows_NT cygwin,$(OS)))
 
 OBJS += $(WIN32_OBJS)
 

+ 1 - 1
apps/ck/app/ckwin32.c

@@ -33,7 +33,7 @@ Environment:
 #define _WIN32_WINNT 0x0600
 
 #include <windows.h>
-#include <shlwapi.h>
+#include <shlobj.h>
 
 #include <assert.h>
 #include <libgen.h>

+ 1 - 1
apps/ck/lib/build/Makefile

@@ -38,7 +38,7 @@ VPATH += $(SRCDIR)/..:
 
 include $(SRCDIR)/../sources
 
-ifeq ($(OS),Windows_NT)
+ifeq ($(OS),$(filter Windows_NT cygwin,$(OS)))
 
 OBJS += $(WIN32_OBJS)
 

+ 1 - 1
apps/ck/lib/build/dynamic/Makefile

@@ -43,7 +43,7 @@ VPATH += ..:
 
 include $(SRCDIR)/../../sources
 
-ifeq ($(OS),Windows_NT)
+ifeq ($(OS),$(filter Windows_NT cygwin,$(OS)))
 
 BINARY := chalk.dll
 BINARYTYPE := dll

+ 1 - 1
apps/ck/lib/ckcore.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
apps/ck/modules/bundle/bundle.c

@@ -54,7 +54,7 @@ Environment:
 
 #endif
 
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__CYGWIN__)
 
 #define fseeko64 fseeko
 #define ftello64 ftello

+ 1 - 1
apps/ck/modules/os/build/Makefile

@@ -37,7 +37,7 @@ VPATH += $(SRCDIR)/..:
 
 include $(SRCDIR)/../sources
 
-ifeq ($(OS),Windows_NT)
+ifeq ($(OS),$(filter Windows_NT cygwin,$(OS)))
 
 OBJS += $(WIN32_OBJS)
 

+ 1 - 1
apps/ck/modules/os/build/dynamic/Makefile

@@ -37,7 +37,7 @@ VPATH += ..:
 
 include $(SRCDIR)/../../sources
 
-ifeq ($(OS),Windows_NT)
+ifeq ($(OS),$(filter Windows_NT cygwin,$(OS)))
 
 BINARY := os.dll
 BINARYTYPE := dll

+ 2 - 2
apps/ck/modules/os/oswin32.c

@@ -96,13 +96,13 @@ Return Value:
     strncpy(Name->SystemName, "Windows", sizeof(Name->SystemName));
     snprintf(Name->Release,
              sizeof(Name->Release),
-             "%d.%d",
+             "%ld.%ld",
              VersionInfo.dwMajorVersion,
              VersionInfo.dwMinorVersion);
 
     snprintf(Name->Version,
              sizeof(Name->Version),
-             "%d %s",
+             "%ld %s",
              VersionInfo.dwBuildNumber,
              VersionInfo.szCSDVersion);
 

+ 1 - 1
apps/debug/client/dbgapi.c

@@ -2729,7 +2729,7 @@ Return Value:
             AccessString = "Write";
         }
 
-        printf("%s %d bytes at address %08I64x.\n",
+        printf("%s %d bytes at address %08llx.\n",
                AccessString,
                BufferSize,
                Address);

+ 4 - 4
apps/debug/client/dbgrcomm.c

@@ -5417,7 +5417,7 @@ Return Value:
     PDEBUG_SYMBOLS Symbols;
     PSTR SymbolString;
     PTYPE_SYMBOL Type;
-    ULONG TypeSize;
+    UINTN TypeSize;
 
     Address = 0;
     AddressStartIndex = 1;
@@ -5466,7 +5466,7 @@ Return Value:
 
             DataStream = malloc(TypeSize);
             if (DataStream == NULL) {
-                DbgOut("Error: unable to allocate %d bytes of memory\n",
+                DbgOut("Error: unable to allocate %ld bytes of memory\n",
                        TypeSize);
 
                 Result = ENOMEM;
@@ -5591,7 +5591,7 @@ Return Value:
     if ((RawDataStream != NULL) && (RawDataStreamSizeInBytes != 0)) {
         if (RawDataStreamSizeInBytes < TypeSize) {
             DbgOut("Error: Supplied buffer of size %d is not big enough to "
-                   "print type of size %d.\n",
+                   "print type of size %ld.\n",
                    RawDataStreamSizeInBytes,
                    TypeSize);
 
@@ -5644,7 +5644,7 @@ Return Value:
                                    &BytesRead);
 
             if (Result != 0) {
-                DbgOut("Error reading virtual memory, only read %d bytes, type "
+                DbgOut("Error reading virtual memory, only read %ld bytes, type "
                        "is %d bytes!\n",
                        TypeSize,
                        BytesRead);

+ 1 - 1
apps/debug/client/dbgrcomm.h

@@ -2389,7 +2389,7 @@ BOOL
 DbgGetDataSymbolTypeInformation (
     PDATA_SYMBOL DataSymbol,
     PTYPE_SYMBOL *TypeSymbol,
-    PULONG TypeSize
+    PUINTN TypeSize
     );
 
 /*++

+ 18 - 18
apps/debug/client/dbgsym.c

@@ -183,7 +183,7 @@ Return Value:
             return NULL;
         }
 
-        sprintf(Symbol, "0x%08I64x", Address);
+        sprintf(Symbol, "0x%08llx", Address);
         return Symbol;
     }
 
@@ -259,7 +259,7 @@ Return Value:
                 if (Line != NULL) {
                     snprintf(Symbol,
                              SymbolSize,
-                             "%s!%s+0x%I64x [%s:%d]",
+                             "%s!%s+0x%llx [%s:%d]",
                              Module->ModuleName,
                              SearchResult.U.FunctionResult->Name,
                              Offset,
@@ -269,7 +269,7 @@ Return Value:
                 } else {
                     snprintf(Symbol,
                              SymbolSize,
-                             "%s!%s+0x%I64x",
+                             "%s!%s+0x%llx",
                              Module->ModuleName,
                              SearchResult.U.FunctionResult->Name,
                              Offset);
@@ -343,11 +343,11 @@ Return Value:
     Address += Module->BaseDifference;
     if (Address >= Module->LowestAddress) {
         Offset = Address - Module->LowestAddress;
-        sprintf(Symbol, "%s+0x%I64x", Module->ModuleName, Offset);
+        sprintf(Symbol, "%s+0x%llx", Module->ModuleName, Offset);
 
     } else {
         Offset = Module->LowestAddress - Address;
-        sprintf(Symbol, "%s-0x%I64x", Module->ModuleName, Offset);
+        sprintf(Symbol, "%s-0x%llx", Module->ModuleName, Offset);
     }
 
     return Symbol;
@@ -357,7 +357,7 @@ BOOL
 DbgGetDataSymbolTypeInformation (
     PDATA_SYMBOL DataSymbol,
     PTYPE_SYMBOL *TypeSymbol,
-    PULONG TypeSize
+    PUINTN TypeSize
     )
 
 /*++
@@ -680,7 +680,7 @@ Return Value:
                 Printed = snprintf(
                                Location,
                                LocationSize,
-                               "[@%s+0x%I64x]",
+                               "[@%s+0x%llx]",
                                DbgGetRegisterName(Symbols->Machine, Register),
                                Offset);
 
@@ -688,7 +688,7 @@ Return Value:
                 Printed = snprintf(
                                Location,
                                LocationSize,
-                               "[@%s-0x%I64x]",
+                               "[@%s-0x%llx]",
                                DbgGetRegisterName(Symbols->Machine, Register),
                                -Offset);
             }
@@ -726,7 +726,7 @@ Return Value:
         if (LocationSize != 0) {
             Printed = snprintf(Location,
                                LocationSize,
-                               "[%+I64x]",
+                               "[%llx]",
                                TargetAddress);
 
             if (Printed > 0) {
@@ -852,7 +852,7 @@ Return Value:
     CHAR Location[64];
     INT Result;
     PTYPE_SYMBOL Type;
-    ULONG TypeSize;
+    UINTN TypeSize;
 
     DataStream = NULL;
 
@@ -1645,7 +1645,7 @@ Return Value:
 {
 
     PVOID Data;
-    UINTN DataSize;
+    ULONG DataSize;
     INT Status;
     PTYPE_SYMBOL Type;
 
@@ -1859,7 +1859,7 @@ Return Value:
 
             NumericValue.Uint64 = 0;
             memcpy(&NumericValue, Data, TypeSize);
-            DbgOut("0x%08I64x", NumericValue.Uint64);
+            DbgOut("0x%08llx", NumericValue.Uint64);
             break;
         }
 
@@ -1903,7 +1903,7 @@ Return Value:
                 }
 
                 DbgOut("\n%*s", SpaceLevel, "");
-                DbgOut("[%I64d] --------------------------------------"
+                DbgOut("[%lld] --------------------------------------"
                        "-------", ArrayIndex);
 
                 DbgOut("\n%*s", SpaceLevel + 2, "");
@@ -1958,7 +1958,7 @@ Return Value:
             return EINVAL;
         }
 
-        DbgOut("%I64d", NumericValue.Int64);
+        DbgOut("%lld", NumericValue.Int64);
         EnumerationMember = Enumeration->FirstMember;
         while (EnumerationMember != NULL) {
             if (EnumerationMember->Value == NumericValue.Int64) {
@@ -2081,7 +2081,7 @@ Return Value:
 
         NumericValue.Uint64 = 0;
         memcpy(&NumericValue, Data, TypeSize);
-        DbgOut("(*0x%08I64x)()", NumericValue.Uint64);
+        DbgOut("(*0x%08llx)()", NumericValue.Uint64);
         break;
 
     default:
@@ -3060,7 +3060,7 @@ Return Value:
             break;
 
         default:
-            DbgOut("%I64x", NumericValue.Uint64);
+            DbgOut("%llx", NumericValue.Uint64);
             break;
         }
 
@@ -3080,12 +3080,12 @@ Return Value:
 
         case 8:
         default:
-            DbgOut("%I64d", NumericValue.Int64);
+            DbgOut("%lld", NumericValue.Int64);
             break;
         }
 
     } else {
-        DbgOut("0x%I64x", NumericValue.Uint64);
+        DbgOut("0x%llx", NumericValue.Uint64);
     }
 
     return 0;

+ 5 - 5
apps/debug/client/tdwarf/tdwarf.c

@@ -1179,7 +1179,7 @@ Return Value:
         Table = Context->Sections.Frame.Data;
         End = Table + Context->Sections.Frame.Size;
         if ((Options & TDWARF_OPTION_PRINT_UNWIND) != 0) {
-            printf(".debug_frame section, %ld bytes\n", End - Table);
+            printf(".debug_frame section, %ld bytes\n", (long)(End - Table));
         }
 
         EhFrame = FALSE;
@@ -1188,7 +1188,7 @@ Return Value:
         Table = Context->Sections.EhFrame.Data;
         End = Table + Context->Sections.EhFrame.Size;
         if ((Options & TDWARF_OPTION_PRINT_UNWIND) != 0) {
-            printf(".eh_frame section, %ld bytes\n", End - Table);
+            printf(".eh_frame section, %ld bytes\n", (long)(End - Table));
         }
 
         EhFrame = TRUE;
@@ -1220,7 +1220,7 @@ Return Value:
             if (Status == EAGAIN) {
                 if ((Options & TDWARF_OPTION_PRINT_UNWIND) != 0) {
                     printf(" Zero terminator Offset %lx.\n\n",
-                           ObjectStart - Start);
+                           (long)(ObjectStart - Start));
                 }
 
                 continue;
@@ -1241,7 +1241,7 @@ Return Value:
                        "  Return Address Register: %llu\n"
                        "  Augmentation Length: %llu\n"
                        "  Language Encoding: ",
-                       ObjectStart - Start,
+                       (long)(ObjectStart - Start),
                        Cie.UnitLength,
                        Cie.Version,
                        Cie.Augmentation,
@@ -1266,7 +1266,7 @@ Return Value:
             if ((Options & TDWARF_OPTION_PRINT_UNWIND) != 0) {
                 printf("  FDE Offset %lx Length %llx CIE %lld "
                        "PC %llx - %llx\n",
-                       ObjectStart - Start,
+                       (long)(ObjectStart - Start),
                        Fde.Length,
                        Fde.CiePointer,
                        Fde.InitialLocation,

+ 5 - 0
apps/debug/client/win32/cmdln/ntcmdln.c

@@ -35,6 +35,11 @@ Environment:
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+
+#ifndef PACKED
+#define PACKED __attribute__((__packed__))
+#endif
+
 #include <minoca/debug/spproto.h>
 #include <minoca/debug/dbgext.h>
 #include "dbgrprof.h"

+ 6 - 1
apps/debug/client/win32/ntcomm.c

@@ -37,6 +37,11 @@ Environment:
 #include <fcntl.h>
 #include <stdio.h>
 #include <windows.h>
+#include <winsock.h>
+
+#ifndef PACKED
+#define PACKED __attribute__((__packed__))
+#endif
 
 #include <minoca/debug/spproto.h>
 #include <minoca/debug/dbgext.h>
@@ -195,7 +200,7 @@ Return Value:
 
 {
 
-    return _pipe(FileDescriptors, 0, _O_BINARY);
+    return _pipe(FileDescriptors, 0, O_BINARY);
 }
 
 char *

+ 2 - 0
apps/lib/lzma/util/lzma.c

@@ -47,6 +47,8 @@ Environment:
 
 #if defined(O_BINARY) && (O_BINARY != O_TEXT)
 
+#include <io.h>
+
 #define SET_BINARY_MODE(_Descriptor) _setmode(_Descriptor, O_BINARY)
 
 #else

+ 1 - 1
apps/libc/dynamic/time.c

@@ -3189,7 +3189,7 @@ Return Value:
     KSTATUS Status;
     PSTR Variable;
     PVOID ZoneData;
-    ULONG ZoneDataSize;
+    UINTN ZoneDataSize;
 
     OldData = NULL;
     ZoneData = NULL;

+ 11 - 11
apps/osbase/time.c

@@ -49,11 +49,11 @@ KSTATUS
 OspTimeZoneControl (
     TIME_ZONE_OPERATION Operation,
     PVOID DataBuffer,
-    PULONG DataBufferSize,
+    PUINTN DataBufferSize,
     PSTR ZoneName,
-    ULONG ZoneNameSize,
+    UINTN ZoneNameSize,
     PSTR OriginalZoneName,
-    PULONG OriginalZoneNameSize
+    PUINTN OriginalZoneNameSize
     );
 
 KSTATUS
@@ -539,7 +539,7 @@ OsGetTimeZoneData (
     BOOL AllZones,
     PSTR ZoneName,
     PVOID *ZoneData,
-    PULONG ZoneDataSize
+    PUINTN ZoneDataSize
     )
 
 /*++
@@ -574,11 +574,11 @@ Return Value:
 {
 
     PVOID Data;
-    ULONG DataSize;
+    UINTN DataSize;
     TIME_ZONE_OPERATION Operation;
     KSTATUS Status;
     PUSER_SHARED_DATA UserSharedData;
-    ULONG ZoneNameSize;
+    UINTN ZoneNameSize;
 
     Data = NULL;
     DataSize = 0;
@@ -666,7 +666,7 @@ KSTATUS
 OsSetSystemTimeZone (
     PSTR Zone,
     PSTR OriginalZoneName,
-    PULONG OriginalZoneNameSize
+    PUINTN OriginalZoneNameSize
     )
 
 /*++
@@ -695,7 +695,7 @@ Return Value:
 
 {
 
-    ULONG NameLength;
+    UINTN NameLength;
     KSTATUS Status;
 
     NameLength = 0;
@@ -1033,11 +1033,11 @@ KSTATUS
 OspTimeZoneControl (
     TIME_ZONE_OPERATION Operation,
     PVOID DataBuffer,
-    PULONG DataBufferSize,
+    PUINTN DataBufferSize,
     PSTR ZoneName,
-    ULONG ZoneNameSize,
+    UINTN ZoneNameSize,
     PSTR OriginalZoneName,
-    PULONG OriginalZoneNameSize
+    PUINTN OriginalZoneNameSize
     )
 
 /*++

+ 2 - 2
apps/setup/steps.c

@@ -1410,7 +1410,7 @@ Return Value:
             if (BytesDone != SETUP_BLOCK_SIZE) {
                 fprintf(stderr,
                         "Read only %ld of %d bytes.\n",
-                        BytesDone,
+                        (long)BytesDone,
                         SETUP_BLOCK_SIZE);
 
                 Result = errno;
@@ -1530,7 +1530,7 @@ Return Value:
         if (BytesDone != SETUP_BLOCK_SIZE) {
             fprintf(stderr,
                     "Error: Wrote only %ld of %d bytes.\n",
-                    BytesDone,
+                    (long)BytesDone,
                     SETUP_BLOCK_SIZE);
 
             Result = errno;

+ 2 - 2
apps/swiss/ps.c

@@ -1882,10 +1882,10 @@ Return Value:
     case PsDataBlockSize:
     case PsDataVirtualSize:
         if (Column->RightJustified != FALSE) {
-            printf("%*lu", Column->Width, SizeData);
+            printf("%*lu", Column->Width, (unsigned long)SizeData);
 
         } else {
-            printf("%-*lu", Column->Width, SizeData);
+            printf("%-*lu", Column->Width, (unsigned long)SizeData);
         }
 
         break;

+ 2 - 1
apps/swiss/swlib/uos.c

@@ -40,6 +40,7 @@ Environment:
 #include <grp.h>
 #include <pwd.h>
 #include <signal.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1390,7 +1391,7 @@ Return Value:
     strncpy(Name->Machine, UtsName.machine, sizeof(Name->Machine));
     Name->Machine[sizeof(Name->Machine) - 1] = '\0';
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__CYGWIN__)
 
     Name->DomainName[0] = '\0';
 

+ 6 - 0
apps/swiss/swlibos.h

@@ -42,6 +42,12 @@ Author:
 
 #endif
 
+#if defined(__CYGWIN__)
+
+#define setdomainname(_Domainname, _Length) -1, errno = ENOSYS
+
+#endif
+
 //
 // ---------------------------------------------------------------- Definitions
 //

+ 3 - 3
apps/swiss/time.c

@@ -296,11 +296,11 @@ Return Value:
     fprintf(stderr,
             "\nreal %ld.%06d\nuser %ld.%06d\nsys %ld.%06d\n",
             (long)RealTime.tv_sec,
-            RealTime.tv_usec,
+            (int)RealTime.tv_usec,
             (long)UserTime.tv_sec,
-            UserTime.tv_usec,
+            (int)UserTime.tv_usec,
             (long)SystemTime.tv_sec,
-            SystemTime.tv_usec);
+            (int)SystemTime.tv_usec);
 
     Status = ReturnValue;
 

+ 2 - 0
apps/swiss/uos/Makefile

@@ -52,8 +52,10 @@ OBJS = $(COMMON_OBJS)   \
 ##
 
 ifneq ($(shell uname -s),Darwin)
+ifeq ($(findstring CYGWIN,$(shell uname -s)),)
 OBJS += $(LOGIN_OBJS)
 endif
+endif
 
 TARGETLIBS = $(OBJROOT)/os/lib/termlib/build/termlib.a                       \
              $(OBJROOT)/os/lib/rtl/rtlc/build/rtlc.a                         \

+ 1 - 1
apps/swiss/uos/uoscmds.c

@@ -124,7 +124,7 @@ SWISS_COMMAND_ENTRY SwissCommands[] = {
      HostnameMain,
      0},
 
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__CYGWIN__)
 
     {USERADD_COMMAND_NAME, USERADD_COMMAND_DESCRIPTION, UseraddMain, 0},
     {USERDEL_COMMAND_NAME, USERDEL_COMMAND_DESCRIPTION, UserdelMain, 0},

+ 2 - 2
boot/loader/loader.c

@@ -1235,7 +1235,7 @@ Return Value:
     ULONG TableIndex;
     ULONG TestTablesExaminedBytes;
     PVOID TestTablesPhysical;
-    ULONG TestTablesSize;
+    UINTN TestTablesSize;
     PVOID TestTablesVirtual;
 
     DsdtTable = NULL;
@@ -2001,7 +2001,7 @@ Return Value:
 
 {
 
-    ULONG DataSize;
+    UINTN DataSize;
     PVOID DataVirtual;
     KSTATUS Status;
 

+ 1 - 1
drivers/net/netcore/igmp.c

@@ -3126,7 +3126,7 @@ Return Value:
     PNET_DEVICE_LINK_GET_SET_INFORMATION GetSetInformation;
     PNET_LINK Link;
     ULONG PromiscuousMode;
-    ULONG PromiscuousModeSize;
+    UINTN PromiscuousModeSize;
     KSTATUS Status;
 
     ASSERT(KeIsQueuedLockHeld(IgmpLink->Lock) != FALSE);

+ 1 - 1
drivers/plat/ti/am3soc/am3cm3fw.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
include/minoca/kernel/bootload.h

@@ -226,7 +226,7 @@ Members:
 
 typedef struct _LOADER_BUFFER {
     PVOID Buffer;
-    ULONG Size;
+    UINTN Size;
 } LOADER_BUFFER, *PLOADER_BUFFER;
 
 /*++

+ 1 - 1
include/minoca/kernel/knet.h

@@ -748,7 +748,7 @@ typedef struct _SOCKET {
     NET_DOMAIN_TYPE Domain;
     NET_SOCKET_TYPE Type;
     ULONG Protocol;
-    UINTN ReferenceCount;
+    ULONG ReferenceCount;
     PIO_OBJECT_STATE IoState;
     PIO_HANDLE IoHandle;
     ULONG Flags;

+ 2 - 2
include/minoca/kernel/ps.h

@@ -3061,7 +3061,7 @@ KSTATUS
 PsGetAllProcessInformation (
     ULONG AllocationTag,
     PVOID *Buffer,
-    PULONG BufferSize
+    PUINTN BufferSize
     );
 
 /*++
@@ -3101,7 +3101,7 @@ KSTATUS
 PsGetProcessInformation (
     PROCESS_ID ProcessId,
     PPROCESS_INFORMATION Buffer,
-    PULONG BufferSize
+    PUINTN BufferSize
     );
 
 /*++

+ 1 - 1
include/minoca/kernel/x86.inc

@@ -191,7 +191,7 @@ Environment:
     mov     %ax, %fs                # Load it.
 .endm
 
-#if defined(__WINNT__)
+#if defined(__WINNT__) || defined(__CYGWIN__)
 
 #define FUNCTION(_Name) \
     _Name: \

+ 2 - 2
include/minoca/lib/minocaos.h

@@ -3325,7 +3325,7 @@ OsGetTimeZoneData (
     BOOL AllZones,
     PSTR ZoneName,
     PVOID *ZoneData,
-    PULONG ZoneDataSize
+    PUINTN ZoneDataSize
     );
 
 /*++
@@ -3362,7 +3362,7 @@ KSTATUS
 OsSetSystemTimeZone (
     PSTR Zone,
     PSTR OriginalZoneName,
-    PULONG OriginalZoneNameSize
+    PUINTN OriginalZoneNameSize
     );
 
 /*++

+ 13 - 4
include/minoca/lib/rtl.h

@@ -427,10 +427,19 @@ Author:
 
 #else
 
-#define RtlAtomicExchange RtlAtomicExchange32
-#define RtlAtomicCompareExchange RtlAtomicCompareExchange32
-#define RtlAtomicAdd RtlAtomicAdd32
-#define RtlAtomicOr RtlAtomicAdd32
+#define RtlAtomicExchange(_Pointer, _Value) \
+    RtlAtomicExchange32((PULONG)(_Pointer), (_Value))
+
+#define RtlAtomicCompareExchange(_Pointer, _Exchange, _Compare) \
+    RtlAtomicCompareExchange32((PULONG)(_Pointer), \
+                               (_Exchange), \
+                               (_Compare))
+
+#define RtlAtomicAdd(_Pointer, _Value) \
+    RtlAtomicAdd32((PULONG)(_Pointer), (_Value))
+
+#define RtlAtomicOr(_Pointer, _Value) \
+    RtlAtomicAdd32((PULONG)(_Pointer), (_Value))
 
 #define RtlCountLeadingZeros RtlCountLeadingZeros32
 #define RtlCountTrailingZeros RtlCountTrailingZeros32

+ 6 - 2
include/minoca/lib/types.h

@@ -161,8 +161,12 @@ typedef unsigned int ULONG, *PULONG;
 typedef long long LONGLONG, *PLONGLONG;
 typedef unsigned long long ULONGLONG, *PULONGLONG;
 
-typedef __INTPTR_TYPE__ INTN, *PINTN;
-typedef __UINTPTR_TYPE__ UINTN, *PUINTN;
+#if __SIZEOF_LONG__ != __SIZEOF_POINTER__
+#error INTN and UINTN definitions are wrong.
+#endif
+
+typedef long INTN, *PINTN;
+typedef unsigned long UINTN, *PUINTN;
 
 typedef unsigned long long PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
 

+ 6 - 2
include/minoca/uefi/arm/procdef.h

@@ -99,8 +99,12 @@ typedef char CHAR8;
 // Define the native architectural integer size.
 //
 
-typedef UINT32 UINTN;
-typedef INT32 INTN;
+#if __SIZEOF_LONG__ != 4
+#error INTN and UINTN definitions are wrong.
+#endif
+
+typedef unsigned long UINTN;
+typedef long INTN;
 
 //
 // -------------------------------------------------------------------- Globals

+ 6 - 2
include/minoca/uefi/x64/procdef.h

@@ -94,8 +94,12 @@ typedef char CHAR8;
 // Define the native architectural integer size.
 //
 
-typedef UINT64 UINTN;
-typedef INT64 INTN;
+#if __SIZEOF_LONG__ != 8
+#error INTN and UINTN definitions are wrong.
+#endif
+
+typedef unsigned long UINTN;
+typedef long INTN;
 
 //
 // -------------------------------------------------------------------- Globals

+ 6 - 2
include/minoca/uefi/x86/procdef.h

@@ -94,8 +94,12 @@ typedef char CHAR8;
 // Define the native architectural integer size.
 //
 
-typedef UINT32 UINTN;
-typedef INT32 INTN;
+#if __SIZEOF_LONG__ != 4
+#error INTN and UINTN definitions are wrong.
+#endif
+
+typedef unsigned long UINTN;
+typedef long INTN;
 
 //
 // -------------------------------------------------------------------- Globals

+ 1 - 1
kernel/io/mount.c

@@ -2556,7 +2556,7 @@ Return Value:
     PMOUNT_POINT_ENTRY MountPointEntry;
     UINTN MountPointEntrySize;
     PSTR MountPointPath;
-    UINTN MountPointPathSize;
+    ULONG MountPointPathSize;
     PATH_POINT PathPoint;
     KSTATUS Status;
     UINTN TargetPathSize;

+ 1 - 1
kernel/io/unsocket.c

@@ -1366,7 +1366,7 @@ Return Value:
     PUNIX_SOCKET UnixSocket;
     BOOL UnixSocketLockHeld;
     PCSTR WalkedPath;
-    UINTN WalkedPathSize;
+    ULONG WalkedPathSize;
 
     BytesCompleted = 0;
     Packet = NULL;

+ 1 - 1
kernel/io/userio.c

@@ -3913,7 +3913,7 @@ Return Value:
 {
 
     PSTR Path;
-    UINTN PathSize;
+    ULONG PathSize;
     KSTATUS Status;
 
     //

+ 1 - 1
kernel/ke/crashdmp.c

@@ -391,7 +391,7 @@ Return Value:
     PFILE_BLOCK_IO_CONTEXT BlockIoContext;
     PDISK_BLOCK_IO_RESET BlockIoReset;
     PVOID Buffer;
-    UINTN BufferSize;
+    ULONG BufferSize;
     UINTN BytesCompleted;
     USHORT Checksum;
     PCRASH_DUMP_FILE CrashFile;

+ 1 - 1
kernel/mm/mmp.h

@@ -402,7 +402,7 @@ KSTATUS
 MmpInitializePhysicalPageAllocator (
     PMEMORY_DESCRIPTOR_LIST MemoryMap,
     PVOID *InitMemory,
-    PULONG InitMemorySize
+    PUINTN InitMemorySize
     );
 
 /*++

+ 2 - 2
kernel/mm/physical.c

@@ -740,7 +740,7 @@ KSTATUS
 MmpInitializePhysicalPageAllocator (
     PMEMORY_DESCRIPTOR_LIST MemoryMap,
     PVOID *InitMemory,
-    PULONG InitMemorySize
+    PUINTN InitMemorySize
     )
 
 /*++
@@ -776,7 +776,7 @@ Return Value:
 
 {
 
-    ULONG AllocationSize;
+    UINTN AllocationSize;
     INIT_PHYSICAL_MEMORY_ITERATOR Context;
     UINTN Count;
     ULONG LastBitIndex;

+ 8 - 8
kernel/ps/process.c

@@ -129,14 +129,14 @@ PspDebugGetThreadList (
 KSTATUS
 PspGetAllProcessInformation (
     PVOID Buffer,
-    PULONG BufferSize
+    PUINTN BufferSize
     );
 
 KSTATUS
 PspGetProcessInformation (
     PKPROCESS Process,
     PPROCESS_INFORMATION Buffer,
-    PULONG BufferSize
+    PUINTN BufferSize
     );
 
 VOID
@@ -185,7 +185,7 @@ KSTATUS
 PsGetAllProcessInformation (
     ULONG AllocationTag,
     PVOID *Buffer,
-    PULONG BufferSize
+    PUINTN BufferSize
     )
 
 /*++
@@ -224,7 +224,7 @@ Return Value:
 {
 
     PVOID Allocation;
-    ULONG Size;
+    UINTN Size;
     KSTATUS Status;
     ULONG Try;
 
@@ -275,7 +275,7 @@ KSTATUS
 PsGetProcessInformation (
     PROCESS_ID ProcessId,
     PPROCESS_INFORMATION Buffer,
-    PULONG BufferSize
+    PUINTN BufferSize
     )
 
 /*++
@@ -4455,7 +4455,7 @@ DebugGetThreadListEnd:
 KSTATUS
 PspGetAllProcessInformation (
     PVOID Buffer,
-    PULONG BufferSize
+    PUINTN BufferSize
     )
 
 /*++
@@ -4488,7 +4488,7 @@ Return Value:
     PKPROCESS *Processes;
     ULONG ProcessIndex;
     PPROCESS_INFORMATION ProcessInformation;
-    ULONG ProcessSize;
+    UINTN ProcessSize;
     KSTATUS ProcessStatus;
     ULONG RemainingSize;
     ULONG Size;
@@ -4535,7 +4535,7 @@ KSTATUS
 PspGetProcessInformation (
     PKPROCESS Process,
     PPROCESS_INFORMATION Buffer,
-    PULONG BufferSize
+    PUINTN BufferSize
     )
 
 /*++

+ 2 - 2
kernel/sp/profiler.c

@@ -2086,7 +2086,7 @@ Return Value:
     RUNLEVEL OldRunLevel;
     PPROCESS_INFORMATION Process;
     PPROCESS_INFORMATION ProcessList;
-    ULONG ProcessListSize;
+    UINTN ProcessListSize;
     ULONG ProcessorNumber;
     KSTATUS Status;
     KSTATUS ThreadStatus;
@@ -2303,7 +2303,7 @@ Return Value:
     RUNLEVEL OldRunLevel;
     PPROCESS_INFORMATION Process;
     ULONG ProcessorNumber;
-    ULONG ProcessSize;
+    UINTN ProcessSize;
     KSTATUS Status;
 
     if ((SpEnabledFlags & PROFILER_TYPE_FLAG_THREAD_STATISTICS) == 0) {

+ 1 - 1
lib/fatlib/fattest/fattest.c

@@ -461,7 +461,7 @@ Return Value:
                 printf("Error: Immediately after writing block %d, offset %lu "
                        "had %x in it instead of %x\n",
                        BlockIndex,
-                       FillIndex * sizeof(ULONG),
+                       (long)FillIndex * sizeof(ULONG),
                        PageBuffer[FillIndex],
                        PageValue);
 

+ 7 - 7
lib/rtl/testrtl/testrtl.c

@@ -711,7 +711,7 @@ Return Value:
         printf("Error: Print basic string with NULL output returned output "
                "length of %d, should have been %lu.\n",
                StringLength,
-               strlen(BASIC_STRING) + 1);
+               (long)strlen(BASIC_STRING) + 1);
 
         TestsFailed += 1;
     }
@@ -729,7 +729,7 @@ Return Value:
         printf("Error: Print basic string with no output returned output "
                "length of %d, should have been %lu.\n",
                StringLength,
-               strlen(BASIC_STRING) + 1);
+               (long)strlen(BASIC_STRING) + 1);
 
         TestsFailed += 1;
     }
@@ -755,7 +755,7 @@ Return Value:
         printf("Error: Print formatted string with no output returned output "
                "length of %d, should have been %lu.\n",
                StringLength,
-               strlen(FORMATTED_STRING_RESULT) + 1);
+               (long)strlen(FORMATTED_STRING_RESULT) + 1);
 
         TestsFailed += 1;
     }
@@ -769,7 +769,7 @@ Return Value:
         printf("Error: Print formatted string with output returned output "
                "length of %d, should have been %lu.\n",
                StringLength,
-               strlen(FORMATTED_STRING_RESULT) + 1);
+               (long)strlen(FORMATTED_STRING_RESULT) + 1);
 
         TestsFailed += 1;
     }
@@ -814,7 +814,7 @@ Return Value:
         printf("Error: Print formatted string with output returned output "
                "length of %d, should have been %lu.\n",
                StringLength,
-               strlen(FORMATTED_STRING_POSITIONAL_RESULT) + 1);
+               (long)strlen(FORMATTED_STRING_POSITIONAL_RESULT) + 1);
 
         TestsFailed += 1;
     }
@@ -863,7 +863,7 @@ Return Value:
         printf("Error: Print float string with output returned output "
                "length of %d, should have been %lu.\n",
                StringLength,
-               strlen(PRINT_FLOAT_RESULT) + 1);
+               (long)strlen(PRINT_FLOAT_RESULT) + 1);
 
         TestsFailed += 1;
     }
@@ -891,7 +891,7 @@ Return Value:
         printf("Error: Print hex float string with output returned output "
                "length of %d, should have been %lu.\n",
                StringLength,
-               strlen(PRINT_HEX_FLOAT_RESULT) + 1);
+               (long)strlen(PRINT_HEX_FLOAT_RESULT) + 1);
 
         TestsFailed += 1;
     }

+ 5 - 1
minoca.mk

@@ -42,6 +42,10 @@ all:
 ##
 
 OS ?= $(shell uname -s)
+ifneq ($(findstring CYGWIN,$(shell uname -s)),)
+OS := cygwin
+endif
+
 BUILD_ARCH = $(shell uname -m)
 ifeq ($(BUILD_ARCH), $(filter i686 i586,$(BUILD_ARCH)))
 BUILD_ARCH := x86
@@ -235,7 +239,7 @@ EXTRA_CFLAGS += -fno-builtin -fno-omit-frame-pointer -g -save-temps=obj \
 EXTRA_CFLAGS_FOR_BUILD := $(EXTRA_CFLAGS)
 
 EXTRA_CFLAGS += -fpic
-ifneq ($(OS),Windows_NT)
+ifneq ($(OS),$(filter Windows_NT cygwin,$(OS)))
 EXTRA_CFLAGS_FOR_BUILD += -fpic
 endif
 

+ 2 - 2
uefi/dev/ns16550/ns16550.c

@@ -348,7 +348,7 @@ EFI_STATUS
 EfipNs16550Transmit (
     PNS16550_CONTEXT Context,
     VOID *Data,
-    UINT32 Size
+    UINTN Size
     )
 
 /*++
@@ -410,7 +410,7 @@ EFI_STATUS
 EfipNs16550Receive (
     PNS16550_CONTEXT Context,
     VOID *Data,
-    UINT32 *Size
+    UINTN *Size
     )
 
 /*++

+ 1 - 1
uefi/plat/beagbone/bbonefwv.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
uefi/plat/beagbone/ramdisk.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
uefi/plat/bios/biosfwv.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
uefi/plat/integcp/integfwv.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
uefi/plat/integcp/ramdisk.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
uefi/plat/panda/pandafwv.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
uefi/plat/panda/ramdisk.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
uefi/plat/rpi/rpifwv.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
uefi/plat/rpi2/rpi2fwv.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 1 - 1
uefi/plat/veyron/veyronfwv.S

@@ -29,7 +29,7 @@ Environment:
 ## ---------------------------------------------------------------- Definitions
 ##
 
-#if defined(__WINNT) || defined(__APPLE__)
+#if defined(__WINNT) || defined(__CYGWIN__) || defined(__APPLE__)
 
 #define LABEL(_Name) _##_Name
 

+ 7 - 7
uefi/tools/genfv/genfv.c

@@ -453,8 +453,8 @@ Return Value:
     Buffer = malloc(BufferSize);
     if (Buffer == NULL) {
         fprintf(stderr,
-                "Error: Failed to allocate image buffer, size 0x%llx.\n",
-                CurrentOffset);
+                "Error: Failed to allocate image buffer, size 0x%lx.\n",
+                (long)CurrentOffset);
 
         Status = ENOMEM;
         goto CreateVolumeEnd;
@@ -656,7 +656,7 @@ Return Value:
     if (BytesRead < HeaderSize) {
         fprintf(stderr,
                 "Error: Only read %ld bytes of %s.\n",
-                BytesRead,
+                (long)BytesRead,
                 FileName);
 
         Status = EINVAL;
@@ -797,9 +797,9 @@ Return Value:
 
     if (BufferSize != 0) {
         if ((Context->Flags & GENFV_OPTION_VERBOSE) != 0) {
-            printf("Adding file %s at offset %llx, size %llx\n",
+            printf("Adding file %s at offset %lx, size %llx\n",
                    FileName,
-                   *Offset,
+                   (long)*Offset,
                    FileSize);
         }
 
@@ -903,8 +903,8 @@ Return Value:
         PadFile->Attributes = 0;
         PadFileSize = (NewOffset - *Offset) - sizeof(EFI_FFS_FILE_HEADER);
         if ((Context->Flags & GENFV_OPTION_VERBOSE) != 0) {
-            printf("Creating pad file at 0x%llx, Size %llx to new offset "
-                   "0x%llx.\n",
+            printf("Creating pad file at 0x%lx, Size %lx to new offset "
+                   "0x%lx.\n",
                    *Offset,
                    PadFileSize,
                    NewOffset);

+ 8 - 8
uefi/tools/mkuboot/mkuboot.c

@@ -618,7 +618,7 @@ Return Value:
                 "mkuboot: Unable to read \"%s\". Read %ld bytes, expected "
                 "%d.\n",
                 Context->InputFileName,
-                BytesRead,
+                (long)BytesRead,
                 InputFileSize);
 
         Result = 1;
@@ -778,10 +778,10 @@ Return Value:
 
     if (BytesWritten != sizeof(UBOOT_HEADER)) {
         fprintf(stderr,
-                "mkuboot: Needed to write %ld byte U-Boot header, wrote %ld "
+                "mkuboot: Needed to write %d byte U-Boot header, wrote %ld "
                 "bytes.\n",
-                sizeof(UBOOT_HEADER),
-                BytesWritten);
+                (int)sizeof(UBOOT_HEADER),
+                (long)BytesWritten);
 
         Result = 1;
         goto CreateLegacyImageEnd;
@@ -928,7 +928,7 @@ Return Value:
         fprintf(stderr,
                 "mkuboot: Failed to write FIT strings. Write %ld bytes, "
                 "expected %d.\n",
-                BytesWritten,
+                (long)BytesWritten,
                 StringsSize);
 
         Result = 1;
@@ -990,10 +990,10 @@ Return Value:
 
     if (BytesWritten != sizeof(UBOOT_FIT_HEADER)) {
         fprintf(stderr,
-                "mkuboot: Needed to write %ld byte U-Boot FIT header, "
+                "mkuboot: Needed to write %d byte U-Boot FIT header, "
                 "wrote %ld bytes.\n",
-                sizeof(UBOOT_FIT_HEADER),
-                BytesWritten);
+                (int)sizeof(UBOOT_FIT_HEADER),
+                (long)BytesWritten);
 
         Result = 1;
         goto CreateFitImageEnd;