projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3e41f8b
)
Change to deal with crappy GAS bug.
author
Ben Pfaff
<blp@cs.stanford.edu>
Tue, 4 Jan 2005 07:12:08 +0000
(07:12 +0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Tue, 4 Jan 2005 07:12:08 +0000
(07:12 +0000)
src/threads/loader.S
patch
|
blob
|
history
diff --git
a/src/threads/loader.S
b/src/threads/loader.S
index 811d2b60be1f2c89706d51ae4dd6ef48dea99792..2bfe1a45304c8756fb1cba4b14bd30af076c6320 100644
(file)
--- a/
src/threads/loader.S
+++ b/
src/threads/loader.S
@@
-70,12
+70,13
@@
start:
cli
cld
cli
cld
-# Set up data segments
and stack
.
+# Set up data segments.
sub ax, ax
mov es, ax
mov ds, ax
sub ax, ax
mov es, ax
mov ds, ax
+# Set up stack segment.
# Stack grows downward starting from us.
# We don't ever use the stack so this is strictly speaking
# unnecessary.
# Stack grows downward starting from us.
# We don't ever use the stack so this is strictly speaking
# unnecessary.
@@
-109,7
+110,7
@@
start:
mov al, 0xdf
out 0x60, al
mov al, 0xdf
out 0x60, al
-#### Get memory size, via interrupt 15h function 88h
. R
eturns CF
+#### Get memory size, via interrupt 15h function 88h
, which r
eturns CF
#### clear if successful, with AX = (kB of physical memory) - 1024.
#### This only works for memory sizes <= 65 MB, which should be fine
#### for our purposes. We cap memory at 64 MB because that's all we
#### clear if successful, with AX = (kB of physical memory) - 1024.
#### This only works for memory sizes <= 65 MB, which should be fine
#### for our purposes. We cap memory at 64 MB because that's all we
@@
-140,11
+141,17
@@
start:
# Also add identical PDEs starting at LOADER_PHYS_BASE.
# See [IA32-v3] section 3.7.6 for a description of the bits in eax.
# Also add identical PDEs starting at LOADER_PHYS_BASE.
# See [IA32-v3] section 3.7.6 for a description of the bits in eax.
+# A bug in some versions of GAS prevents us from using the straightforward
+# mov es:[di + LOADER_PHYS_BASE / 1024 / 1024], eax
+# so we calculate the displacement in bx instead.
+
mov eax, 0x11007
mov ecx, 0x11
mov eax, 0x11007
mov ecx, 0x11
- sub edi, edi
+ sub di, di
+ mov ebx, LOADER_PHYS_BASE
+ shr ebx, 20
1: mov es:[di], eax
1: mov es:[di], eax
- mov es:
LOADER_PHYS_BASE / 1024 / 1024[
di], eax
+ mov es:
[bx +
di], eax
add di, 4
add eax, 0x1000
loop 1b
add di, 4
add eax, 0x1000
loop 1b
@@
-155,8
+162,8
@@
start:
mov ax, 0x1100
mov es, ax
mov eax, 0x7
mov ax, 0x1100
mov es, ax
mov eax, 0x7
- mov
e
cx, 0x4000
- sub
edi, e
di
+ mov cx, 0x4000
+ sub
di,
di
1: mov es:[di], eax
add di, 4
add eax, 0x1000
1: mov es:[di], eax
add di, 4
add eax, 0x1000
@@
-169,10
+176,6
@@
start:
#### Switch to protected mode.
#### Switch to protected mode.
-# First we turn off interrupts because we don't set up an IDT.
-
- cli
-
# Then we point the GDTR to our GDT. Protected mode requires a GDT.
# We need a data32 prefix to ensure that all 32 bits of the GDT
# descriptor are loaded (default is to load only 24 bits).
# Then we point the GDTR to our GDT. Protected mode requires a GDT.
# We need a data32 prefix to ensure that all 32 bits of the GDT
# descriptor are loaded (default is to load only 24 bits).