From: Andrew Lunn <andrew@lunn.ch>
To: Yi Tang <yitang@itee.uq.edu.au>
Cc: eCos-discuss <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] ecos kernel modification and kapidata
Date: Fri, 07 Sep 2007 09:32:00 -0000 [thread overview]
Message-ID: <20070907093158.GK32192@lunn.ch> (raw)
In-Reply-To: <000501c7f10a$81073a50$82406682@itee.uq.edu.au>
On Fri, Sep 07, 2007 at 02:49:41PM +1000, Yi Tang wrote:
> Hi,
>
> I'm currently doing some modification to ecos kernel, mainly trying to add
> a custom scheduler. I have created my own scheduler implementation file and
> changed some to kapi.cxx (hxx).
>
> I thought that's all. After finished the cdl modification to add the new
> scheduler, I tried to build the library. But during the compiling, it says
> I also need to do some modification to kapidata.hxx.
Could you be more specific about this....
> The thing is I don't understand the role this file takes in the whole
> kernel.
There is a nice comment in kapidata.h
Description: This file defines the structures used in the native API. The
// sizes of these structures are dependent on the system
// configuration and must be kept in step with their real
// counterparts in the C++ headers.
// IMPORTANT: It is NOT guaranteed that the fields of these
// structures correspond to the equivalent fields in the
// C++ classes they shadow.
//
// One oddity with this file is that the way many of the "mirror"
// classes are defined with macros. The resulting structures
// then have a "flat" layout, rather than just declaring a
// member structure directly in the structure. The reason for
// this is that as of GCC 3.x, the C++ compiler will optimise
// classes by removing padding and reusing it for subsequent
// members defined in a derived class. This affects some targets
// (including PowerPC and MIPS at least) when a C++ base class
// includes a long long. By instead arranging for the C structure
// to just list all the members directly, the compiler will then
// behave the same for the C structures as the C++ classes.
//
// This means that care has to be taken to follow the same
// methodology if new stuff is added to this file. Even if
// it doesn't contain long longs for your target, it may for
// others, depending on HAL definitions.
//
The memory for kernel data structures, like threads, mutexes, flags
etc are allocated in applications C code. However these structures are
actually used as classes in the C++ code. You need to ensure that the
C structure is the same size as the C++ class. If not, bad things will
happen. If you have added members to a class, you also need to add
extra members to the C structures. Otherwise too little memory will be
allocated.
> Also is there any other source file I need to modify?
Hard to say. It sounds like you have made major changes to the API, so
without seeing your code it is impossible to say.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
next prev parent reply other threads:[~2007-09-07 9:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-07 4:49 Yi Tang
2007-09-07 9:19 ` Andrew Lunn
2007-09-07 11:32 ` Paul D. DeRocco
2007-09-07 12:57 ` Nick Garnett
2007-09-07 9:32 ` Andrew Lunn [this message]
2007-09-11 14:22 ` Yi Tang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070907093158.GK32192@lunn.ch \
--to=andrew@lunn.ch \
--cc=ecos-discuss@ecos.sourceware.org \
--cc=yitang@itee.uq.edu.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).