+
+ if ((int64_t)str_id == -1) {
+ errno = EINVAL;
+ return (uint64_t)-1;
+ }
+
+ if (str_id == 0 && str == NULL) {
+ errno = EINVAL;
+ return (uint64_t)-1;
+ }
+
+ return __kdebug_trace_string(debugid, str_id, str);
+}
+
+static int
+kdebug_signpost_internal(uint32_t debugid, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4)
+{
+ if (KDBG_EXTRACT_CSC(debugid) != 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ debugid |= APPSDBG_CODE(DBG_APP_SIGNPOST, 0);
+
+ return kdebug_trace(debugid, arg1, arg2, arg3, arg4);
+}
+
+int
+kdebug_signpost(uint32_t code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4)
+{
+ return kdebug_signpost_internal(code << KDBG_CODE_OFFSET, arg1, arg2, arg3, arg4);
+}
+
+int
+kdebug_signpost_start(uint32_t code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4)
+{
+ return kdebug_signpost_internal((code << KDBG_CODE_OFFSET) | DBG_FUNC_START, arg1, arg2, arg3, arg4);
+}
+
+int
+kdebug_signpost_end(uint32_t code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4)
+{
+ return kdebug_signpost_internal((code << KDBG_CODE_OFFSET) | DBG_FUNC_END, arg1, arg2, arg3, arg4);