Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bootloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
bootloader
Compare revisions
10d302f3e0982f72f0020ee55368dce294daf171 to f44c3874782b0987f8c73260d2341ca046e1bd53
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
redox-os/bootloader
Select target project
No results found
f44c3874782b0987f8c73260d2341ca046e1bd53
Select Git revision
Branches
0.4.1
aarch64-revival
master
Tags
1.0.0
Swap
Target
redox-os/bootloader
Select target project
redox-os/bootloader
microcolonel/bootloader
noam93k/bootloader
carrot93/bootloader
tcrawford/bootloader
potatogim/bootloader
4lDO2/bootloader
Ivan/bootloader
uuuvn/bootloader
lewiszlw/bootloader
andar1an/bootloader
BjornTheProgrammer/bootloader
CodingRays/bootloader
ybalrid/bootloader
rus/bootloader
saraelsa/bootloader
willnode/bootloader
bjorn3/bootloader
jensliu29/bootloader
xTibor/bootloader
enygmator/bootloader
crclark96/bootloader
22 results
10d302f3e0982f72f0020ee55368dce294daf171
Select Git revision
Branches
0.4.1
aarch64-revival
master
Tags
1.0.0
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/os/uefi/mod.rs
+29
-28
29 additions, 28 deletions
src/os/uefi/mod.rs
src/serial_16550.rs
+16
-25
16 additions, 25 deletions
src/serial_16550.rs
targets/x86-unknown-none.json
+2
-2
2 additions, 2 deletions
targets/x86-unknown-none.json
with
47 additions
and
55 deletions
src/os/uefi/mod.rs
View file @
f44c3874
...
...
@@ -12,8 +12,8 @@ use std::{
use
uefi
::{
Handle
,
boot
::
LocateSearchType
,
reset
::
ResetType
,
memory
::
MemoryType
,
reset
::
ResetType
,
status
::{
Result
,
Status
},
system
::
SystemTable
,
text
::
TextInputKey
,
...
...
@@ -26,6 +26,7 @@ use crate::os::{
};
use
self
::{
device
::{
disk_device_priority
,
device_path_to_string
},
disk
::
DiskEfi
,
display
::{
EdidActive
,
Output
},
video_mode
::
VideoModeIter
,
...
...
@@ -33,9 +34,11 @@ use self::{
mod
acpi
;
mod
arch
;
mod
device
;
mod
disk
;
mod
display
;
mod
dtb
;
#[cfg(target_arch
=
"aarch64"
)]
pub
mod
dtb
;
mod
memory_map
;
mod
video_mode
;
...
...
@@ -163,39 +166,36 @@ impl Os<
}
fn
filesystem
(
&
self
,
password_opt
:
Option
<&
[
u8
]
>
)
->
syscall
::
Result
<
redoxfs
::
FileSystem
<
DiskEfi
>>
{
for
block_io
in
DiskEfi
::
all
()
.into_iter
()
{
if
!
block_io
.0
.Media.MediaPresent
{
// Search for RedoxFS on disks in prioritized order
println!
(
"Looking for RedoxFS:"
);
for
device
in
disk_device_priority
()
{
println!
(
" - {}"
,
device_path_to_string
(
device
.device_path
.0
));
if
!
device
.disk
.0
.Media.MediaPresent
{
continue
;
}
if
block_io
.0
.Media.LogicalPartition
{
match
redoxfs
::
FileSystem
::
open
(
block_io
,
password_opt
,
Some
(
0
),
false
)
{
Ok
(
ok
)
=>
return
Ok
(
ok
),
Err
(
err
)
=>
match
err
.errno
{
// Ignore header not found error
syscall
::
ENOENT
=>
(),
// Print any other errors
_
=>
{
log
::
warn!
(
"BlockIo error: {:?}"
,
err
);
}
}
}
let
block
=
if
device
.disk
.0
.Media.LogicalPartition
{
0
}
else
{
//TODO: get block from partition table
let
block
=
2
*
crate
::
MIBI
as
u64
/
redoxfs
::
BLOCK_SIZE
;
match
redoxfs
::
FileSystem
::
open
(
block_io
,
password_opt
,
Some
(
block
),
false
)
{
Ok
(
ok
)
=>
return
Ok
(
ok
),
Err
(
err
)
=>
match
err
.errno
{
// Ignore header not found error
syscall
::
ENOENT
=>
(),
// Print any other errors
_
=>
{
log
::
warn!
(
"BlockIo error: {:?}"
,
err
);
}
2
*
crate
::
MIBI
as
u64
/
redoxfs
::
BLOCK_SIZE
};
match
redoxfs
::
FileSystem
::
open
(
device
.disk
,
password_opt
,
Some
(
block
),
false
)
{
Ok
(
ok
)
=>
return
Ok
(
ok
),
Err
(
err
)
=>
match
err
.errno
{
// Ignore header not found error
syscall
::
ENOENT
=>
(),
// Print any other errors
_
=>
{
log
::
warn!
(
"BlockIo error: {:?}"
,
err
);
}
}
}
}
log
::
warn!
(
"No RedoxFS partitions found"
);
Err
(
syscall
::
Error
::
new
(
syscall
::
ENOENT
))
}
...
...
@@ -304,9 +304,10 @@ impl Os<
}
fn
set_text_position
(
&
self
,
x
:
usize
,
y
:
usize
)
{
status_to_result
(
// Ignore error because Tow-Boot appears to not implement this
let
_
=
status_to_result
(
(
self
.st.ConsoleOut.SetCursorPosition
)(
self
.st.ConsoleOut
,
x
,
y
)
)
.unwrap
(
);
);
}
fn
set_text_highlight
(
&
self
,
highlight
:
bool
)
{
...
...
This diff is collapsed.
Click to expand it.
src/serial_16550.rs
View file @
f44c3874
use
bitflags
::
bitflags
;
use
core
::
convert
::
TryInto
;
use
core
::
fmt
;
use
core
::
ptr
::{
addr_of
,
addr_of_mut
}
;
use
syscall
::
io
::{
Io
,
Mmio
,
ReadOnly
};
#[cfg(any(target_arch
=
"x86"
,
target_arch
=
"x86_64"
))]
use
syscall
::
io
::
Pio
;
...
...
@@ -71,24 +71,23 @@ where
T
::
Value
:
From
<
u8
>
+
TryInto
<
u8
>
,
{
pub
fn
init
(
&
mut
self
)
{
// Disable all interrupts
self
.int_en
.write
(
0x00
.into
());
// Use DLAB register
self
.line_ctrl
.write
(
0x80
.into
());
// Set divisor to 1 (115200 baud)
self
.data
.write
(
0x01
.into
());
self
.int_en
.write
(
0x00
.into
());
// 8 bits, no parity, one stop bit
self
.line_ctrl
.write
(
0x03
.into
());
// Enable FIFO, clear FIFO, 14-byte threshold
self
.fifo_ctrl
.write
(
0xC7
.into
());
// Enable IRQs and set RTS/DSR
self
.modem_ctrl
.write
(
0x0B
.into
());
unsafe
{
//TODO: Cleanup
// FIXME: Fix UB if unaligned
(
&
mut
*
addr_of_mut!
(
self
.int_en
))
.write
(
0x00
.into
());
(
&
mut
*
addr_of_mut!
(
self
.line_ctrl
))
.write
(
0x80
.into
());
(
&
mut
*
addr_of_mut!
(
self
.data
))
.write
(
0x01
.into
());
(
&
mut
*
addr_of_mut!
(
self
.int_en
))
.write
(
0x00
.into
());
(
&
mut
*
addr_of_mut!
(
self
.line_ctrl
))
.write
(
0x03
.into
());
(
&
mut
*
addr_of_mut!
(
self
.fifo_ctrl
))
.write
(
0xC7
.into
());
(
&
mut
*
addr_of_mut!
(
self
.modem_ctrl
))
.write
(
0x0B
.into
());
(
&
mut
*
addr_of_mut!
(
self
.int_en
))
.write
(
0x01
.into
());
}
}
fn
line_sts
(
&
self
)
->
LineStsFlags
{
LineStsFlags
::
from_bits_truncate
(
(
self
.line_sts
.read
()
&
0xFF
.into
())
(
unsafe
{
&*
addr_of!
(
self
.line_sts
)
}
.read
()
&
0xFF
.into
())
.try_into
()
.unwrap_or
(
0
),
)
...
...
@@ -97,7 +96,7 @@ where
pub
fn
receive
(
&
mut
self
)
->
Option
<
u8
>
{
if
self
.line_sts
()
.contains
(
LineStsFlags
::
INPUT_FULL
)
{
Some
(
(
self
.data
.read
()
&
0xFF
.into
())
(
unsafe
{
&*
addr_of!
(
self
.data
)
}
.read
()
&
0xFF
.into
())
.try_into
()
.unwrap_or
(
0
),
)
...
...
@@ -108,7 +107,7 @@ where
pub
fn
send
(
&
mut
self
,
data
:
u8
)
{
while
!
self
.line_sts
()
.contains
(
LineStsFlags
::
OUTPUT_EMPTY
)
{}
self
.data
.write
(
data
.into
())
unsafe
{
&
mut
*
addr_of_mut!
(
self
.data
)
}
.write
(
data
.into
())
}
pub
fn
write
(
&
mut
self
,
buf
:
&
[
u8
])
{
...
...
@@ -130,11 +129,3 @@ where
}
}
}
impl
<
T
:
Io
>
fmt
::
Write
for
SerialPort
<
T
>
where
T
::
Value
:
From
<
u8
>
+
TryInto
<
u8
>
{
fn
write_str
(
&
mut
self
,
s
:
&
str
)
->
fmt
::
Result
{
self
.write
(
s
.as_bytes
());
Ok
(())
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
targets/x86-unknown-none.json
View file @
f44c3874
...
...
@@ -3,7 +3,7 @@
"target-endian"
:
"little"
,
"target-pointer-width"
:
"32"
,
"target-c-int-width"
:
"32"
,
"data-layout"
:
"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
,
"data-layout"
:
"e-m:e-p:32:32-
p270:32:32-p271:32:32-p272:64:64-i128:128-
f64:32:64-f80:32-n8:16:32-S128"
,
"arch"
:
"x86"
,
"os"
:
"none"
,
"env"
:
""
,
...
...
@@ -16,7 +16,7 @@
"features"
:
"-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float"
,
"dynamic-linking"
:
false
,
"executables"
:
false
,
"relocation-model"
:
"
p
ic"
,
"relocation-model"
:
"
stat
ic"
,
"code-model"
:
"large"
,
"disable-redzone"
:
true
,
"frame-pointer"
:
"always"
,
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next