Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hyperion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Maintenance on Tuesday 15.4. at 14:00. ETA 60 - 90 minutes.
Show more breadcrumbs
Eemeli Lehtonen
hyperion
Commits
d53fd6d7
Commit
d53fd6d7
authored
2 years ago
by
Eemeli Lehtonen
Browse files
Options
Downloads
Patches
Plain Diff
Limine & BOOTBOOT
parent
d6707183
No related branches found
No related tags found
No related merge requests found
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/log.rs
+47
-0
47 additions, 0 deletions
src/log.rs
src/main.rs
+30
-0
30 additions, 0 deletions
src/main.rs
src/qemu.rs
+19
-0
19 additions, 0 deletions
src/qemu.rs
src/vga.rs
+0
-24
0 additions, 24 deletions
src/vga.rs
with
96 additions
and
24 deletions
src/log.rs
0 → 100644
+
47
−
0
View file @
d53fd6d7
use
core
::
fmt
::
Arguments
;
use
spin
::
Lazy
;
//
#[macro_export]
macro_rules!
print
{
(
$
(
$t:tt
)
*
)
=>
{
$crate
::
log
::
_print
(
format_args!
(
$
(
$t
)
*
))
};
}
#[macro_export]
macro_rules!
println
{
()
=>
{
$crate
::
log
::
_print
(
format_args!
(
"
\n
"
));
};
(
$
(
$t:tt
)
*
)
=>
{
$crate
::
log
::
_print
(
format_args_nl!
(
$
(
$t
)
*
));
};
}
//
static
LOGGER
:
Lazy
<
Logger
>
=
Lazy
::
new
(
Logger
::
init
);
struct
Logger
{
term
:
bool
,
qemu
:
bool
,
}
impl
Logger
{
fn
init
()
->
Self
{
Logger
{
term
:
true
,
qemu
:
true
,
}
}
fn
print
(
&
self
,
args
:
Arguments
)
{
if
self
.term
{
crate
::
arch
::
boot
::
_print
(
args
);
}
if
self
.qemu
{
crate
::
qemu
::
_print
(
args
);
}
}
}
#[doc(hidden)]
pub
fn
_print
(
args
:
Arguments
)
{
LOGGER
.print
(
args
)
}
This diff is collapsed.
Click to expand it.
src/
lib
.rs
→
src/
main
.rs
+
30
−
0
View file @
d53fd6d7
#![no_std]
#![no_std]
#![no_main]
#![no_main]
#![feature(format_args_nl)]
#![feature(abi_x86_interrupt)]
use
spin
::
Mutex
;
#[path
=
"arch/x86_64/mod.rs"
]
#[path
=
"arch/x86_64/mod.rs"
]
pub
mod
arch
;
pub
mod
arch
;
pub
mod
log
;
pub
mod
qemu
;
// pub mod vga;
pub
mod
vga
;
static
BOOTLOADER
:
Mutex
<&
'static
str
>
=
Mutex
::
new
(
"Hyperion"
)
;
#[panic_handler]
#[panic_handler]
fn
panic_handler
(
_
:
&
core
::
panic
::
PanicInfo
)
->
!
{
fn
panic_handler
(
_
:
&
core
::
panic
::
PanicInfo
)
->
!
{
...
@@ -12,10 +19,8 @@ fn panic_handler(_: &core::panic::PanicInfo) -> ! {
...
@@ -12,10 +19,8 @@ fn panic_handler(_: &core::panic::PanicInfo) -> ! {
}
}
fn
kernel_main
()
->
!
{
fn
kernel_main
()
->
!
{
// null byte clears the VGA buffer
println!
(
"Hello from Hyperion"
);
// print!("\0");
println!
(
" - Hyperion was booted with {}"
,
BOOTLOADER
.lock
());
// println!("Hello from Hyperion, pointer = {pointer:#x}, fb = {fb:#x}");
loop
{
loop
{
unsafe
{
unsafe
{
...
...
This diff is collapsed.
Click to expand it.
src/qemu.rs
0 → 100644
+
19
−
0
View file @
d53fd6d7
use
core
::
fmt
::{
Arguments
,
Write
};
use
spin
::{
Lazy
,
Mutex
};
use
uart_16550
::
SerialPort
;
//
static
COM1
:
Lazy
<
Mutex
<
SerialPort
>>
=
Lazy
::
new
(||
{
let
mut
port
=
unsafe
{
SerialPort
::
new
(
0x3f8
)
};
port
.init
();
Mutex
::
new
(
port
)
});
//
#[doc(hidden)]
pub
fn
_print
(
args
:
Arguments
)
{
let
mut
writer
=
COM1
.lock
();
writer
.write_fmt
(
args
)
.unwrap
();
}
This diff is collapsed.
Click to expand it.
src/vga.rs
+
0
−
24
View file @
d53fd6d7
...
@@ -7,30 +7,6 @@ use volatile::Volatile;
...
@@ -7,30 +7,6 @@ use volatile::Volatile;
//
//
#[macro_export]
macro_rules!
println
{
()
=>
{
println!
(
""
);
};
(
$
(
$arg:tt
)
*
)
=>
{
$crate
::
vga
::
_println
(
format_args!
(
$
(
$arg
)
*
))
}
}
#[macro_export]
macro_rules!
print
{
()
=>
{
print!
(
""
);
};
(
$
(
$arg:tt
)
*
)
=>
{
$crate
::
vga
::
_print
(
format_args!
(
$
(
$arg
)
*
))
};
}
//
pub
struct
Writer
{
pub
struct
Writer
{
cursor
:
[
usize
;
2
],
cursor
:
[
usize
;
2
],
color
:
ColorCode
,
color
:
ColorCode
,
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment