Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

control registers

Altera_Forum
Honored Contributor II
1,113 Views

Ok, so since I need multi-threading to work, and since adding a compare-and-exchange instruction is out of the question since interfacing with SDRAM is too difficult from a custom instruction, the obvious way to do mutexing and other multi-threaded operations is by disabling interrupts every time any of the mutexing (etc) operations take place. Simple enough in the kernel (that's how all of the atomic operations are already implemented). 

 

But is it possible to disable interrupts in userspace? Specifically, does microtronix uClinux put the CPU into "user mode" (i.e. the mode where code can't access the control registers) for userspace code, or can userspace code get at the control registers (in order to set ctrl0[0] (PIE) to 0 and then to 1 again)? 

 

Thanks.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
441 Views

And, more to the point, if userspace code runs in user-mode rather than supervisor mode (i.e. you can't run the rdctl and wrctl instructions), how does one disable that so that all code in uClinux runs in supervisor mode (i.e. you can run the rdctl and wrctl instructions)?

0 Kudos
Altera_Forum
Honored Contributor II
441 Views

At this point, the pthread in uClibc for Nios II uses disabling interrupts to achieve the testandset functionality, required to implement spinlocks. Right now both kernel and user applicaitons work in supervisor state. 

 

When Linux was ported to Nios II, user mode was not supported. I am not sure if it is supported now. I guess Altera will provide a test-and-set style instruction when they begin to support user space.
0 Kudos
Altera_Forum
Honored Contributor II
441 Views

Thanks.

0 Kudos
Reply