From b70cb5c663255b46ece13e6758a5cb3e58d9a95c Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 1 Apr 2010 15:18:01 -0700 Subject: Add kernel-writing functions for guru only * runtime/loc2c-runtime.h (store_deref_string): New. * tapset/conversions-guru.stp (set_kernel_*): New guru functions. --- runtime/loc2c-runtime.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'runtime/loc2c-runtime.h') diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h index c75639ee..bd1faa51 100644 --- a/runtime/loc2c-runtime.h +++ b/runtime/loc2c-runtime.h @@ -1011,6 +1011,17 @@ extern void __store_deref_bad(void); (dst); \ }) +#define store_deref_string(src, addr, maxbytes) \ + ({ \ + uintptr_t _addr; \ + size_t _len; \ + char *_s = (src); \ + for (_len = (maxbytes), _addr = (uintptr_t)(addr); \ + _len > 1 && _s && *_s != '\0'; --_len, ++_addr) \ + store_deref(1, _addr, *_s++); \ + store_deref(1, _addr, '\0'); \ + }) + #define CATCH_DEREF_FAULT() \ if (0) { \ deref_fault: ; \ -- cgit