steve@tellab3.UUCP (Steve Harpster) (06/13/85)
I'm running Xenix 286 and having problems writing a device driver (we have no source either). Basically, I'm trying to write to the enhanced color graphics adapter (EGA) directly. I know this starts at physical address 0xb8000 but I can't seem to get there. The special files /dev/mem and /dev/kmem look like this: ------------- <- 0 | mem | |------------ <- kmemstart | kmem | |------------ | more | mem ------------- ------------- <- ~0xa0000 | I/O devs | ------------- So obviously I can't use /dev/[k]mem. I haven't a clue as to what /dev/color or /dev/monochrome really do. The documentation doesn't say much and kinds of hints that these are worthless for what I'm trying to do. Next step was to write a driver where the xxwrite() routine just used cpass() to get a character from the user and stuff it into memory starting at 0xb8000. Sounds simple, right? When trying to write though, the kernel panics with a "General Protection Fault". What does this REALLY mean? I thought that once inside xxwrite(), I would be in kernel mode. Am I still in user mode? Do I have to write a "bottom half" to get to kernel mode (yeechy way because there are no interrupts, per se)? Or is there something else going on that I haven't thought of? Do I really want to use /dev/color instead? Any help would be GREATLY appreciated. Stephen Harpster Tellabs, Inc. ...ihnp4!tellab1!steve -- ...ihnp4!tellab1!steve Steve Harpster Tellabs, Inc.
alan@drivax.UUCP (Alan Fargusson) (06/16/85)
> Next step was to write a driver where the xxwrite() routine just used > cpass() to get a character from the user and stuff it into memory > starting at 0xb8000. > > Sounds simple, right? When trying to write though, the kernel panics > with a "General Protection Fault". What does this REALLY mean? I > thought that once inside xxwrite(), I would be in kernel mode. Am I > still in user mode? Do I have to write a "bottom half" to get to > kernel mode (yeechy way because there are no interrupts, per se)? > Or is there something else going on that I haven't thought of? > Do I really want to use /dev/color instead? Boy is there something you haven't thought of. The problem is that kernel address are relocated by the on chip memory management of the 286. XENIX runs in protected mode. The protection violation is because there is no valid address on a 286 of 0xb8000. You will have to make a GDT, or LDT entry (see the iNTEL manual) that has a base of 0xb8000 and construct a pointer that uses that GDT entry. This is not very easy and you will probably need the source to do it. Don't you just love segmentation. -- Alan Fargusson. { ihnp4, amdahl, mot }!drivax!alan