Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bootloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
redox-os
bootloader
Commits
7ea16c73
Commit
7ea16c73
authored
8 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Prepare for higher half - map entire lower 4 GB
parent
babed67d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
x86/kernel.ld
+17
-9
17 additions, 9 deletions
x86/kernel.ld
x86/startup-x86_64.asm
+8
-3
8 additions, 3 deletions
x86/startup-x86_64.asm
with
25 additions
and
12 deletions
x86/kernel.ld
+
17
−
9
View file @
7ea16c73
ENTRY(kstart)
ENTRY(kstart)
OUTPUT_FORMAT(elf64-x86-64)
KERNEL_OFFSET = 0;
SECTIONS {
SECTIONS {
kernel_base = 0x101000;
. = 0x100000;
. = kernel_base;
. += SIZEOF_HEADERS;
. = ALIGN(4096);
. += KERNEL_OFFSET;
.text : AT(ADDR(.text) -
kernel_base
) {
.text : AT(ADDR(.text) -
KERNEL_OFFSET
) {
__text_start = .;
__text_start = .;
*(.text*)
*(.text*)
. = ALIGN(4096);
. = ALIGN(4096);
__text_end = .;
__text_end = .;
}
}
.rodata : AT(ADDR(.rodata) -
kernel_base
) {
.rodata : AT(ADDR(.rodata) -
KERNEL_OFFSET
) {
__rodata_start = .;
__rodata_start = .;
*(.rodata*)
*(.rodata*)
. = ALIGN(4096);
. = ALIGN(4096);
__rodata_end = .;
__rodata_end = .;
}
}
.data : AT(ADDR(.data) -
kernel_base
) {
.data : AT(ADDR(.data) -
KERNEL_OFFSET
) {
__data_start = .;
__data_start = .;
*(.data*)
*(.data*)
. = ALIGN(4096);
. = ALIGN(4096);
__data_end = .;
__data_end = .;
}
}
.bss : AT(ADDR(.bss) -
kernel_base
) {
.bss : AT(ADDR(.bss) -
KERNEL_OFFSET
) {
__bss_start = .;
__bss_start = .;
*(.bss*)
*(.bss*)
. = ALIGN(4096);
. = ALIGN(4096);
...
@@ -33,8 +40,9 @@ SECTIONS {
...
@@ -33,8 +40,9 @@ SECTIONS {
}
}
/DISCARD/ : {
/DISCARD/ : {
*(.comment)
*(.comment*)
*(.eh_frame)
*(.eh_frame*)
*(.rel.eh_frame)
*(.note*)
*(.rel.eh_frame*)
}
}
}
}
This diff is collapsed.
Click to expand it.
x86/startup-x86_64.asm
+
8
−
3
View file @
7ea16c73
...
@@ -53,7 +53,7 @@ startup_arch:
...
@@ -53,7 +53,7 @@ startup_arch:
xor
edi
,
edi
xor
edi
,
edi
xor
eax
,
eax
xor
eax
,
eax
mov
ecx
,
3
*
4096
/
4
;PML4, PDP, PD / moves 4 Bytes at once
mov
ecx
,
6
*
4096
/
4
;PML4, PDP,
4
PD / moves 4 Bytes at once
cld
cld
rep
stosd
rep
stosd
...
@@ -63,12 +63,15 @@ startup_arch:
...
@@ -63,12 +63,15 @@ startup_arch:
add
edi
,
0x1000
add
edi
,
0x1000
;Link last PML4 to PML4
;Link last PML4 to PML4
mov
DWORD
[
es
:
edi
-
8
],
0x70000
|
1
<<
1
|
1
mov
DWORD
[
es
:
edi
-
8
],
0x70000
|
1
<<
1
|
1
;Link first PDP to PD
;Link first
four
PDP to PD
mov
DWORD
[
es
:
edi
],
0x72000
|
1
<<
1
|
1
mov
DWORD
[
es
:
edi
],
0x72000
|
1
<<
1
|
1
mov
DWORD
[
es
:
edi
+
8
],
0x73000
|
1
<<
1
|
1
mov
DWORD
[
es
:
edi
+
16
],
0x74000
|
1
<<
1
|
1
mov
DWORD
[
es
:
edi
+
24
],
0x75000
|
1
<<
1
|
1
add
edi
,
0x1000
add
edi
,
0x1000
;Link all PD's (512 per PDP, 2MB each)y
;Link all PD's (512 per PDP, 2MB each)y
mov
ebx
,
1
<<
7
|
1
<<
1
|
1
mov
ebx
,
1
<<
7
|
1
<<
1
|
1
mov
ecx
,
512
mov
ecx
,
4
*
512
.setpd:
.setpd:
mov
[
es
:
edi
],
ebx
mov
[
es
:
edi
],
ebx
add
ebx
,
0x200000
add
ebx
,
0x200000
...
@@ -100,6 +103,8 @@ startup_arch:
...
@@ -100,6 +103,8 @@ startup_arch:
or
ebx
,
1
<<
31
|
1
<<
16
|
1
;Bit 31: Paging, Bit 16: write protect kernel, Bit 0: Protected Mode
or
ebx
,
1
<<
31
|
1
<<
16
|
1
;Bit 31: Paging, Bit 16: write protect kernel, Bit 0: Protected Mode
mov
cr0
,
ebx
mov
cr0
,
ebx
xchg
bx
,
bx
; far jump to enable Long Mode and load CS with 64 bit segment
; far jump to enable Long Mode and load CS with 64 bit segment
jmp
gdt.kernel_code
:
long_mode
jmp
gdt.kernel_code
:
long_mode
...
...
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