diff --git a/include/SDL_endian.h b/include/SDL_endian.h
index 6fe37460f5a1f9a343b484d4781b227e45a86576..327fe179187d72a567315122a3b4f9331fd4f938 100644
--- a/include/SDL_endian.h
+++ b/include/SDL_endian.h
@@ -68,7 +68,7 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x)
 #elif defined(__GNUC__) && defined(__x86_64__)
 static __inline__ Uint16 SDL_Swap16(Uint16 x)
 {
-	__asm__("xchgb %b0,%h0" : "=q" (x) :  "0" (x));
+	__asm__("xchgb %b0,%h0" : "=Q" (x) :  "0" (x));
 	return x;
 }
 #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h
index ac351987d0381c98af9500b7dd17b1c452d6afc4..9149b23b4d2ce84edaf2a05e80d9ea753455855c 100644
--- a/include/SDL_syswm.h
+++ b/include/SDL_syswm.h
@@ -49,7 +49,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
 #else
 
 /* This is the structure for custom window manager events */
-#if (defined(unix) || defined(__unix__) || defined(_AIX) || defined(__OpenBSD__)) && \
+#if (defined(unix) || defined(__unix__) || defined(_AIX) || defined(__OpenBSD__) || defined(__NetBSD__)) && \
     (!defined(DISABLE_X11) && !defined(__CYGWIN32__) && !defined(ENABLE_NANOX) && \
      !defined(__QNXNTO__))
  /* AIX is unix, of course, but the native compiler CSet doesn't define unix */
diff --git a/src/audio/SDL_audiodev.c b/src/audio/SDL_audiodev.c
index 8ed6e4f04b85159f2985eb9603ece85981ca4a27..c3f3be33ff8db25be5fc2b5eb802701fc674f869 100644
--- a/src/audio/SDL_audiodev.c
+++ b/src/audio/SDL_audiodev.c
@@ -39,7 +39,7 @@ static char rcsid =
 #include "SDL_audiodev_c.h"
 
 #ifndef _PATH_DEV_DSP
-#ifdef __OpenBSD__
+#if defined(__NetBSD__) || defined(__OpenBSD__)
 #define _PATH_DEV_DSP  "/dev/audio"
 #else
 #define _PATH_DEV_DSP  "/dev/dsp"
diff --git a/src/cdrom/openbsd/SDL_syscdrom.c b/src/cdrom/openbsd/SDL_syscdrom.c
index 8475cf4c8544346c2d7bf57c2046a082bc205f4b..72741b6ef1972f8473dd1cb0ee5557e44d239269 100644
--- a/src/cdrom/openbsd/SDL_syscdrom.c
+++ b/src/cdrom/openbsd/SDL_syscdrom.c
@@ -143,6 +143,8 @@ int  SDL_SYS_CDInit(void)
 	static char *checklist[] = {
 #ifdef __OpenBSD__
 		"?0 cd?c", "cdrom", NULL
+#elif defined(__NetBSD__)
+		"?0 cd?d", "?0 cd?c", "cdrom", NULL
 #else
 		"?0 cd?c", "?0 acd?c", "cdrom", NULL
 #endif