Re: Interchangeable device drivers
Posted: Tue Jan 21, 2014 1:12 pm
You're right, the osdep structs are a good point why it's not even possible for a single version. Too bad, I can keep pulling a Linus on API stability.
The Place to Start for Operating System Developers
https://f.osdev.org/
And how do you handle relocation? ...turdus wrote:You simply don't understand.
The whole point is: let's say you have a kernel in ELF, that knows nothing about PE format. With UDRV you'll still able to load and use a driver in that non-native format, by searching for UDRV block and get the info from there. No sources, no compilation. You would be also able to configure the devices driven by that driver in a standard way.
The __TEXT segment of these binaries starts somewhere around 8GB past the load address...turdus wrote:@Owen: "I regularly run binaries where there is a greater than 4GB difference between the load address of the lowest segment and the end of the binary"
And what? I don't think you split the text section. It's easier to keep it just as is, and allocate memory for data at whatever address you want. Nothing stops you from that, still 32 bit more than enough to mark entry points within text.
CDI has a central registry. Go contribute it to there...turdus wrote:About CDI category: "So add a category?" Great, and my kernel will have a category that no other OS knows about. You really fail to see the benefit of a central registry such as PCI ID class?
The file system protocol seems to be synchronous. No defined threading model - and if your threading model involves shared memory concurrency, its' a hard threading model which will result in many bugs.turdus wrote:"too simplistic for anything but the most basic of hobby kernels"
Give it a think again. It was it's goal to be simplistic, and to help hobby kernel developers. And I disagree on it's only useful for basics.
What relevance has age?turdus wrote:About no UDI drivers and no UDRV drivers: the difference is that UDRV is a draft, while UDI is over 4 years old. Despite of that, you compare them?!?
So VMS was a bad example.turdus wrote:"The commonality between, say, the UNIX and VMS command line interfaces is very slim." Don't tell me, I used to be a VMS system admin for years, and UNIX twice the time. And you're wrong, they have a lot of common. In fact, there's only minor difference in syntax, not semantics.
The central registry is cdi.git.turdus wrote:About CDI category: "So add a category?" Great, and my kernel will have a category that no other OS knows about. You really fail to see the benefit of a central registry such as PCI ID class?
I recently bought a wifi adaptor for my rpi and found that I need to rebuild the driver every time I perform kernel upgrade, even just one reversion ahead without anything matter to the driver.Kevin wrote:You're right, the osdep structs are a good point why it's not even possible for a single version. Too bad, I can keep pulling a Linus on API stability.
UDRV does not handle it in any way. It's the duty of your kernel. UDRV simply marks entry points within image.Owen wrote:And how do you handle relocation? ...
In this case you map the image at 8GB, so you should add 8G to every entry point to get effective address. Tadaa! Would be the same procedure if mapping address was 0x1234000, wasn't it? Within text use PIC-relative addresses if possible (requires additional relocation information for protected mode. But UDRV is not for the past, it's for the future, and thankfully none needed for long mode).Owen wrote:The __TEXT segment of these binaries starts somewhere around 8GB past the load address...
Now that's what I call reinventing the wheel. To my opinion there's no need for yet another registry (by the way, PCI ID covers much more and totally open. Not to mention it's editable like a wiki.)Owen wrote:CDI has a central registry. Go contribute it to there...
Threading model is just like the mapping address, out of the scope. It has nothing to do with the driver model. If you want to execute the same driver in separated threads, then it's your kernel's duty let that happen without interference. If the driver is supposed to use shared memory, it must be able to use that for locks or semaphores as well. If memory is shared among threads of the same driver, there's no problem; however drivers need to speak the same language on locking, but that's totally out of the scope of UDRV.Owen wrote:The file system protocol seems to be synchronous. No defined threading model - and if your threading model involves shared memory concurrency, its' a hard threading model which will result in many bugs.
I think you have been misguided by names. It's totally valid to issue a command to a driver, which returns instantly with a sequence number, and later on, when the job is done, informs your kernel via sendsignal(sequence). Originally it was called notifykernel, but sendsignal seemed more like POSIX. The supported mode can be queried via getcapability(). If both sync and async supported, kernel can switch by applying a cmd(this,"sync",true/false) call.Owen wrote:But mainly, it seems to be synchronous, which is just a terrible idea.
Much. 4 years enough to write a lot of drivers, on the other hand you won't get far with them in 0 sec.Owen wrote:What relevance has age?
Why? I think it's just as good as any other would. You see every command language mimic the structure of human sentence. There's a verb about what to do, and other words narrowing on how to do it and with what. Quite common.Owen wrote:So VMS was a bad example.
Beside of the obvious fact that no new specification will ever be implemented on a proprietary end of life OS, this is from the wiki:Owen wrote:How about Mac OS Classic?
If it's not clear, you have to provide exactly the same commands (reset, get, set, list, path optionally update). It does not matter if "reset" (or any translated version) is spoken, typed or clicked on, the specification expects the same to happen from the device's point of view.If you do some extreme stuff without shell, you'll need to provide a way to communicate with the UDRV compatible devices (voice command, GUI whatever).
So I CAN'T use a PE driver on an ELF kernel. As I suspected!turdus wrote:UDRV does not handle it in any way. It's the duty of your kernel. UDRV simply marks entry points within image.Owen wrote:And how do you handle relocation? ...
The load address of these binaries is 8GB before the __TEXT segment, because there is another (8GB!) segment before the text segment.turdus wrote:In this case you map the image at 8GB, so you should add 8G to every entry point to get effective address. Tadaa! Would be the same procedure if mapping address was 0x1234000, wasn't it? Within text use PIC-relative addresses if possible (requires additional relocation information for protected mode. But UDRV is not for the past, it's for the future, and thankfully none needed for long mode).Owen wrote:The __TEXT segment of these binaries starts somewhere around 8GB past the load address...
Find me the PCI ID for a keyboardturdus wrote:Now that's what I call reinventing the wheel. To my opinion there's no need for yet another registry (by the way, PCI ID covers much more and totally open. Not to mention it's editable like a wiki.)Owen wrote:CDI has a central registry. Go contribute it to there...
So, what? A driver is supposed to support being invoked on a single device from multiple threads or a single thread or whatever the kernel wants?turdus wrote:Threading model is just like the mapping address, out of the scope. It has nothing to do with the driver model. If you want to execute the same driver in separated threads, then it's your kernel's duty let that happen without interference. If the driver is supposed to use shared memory, it must be able to use that for locks or semaphores as well. If memory is shared among threads of the same driver, there's no problem; however drivers need to speak the same language on locking, but that's totally out of the scope of UDRV.Owen wrote:The file system protocol seems to be synchronous. No defined threading model - and if your threading model involves shared memory concurrency, its' a hard threading model which will result in many bugs.
And how does it pass information back to the kernel?turdus wrote:I think you have been misguided by names. It's totally valid to issue a command to a driver, which returns instantly with a sequence number, and later on, when the job is done, informs your kernel via sendsignal(sequence). Originally it was called notifykernel, but sendsignal seemed more like POSIX. The supported mode can be queried via getcapability(). If both sync and async supported, kernel can switch by applying a cmd(this,"sync",true/false) call.Owen wrote:But mainly, it seems to be synchronous, which is just a terrible idea.
(Hint: as mentioned before on this forum long ago, my kernel supports 4 system calls, 2 for synchronous and 2 for asynchronous messaging. If anyone, I would not build on synchronous only )
I see no relevance. UDRV isn't going to magically attain drivers by being young.turdus wrote:Much. 4 years enough to write a lot of drivers, on the other hand you won't get far with them in 0 sec.Owen wrote:What relevance has age?
OK, so its' a "maybe available" command line interface.turdus wrote:Why? I think it's just as good as any other would. You see every command language mimic the structure of human sentence. There's a verb about what to do, and other words narrowing on how to do it and with what. Quite common.Owen wrote:So VMS was a bad example.
Beside of the obvious fact that no new specification will ever be implemented on a proprietary end of life OS, this is from the wiki:Owen wrote:How about Mac OS Classic?If it's not clear, you have to provide exactly the same commands (reset, get, set, list, path optionally update). It does not matter if "reset" (or any translated version) is spoken, typed or clicked on, the specification expects the same to happen from the device's point of view.If you do some extreme stuff without shell, you'll need to provide a way to communicate with the UDRV compatible devices (voice command, GUI whatever).
You can.Owen wrote:So I CAN'T use a PE driver on an ELF kernel. As I suspected!
Who cares? Add the offset where you have the binary mapped and you're good to go. Referencing data segment before the text segment with PIC is rather easy.Owen wrote:The load address of these binaries is 8GB before the __TEXT segment, because there is another (8GB!) segment before the text segment.
Class: 0x09 Input device controllerOwen wrote:Find me the PCI ID for a keyboard
No. The driver is supposed to execute in multiple threads, that's all. There are drivers that typically runs as single thread, like PS2 keyboard driver. You won't have more of that on one board, on the other hand you may have several network cards of the same chipset.Owen wrote:So, what? A driver is supposed to support being invoked on a single device from multiple threads or a single thread or whatever the kernel wants?
Look, any process that's not capable of proper lock handling would be horrifically buggy. Not UDRV specific in any way.Owen wrote:OK, great, every driver is going to be horrifically buggy from threading issues that were untested on its' origin platform.
Read the spec. It's there.Owen wrote:And how does it pass information back to the kernel?
How does it request notification of events?
Because the spec says so. Why do POSIX have standard stream as 0,1,2?Owen wrote:Why are we passing back sequence numbers, rather than some form of pointer or handle?
It has nothing to do with POSIX singals, I must remind you. It's a callback.Owen wrote:Why are we considering "POSIX signals design", when they're widely considered to be one of the worst aspects of POSIX (from the perspective of doing complex things)?
Something you would know if the spec would be ready. Now you'll never know.Owen wrote:How do I allocate a sequence number? What happens if sequence number allocation fails? What happens if memory allocation fails?
Bad for you. You've compared a draft to a specification already in use.Owen wrote:I see no relevance.turdus wrote:4 years enough to write a lot of drivers, on the other hand you won't get far with them in 0 sec.
Having a standard way to configure drivers? How come you don't see?Owen wrote:Maybe slightly useful, but I don't see any great utility in that.
Yes.Owen wrote:(BTW, Mac OS Classic was just an example of an OS without a command line. They may be rare, but they exist. Of course, one can hypothesize an OS where the "command line" is not built upon programs)