mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-06 11:12:36 +00:00
Only try to patch GPU referenced.
This commit is contained in:
parent
f6486efb71
commit
401586f92a
21
ocl.c
21
ocl.c
@ -379,22 +379,13 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
|
|
||||||
/* copy over all of the generated binaries. */
|
/* copy over all of the generated binaries. */
|
||||||
binaries = (char **)malloc( sizeof(char *)*nDevices );
|
binaries = (char **)malloc( sizeof(char *)*nDevices );
|
||||||
for( i = 0; i < nDevices; i++ ) {
|
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, "binary size %d : %d", i, binary_sizes[i]);
|
applog(LOG_DEBUG, "binary size %d : %d", gpu, binary_sizes[gpu]);
|
||||||
if( binary_sizes[i] != 0 )
|
binaries[gpu] = (char *)malloc( sizeof(char)*binary_sizes[i] );
|
||||||
binaries[i] = (char *)malloc( sizeof(char)*binary_sizes[i] );
|
|
||||||
else
|
|
||||||
binaries[i] = NULL;
|
|
||||||
}
|
|
||||||
err = clGetProgramInfo( clState->program, CL_PROGRAM_BINARIES, sizeof(char *)*nDevices, binaries, NULL );
|
err = clGetProgramInfo( clState->program, CL_PROGRAM_BINARIES, sizeof(char *)*nDevices, binaries, NULL );
|
||||||
|
|
||||||
for (i = 0; i < nDevices; i++) {
|
unsigned remaining = binary_sizes[gpu];
|
||||||
if (!binaries[i])
|
char *w = binaries[gpu];
|
||||||
continue;
|
|
||||||
|
|
||||||
unsigned remaining = binary_sizes[i];
|
|
||||||
char *w = binaries[i];
|
|
||||||
unsigned int start, length;
|
unsigned int start, length;
|
||||||
|
|
||||||
/* Find 2nd incidence of .text, and copy the program's
|
/* Find 2nd incidence of .text, and copy the program's
|
||||||
@ -406,7 +397,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
advance(&w, &remaining, ".text");
|
advance(&w, &remaining, ".text");
|
||||||
memcpy(&start, w + 285, 4);
|
memcpy(&start, w + 285, 4);
|
||||||
memcpy(&length, w + 289, 4);
|
memcpy(&length, w + 289, 4);
|
||||||
w = binaries[i]; remaining = binary_sizes[i];
|
w = binaries[gpu]; remaining = binary_sizes[gpu];
|
||||||
advance(&w, &remaining, "ELF");
|
advance(&w, &remaining, "ELF");
|
||||||
w++; remaining--;
|
w++; remaining--;
|
||||||
advance(&w, &remaining, "ELF");
|
advance(&w, &remaining, "ELF");
|
||||||
@ -416,7 +407,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
applog(LOG_DEBUG, "At %p (%u rem. bytes), to begin patching",
|
applog(LOG_DEBUG, "At %p (%u rem. bytes), to begin patching",
|
||||||
w, remaining);
|
w, remaining);
|
||||||
patch_opcodes(w, length);
|
patch_opcodes(w, length);
|
||||||
}
|
|
||||||
status = clReleaseProgram(clState->program);
|
status = clReleaseProgram(clState->program);
|
||||||
if(status != CL_SUCCESS)
|
if(status != CL_SUCCESS)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user