36 lines
893 B
Nim
36 lines
893 B
Nim
# SPDX-License-Identifier: LSL-1.0
|
|
# Copyright (c) 2026 Markus Maiwald
|
|
# Stewardship: Self Sovereign Society Foundation
|
|
#
|
|
# This file is part of the Nexus Sovereign Core.
|
|
# See legal/LICENSE_SOVEREIGN.md for license terms.
|
|
|
|
## Rumpk Layer 1: Panic Override (Emergency Procedures)
|
|
|
|
# Rumpk Panic Override
|
|
# Required for Nim --os:any / --os:standalone
|
|
# This file must be named panicoverride.nim
|
|
|
|
{.push stackTrace: off.}
|
|
|
|
proc console_write(p: pointer, len: csize_t) {.importc, cdecl.}
|
|
proc rumpk_halt() {.importc, cdecl, noreturn.}
|
|
|
|
proc rawoutput(s: string) =
|
|
if s.len > 0:
|
|
console_write(unsafeAddr s[0], csize_t(s.len))
|
|
|
|
proc panic(s: cstring) {.exportc, noreturn.} =
|
|
rawoutput("[PANIC] ")
|
|
if s != nil:
|
|
var i = 0
|
|
while s[i] != '\0':
|
|
var buf: array[1, char]
|
|
buf[0] = s[i]
|
|
console_write(addr buf[0], 1)
|
|
inc i
|
|
rawoutput("\n")
|
|
rumpk_halt()
|
|
|
|
{.pop.}
|