Skip to content

Commit ca11e5f

Browse files
committed
version 1.4
1 parent 5faf492 commit ca11e5f

File tree

2,404 files changed

+25681
-1954
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,404 files changed

+25681
-1954
lines changed

Diff for: Makefile.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ bits-1 = 64
1212
CFLAGS = -m$(bits-$(CONFIG_64)) -mno-red-zone -mno-sse -nostdinc -g -O \
1313
-ffreestanding -fno-builtin -fno-stack-protector $(backtrace) \
1414
-fno-strict-aliasing -Wall $(CONSTANTS-1) -I$(DIR) -Iinclude
15-
ASFLAGS = -m$(bits-$(CONFIG_64)) -g -Wa,-I,$(DIR)
15+
ASFLAGS = -m$(bits-$(CONFIG_64)) -g -Wa,-I,$(DIR) -Wa,--divide
1616
LDFLAGS = -m$(bits-$(CONFIG_64)) -g -nostdlib
1717
outo_p = $(outo)_p
1818
outa_p = $(outa)_p

Diff for: Makefile.common

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ objects = .objects
2525
boptions = .boptions
2626

2727
# OpenSSL
28-
OPENSSL_VERSION = 1.0.0g
28+
OPENSSL_VERSION = 1.0.0l
2929

3030
# V
3131
V-makeopt-0 := -s

Diff for: Makefile.config

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ include $(CONFIG)
44

55
# default configurations
66
gcc_support_64 := \
7-
$(shell gcc --target-help | grep -q x86_64: && echo -n 1 || echo -n 0)
8-
gcc_support_64 != gcc --target-help | grep -q x86_64: && echo -n 1 || echo -n 0
7+
$(shell $(CC) --target-help | grep -q x86_64: && /bin/echo -n 1 || /bin/echo -n 0)
8+
gcc_support_64 != $(CC) --target-help | grep -q x86_64: && /bin/echo -n 1 || /bin/echo -n 0
99
CONFIG_64 ?= $(gcc_support_64)
1010
CONFIG_DEBUG_GDB ?= 0
1111
CONFIG_SPINLOCK_DEBUG ?= 0
@@ -56,6 +56,7 @@ CONFIG_TCG_BIOS ?= $(CONFIG_64)
5656
CONFIG_BACKTRACE ?= 0
5757
CONFIG_VGA_INTEL_DRIVER ?= 0
5858
CONFIG_TTY_VGA ?= 0
59+
CONFIG_SHIFT_KEY_DEBUG ?= 0
5960

6061
# config list
6162
CONFIGLIST :=
@@ -111,10 +112,11 @@ CONFIGLIST += CONFIG_TCG_BIOS=$(CONFIG_TCG_BIOS)[TCG BIOS support]
111112
CONFIGLIST += CONFIG_BACKTRACE=$(CONFIG_BACKTRACE)[Enable backtrace in panic]
112113
CONFIGLIST += CONFIG_VGA_INTEL_DRIVER=$(CONFIG_VGA_INTEL_DRIVER)[Enable vga_intel driver]
113114
CONFIGLIST += CONFIG_TTY_VGA=$(CONFIG_TTY_VGA)[VMM output using VGA driver]
115+
CONFIGLIST += CONFIG_SHIFT_KEY_DEBUG=$(CONFIG_SHIFT_KEY_DEBUG)[Debug shell with shift key while booting]
114116

115117
.PHONY : update-config
116118
update-config :
117-
echo -n '$(CONFIGLIST)' | tr '[' '#' | tr ']' '\n' | \
119+
/bin/echo -n '$(CONFIGLIST)' | tr '[' '#' | tr ']' '\n' | \
118120
sed 's/^ //' > $(CONFIG)
119121

120122
.PHONY : config

Diff for: README

+34
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,37 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
294294
PURPOSE. */
295295

296296
---------------------------------------------------------------------------
297+
298+
8) EFI Development Kit (EDK)
299+
300+
Copyright (c) 2004, Intel Corporation
301+
All rights reserved.
302+
303+
Redistribution and use in source and binary forms, with or without
304+
modification, are permitted provided that the following conditions are
305+
met:
306+
307+
. Redistributions of source code must retain the above copyright
308+
notice, this list of conditions and the following disclaimer.
309+
310+
. Redistributions in binary form must reproduce the above copyright
311+
notice, this list of conditions and the following disclaimer in the
312+
documentation and/or other materials provided with the distribution.
313+
314+
. Neither the name of the Intel Corporation nor the names of its
315+
contributors may be used to endorse or promote products derived from
316+
this software without specific prior written permission.
317+
318+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
319+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
320+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
321+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
323+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
324+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
325+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
326+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
327+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
328+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
329+
330+
---------------------------------------------------------------------------

Diff for: bitvisor.lds

+9-4
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ SECTIONS {
99
. = virt;
1010
head = .;
1111
. = virt + SIZEOF_HEADERS;
12-
.text : AT (phys + (code - head)) {
12+
.entry : AT (phys + (code - head)) {
1313
code = .;
1414
*(.entry)
15+
*(.entry.text)
16+
*(.entry.data)
17+
} :all
18+
.text : AT (phys + (text - head)) {
19+
text = .;
1520
*(.text)
1621
codeend = .;
17-
} :all
22+
}
1823
.data : AT (phys + (data - head)) {
1924
data = .;
2025
*(.data)
@@ -25,8 +30,8 @@ SECTIONS {
2530
__process_builtin = .;
2631
*(.processes)
2732
__process_builtin_end = .;
28-
/* }
29-
.bss : AT (phys + (bss - head)) { */
33+
}
34+
.bss : AT (phys + (bss - head)) {
3035
bss = .;
3136
*(.bss)
3237
*(COMMON)

Diff for: boot/loader/bootloader.s

+50-158
Original file line numberDiff line numberDiff line change
@@ -38,177 +38,69 @@ entry: # 0x7C00
3838
.space 8 # 0x7C08 LBA
3939
.space 4 # 0x7C10 1st module start offset
4040
.space 4 # 0x7C14 2nd module start offset
41-
#.short 0x27 # 0x7C10 GDTR
42-
#.long 0x7C10 # 0x7C12
43-
#.short 0 # 0x7C16
44-
.quad 0x00CF9B000000FFFF # 0x7C18 0x08 CODE32
45-
.quad 0x008F93000000FFFF # 0x7C20 0x10 DATA32 not big
46-
.quad 0x00009B000000FFFF # 0x7C28 0x18 CODE16
47-
.quad 0x000093000000FFFF # 0x7C30 0x20 DATA16
48-
start: # 0x7C38
41+
start: # 0x7C18
4942
cli
5043
push %cs
5144
pop %ds
5245
push %cs
5346
pop %ss
54-
mov $0x7FFC,%sp # B flag of the stack segment is off
55-
mov %sp,%bp
56-
57-
# Enable A20
58-
in $0x92,%al
59-
or $0x2,%al
60-
out %al,$0x92
61-
62-
# Read sectors
63-
lea 0x7C00,%esi
64-
mov 4(%si),%ecx # length
65-
pushl %ecx
66-
lea 16(%si),%ebx
67-
pushl 4(%bx)
68-
pushl (%bx)
69-
mov %bx,(%bx)
70-
mov %ebx,2(%bx)
71-
mov $511,%bx
72-
add %ebx,%ecx
73-
mov $0x100000,%edi # destination address
74-
push %edi
75-
mov $'L'|('o'<<8)|('a'<<16)|('d'<<24),%eax
76-
call print
77-
shr $9,%ecx
78-
je error
79-
mov %ecx,%eax
80-
shr $6,%eax
81-
mov %ax,(%bp)
82-
mov %ax,2(%bp)
83-
mov $'i'|('n'<<8)|('g'<<16)|(' '<<24),%eax
84-
call print
85-
readloop:
86-
sti
87-
pushl %ecx
88-
movw $0x10,(%si)
89-
mov $0x40,%al
90-
cmpl %eax,%ecx
91-
jb readsmall
92-
mov %eax,%ecx
93-
readsmall:
94-
mov %cx,2(%si)
95-
mov $0x8000,%ax
96-
movl %eax,4(%si)
97-
mov $0x42,%ah
47+
mov $0x8000,%sp
48+
mov $0x7C00,%si
49+
pushl 20(%si) # 2nd module offset
50+
pushl 16(%si) # 1st module offset
51+
pushl 4(%si) # length
52+
movl $0xF000000,4(%si) # address (segment 0xF00 offset 0x0)
53+
pushw 6(%si) # the segment 0xF00
54+
mov $2,%cx # loop count 2
55+
1:
56+
pusha
57+
movl $0x400010,(%si) # size of packet (0x10) and 0x40 blocks
58+
mov $0x42,%ah # extended read command
9859
int $0x13
99-
jnc copy
60+
jc error
61+
popa
62+
addw $0x800,6(%si) # segment += 0x800
63+
addl $0x40,8(%si) # LBA += 0x40
64+
adcl $0,12(%si) #
65+
loop 1b
66+
cmpl $0x464C457F,0xF000 # ELF header correct?
67+
jne error
68+
pushw 0xF018 # Get an entry point address < 64KiB
69+
lretw
70+
1:
71+
call putchar
72+
.byte 0x38
10073
error:
101-
mov $'E'|('r'<<8)|('r'<<16)|('o'<<24),%eax
102-
call print
103-
mov $'r'|('!'<<8)|('\r'<<16)|('\n'<<24),%eax
104-
call print
74+
mov $errormsg-entry+0x7C00,%si
75+
cld
76+
lodsb
77+
test %al,%al
78+
jne 1b
79+
xchg %ah,%al
80+
rol $4,%al
81+
call hex4
82+
ror $4,%al
83+
call hex4
10584
int $0x16
10685
int $0x19
107-
toreal:
108-
mov %cx,%ds
109-
mov %cx,%es
110-
mov %cx,%ss
111-
jc error
112-
pop %ecx
113-
progressloop:
114-
decw 2(%si)
115-
js readloop
116-
lea '.'|('\b'<<8),%eax
117-
decw (%bp)
118-
jne progressprint
119-
pushw 2(%bp)
120-
popw (%bp)
121-
cbtw
122-
progressprint:
123-
call print
124-
dec %ecx
125-
jne progressloop
126-
mov $'\r'|('\n'<<8),%ax
127-
call print
128-
copy:
129-
mov $0x10,%bx
130-
lgdt (%bx,%si) # GDTR
131-
cli
132-
mov %cr0,%eax
133-
inc %ax
134-
mov %eax,%cr0
135-
ljmp $0x8,$to32-entry+0x7C00
136-
to16:
137-
mov $0x20,%bl
138-
mov %bx,%ds
139-
mov %bx,%es
140-
mov %bx,%ss
141-
dec %ax # CF is not affected
142-
mov %eax,%cr0
143-
ljmp $0x0,$toreal-entry+0x7C00
144-
print:
145-
pushal
86+
jmp .
87+
hex4:
88+
pusha
89+
and $0xF,%al
90+
add $0x90,%al
91+
daa
92+
adc $0x40,%al
93+
daa
94+
.byte 0x3C
95+
putchar:
96+
pusha
14697
mov $7,%bx
14798
mov $0xE,%ah
14899
int $0x10
149-
popal
150-
shr $8,%eax
151-
jne print
100+
popa
152101
ret
153-
.code32
154-
to32:
155-
mov %ebx,%ds
156-
mov %ebx,%es
157-
mov %ebx,%ss
158-
cld
159-
jecxz start32
160-
addl %ecx,8(%esi)
161-
adcl $0,12(%esi)
162-
push %esi
163-
mov 4(%esi),%esi
164-
shl $7,%ecx # CF should be zero after this
165-
rep movsl
166-
pop %esi
167-
error2:
168-
ljmpw $0x18,$to16-entry+0x7C00
169-
# Start
170-
start32:
171-
pop %esi # 0x100000
172-
# ELF header check
173-
cmpl $0x464C457F,(%esi) # ELF header correct?
174-
stc # Set CF
175-
jne error2 # No-
176-
# Make a multiboot info
177-
xor %eax,%eax
178-
lea 4(%bp),%edi
179-
push %edi # Clear multiboot info
180-
lea 88/4(%eax),%ecx
181-
rep stosl
182-
pop %ebx
183-
mov %dl,15(%ebx) # Write a drive number
184-
orb $2,(%ebx) # Set a boot device flag
185-
# Modules
186-
pop %eax # 1st module offset
187-
test %eax,%eax
188-
je dojmp
189-
mov %edi,24(%ebx) # Write a modules structure address
190-
orb $8,(%ebx) # Set a mods flag
191-
add %esi,%eax # Calculate the address of the module
192-
stosl # Store the 1st module start address
193-
pop %eax # 2nd module offset
194-
test %eax,%eax
195-
je modend
196-
add %esi,%eax # Calculate the address of the module
197-
stosl # Store the 1st module end address
198-
stosl # unused
199-
stosl # unused
200-
incl 20(%ebx) # Increment modules count
201-
stosl # Store the 2nd module start address
202-
modend:
203-
pop %eax # end of the data
204-
add %esi,%eax # Calculate the address
205-
stosl # Store the module end address
206-
stosl # unused
207-
stosl # unused
208-
incl 20(%ebx) # Increment modules count
209-
dojmp:
210-
mov 0x18(%esi),%si # Get an entry point address < 64KiB
211-
jmp *%esi
102+
errormsg:
103+
.string "Load error "
212104

213105
.org entry+0x1FE
214106
.byte 0x55

0 commit comments

Comments
 (0)