summaryrefslogtreecommitdiff
path: root/src/ac.c
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-12-27 03:05:05 +0000
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2026-02-16 19:11:24 +0000
commit8d4b47298b6c9eeb9a3f79a5b80d894f80ed4a45 (patch)
tree63a8ea6f645b997fd7943a58a002e66244fa49ac /src/ac.c
parente7943fb834cbcaec585ed68e67b5f17ceda504f7 (diff)
downloadsst-8d4b47298b6c9eeb9a3f79a5b80d894f80ed4a45.tar.gz
sst-8d4b47298b6c9eeb9a3f79a5b80d894f80ed4a45.zip
Do away with memcpy/memset/memcmp
Now everything is either explicitly a rep thing, or explicitly some other small run of reasonably efficient instructions. No library calls or function call overhead of any kind. Code size remains nice and small. Ban a few other bad libc functions while we're at it. More can be added later if we decide that's a useful idea. This will require some discipline and workarounds to cope with Clang's tendency to shove mem* calls in places you don't want them even when you tell it not to. Well, c'est la vie. I'm a little nervous that the __builtin_memmove() usage in shuntvars() could still one day emit actual library calls. It appears we're not importing memmove() from anywhere at the moment, though. So I guess it's good enough for now. Also I had to get rid of alloca() in con_.c but that was kind of bad anyway, so that's fine.
Diffstat (limited to 'src/ac.c')
-rw-r--r--src/ac.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ac.c b/src/ac.c
index f5a2de5..fc1d318 100644
--- a/src/ac.c
+++ b/src/ac.c
@@ -111,11 +111,11 @@ static ssize __stdcall kproc(int code, usize wp, ssize lp) {
// something like the following, but with a proper abstraction...
//uchar buf[28 + 16], *p = buf;
//msg_putasz4(p, 2); p += 1;
- // msg_putssz5(p, 8); memcpy(p + 1, "FakeKey", 7); p += 8;
+ // msg_putssz5(p, 8); mem_copy(p + 1, "FakeKey", 7); p += 8;
// msg_putmsz4(p, 2); p += 1;
- // msg_putssz5(p, 3); memcpy(p + 1, "vk", 2); p += 3;
+ // msg_putssz5(p, 3); mem_copy(p + 1, "vk", 2); p += 3;
// p += msg_putu32(p, data->vkCode);
- // msg_putssz5(p, 3); memcpy(p + 1, "scan", 4); p += 5;
+ // msg_putssz5(p, 3); mem_copy(p + 1, "scan", 4); p += 5;
// p += msg_putu32(p, data->scanCode);
//++keybox->nonce;
//// append mac at end of message
@@ -297,14 +297,14 @@ static void hookdest_Key_Event(struct inputevent *ev) {
// TODO(rta): do something interesting with button data
//uchar buf[28], *p = buf;
//msg_putasz4(p, 2); p += 1;
- // msg_putssz5(p, 8); memcpy(p + 1, "KeyInput", 8); p += 9;
+ // msg_putssz5(p, 8); mem_copy(p + 1, "KeyInput", 8); p += 9;
// msg_putmsz4(p, 2); p += 1;
- // msg_putssz5(p, 3); memcpy(p + 1, "key", 3); p += 4;
+ // msg_putssz5(p, 3); mem_copy(p + 1, "key", 3); p += 4;
// p += msg_puts32(p, ev->data);
- // msg_putssz5(p, 3); memcpy(p + 1, "btn", 3); p += 4;
+ // msg_putssz5(p, 3); mem_copy(p + 1, "btn", 3); p += 4;
// int idx = ev->type - BTNDOWN;
// msg_putssz5(p++, desclen[idx]);
- // memcpy(p, desc[idx], desclen[idx]); p += desclen[idx];
+ // mem_copy(p, desc[idx], desclen[idx]); p += desclen[idx];
}
orig_Key_Event(ev);
}
@@ -423,7 +423,7 @@ INIT {
if (GAMETYPE_MATCHES(L4D)) {
// copy into the keybox so key derivation blake2 gets a nice contiguous
// run of bytes
- memcpy(keybox->lbpub, lbpubkeys[LBPK_L4D], 32);
+ mem_copy(keybox->lbpub, lbpubkeys[LBPK_L4D], 32);
}
hook_commit_Key_Event(h.hookpos, hookdest_Key_Event);
return FEAT_OK;