MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / pushThreadStack

Function pushThreadStack

source/kernel/kprocess.cpp:340–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338#define HWCAP_I386_AMD3D 1 << 31
339
340static void pushThreadStack(KThread* thread, CPU* cpu, int argc, U32* a, int envc, U32* e) {
341 KProcessPtr process = cpu->thread->process;
342
343 cpu->push32(rand());
344 cpu->push32(rand());
345 cpu->push32(rand());
346 cpu->push32(rand());
347 U32 randomAddress = ESP;
348 cpu->push32(0);
349 cpu->push32(0);
350 writeStackString(thread, cpu, "i686");
351 U32 platform = ESP;
352
353 cpu->push32(0);
354 cpu->push32(0);
355
356 // end of auxv
357 cpu->push32(0);
358 cpu->push32(0);
359
360
361 cpu->push32(randomAddress);
362 cpu->push32(25); // AT_RANDOM
363 cpu->push32(100);
364 cpu->push32( 17); // AT_CLKTCK
365 //push32(cpu, HWCAP_I386_FPU|HWCAP_I386_VME|HWCAP_I386_TSC|HWCAP_I386_CX8|HWCAP_I386_CMOV|HWCAP_I386_FCMOV);
366 //push32(cpu, 16); // AT_HWCAP
367 cpu->push32(platform);
368 cpu->push32(15); // AT_PLATFORM
369 cpu->push32(process->effectiveGroupId);
370 cpu->push32(14); // AT_EGID
371 cpu->push32(process->groupId);
372 cpu->push32(13); // AT_GID
373 cpu->push32(process->effectiveUserId);
374 cpu->push32(12); // AT_EUID
375 cpu->push32(process->userId);
376 cpu->push32(11); // AT_UID
377 cpu->push32(process->entry);
378 cpu->push32(9); // AT_ENTRY
379 cpu->push32(process->loaderBaseAddress);
380 cpu->push32(7); // AT_BASE
381 cpu->push32(4096);
382 cpu->push32(6); // AT_PAGESZ
383 cpu->push32(process->phnum);
384 cpu->push32(5); // AT_PHNUM
385 cpu->push32(process->phentsize);
386 cpu->push32(4); // AT_PHENT
387 cpu->push32(process->phdr);
388 cpu->push32(3); // AT_PHDR
389
390 // /libgdk-pixbuf2.0 package on buster needed this
391 cpu->push32(0);
392 cpu->push32(23); // AT_SECURE
393
394 cpu->push32(0);
395 for (int i=envc-1;i>=0;i--) {
396 cpu->push32(e[i]);
397 }

Callers 1

setupThreadStackFunction · 0.85

Calls 2

writeStackStringFunction · 0.85
push32Method · 0.45

Tested by

no test coverage detected