libk  Diff

Differences From Artifact [ae0ed8cd11]:

  • File mod/kcore/testbin.exe.c — part of check-in [e50a476efe] at 2019-08-22 02:52:20 on branch trunk — removed sneaky segfault in x86-64 syscall fn where %r8 (the register that contains the pointer to the syscall arguments from the C syscall wrapper, which need to be copied into the correct registers before the kernel is invoked) gets overwritten if the syscall valency > 5, because of overlapping ccall and syscall ABI argument registers - r8 is clobbered by argument 5 and any further attempts to use it as a ptr segfault at best. also modified the report function so that it immediate cancels compilation if a sub-process reports failure. changed allocator function signatures so they can return a condition code if the kernel reports an error; updated example code so it compiles and runs without fault. (user: lexi, size: 557) [annotate] [blame] [check-ins using]

To Artifact [2c9c964882]:


18
19
20
21
22
23
24
25
26
27
28

29
30
31
32
33
34

	if (kiosend(e.std, ptr, null) == kiocond_ok) {
		/* great, continue */
	} else {
		return kbad_io;
	}

	void* region;
	kmcond alloc = kmheapa(&region, 2048);
	if (alloc != kmcond_ok) return kbad_mem;


	kmzero(region,2048);

	if (kmheapf(region) >= kmcond_fail) return kbad_mem;

	return kbad_ok;
}







<
|
|
|
>






18
19
20
21
22
23
24

25
26
27
28
29
30
31
32
33
34

	if (kiosend(e.std, ptr, null) == kiocond_ok) {
		/* great, continue */
	} else {
		return kbad_io;
	}


	kmres alloc = kmheapa(2048);
	if (alloc.cond != kmcond_ok) return kbad_mem;
	
	void* region = alloc.raw;
	kmzero(region,2048);

	if (kmheapf(region) >= kmcond_fail) return kbad_mem;

	return kbad_ok;
}