arm linux kernel startkenal problem

Publisher:chunliLatest update time:2016-04-18 Source: eefocusKeywords:arm  linux  kernel  startkenal Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
I have been puzzled about the problem of start_kenal in the arm linux kernel for a long time but still can't solve it:

In include\linux\Cupmask.h, there are the following definitions
typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
extern cpumask_t _unused_cpumask_arg_;

#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
{
set_bit(cpu, dstp->bits);
}

In include\linux\Types.h, there are the following definitions
#ifdef __KERNEL__
#define BITS_TO_LONGS(bits) \
(((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
#define DECLARE_BITMAP(name,bits) \
unsigned long name(this bits =32)
#define BITS_PER_BYTE 8
#endif

Problem with using single quotes in awk variables


We can conclude that: cpumask_t is equivalent to unsigned long bits
, so cpumask_t *dstp is a pointer to an unsigned long array.
Then why does this expression appear? set_bit(cpu, dstp->bits); ?????cpusets are represented by bit masks.
For an unsigned int type on a 32-bit machine, it has 32 bits. Then each bit corresponds to a CPU. For example, 0x1 represents the CPU at position 0. 0x3 represents the two CPUs at positions 0 and 1.

You can also look at the sixth post of this thread:
http://www.chinaunix.net/index.php?uid=20551201&url=http://linux.chinaunix.net/bbs/viewthread.php?tid=904906 Thanks to scutan (冬日夜雨) for his help (great guy),
I understand the meaning of the code better.

There is one thing I don't understand
static inline void __cpu_set(int cpu, volatile cpumask_t *dstp) //dest points to unsigned long bits
//I can't understand this expression dstp->bits
{
set_bit(cpuhttp://www.airmaxshoe.net, dstp->bits);
}-> It is generally used in data structures.
For example,
struct student
{
age;
heathy;
}

struct stdent *p;
If I want to access the age of *p, I can write p->age like this;

If you define an unsigned long aaa; unsigned long p; There is no such usage p->bit,,,,, I don't understand here. Original post by eezzrr at 2009-2-17 01:36 http://linux.chinaunix.net/bbs/images/common/back.gif
-> Generally used in data structures.
For example,
struct student
{
age;
heathy;
}

struct stdent *p;
If I want to access the age of *p, I can write p->age;

If you define an unsigned long aaa; unsigned long ...

is like this http://www.posercity.com, for example, unsigned long a, then a is the value of the first element of the array. And you can also use a, then a represents the first address of the array. 
Keywords:arm  linux  kernel  startkenal Reference address:arm linux kernel startkenal problem

Previous article:ARM9 first contact experience
Next article:Implementation of Embedded CCD Image Data Acquisition System Based on USB

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号