Hello, I'm working on the device management platform of my nanokernel.
However, I've ran into a problem. When a driver wishes to bind to a device exposed by the bus driver, it calls GlobalIO.BindDevice(DeviceID of the device, BusID on the bus it's expected to be found, Pointer to the driver device's class) (it's C++). My device driver platform
will search if the device is existing and if it is, it will assign the pointer to an array of pointers representing the device list of that bus. Now, here's the problem: the system needs to set some information about the bus number, and the device number in that bus. I'd like to do that in a constructor, because it won't allow the other drivers, and the upper system, to modify this information. So how do I do that, and if it's not possible, how could I implement a secure alternative ? Any help appreciated.
Running constructors manually
What is your question?
How to set constant members in a constructor?
How to make members write-once without making them constuctor-time const (because, for example, you don't have the complete information when you set up the object)?
If your question doesn't refer to one of the above, please elaborate. If it did, I would add the suggestion that your C++ experience does not seem up to par with OS development in that language.
How to set constant members in a constructor?
Code: Select all
class Driver
{
public:
Driver( int BusID, int DeviceID ) : mBusID( BusID ), mDeviceID( DeviceID ) { };
private:
int const mBusID;
int const mDeviceID;
};
Code: Select all
class Driver
{
public:
Driver() : mBusID( -1 ), mDeviceID( -1 ) {};
bool init( int BusID, DeviceID )
{
if ( mBusID != -1 || mDeviceID != -1 )
return false;
mBusID = BusID;
mDeviceID = DeviceID;
}
private:
int mBusID;
int mDeviceID;
};
Every good solution is obvious once you've found it.
-
- Posts: 15
- Joined: Sun Jan 28, 2007 8:45 am
- Location: Somewhere in the infinite dimension universe that my vast imagination is.
After some intensive thinking, I found a solution to my problem. I'm doing 'something' (If you can help me find the name) that looks like:
SysCore: Exports CPU, memory & paging, IRQ, and IO in an arch-independent way. It does not depend on any other higher level layer.
CoreKernel: It controls task management, does memory management via SysCore, and manages IPC.
SystemLib: It is pack of several userspace applications containing a basic userland and servers for the CoreKernel
SysCore: Exports CPU, memory & paging, IRQ, and IO in an arch-independent way. It does not depend on any other higher level layer.
CoreKernel: It controls task management, does memory management via SysCore, and manages IPC.
SystemLib: It is pack of several userspace applications containing a basic userland and servers for the CoreKernel
-
- Posts: 15
- Joined: Sun Jan 28, 2007 8:45 am
- Location: Somewhere in the infinite dimension universe that my vast imagination is.
Actually, it has no link (direct or not) with it. It's rather to have a second advice, cause someone told me:
SysCore -> Nanokernel
CoreKernel -> Microkernel
SystemLib -> Base userland (on that part, he's right, as SystemLib will include a small shell, a system tool, a physical copier (reduced version of Unix's 'dd') etc.) & Core services (looks like he thinks my OS is Windows ?).
Depending on the definition of a nanokernel, SysCore may be it or not. It is true that SysCore does not rely on neither CoreKernel or SystemLib. I've searched, and as far as I'm concerned, anything modular and new is a nanokernel.
How comes CoreKernel is a microkernel ? It's hardware independent. This may sound weird but it is (half).
For SystemLib, I'm in a mambo-jumbo of words.
In the end, I believe your definition is the best. Thanks.
SysCore -> Nanokernel
CoreKernel -> Microkernel
SystemLib -> Base userland (on that part, he's right, as SystemLib will include a small shell, a system tool, a physical copier (reduced version of Unix's 'dd') etc.) & Core services (looks like he thinks my OS is Windows ?).
Depending on the definition of a nanokernel, SysCore may be it or not. It is true that SysCore does not rely on neither CoreKernel or SystemLib. I've searched, and as far as I'm concerned, anything modular and new is a nanokernel.
How comes CoreKernel is a microkernel ? It's hardware independent. This may sound weird but it is (half).
For SystemLib, I'm in a mambo-jumbo of words.
In the end, I believe your definition is the best. Thanks.
- Kevin McGuire
- Member
- Posts: 843
- Joined: Tue Nov 09, 2004 12:00 am
- Location: United States
- Contact:
We have this button (below):synthetix wrote: Actually, it has no link (direct or not) with it. It's rather to have a second advice, cause someone told me:
You can push it when your current question deviates from the original question so much as to have no direct (specific) relation to the original question.
This button is also very magical in that it helps other users find questions that they can help someone with by giving a answer or feedback. What you end up doing is hurting your self more than anyone else by hiding a question beneath another one that is completely .... different.