Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Feb 8, 2024
1 parent 87e371b commit 360298a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() -> anyhow::Result<()> {
} else {
Path::new("src/arch/x86_64/entry.s")
};
assemble_entry(entry).unwrap();
// assemble_entry(entry).unwrap();
}

Ok(())
Expand Down
12 changes: 6 additions & 6 deletions src/arch/x86_64/entry.s
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@ L1:
push ecx
popfd
xor eax, ecx
jz OFFSET Linvalid
jz Linvalid

# cpuid > 0x80000000?
mov eax, 0x80000000
cpuid
cmp eax, 0x80000001
jb OFFSET Linvalid # It is less, there is no long mode.
jb Linvalid # It is less, there is no long mode.

# do we have a long mode?
mov eax, 0x80000001
cpuid
test edx, 1 << 29 # Test if the LM-bit, which is bit 29, is set in the D-register.
jz OFFSET Linvalid # They aren't, there is no long mode.
jz Linvalid # They aren't, there is no long mode.

# Set CR3
mov eax, OFFSET boot_pml4
Expand Down Expand Up @@ -173,7 +173,7 @@ L1:

# there is no long mode
Linvalid:
jmp OFFSET Linvalid
jmp Linvalid

.code64
start64:
Expand All @@ -192,8 +192,8 @@ start64:

# jump to the boot processors's C code
.extern loader_main
jmp OFFSET loader_main
jmp OFFSET start64+0x28
jmp loader_main
jmp start64+0x28

.section .data

Expand Down
2 changes: 2 additions & 0 deletions src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ impl MemoryManagement for Mem {
}
}

core::arch::global_asm!(include_str!("entry.s"));

// FUNCTIONS
pub fn message_output_init() {
unsafe { COM1.init() };
Expand Down

0 comments on commit 360298a

Please sign in to comment.