what is meant by normalization in huge pointers

后端 未结 3 706
暗喜
暗喜 2021-01-05 11:14

I have a lot of confusion on understanding the difference between a \"far\" pointer and \"huge\" pointer, searched for it all over in google for a solution, couldnot find on

3条回答
  •  Happy的楠姐
    2021-01-05 11:41

    First thing to understand is how a segmented pointer is converted into a linear address. For the example you have, the conversion is:

    linear = segment * 16 + offset;
    

    Because of that, it turns out there there the same linear address can be expressed using different segment/offset combinations. For example, the following segment/offset combinations all refer to the same linear address:

    0004:0000
    0003:0010
    0002:0020
    0001:0030
    0000:0040
    

    The problem with this is that if you have ptr1 with a segmented address of 0100:0000 and ptr2 with a segmented address of 0010:0020, a simple comparison will determine that ptr1 != ptr2 even though they actually point to the same address.

    Normalization is the process by which you convert an address to a form such that if two non-normalized pointers refer to the same linear address, they will both be converted to the same normalized form.

提交回复
热议问题