|
@@ -50,16 +50,14 @@
|
50
|
50
|
.arch i386
|
51
|
51
|
.org 0
|
52
|
52
|
.section ".prefix", "ax", @progbits
|
53
|
|
-_prefix:
|
54
|
|
-
|
55
|
53
|
/*
|
56
|
54
|
This is a minimal boot sector. If anyone tries to execute it (e.g., if
|
57
|
55
|
a .lilo file is dd'ed to a floppy), print an error message.
|
58
|
56
|
*/
|
59
|
57
|
|
60
|
58
|
bootsector:
|
61
|
|
- jmp $BOOTSEG, $go - _prefix /* reload cs:ip to match relocation addr */
|
62
|
|
-go:
|
|
59
|
+ jmp $BOOTSEG, $1f /* reload cs:ip to match relocation addr */
|
|
60
|
+1:
|
63
|
61
|
movw $0x2000, %di /* 0x2000 is arbitrary value >= length
|
64
|
62
|
of bootsect + room for stack */
|
65
|
63
|
|
|
@@ -73,7 +71,7 @@ go:
|
73
|
71
|
sti
|
74
|
72
|
|
75
|
73
|
movw $why_end-why, %cx
|
76
|
|
- movw $why - _prefix, %si
|
|
74
|
+ movw $why, %si
|
77
|
75
|
|
78
|
76
|
movw $0x0007, %bx /* page 0, attribute 7 (normal) */
|
79
|
77
|
movb $0x0e, %ah /* write char, tty mode */
|
|
@@ -93,7 +91,7 @@ setup_sects:
|
93
|
91
|
root_flags:
|
94
|
92
|
.word 0
|
95
|
93
|
syssize:
|
96
|
|
- .word _verbatim_size_pgh - PREFIXPGH
|
|
94
|
+ .word _load_size_pgh - PREFIXPGH
|
97
|
95
|
swap_dev:
|
98
|
96
|
.word 0
|
99
|
97
|
ram_size:
|
|
@@ -105,6 +103,8 @@ root_dev:
|
105
|
103
|
boot_flag:
|
106
|
104
|
.word 0xAA55
|
107
|
105
|
|
|
106
|
+
|
|
107
|
+ .org 512
|
108
|
108
|
/*
|
109
|
109
|
We're now at the beginning of the second sector of the image -
|
110
|
110
|
where the setup code goes.
|
|
@@ -115,27 +115,33 @@ boot_flag:
|
115
|
115
|
executing the Etherboot image that's loaded at SYSSEG:0 and
|
116
|
116
|
whose entry point is SYSSEG:0.
|
117
|
117
|
*/
|
118
|
|
-setup_code:
|
119
|
|
- pushl $0 /* No parameters to preserve for exit path */
|
120
|
|
- pushw $0 /* Use prefix exit path mechanism */
|
|
118
|
+setup_code:
|
121
|
119
|
/* Etherboot expects to be contiguous in memory once loaded.
|
122
|
120
|
* LILO doesn't do this, but since we don't need any
|
123
|
121
|
* information that's left in the prefix, it doesn't matter:
|
124
|
122
|
* we just have to ensure that %cs:0000 is where the start of
|
125
|
123
|
* the Etherboot image *would* be.
|
126
|
124
|
*/
|
127
|
|
- ljmp $(SYSSEG-(PREFIXSIZE/16)), $_start
|
128
|
|
-
|
129
|
|
- .section ".text16", "ax", @progbits
|
130
|
|
-prefix_exit:
|
131
|
|
- int $0x19 /* should try to boot machine */
|
132
|
|
-prefix_exit_end:
|
133
|
|
- .previous
|
134
|
|
-
|
135
|
|
- .org (PREFIXSIZE-1)
|
136
|
|
- .byte 0
|
137
|
|
-prefix_end:
|
138
|
|
-/*
|
139
|
|
- That's about it.
|
140
|
|
-*/
|
|
125
|
+ ljmp $(SYSSEG-(PREFIXSIZE/16)), $run_etherboot
|
|
126
|
+
|
141
|
127
|
|
|
128
|
+ .org PREFIXSIZE
|
|
129
|
+/*
|
|
130
|
+ We're now at the beginning of the kernel proper.
|
|
131
|
+ */
|
|
132
|
+run_etherboot:
|
|
133
|
+ call install
|
|
134
|
+
|
|
135
|
+ /* Jump to .text16 segment */
|
|
136
|
+ pushw %ax
|
|
137
|
+ pushw $1f
|
|
138
|
+ lret
|
|
139
|
+ .section ".text16", "awx", @progbits
|
|
140
|
+1:
|
|
141
|
+ pushl $main
|
|
142
|
+ pushw %cs
|
|
143
|
+ call prot_call
|
|
144
|
+ popl %eax /* discard */
|
|
145
|
+
|
|
146
|
+ /* Boot next device */
|
|
147
|
+ int $0x18
|