Add missing VM patches by Toni Spets. Pointed by Antti Harri, thanks.

Remove old patches (yes, I should tattoo cvs add and cvs rm on my wrist).
This commit is contained in:
kirby 2012-03-18 16:48:15 +00:00
parent ba9161e131
commit 559d2919f4
6 changed files with 57 additions and 86 deletions

View File

@ -1,25 +0,0 @@
$OpenBSD: patch-code_qcommon_net_ip_c,v 1.1.1.1 2008/10/27 13:29:02 weerd Exp $
--- code/qcommon/net_ip.c.orig Sun Aug 31 14:36:07 2008
+++ code/qcommon/net_ip.c Sun Aug 31 14:44:25 2008
@@ -335,7 +335,21 @@ Sys_SockaddrToString
*/
static void Sys_SockaddrToString(char *dest, int destlen, struct sockaddr *input, int inputlen)
{
+/* OA's inputlen is incompatible with getnameinfo() on OpenBSD */
+#ifdef __OpenBSD__
+ struct sockaddr_in *s4;
+ struct sockaddr_in6 *s6;
+
+ if (input->sa_family == AF_INET) {
+ s4 = (struct sockaddr_in *)(input);
+ inet_ntop(AF_INET, (void *)&(s4->sin_addr), dest, destlen);
+ } else if (input->sa_family == AF_INET6) {
+ s6 = (struct sockaddr_in6 *)(input);
+ inet_ntop(AF_INET6, (void *)&(s6->sin6_addr), dest, destlen);
+ }
+#else
getnameinfo(input, inputlen, dest, destlen, NULL, 0, NI_NUMERICHOST);
+#endif
}
/*

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-code_qcommon_q_shared_h,v 1.1 2010/05/27 03:47:28 jakemsr Exp $
--- code/qcommon/q_shared.h.orig Mon May 3 04:41:00 2010
+++ code/qcommon/q_shared.h Mon May 3 04:41:20 2010
@@ -157,9 +157,9 @@ typedef int clipHandle_t;
#define PAD(x,y) (((x)+(y)-1) & ~((y)-1))
#ifdef __GNUC__
-#define ALIGN(x) __attribute__((aligned(x)))
+#define QALIGN(x) __attribute__((aligned(x)))
#else
-#define ALIGN(x)
+#define QALIGN(x)
#endif
#ifndef NULL

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-code_qcommon_vm_x86_64_c,v 1.1 2012/03/18 16:48:16 kirby Exp $
* Add PROT_READ to x86 and x86_64 VM mmap calls[1]
[1] According to OpenBSD's mmap(2):
BUGS
Due to a limitation of the current vm system (see uvm(9)), mapping
descriptors PROT_WRITE without also specifying PROT_READ is useless
(results in a segmentation fault when first accessing the mapping). This
means that such descriptors must be opened with O_RDWR, which requires
both read and write permissions on the underlying object.
--- code/qcommon/vm_x86_64.c.orig Sat Dec 24 14:29:32 2011
+++ code/qcommon/vm_x86_64.c Sun Mar 11 15:22:24 2012
@@ -445,7 +445,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
vm->codeLength = compiledOfs;
#ifdef VM_X86_64_MMAP
- vm->codeBase = mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
+ vm->codeBase = mmap(NULL, compiledOfs, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
if(vm->codeBase == MAP_FAILED)
Com_Error(ERR_FATAL, "VM_CompileX86_64: can't mmap memory");
#elif __WIN64__

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-code_qcommon_vm_x86_c,v 1.1 2012/03/18 16:48:16 kirby Exp $
* Add PROT_READ to x86 and x86_64 VM mmap calls[1]
[1] According to OpenBSD's mmap(2):
BUGS
Due to a limitation of the current vm system (see uvm(9)), mapping
descriptors PROT_WRITE without also specifying PROT_READ is useless
(results in a segmentation fault when first accessing the mapping). This
means that such descriptors must be opened with O_RDWR, which requires
both read and write permissions on the underlying object.
--- code/qcommon/vm_x86.c.orig Sat Dec 24 14:29:32 2011
+++ code/qcommon/vm_x86.c Sun Mar 11 15:22:08 2012
@@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
/* need this on NX enabled systems (i386 with PAE kernel or
* noexec32=on x86_64) */
-#if defined(__linux__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#define VM_X86_MMAP
#endif
@@ -1094,7 +1094,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
// copy to an exact size buffer on the hunk
vm->codeLength = compiledOfs;
#ifdef VM_X86_MMAP
- vm->codeBase = mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
+ vm->codeBase = mmap(NULL, compiledOfs, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
if(vm->codeBase == MAP_FAILED)
Com_Error(ERR_FATAL, "VM_CompileX86: can't mmap memory");
#elif _WIN32

View File

@ -1,28 +0,0 @@
$OpenBSD: patch-code_renderer_tr_local_h,v 1.1 2010/05/27 03:47:28 jakemsr Exp $
--- code/renderer/tr_local.h.orig Mon May 3 04:41:46 2010
+++ code/renderer/tr_local.h Mon May 3 04:42:13 2010
@@ -1302,16 +1302,16 @@ typedef struct stageVars
typedef struct shaderCommands_s
{
- glIndex_t indexes[SHADER_MAX_INDEXES] ALIGN(16);
- vec4_t xyz[SHADER_MAX_VERTEXES] ALIGN(16);
- vec4_t normal[SHADER_MAX_VERTEXES] ALIGN(16);
- vec2_t texCoords[SHADER_MAX_VERTEXES][2] ALIGN(16);
- color4ub_t vertexColors[SHADER_MAX_VERTEXES] ALIGN(16);
- int vertexDlightBits[SHADER_MAX_VERTEXES] ALIGN(16);
+ glIndex_t indexes[SHADER_MAX_INDEXES] QALIGN(16);
+ vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(16);
+ vec4_t normal[SHADER_MAX_VERTEXES] QALIGN(16);
+ vec2_t texCoords[SHADER_MAX_VERTEXES][2] QALIGN(16);
+ color4ub_t vertexColors[SHADER_MAX_VERTEXES] QALIGN(16);
+ int vertexDlightBits[SHADER_MAX_VERTEXES] QALIGN(16);
- stageVars_t svars ALIGN(16);
+ stageVars_t svars QALIGN(16);
- color4ub_t constantColor255[SHADER_MAX_VERTEXES] ALIGN(16);
+ color4ub_t constantColor255[SHADER_MAX_VERTEXES] QALIGN(16);
shader_t *shader;
float shaderTime;

View File

@ -1,18 +0,0 @@
$OpenBSD: patch-code_renderer_tr_surface_c,v 1.1 2010/05/27 03:47:28 jakemsr Exp $
--- code/renderer/tr_surface.c.orig Mon May 3 04:42:28 2010
+++ code/renderer/tr_surface.c Mon May 3 04:42:47 2010
@@ -615,10 +615,10 @@ static void LerpMeshVertexes_altivec(md3Surface_t *sur
{
short *oldXyz, *newXyz, *oldNormals, *newNormals;
float *outXyz, *outNormal;
- float oldXyzScale ALIGN(16);
- float newXyzScale ALIGN(16);
- float oldNormalScale ALIGN(16);
- float newNormalScale ALIGN(16);
+ float oldXyzScale QALIGN(16);
+ float newXyzScale QALIGN(16);
+ float oldNormalScale QALIGN(16);
+ float newNormalScale QALIGN(16);
int vertNum;
unsigned lat, lng;
int numVerts;