does the loader changes the relocation table when it knows segmentation is off (noaways)?












0















let me try to explain my vague question.



A few days ago i started to learn about paging and segmentation, and I understood that today the segmentation is ignored by setting all the segments base to 0 and their max to the limit- 2^32 (also known as flat memory model).



But before that, and also today(altough ignored), each memory reference was combined of a segment register: segment offset. the segment register is a selector that contains an index to the segment in the segments table, which contains the base address of the segment. as I said before now its all 0. this memory reference is also known as "logical address".



From the way i see it, in the times where each segment had its own memory space, we would reach the first byte of code with: call CS:0 and the first byte of data with [DS:0].



But today it just would not work (i think), because all the segments uses the same memory space so the code needs to be different. foe Example, the first byte of code shoould be at (arbitrary address) call CS:0x4567 (just absolute and not an offset like before)
and the first data byte will be at (arbitrary address) [DS:0x12121212].



So it turns out that the same code should be a little bit different when it will be loaded to the ram with or without segmentation. so my question is, am I talking sense? if not please explain me the truth because all I mentioned are speculations. And if I am correct, does the loader do all this relocation magic (because it knows whether segmentation is on or off)? because in the way I see it, with segmentation on and off the code should be a little bit different from the reasons i mentioned above.



thank you, and have a nice day.










share|improve this question

























  • can someone answer? :/

    – ליאב לוי
    Nov 24 '18 at 13:56
















0















let me try to explain my vague question.



A few days ago i started to learn about paging and segmentation, and I understood that today the segmentation is ignored by setting all the segments base to 0 and their max to the limit- 2^32 (also known as flat memory model).



But before that, and also today(altough ignored), each memory reference was combined of a segment register: segment offset. the segment register is a selector that contains an index to the segment in the segments table, which contains the base address of the segment. as I said before now its all 0. this memory reference is also known as "logical address".



From the way i see it, in the times where each segment had its own memory space, we would reach the first byte of code with: call CS:0 and the first byte of data with [DS:0].



But today it just would not work (i think), because all the segments uses the same memory space so the code needs to be different. foe Example, the first byte of code shoould be at (arbitrary address) call CS:0x4567 (just absolute and not an offset like before)
and the first data byte will be at (arbitrary address) [DS:0x12121212].



So it turns out that the same code should be a little bit different when it will be loaded to the ram with or without segmentation. so my question is, am I talking sense? if not please explain me the truth because all I mentioned are speculations. And if I am correct, does the loader do all this relocation magic (because it knows whether segmentation is on or off)? because in the way I see it, with segmentation on and off the code should be a little bit different from the reasons i mentioned above.



thank you, and have a nice day.










share|improve this question

























  • can someone answer? :/

    – ליאב לוי
    Nov 24 '18 at 13:56














0












0








0








let me try to explain my vague question.



A few days ago i started to learn about paging and segmentation, and I understood that today the segmentation is ignored by setting all the segments base to 0 and their max to the limit- 2^32 (also known as flat memory model).



But before that, and also today(altough ignored), each memory reference was combined of a segment register: segment offset. the segment register is a selector that contains an index to the segment in the segments table, which contains the base address of the segment. as I said before now its all 0. this memory reference is also known as "logical address".



From the way i see it, in the times where each segment had its own memory space, we would reach the first byte of code with: call CS:0 and the first byte of data with [DS:0].



But today it just would not work (i think), because all the segments uses the same memory space so the code needs to be different. foe Example, the first byte of code shoould be at (arbitrary address) call CS:0x4567 (just absolute and not an offset like before)
and the first data byte will be at (arbitrary address) [DS:0x12121212].



So it turns out that the same code should be a little bit different when it will be loaded to the ram with or without segmentation. so my question is, am I talking sense? if not please explain me the truth because all I mentioned are speculations. And if I am correct, does the loader do all this relocation magic (because it knows whether segmentation is on or off)? because in the way I see it, with segmentation on and off the code should be a little bit different from the reasons i mentioned above.



thank you, and have a nice day.










share|improve this question
















let me try to explain my vague question.



A few days ago i started to learn about paging and segmentation, and I understood that today the segmentation is ignored by setting all the segments base to 0 and their max to the limit- 2^32 (also known as flat memory model).



But before that, and also today(altough ignored), each memory reference was combined of a segment register: segment offset. the segment register is a selector that contains an index to the segment in the segments table, which contains the base address of the segment. as I said before now its all 0. this memory reference is also known as "logical address".



From the way i see it, in the times where each segment had its own memory space, we would reach the first byte of code with: call CS:0 and the first byte of data with [DS:0].



But today it just would not work (i think), because all the segments uses the same memory space so the code needs to be different. foe Example, the first byte of code shoould be at (arbitrary address) call CS:0x4567 (just absolute and not an offset like before)
and the first data byte will be at (arbitrary address) [DS:0x12121212].



So it turns out that the same code should be a little bit different when it will be loaded to the ram with or without segmentation. so my question is, am I talking sense? if not please explain me the truth because all I mentioned are speculations. And if I am correct, does the loader do all this relocation magic (because it knows whether segmentation is on or off)? because in the way I see it, with segmentation on and off the code should be a little bit different from the reasons i mentioned above.



thank you, and have a nice day.







assembly memory-management linker operating-system






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 15:54







ליאב לוי

















asked Nov 24 '18 at 11:08









ליאב לויליאב לוי

304




304













  • can someone answer? :/

    – ליאב לוי
    Nov 24 '18 at 13:56



















  • can someone answer? :/

    – ליאב לוי
    Nov 24 '18 at 13:56

















can someone answer? :/

– ליאב לוי
Nov 24 '18 at 13:56





can someone answer? :/

– ליאב לוי
Nov 24 '18 at 13:56












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53457507%2fdoes-the-loader-changes-the-relocation-table-when-it-knows-segmentation-is-off%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53457507%2fdoes-the-loader-changes-the-relocation-table-when-it-knows-segmentation-is-off%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks