aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/node.rs
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-04-08 16:04:12 +0200
committerMiquel Sabaté Solà <mssola@mssola.com>2026-04-08 16:04:12 +0200
commita2cb050ca18fd7c5533d69e9aa093e4f0a40d0fa (patch)
tree9ee9c3c72804c7e78c4dc3e7382f29c669f6da35 /lib/xixanta/src/node.rs
parentabaffa61df7db8522d29869f7c455c59b8e96dbc (diff)
downloadtools.nes-a2cb050ca18fd7c5533d69e9aa093e4f0a40d0fa.tar.gz
tools.nes-a2cb050ca18fd7c5533d69e9aa093e4f0a40d0fa.zip
Implement the asan:stack statement
This statement allows programmers to reserve a memory range for the stack. This is useful to reserve a memory region which is not attached to any variable, and: 1. It is a way to safely reserve space on the $0100 page. 2. The --stats/--write-info flags will be able to add up the memory space reserved for the stack. 3. Future tooling might be able to use this value as a way to detect stack overflows. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'lib/xixanta/src/node.rs')
-rw-r--r--lib/xixanta/src/node.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/xixanta/src/node.rs b/lib/xixanta/src/node.rs
index 7a5cf3d..3803840 100644
--- a/lib/xixanta/src/node.rs
+++ b/lib/xixanta/src/node.rs
@@ -1,4 +1,5 @@
use std::fmt;
+use std::ops::Range;
/// Returns true if this String follows the naming
/// conventions as expected by the address sanitizer.
@@ -264,6 +265,7 @@ pub enum OperationType {
pub enum CommentType {
AsanReserveIdentifier(PString),
AsanReserve(usize),
+ AsanStack(Range<usize>),
AsanIgnore,
}
@@ -366,6 +368,7 @@ impl fmt::Display for NodeType {
NodeType::Comment(ct) => match ct {
CommentType::AsanReserveIdentifier(_) => write!(f, ";; asan:reserve"),
CommentType::AsanReserve(_) => write!(f, ";; asan:reserve"),
+ CommentType::AsanStack(_) => write!(f, ";; asan:stack"),
CommentType::AsanIgnore => write!(f, ";; asan:ignore"),
},
}