Yeah my bad. Was working on my own OS where I *did* map 0x0 in VM. I just realised that other OS's don't tho.
The state of Twitter programmers
@71139247
ultracringe
>assuming it will crash
And that's how you get fucked by undefined behavior.
The first 1KiB is IVT
0x400 is BDA
and so on
Accessing REAL memory around 0x0 is a very stupid idea
>0x0 has to be readable
>Reading 0x0 and therefore NULL is legal.
#include
#include
int main()
{
int a = *((int*) NULL);
fprintf(stderr, "Value of a=%x\n", a);
return 0;
}
There's nothing preventing you from doing that. :)
Here's a fun fact, the macOS loader has a segment that is called SEG_NULL which maps the lower part of memory as non-writable and non-readable. I found this out when messing with the loader code on macOS and trying to reverse engineer a way of making minimal Mach-O binaries.
IVT and BDA is only relevant when running in 16-bit real-mode. IVT becomes the IDT and BDA can be safely overwritten in protected/long mode.
Interesting.
Holy shit nobody fucking cares, take your outrage bait back to /b/ or /trash/
SMM is still running when in protected mode and requires EBDA. it is mapped ~500k
what is this creature
That's a gender-fluid mutt