Thanks XenOS for your reply,
I think i will have to write a little bit of assembly codes to make pointers read and write to SS offsets. The cause for what i do is that when a program calls System Call INT, System Call changes DS and ES to 0x10 (Kernel's Data Segment) and it keeps SS (in order to allow running tasks to call system call in the same time, so no violation will happen).
If System call wants to call a function in kernel, it makes vriables (which are made into SS) and calls the function, something like this function:
Code: Select all
void devman_getinfo(unsigned char id, unsigned short *irqs, unsigned short *cs, unsigned short *ds,
unsigned int *off, unsigned int *cls) {
This one needs to return irqs, cs, ds, off, and cls. so it does this:
Code: Select all
irqs[0] = devman_devices[id].irq[0] + (devman_devices[id].irq[1]<<8);
cs [0] = devman_devices[id].cs;
ds [0] = devman_devices[id].ds;
off [0] = devman_devices[id].entry;
cls [0] = devman_devices[id].cls;
all these data are written to DS, so System Call will not recieve anything! I think i shall make a function like 'stack_read' and 'stack_write', and 'devman_getinfo' will be like this:
Code: Select all
void devman_getinfo(unsigned char id, unsigned short *irqs, unsigned short *cs, unsigned short *ds,
unsigned int *off, unsigned int *cls) {
stack_write(devman_devices[id].irq[0] + (devman_devices[id].irq[1]<<8), irqs);
stack_write(devman_devices[id].cs, cs);
stack_write(devman_devices[id].ds, ds);
stack_write(devman_devices[id].entry, off);
stack_write(devman_devices[id].cls, cls);
}
Regards,
Mostafa