shithub: riscv

Download patch

ref: 38c35d619570d9873cb2a9ba016c1682edc07365
parent: 7d73312def268ec9f912161289a2bf622977196f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Feb 14 09:02:33 EST 2014

acid: add semacquire/semrelease/tsemacquire syscalls, handle _seek hack for amd64 (thanks erik)

--- a/sys/lib/acid/syscall
+++ b/sys/lib/acid/syscall
@@ -106,7 +106,7 @@
 	{24, {"brk_",		"X",		code(*sysbrk_:list)}},
 	{25, {"remove",		"s",		code(*sysremove:list)}},
 	{26, {"_wstat",		"sX",		code(*sys_wstat:list)}},
-	{27, {"_fwstat",		"DX",		code(*sys_fwstat:list)}},
+	{27, {"_fwstat",	"DX",		code(*sys_fwstat:list)}},
 	{28, {"notify",		"X",		code(*sysnotify:list)}},
 	{29, {"noted",		"D",		code(*sysnoted:list)}},
 	{30, {"segattach",	"DsXD",		code(*syssegattach:list)}},
@@ -116,6 +116,8 @@
 	{34, {"rendezvous",	"XX",		code(*sysrendezvous:list)}},
 	{35, {"unmount",	"ss",		code(*sysunmount:list)}},
 	{36, {"_wait",		"X",		code(*sys_wait:list)}},
+	{37, {"semacquire",	"XD",		code(*syssemacquire:list)}},
+	{38, {"semrelease",	"XD",		code(*syssemrelease:list)}},
 	{39, {"seek",		"XDVD",		code(*sysseek:list)}},
 	{40, {"fversion",	"DDsD",		code(*sysfversion:list)}},
 	{41, {"errstr",		"TD",		code(*syserrstr:list)}},
@@ -123,10 +125,11 @@
 	{43, {"fstat",		"DXD",		code(*sysfstat:list)}},
 	{44, {"wstat",		"sXD",		code(*syswstat:list)}},
 	{45, {"fwstat",		"DXD",		code(*sysfwstat:list)}},
-	{46, {"mount",		"DDsXs",		code(*sysmount:list)}},
+	{46, {"mount",		"DDsXs",	code(*sysmount:list)}},
 	{47, {"await",		"TD",		code(*sysawait:list)}},
 	{50, {"pread",		"DXDZ",		code(*syspread:list)}},
 	{51, {"pwrite",		"DTDZ",		code(*syspwrite:list)}},
+	{52, {"tsemacquire",	"XD",		code(*systsemacquire:list)}},
 };
 
 defn syscall() {
--- a/sys/lib/acid/truss
+++ b/sys/lib/acid/truss
@@ -84,6 +84,8 @@
 		"rendezvous",
 		"unmount",
 		"_wait",
+		"semacquire",
+		"semrelease",
 		"seek",
 		"fversion",
 		"errstr",
@@ -95,6 +97,7 @@
 		"await",
 		"pread",
 		"pwrite",
+		"tsemacquire",
 	};
 
 trussapecalls = {
@@ -135,6 +138,8 @@
 		"_RENDEZVOUS",
 		"_UNMOUNT",
 		"__WAIT",
+		"_SEMACQUIRE",
+		"_SEMRELEASE",
 		"_SEEK",
 		"__NFVERSION",
 		"__NERRSTR",
@@ -146,13 +151,16 @@
 		"__NAWAIT",
 		"_PREAD",
 		"_PWRITE",
+		"_TSEMACQUIRE",
 	};
 
 defn addressof(pattern) {
 	// translate to ape system calls if we have an ape binary
-	if _addressof("_EXITS") == 0 then
-		return _addressof(pattern);
-	return _addressof(trussapecalls[match(pattern, trusscalls)]);
+	if _addressof("_EXITS") != 0 then
+		pattern = trussapecalls[match(pattern, trusscalls)];
+	if regexp("(seek|_SEEK)", pattern) && (objtype=="amd64" || objtype == "power64" || objtype == "alpha") then
+		pattern = "_" + pattern;
+	return _addressof(pattern);
 }
 
 defn setuptruss() {