-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[FREELDR] Change base address for NTLDR compatibility #7527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
84eaa06 to
92edf3a
Compare
adf4ded to
d932b39
Compare
| #define FREELDR_PE_BASE HEX(21000) | ||
| #define TEMPCODE_BASE HEX(200000) | ||
| #define TEMPCODE16_BASE HEX(7000) | ||
| #define MEMORY_MARGIN HEX(9FC00) /* We need this much memory */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will have to be changed back before the merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing it back to HEX(88000) will limit freeldr to have 408KBs but i can change it to HEX(99000) because HEX(9FC00) is too big.
d613c38 to
e64cbbe
Compare
e64cbbe to
6dc2f86
Compare
| call ReadSectors | ||
|
|
||
| mov dl, byte ptr [BootDrive] // Load boot drive into DL | ||
| mov dl, byte ptr fs:[BootDrive] // Load boot drive into DL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not intended change
| AddressOfRealModeEntryPoint: | ||
| .long 0 // receives address of RealModeEntryPoint | ||
| .word HEX(20)//RMODE_CS | ||
| .word L_RMODE_CS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does that L_ prefix mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long mode
| /* Output status */ | ||
| mov si, offset Msg_SwitchToLongMode | ||
| call writestr | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code space
|
|
||
| /* Get flags CF, ZF and SF from the REGS structure */ | ||
| mov ax, word ptr cs:[BSS_RegisterSet + REGS_EFLAGS] | ||
| mov ax, word ptr ss:[BSS_RegisterSet + REGS_EFLAGS] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer using es instead of ss (which looks weird).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naive question: why would ES be preferrable ?
| .word HEX(9E00) | ||
| .word HEX(0000) | ||
| .word HEX(9B00) | ||
| .word HEX(008F) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 16 bits flat CS is necessary because we need 21 bits instruction pointer on > 0xffff base address
| #define FREELDR_BASE HEX(20000) | ||
| #define FREELDR_PE_BASE HEX(30000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
64k padding? Why not 0x21000? Or does the base have to be 64k aligned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 64k unaligned base address make freeldr_pe.exe fail to generate on MSVC
Purpose
This PR has the same purpose as #7501 but it changes the base address instead of "that relocation haxxory".
JIRA issue: CORE-19882
Warning
This PR is paused because of #7530
TODO