Usefulness of UEFI

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: Usefulness of UEFI

Post by nullplan »

linguofreak wrote:I think it has more to do with C itself than any specific compiler. C was simply designed on the assumption of a flat memory model (with the exception of the fact that it can handle separate code and data spaces).
This is just plain false. C was designed with complex address spaces in mind. Why else are there all these weird rules about pointer arithmetic and what pointer comparisons are allowed? If C was designed with flat address spaces in mind, it would have just been "compare the numbers", but those are not the rules. The fact that the DOS compilers made a hash of things with their __far pointers doesn't invalidate that they could have just made all pointers far. That would have been a valid implementation.
Carpe diem!
rdos
Member
Member
Posts: 3297
Joined: Wed Oct 01, 2008 1:55 pm

Re: Usefulness of UEFI

Post by rdos »

nullplan wrote:
linguofreak wrote:I think it has more to do with C itself than any specific compiler. C was simply designed on the assumption of a flat memory model (with the exception of the fact that it can handle separate code and data spaces).
This is just plain false. C was designed with complex address spaces in mind. Why else are there all these weird rules about pointer arithmetic and what pointer comparisons are allowed? If C was designed with flat address spaces in mind, it would have just been "compare the numbers", but those are not the rules. The fact that the DOS compilers made a hash of things with their __far pointers doesn't invalidate that they could have just made all pointers far. That would have been a valid implementation.
The basic problem is that the compiler must minimize the number of far pointers (segment register loads) in order to achieve optimal performance. Watcom has based pointers, but I don't think these work in an optimal way. Ideally, all pointers should be typed so it was possible to determine if they were far pointer, ss-based, ds-based or cs-based near pointers. Then the segment part could be passed on stack or in segment registers (es, fs, gs).
Post Reply