muta...@gmail.com
2021-05-02 03:33:35 UTC
It is very convenient for me to go:
*(char *)0 = 0;
to generate an exception, but that is not an exception
under PDOS/386, and I am wondering what is required
to change that.
I can't think of any reason why PDOS/386 needs to write
to low memory and disturb the real mode interrupt
vectors, but I'd be happy to start with just the first 4
bytes, if that is technically allowed.
Here is what I currently have:
typedef struct {
unsigned short limit;
unsigned short base15_0;
unsigned char base23_16;
unsigned char access;
unsigned char gran_limit;
unsigned char base31_24;
} descriptor;
static struct {
descriptor null_descriptor;
descriptor os_code;
descriptor os_data;
descriptor small_code;
descriptor small_data;
descriptor spawn_code;
descriptor spawn_data;
} descriptors = {
{0},
{ 0xffff, 0x0, 0xff, 0x9a, 0xcf, 0xff },
{ 0xffff, 0x0, 0xff, 0x92 /* not code, goes up, writable */, 0xcf, 0xff},
{ 0xffff, 0x0, /* scbase */ 0x00, 0x9a, 0x00, 0x00 },
{ 0xffff, 0x0, /* sdbase */ 0x00, 0x92, 0x00, 0x00 },
{ 0xffff, 0x0, 0x00, 0x9a, 0xcf, 0x00 },
{ 0xffff, 0x0, 0xff, 0x92, 0xcf, 0xff }
};
It looks to me like if I change:
{ 0xffff, 0x0, /* sdbase */ 0x00, 0x92, 0x00, 0x00 },
to:
{ 0xffff, 0x4, /* sdbase */ 0x00, 0x92, 0x00, 0x00 },
it might do what I want.
I can see the following potential problems:
1. A small number like 0x4 might not be allowed.
2. The size of 0xffff may no longer be acceptable and
need to be adjusted to at least 0xfffe
3. A reference to 0xb8000 may actually give me
0xb8004.
Anyone know what I need to do to prevent NULL pointer
assignment? I'm expecting to get an interrupt D if anyone
tries to write there. I don't mind if reads are allowed or not.
Thanks. Paul.
*(char *)0 = 0;
to generate an exception, but that is not an exception
under PDOS/386, and I am wondering what is required
to change that.
I can't think of any reason why PDOS/386 needs to write
to low memory and disturb the real mode interrupt
vectors, but I'd be happy to start with just the first 4
bytes, if that is technically allowed.
Here is what I currently have:
typedef struct {
unsigned short limit;
unsigned short base15_0;
unsigned char base23_16;
unsigned char access;
unsigned char gran_limit;
unsigned char base31_24;
} descriptor;
static struct {
descriptor null_descriptor;
descriptor os_code;
descriptor os_data;
descriptor small_code;
descriptor small_data;
descriptor spawn_code;
descriptor spawn_data;
} descriptors = {
{0},
{ 0xffff, 0x0, 0xff, 0x9a, 0xcf, 0xff },
{ 0xffff, 0x0, 0xff, 0x92 /* not code, goes up, writable */, 0xcf, 0xff},
{ 0xffff, 0x0, /* scbase */ 0x00, 0x9a, 0x00, 0x00 },
{ 0xffff, 0x0, /* sdbase */ 0x00, 0x92, 0x00, 0x00 },
{ 0xffff, 0x0, 0x00, 0x9a, 0xcf, 0x00 },
{ 0xffff, 0x0, 0xff, 0x92, 0xcf, 0xff }
};
It looks to me like if I change:
{ 0xffff, 0x0, /* sdbase */ 0x00, 0x92, 0x00, 0x00 },
to:
{ 0xffff, 0x4, /* sdbase */ 0x00, 0x92, 0x00, 0x00 },
it might do what I want.
I can see the following potential problems:
1. A small number like 0x4 might not be allowed.
2. The size of 0xffff may no longer be acceptable and
need to be adjusted to at least 0xfffe
3. A reference to 0xb8000 may actually give me
0xb8004.
Anyone know what I need to do to prevent NULL pointer
assignment? I'm expecting to get an interrupt D if anyone
tries to write there. I don't mind if reads are allowed or not.
Thanks. Paul.