Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSEP551
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Krishna Vinnakota
CSEP551
Commits
887f1968
Commit
887f1968
authored
15 years ago
by
Russ Cox
Browse files
Options
Downloads
Patches
Plain Diff
bootasm cleanup
parent
8b75366c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bootasm.S
+1
-2
1 addition, 2 deletions
bootasm.S
bootother.S
+11
-10
11 additions, 10 deletions
bootother.S
with
12 additions
and
12 deletions
bootasm.S
+
1
−
2
View file @
887f1968
...
...
@@ -86,8 +86,7 @@ gdt:
SEG_NULLASM
#
null
seg
SEG_ASM
(
STA_X
|
STA_R
,
0x0
,
0xffffffff
)
#
code
seg
SEG_ASM
(
STA_W
,
0x0
,
0xffffffff
)
#
data
seg
SEG_ASM
(
STA_W
,
0x100
,
0xffffffff
)
#
per
-
cpu
data
seg
; 0x100 is okay for now
gdtdesc
:
.
word
0x1f
#
sizeof
(
gdt
)
-
1
.
word
(
gdtdesc
-
gdt
-
1
)
#
sizeof
(
gdt
)
-
1
.
long
gdt
#
address
gdt
This diff is collapsed.
Click to expand it.
bootother.S
+
11
−
10
View file @
887f1968
...
...
@@ -19,15 +19,15 @@
#
-
it
uses
the
address
at
start
-
4
for
the
%
esp
#
-
it
jumps
to
the
address
at
start
-
8
instead
of
calling
bootmain
.
set
PROT_MODE_CSEG
,
0x8
#
kernel
code
segment
selector
.
set
PROT_MODE_DSEG
,
0x10
#
kernel
data
segment
selector
.
set
CR0_PE_ON
,
0x1
#
protected
mode
enable
flag
#define SEG_KCODE 1 // kernel code
#define SEG_KDATA 2 // kernel data+stack
#define CR0_PE 1 // protected mode enable bit
.
code16
#
Assemble
for
16
-
bit
mode
.
globl
start
start
:
.
code16
#
Assemble
for
16
-
bit
mode
cli
#
Disable
interrupts
cld
#
String
operations
increment
#
Set
up
the
important
data
segment
registers
(
DS
,
ES
,
SS
)
.
xorw
%
ax
,%
ax
#
Segment
number
zero
...
...
@@ -42,22 +42,23 @@ start:
#
effective
memory
map
does
not
change
during
the
switch
.
lgdt
gdtdesc
movl
%
cr0
,
%
eax
orl
$CR0_PE
_ON
,
%
eax
orl
$CR0_PE
,
%
eax
movl
%
eax
,
%
cr0
#
Jump
to
next
instruction
,
but
in
32
-
bit
code
segment
.
#
Switches
processor
into
32
-
bit
mode
.
ljmp
$
PROT_MODE_CSEG
,
$protcseg
ljmp
$
(
SEG_KCODE
<<
3
)
,
$protcseg
.
code32
#
Assemble
for
32
-
bit
mode
protcseg
:
#
Set
up
the
protected
-
mode
data
segment
registers
movw
$
PROT_MODE_DSEG
,
%
ax
#
Our
data
segment
selector
movw
$
(
SEG_KDATA
<<
3
)
,
%
ax
#
Our
data
segment
selector
movw
%
ax
,
%
ds
#
->
DS
:
Data
Segment
movw
%
ax
,
%
es
#
->
ES
:
Extra
Segment
movw
%
ax
,
%
ss
#
->
SS
:
Stack
Segment
movw
$
0
,
%
ax
#
Zero
segments
not
ready
for
use
movw
%
ax
,
%
fs
#
->
FS
movw
%
ax
,
%
gs
#
->
GS
movw
%
ax
,
%
ss
#
->
SS
:
Stack
Segment
movl
start
-
4
,
%
esp
movl
start
-
8
,
%
eax
...
...
@@ -81,5 +82,5 @@ gdt:
SEG_ASM
(
STA_W
,
0x0
,
0xffffffff
)
#
data
seg
gdtdesc
:
.
word
0x17
#
sizeof
(
gdt
)
-
1
.
word
(
gdtdesc
-
gdt
-
1
)
#
sizeof
(
gdt
)
-
1
.
long
gdt
#
address
gdt
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