473,769 Members | 5,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data type and register location errors on compilation

4 New Member
Hi all! I'm a French student currently doing an internship in Beijing. I have to simulate a mips machine running with the micro kernel l4. When i compile the kernel i got some compilation errors. I solved most of them but here I'm stuck and I hope you could help me.
Here is the error message :

/home/antoine/Final/pistachio/kernel/src/api/v4/exregs.cc:233:2 : warning: #warning VU: do we have to preserve prios on ex-regs?
/home/antoine/Final/pistachio/kernel/src/api/v4/exregs.cc:248:2 : warning: #warning eSk: Halting a thread with ongoing kernel operations is not supported
/home/antoine/Final/pistachio/kernel/src/api/v4/exregs.cc: In function `threadid_t sys_exchange_re gisters(threadi d_t, word_t, word_t, word_t, word_t, word_t, threadid_t, bool)':
/home/antoine/Final/pistachio/kernel/src/api/v4/exregs.cc:333: error: data type of 'pgr' isn't suitable for a register
/home/antoine/Final/pistachio/kernel/src/api/v4/exregs.cc:333: error: register name given for non-register variable 'pgr'
/home/antoine/Final/pistachio/kernel/src/api/v4/exregs.cc:333: confused by earlier errors, bailing out
make[1]: *** [src/api/v4/exregs.o] Error 1

And here is the concerned code :

Expand|Select|Wrap|Line Numbers
  1. // Only allow exregs on:
  2.     //  - active threads
  3.     //  - in the same address space
  4.     //  - with a valid thread ID.
  5.     if ((! tcb->is_activated ()) || (! has_exregs_perms(tcb, dest_tid)) )
  6.     {
  7.     get_current_tcb ()->set_error_code (EINVALID_THREAD);
  8.     return_exchange_registers (threadid_t::nilthread (), 0, 0, 0, 0,
  9.                    threadid_t::nilthread (), 0);
  10.     }
  11.  
The 333 line is the one beginning with return_... and I've searched what is pgr all over the file but I've found nor variables neither functions with this name.
Hope you'll understand this better than me ;)
Thanks
Antoine
Jul 6 '07 #1
7 3013
weaknessforcats
9,208 Recognized Expert Moderator Expert
Is it in a library? It may not be in your source code.
Jul 6 '07 #2
antoine
4 New Member
In fact I've continued to search and i ve found this portion of code in an included file :

Expand|Select|Wrap|Line Numbers
  1. #define return_exchange_registers(result, control, sp, ip, flags, pager, handle)    \
  2. {                                \
  3.     register word_t ctrl asm("$4") = control;    /* a0 */    \
  4.     register word_t sp_r asm("$5") = sp;    /* a1 */    \
  5.     register word_t ip_r asm("$6") = ip;    /* a2 */    \
  6.     register word_t flg asm("$7") = flags;    /* a3 */    \
  7.     register threadid_t pgr asm("$8") = pager;    /* t0 */    \
  8.     register word_t hdl asm("$9") = handle;    /* t1 */    \
  9. \
  10.     __asm__ __volatile__ (                    \
  11.     "" : : "r" (ctrl), "r" (sp_r), "r" (ip_r),        \
  12.     "r" (flg), "r" (pgr), "r" (hdl)                \
  13.     );                                \
  14.     return (result);                        \
  15. }
  16.  
With this it becomes a bit clearer. I think that we can't put a threadid_t into a register. But what can i do to solve that? Is register a predefined type in C++ or not?
I hope it would help you to help me ;)
Bye
Antoine
Jul 9 '07 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
register is a strage class specifer. It suggests to the compiler that the variable should be kept in a register instead of existing as a variable in memory. The compiler is free to ignore this suggestion.

A register is most likely 32 or 64 bits depending on the chip. If your threadid_t fits you can use a register. This code:
register threadid_t pgr asm("$8") = pager; /* t0 */ \
says the threadid_t will fit in a register.

In this line, pgr is the name of the variable. threadid_t is the type. and register is the storage class specifer.

However, this error:
/home/antoine/Final/pistachio/kernel/src/api/v4/exregs.cc: In function `threadid_t sys_exchange_re gisters(threadi d_t, word_t, word_t, word_t, word_t, word_t, threadid_t, bool)':
/home/antoine/Final/pistachio/kernel/src/api/v4/exregs.cc:333: error: data type of 'pgr' isn't suitable for a register
says that the data type of pgr (that's threadid_t) won't fit in a register.

What does thread_t look like? Is it a struct?? Or is it a typedef of some kind??
Jul 9 '07 #4
antoine
4 New Member
Hi thank you for your help. Here is how threadid_t is defined :

public:
042 static threadid_t anythread() {
043 threadid_t tid;
044 tid.raw = (word_t)-1UL;
045 return tid;
046 };
047
048 static threadid_t waitnotify() {
049 threadid_t tid;
050 tid.raw = (word_t)-2UL;
051 return tid;
052 };
053
054 static threadid_t anylocalthread( ) {
055 threadid_t tid;
056 tid.raw = (word_t)-64UL;
057 return tid;
058 }
059
060 static threadid_t nilthread()
061 {
062 threadid_t tid;
063 tid.raw = 0;
064 return tid;
065 }
066
067 static threadid_t irqthread(word_ t irq)
068 {
069 threadid_t tid;
070 tid.raw = 0;
071 tid.global.vers ion = 1;
072 tid.global.thre adno = irq;
073 return tid;
074 }
075
076 static threadid_t threadid(word_t threadno, word_t version)
077 {
078 threadid_t tid;
079 tid.raw = 0;
080 tid.global.vers ion = version;
081 tid.global.thre adno = threadno;
082 return tid;
083 }

If it's not enough you can see the entire file at :
http://www.disy.cse.un sw.edu.au/lxr/aos-2006/source/pistachio/kernel/include/api/v4/thread.h#039
I hope it will help you because it donts help me so much ;)
Bye and thanks again.
Antoine
Jul 10 '07 #5
weaknessforcats
9,208 Recognized Expert Moderator Expert
Your previous post has code like this:
static threadid_t irqthread(word_ t irq)
068 {
069 threadid_t tid;
070 tid.raw = 0;
071 tid.global.vers ion = 1;
072 tid.global.thre adno = irq;
073 return tid;
074 }
Note lines 70, 71 and 72. They show a thread_t has members. That tells me threadid_t cannot fit in a register unless you can show me the definiton of threadid_t so I can see that it is 32 bits or less.

What you are showing me are static functions that return a threadid_t but nowhere to I see the threadid_t itself.

Somewhere, there should be something like:
Expand|Select|Wrap|Line Numbers
  1. struct threadid_t
  2. {
  3.       //with members declaredin here
  4.  
  5. };
  6.  
Jul 10 '07 #6
antoine
4 New Member
Hi. I think I've found were threadid_t is defined. Here is the code :
Expand|Select|Wrap|Line Numbers
  1. private:
  2.     union {
  3.     word_t raw;
  4.  
  5.     struct {
  6.         BITFIELD2( word_t,
  7.                zero    : TID_LOCAL_ID_ZERO_BITS,
  8.                id    : TID_LOCAL_ID_BITS );
  9.     } local;
  10.  
  11.     struct {
  12.         BITFIELD2( word_t,
  13.                version    : TID_GLOBAL_VERSION_BITS,
  14.                threadno    : TID_GLOBAL_THREADNO_BITS );
  15.     } global;
  16.     };
  17. } __attribute__((packed));
  18.  
I've found in another file these definitions :
Expand|Select|Wrap|Line Numbers
  1. #if defined(CONFIG_IS_32BIT)
  2. # define L4_ARCH_CONST(const)        const##_32
  3. #elif defined(CONFIG_IS_64BIT)
  4. # define L4_ARCH_CONST(const)        const##_64
  5. #else
  6. # error undefined architecture width (32/64bit?)
  7. #endif
  8.  
  9. #define L4_GLOBAL_THREADNO_BITS_32    18
  10. #define L4_GLOBAL_INTRNO_BITS_32    18
  11. #define L4_GLOBAL_VERSION_BITS_32    14
  12. #define L4_LOCAL_ID_BITS_32        26
  13. #define L4_LOCAL_ID_ZERO_BITS_32    6
  14. #define L4_FPAGE_BASE_BITS_32        22
  15.  
  16. #define L4_GLOBAL_THREADNO_BITS_64    32
  17. #define L4_GLOBAL_INTRNO_BITS_64    32
  18. #define L4_GLOBAL_VERSION_BITS_64    32
  19. #define L4_LOCAL_ID_BITS_64        58
  20. #define L4_LOCAL_ID_ZERO_BITS_64    6
  21. #define L4_FPAGE_BASE_BITS_64        54
  22.  
  23. #define L4_GLOBAL_THREADNO_BITS        L4_ARCH_CONST(L4_GLOBAL_THREADNO_BITS)
  24. #define L4_GLOBAL_INTRNO_BITS        L4_ARCH_CONST(L4_GLOBAL_INTRNO_BITS)
  25. #define L4_GLOBAL_VERSION_BITS        L4_ARCH_CONST(L4_GLOBAL_VERSION_BITS)
  26. #define L4_LOCAL_ID_BITS        L4_ARCH_CONST(L4_LOCAL_ID_BITS)
  27. #define L4_LOCAL_ID_ZERO_BITS        L4_ARCH_CONST(L4_LOCAL_ID_ZERO_BITS)
  28. #define L4_FPAGE_BASE_BITS        L4_ARCH_CONST(L4_FPAGE_BASE_BITS)
  29.  
If I've well understand, the problem is that 32 bits for the number + 32 bits for the version + the word_t doesn't fit in a register ?
But the fact is that these constants does not seem to have precisely the same name (TID_... vs L4...) Have I found the good definitions?
Antoine
Jul 11 '07 #7
weaknessforcats
9,208 Recognized Expert Moderator Expert
This code:
private:
union {
word_t raw;

struct {
BITFIELD2( word_t,
zero : TID_LOCAL_ID_ZE RO_BITS,
id : TID_LOCAL_ID_BI TS );
} local;

struct {
BITFIELD2( word_t,
version : TID_GLOBAL_VERS ION_BITS,
threadno : TID_GLOBAL_THRE ADNO_BITS );
} global;
};
} __attribute__(( packed));
doesn't say threadid_t anywhere. But assuming this is the declaration, I can see that it is a union of a word_t, a struct local and a struct global.

The threadid_t will be the largest of these three members:

word_t -> I don't know how buig this is
struct local -> has a bitfield member some of the members of the bitfield are defined to be TID_LOCAL_ID_ZE RO_BITS and TID_GLOBAL_THRE ADNO_BITS.

If you find something like:

#define TID_GLOBAL_THRE ADNO_BITS 25

then that bitfield member is 5 bits since 25 only requires 5 bits.

Field members are packed into integers and no field is split between integers.

Have you tried to sizeof(threadid _t) to see how large it is??

I suspect the original processor has a bigger word than your micro kernal 14.

One work around is to use actual integer variables instead of register variables.
Jul 11 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

18
1456
by: Marina | last post by:
Hi, if anyone can help on this, please! This is driving me crazy. I have a user control hierarchy several levels deep that derive for UserControl (windows). The class that is at the top level, has the following constructor (generated by VS.NET) Public Sub New() MyBase.New()
4
25548
by: Ced | last post by:
Hi, i'm not an expert in C but i try to compile BTNG software under linux kernel 2.4.2-2. I get these errors at the very first stage. Does someone could have a rapid look on this and tell me what's wrong regards I get this error:
5
2956
by: Adam McKee | last post by:
We are using Visual Studio.NET 2003 in our project with .NET framework 1.1. One of our libraries is a mixed-mode dll assembly consisting of one managed C++ library, and several unmanaged C++ libraries. We are using managed C++ as a bridge between managed .NET code and unmanaged C++ code, which I'm sure is a fairly common practice. The managed C++ library is compiled with /CLR whereas all other libraries are compiled without /CLR because...
6
4939
by: Mikael Syska | last post by:
Hi asp.net guru's, i have developped this site in ASP.NET 2.0 in the 2005 web delopment beta1 version from microsoft, the site works fine local, but when I move it to my IIS 6.0 with ASP.NET 2.0 I get some errors, http://porse.asp.syska.dk/ I use the mysql connector http://www.mysql.com/products/connector/net/ how do I make it work on the IIS 6.0, do I need to register the dll file or something.... hope there are some that can help me,...
1
2647
by: Michael Tissington | last post by:
I'm trying to convert a project from VS2003 to VS2005 After conversion all of my TagPrefix are not recognized in the body. <%@ Register TagPrefix="Oaklodge" TagName="Curve" Src="ctrls/Curve.ascx" %> This does not report any errors, but when I try to use it like <Oaklodge:Curve runat="server" /> I get the following error
0
3016
by: qiang | last post by:
Hi everyone, Could you please take a look at an exception for ASP.NET application? My ASP.NET application is using Infragistics WebChart control. I encounter an exception below when deploying the application into a third-part host.
12
3900
by: Sensei | last post by:
Hi again! I have recently encountered an old code in K&R style which declared function parameters as register. That puzzles me, and I know this is implementation defined, and depends on architecture, compiler and so on. But my question is, how can be a parameter made "faster" (6.7.1, with note 103). On Intel and similar implementations all parameters are, as far as I know, pushed into the stack. On PPC they can be passed through
0
1307
by: ma740988 | last post by:
I often peruse source that use memory mapped registers as a configuration and/or command and status interface between embedded software and FPGA logic. In doing so you're given a register name accompanied by descriptions and a location in memory for reading/ writing data. For ex:. Revision Register - Location 0x0000 spare
9
5561
by: gavy7210 | last post by:
hello friends i am new to struts. i want to add the user information in the database and then display it back to him. i am using struts 1.2,Eclipse Platform Version: 3.4.2,mySql 5.0.1,jdk 1.5.. i have created a form bean to get the data from the user. then in my action class i m trying to get a database connection and adding the values of the user. and i also wanna show them back to him. its a dummy project for my learning(to get...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.