Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xv6-19au
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
csep551
xv6-19au
Commits
e97519a6
Commit
e97519a6
authored
15 years ago
by
rsc
Browse files
Options
Downloads
Patches
Plain Diff
sync with c; .text is implied
parent
ba6cd8a6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bootasm.S
+12
-9
12 additions, 9 deletions
bootasm.S
trapasm.S
+13
-7
13 additions, 7 deletions
trapasm.S
vectors.pl
+0
-2
0 additions, 2 deletions
vectors.pl
with
25 additions
and
18 deletions
bootasm.S
+
12
−
9
View file @
e97519a6
...
...
@@ -5,15 +5,16 @@
#
memory
at
physical
address
0x7c00
and
starts
executing
in
real
mode
#
with
%
cs
=
0
%
ip
=
7
c00
.
.
set
CSEG32
,
0x8
#
kernel
code
segment
selector
.
set
DSEG32
,
0x10
#
kernel
data
segment
selector
.
set
CR0_PE
,
0x1
#
protected
mode
enable
flag
#define SEG_KCODE 1 // kernel code
#define SEG_KDATA 2 // kernel data+stack
#define SEG_KCPU 3 // kernel per-cpu data
#define CR0_PE 1 // protected mode enable bit
.
code16
#
Assemble
for
16
-
bit
mode
.
globl
start
start
:
cli
#
Disable
interrupts
cld
#
String
operations
increment
#
Set
up
the
important
data
segment
registers
(
DS
,
ES
,
SS
)
.
xorw
%
ax
,%
ax
#
Segment
number
zero
...
...
@@ -53,18 +54,19 @@ seta20.2:
#
Jump
to
next
instruction
,
but
in
32
-
bit
code
segment
.
#
Switches
processor
into
32
-
bit
mode
.
ljmp
$
C
SEG
32
,
$start32
ljmp
$
(
SEG
_KCODE
<<
3
)
,
$start32
.
code32
#
Assemble
for
32
-
bit
mode
start32
:
#
Set
up
the
protected
-
mode
data
segment
registers
movw
$
D
SEG
32
,
%
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
$
(
SEG_KCPU
<<
3
),
%
ax
#
Our
per
-
cpu
segment
selector
movw
%
ax
,
%
fs
#
->
FS
movw
%
ax
,
%
gs
#
->
GS
movw
%
ax
,
%
ss
#
->
SS
:
Stack
Segment
#
Set
up
the
stack
pointer
and
call
into
C
.
movl
$start
,
%
esp
call
bootmain
...
...
@@ -85,7 +87,8 @@ 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
0x1
7
#
sizeof
(
gdt
)
-
1
.
word
0x1
f
#
sizeof
(
gdt
)
-
1
.
long
gdt
#
address
gdt
This diff is collapsed.
Click to expand it.
trapasm.S
+
13
−
7
View file @
e97519a6
.
text
.
set
SEG_KDATA_SEL
,
0x10
#
selector
for
SEG_KDATA
#define SEG_KCODE 1 // kernel code
#define SEG_KDATA 2 // kernel data+stack
#define SEG_KCPU 3 // kernel per-cpu data
#
vectors
.
S
sends
all
traps
here
.
.
globl
alltraps
...
...
@@ -12,10 +12,16 @@ alltraps:
pushl
%
gs
pushal
#
Set
up
data
segments
.
movl
$SEG_KDATA_SEL
,
%
eax
movw
%
ax
,%
ds
movw
%
ax
,%
es
#
Set
up
data
and
per
-
cpu
segments
.
#
Can
find
out
KDATA
from
%
ss
.
#
Assume
that
KCPU
is
KDATA
+
1
.
movw
$
(
SEG_KDATA
<<
3
),
%
ax
movw
%
ss
,
%
ax
movw
%
ax
,
%
ds
movw
%
ax
,
%
es
movw
$
(
SEG_KCPU
<<
3
),
%
ax
movw
%
ax
,
%
fs
movw
%
ax
,
%
gs
#
Call
trap
(
tf
),
where
tf
=%
esp
pushl
%
esp
...
...
This diff is collapsed.
Click to expand it.
vectors.pl
+
0
−
2
View file @
e97519a6
...
...
@@ -7,7 +7,6 @@
print
"
# generated by vectors.pl - do not edit
\n
";
print
"
# handlers
\n
";
print
"
.text
\n
";
print
"
.globl alltraps
\n
";
for
(
my
$i
=
0
;
$i
<
256
;
$i
++
){
print
"
.globl vector
$i
\n
";
...
...
@@ -29,7 +28,6 @@ for(my $i = 0; $i < 256; $i++){
# sample output:
# # handlers
# .text
# .globl alltraps
# .globl vector0
# vector0:
...
...
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