Skip to content

Commit

Permalink
Some setup for working on labels that do not lie within the code segm…
Browse files Browse the repository at this point in the history
…ent.
  • Loading branch information
sciguyryan committed Jul 17, 2024
1 parent ca23d53 commit 87982cf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions redox-core/src/compiling/executable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// [CODE]
// [DATA]
// [READ-ONLY DATA]
// The data will also be loaded into memory in the same configuration,
// though different segments will have slightly different permissions.

pub struct Executable {}

Expand Down
16 changes: 16 additions & 0 deletions redox-core/src/compiling/labels.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#[derive(Debug, Eq, PartialEq)]
pub enum LabelType {
Code,
Data,
Global,
}

#[derive(Debug, Eq, PartialEq)]
pub struct LabelEntry {
/// The [`LabelType`] of the label.
pub label_type: LabelType,
/// The name of the label.
pub label_name: String,
/// The position of the destination. This may be relative to the block or absolute, depending on the label type.
pub position: usize,
}
1 change: 1 addition & 0 deletions redox-core/src/compiling/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod compiler;
pub mod decompiler;
pub mod executable;
mod labels;
2 changes: 1 addition & 1 deletion redox-core/src/parsing/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod asm_parser;
mod data_declaration;
pub mod data_declaration;
mod type_hints;
5 changes: 1 addition & 4 deletions redox-terminal/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ fn main() {
panic!("currently unsupported");
}

let code = "section .data
banana db \"apples\"
waffles db \"waffles\"
section .text
let code = "section .text
push 0
call :LABEL_1
hlt
Expand Down

0 comments on commit 87982cf

Please sign in to comment.