Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minimalOS
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
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
ty2-yuen
minimalOS
Commits
458fd013
Commit
458fd013
authored
4 years ago
by
ty2-yuen
Browse files
Options
Downloads
Patches
Plain Diff
Delete boot.s
parent
cb6cd53d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
minimalOS/boot.s
+0
-77
0 additions, 77 deletions
minimalOS/boot.s
with
0 additions
and
77 deletions
minimalOS/boot.s
deleted
100644 → 0
+
0
−
77
View file @
cb6cd53d
#
Declare
constants
used
for
creating
a
multiboot
header
.
.
set
ALIGN
,
1
<<
0
#
align
loaded
modules
on
page
boundaries
.
set
MEMINFO
,
1
<<
1
#
provide
memory
map
.
set
FLAGS
,
ALIGN
|
MEMINFO
#
this
is
the
Multiboot
'flag'
field
.
set
MAGIC
,
0x1BADB002
#
'magic number'
lets
bootloader
find
the
header
.
set
CHECKSUM
,
-(
MAGIC
+
FLAGS
)
#
checksum
of
above
,
to
prove
we
are
multiboot
#
Declare
a
header
as
in
the
Multiboot
Standard
.
We
put
this
into
a
special
#
section
so
we
can
force
the
header
to
be
in
the
start
of
the
final
program
.
#
You
don
't need to understand all these details as it is just magic values that
#
is
documented
in
the
multiboot
standard
.
The
bootloader
will
search
for
this
#
magic
sequence
and
recognize
us
as
a
multiboot
kernel
.
.
section
.
multiboot
.
align
4
.
long
MAGIC
.
long
FLAGS
.
long
CHECKSUM
#
Currently
the
stack
pointer
register
(
esp
)
points
at
anything
and
using
it
may
#
cause
massive
harm
.
Instead
,
we
'll provide our own stack. We will allocate
#
room
for
a
small
temporary
stack
by
creating
a
symbol
at
the
bottom
of
it
,
#
then
allocating
16384
bytes
for
it
,
and
finally
creating
a
symbol
at
the
top
.
.
section
.
bootstrap_stack
,
"aw"
,
@
nobits
stack_bottom
:
.
skip
16384
#
16
KiB
stack_top
:
#
The
linker
script
specifies
_start
as
the
entry
point
to
the
kernel
and
the
#
bootloader
will
jump
to
this
position
once
the
kernel
has
been
loaded
.
It
#
doesn
'
t
make
sense
to
return
from
this
function
as
the
bootloader
is
gone
.
.
section
.
text
.
global
_start
.
type
_start
,
@
function
_start
:
#
Welcome
to
kernel
mode
!
We
now
have
sufficient
code
for
the
bootloader
to
#
load
and
run
our
operating
system
.
It
doesn
't do anything interesting yet.
#
Perhaps
we
would
like
to
call
printf
(
"Hello, World\n"
)
.
You
should
now
#
realize
one
of
the
profound
truths
about
kernel
mode
:
There
is
nothing
#
there
unless
you
provide
it
yourself
.
There
is
no
printf
function
.
There
#
is
no
<
stdio
.
h
>
header
.
If
you
want
a
function
,
you
will
have
to
code
it
#
yourself
.
And
that
is
one
of
the
best
things
about
kernel
development
:
#
you
get
to
make
the
entire
system
yourself
.
You
have
absolute
and
complete
#
power
over
the
machine
,
there
are
no
security
restrictions
,
no
safe
#
guards
,
no
debugging
mechanisms
,
there
is
nothing
but
what
you
build
.
#
By
now
,
you
are
perhaps
tired
of
assembly
language
.
You
realize
some
#
things
simply
cannot
be
done
in
C
,
such
as
making
the
multiboot
header
in
#
the
right
section
and
setting
up
the
stack
.
However
,
you
would
like
to
#
write
the
operating
system
in
a
higher
level
language
,
such
as
C
or
C
++
.
#
To
that
end
,
the
next
task
is
preparing
the
processor
for
execution
of
#
such
code
.
C
doesn
't expect much at this point and we only need to set up
#
a
stack
.
Note
that
the
processor
is
not
fully
initialized
yet
and
stuff
#
such
as
floating
point
instructions
are
not
available
yet
.
#
To
set
up
a
stack
,
we
simply
set
the
esp
register
to
point
to
the
top
of
#
our
stack
(
as
it
grows
downwards
)
.
movl
$stack_top
,
%
esp
#
We
are
now
ready
to
actually
execute
C
code
.
We
cannot
embed
that
in
an
#
assembly
file
,
so
we
'll create a kernel.c file in a moment. In that file,
#
we
'll create a C entry point called kernel_main and call it here.
call
kernel_main
#
In
case
the
function
returns
,
we
'll want to put the computer into an
#
infinite
loop
.
To
do
that
,
we
use
the
clear
interrupt
(
'cli'
)
instruction
#
to
disable
interrupts
,
the
halt
instruction
(
'hlt'
)
to
stop
the
CPU
until
#
the
next
interrupt
arrives
,
and
jumping
to
the
halt
instruction
if
it
ever
#
continues
execution
,
just
to
be
safe
.
We
will
create
a
local
label
rather
#
than
real
symbol
and
jump
to
there
endlessly
.
cli
hlt
.
Lhang
:
jmp
.
Lhang
#
Set
the
size
of
the
_start
symbol
to
the
current
location
'.'
minus
its
start
.
#
This
is
useful
when
debugging
or
when
you
implement
call
tracing
.
.
size
_start
,
.
-
_start
This diff is collapsed.
Click to expand it.
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