![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Arm64
文章平均质量分 85
Roland_Sun
职业旅程:Engineer->Senior Engineer->QA Manager->Project Manager->Senior Staff Engineer
展开
-
ARM架构下常用GNU汇编程序伪指令介绍(Assembler Directive)
所有的GNU汇编程序伪指令都以句号(.)打头,后面接上伪指令的名字,通常是由小写字母组成。.section.subsection.pushsection.popsection.previous.ascii语法: .ascii "string"....ascii 表示零个或多个(用逗号隔开)字符串,并把每个字符串(结尾不自动加“\0”字符)中的字符放在连续的地址单元。还有一个与.ascii 类似的.asciz,z ...原创 2020-08-07 17:08:06 · 15927 阅读 · 0 评论 -
Linux内核同步原语之原子操作(Atomic)
原子操作原创 2020-07-28 08:50:24 · 18056 阅读 · 0 评论 -
ARMv8.1平台下新添加原子操作指令
Large System Extensions (LSE)New atomic instructions to support scalable performance: Instructions for full-word, half-word, and byte operations are available. Most of the following have optional load-acquire and/or store-release semantics. Compare an原创 2020-07-28 17:25:40 · 14124 阅读 · 3 评论 -
Linux同步原语之顺序锁(Sequence Lock)
(代码位于arch/arm64/include/asm/atomic.h中):#define ATOMIC_OP(op) \static inline void arch_##op(int i, atomic_t *v) \{ \ __lse_ll_sc_body(op, i, v); \}ATOMIC_OP(atomic_andnot)ATOMIC_OP(atomic_or)ATOMIC_OP(atomic_xor)ATOM...原创 2020-07-29 14:54:19 · 5861 阅读 · 0 评论 -
Arm64内存屏障
smp_load_acquire()forces a read of a location in memory (in much the same way asACCESS_ONCE()), but it ensures that the read happens before any subsequent reads or writes. smp_store_release()writes a value back to memory, ensuring that the write h...原创 2020-07-22 09:05:13 · 12812 阅读 · 2 评论 -
ARM平台下独占访问指令LDREX和STREX的原理与使用详解
为了实现线程间同步,一般都要在执行关键代码段之前加互斥(Mutex)锁,且在执行完关键代码段之后解锁。为了实现所谓的互斥锁的概念,一般都需要所在平台提供支持。本文主要用来说明ARM平台上特有的独占访问指令LDREX和STREX的工作原理,以及如何使用。而它们也是ARM平台上,实现互斥锁等线程同步工具的基础。原创 2015-08-17 16:28:40 · 25700 阅读 · 9 评论 -
ARM64平台下WFE和SEV相关指令解析
WFEWait For Event.If the Event Register is not set,WFEsuspends execution until one of the following events occurs:An IRQ interrupt, unless masked by the CPSR I-bit. An FIQ interrupt, unless masked by the CPSR F-bit. An Imprecise Data abort, unles..原创 2020-07-20 14:24:34 · 15691 阅读 · 1 评论 -
Linux内核同步原语之自旋锁(Spin Lock)
在Linux内核代码中,大量使用了自旋锁。自旋锁不会让原创 2020-07-15 14:35:44 · 9365 阅读 · 1 评论 -
Linux时间子系统之Tick广播层(Tick Broadcast)
test reserve原创 2020-06-18 15:20:39 · 9534 阅读 · 4 评论 -
Linux时间子系统之Tick模拟层(Tick Sched)
在分析高分辨率定时器的时候曾经提到过,一旦切换到高精度模式后,struct tick_sched { struct hrtimer sched_timer; unsigned long check_clocks; enum tick_nohz_mode nohz_mode; unsigned int inidle : 1; unsigned int tick_stopped : 1; unsigned int idle_active : 1; unsigned原创 2020-06-05 16:28:08 · 11837 阅读 · 0 评论 -
Linux时间子系统之高分辨率定时器层(HR Timer)
在前面介绍定时器层的文章中我们已经知道了在Linux内核中已经存在了一个管理定时器的通用框架。不过它也有很多不足,最大的问题是其精度不是很高。哪怕底层的定时事件设备精度再高,定时器层的分辨率只能达到Tick级别,按照内核配置选项的不同,在100Hz到1000Hz之间。但是,原有的定时器层由于实现教早,应用广泛,如果完全替换掉会引入大量代码改动。因此,Linux内核又独立设计出了一个叫高精度定时器层(High Resolution Timer)的框架,可以为我们提供纳秒级的定时精度,以满足对精确时间有迫切需求原创 2020-05-28 20:24:22 · 11068 阅读 · 0 评论 -
Linux时间子系统之时间维护层(Time Keeper)
struct timekeeper { struct tk_read_base tkr_mono; struct tk_read_base tkr_raw; u64 xtime_sec; unsigned long ktime_sec; struct timespec64 wall_to_monotonic; ktime_t offs_real; ktime_t of...原创 2020-05-19 15:14:56 · 10707 阅读 · 0 评论 -
Linux时间子系统之时间的表示
为了实现以上功能,Linux 实现了多种与时间相关但用于不同目的的数据结构。1)jiffies和jiffies_64内核用jiffies_64全局变量记录系统自启动以来经过了多少次Tick。它的声明如下(代码位于kernel/time/timer.c中):__visible u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;EXPORT_SYMBOL(jiffies_64);可以看出来jiffies_64被定义成了6原创 2020-05-11 14:56:46 · 7688 阅读 · 1 评论 -
Linux时间子系统之定时器层(Timer)
定时器层是基于Tick层之上的,精度比较低,struct timer_list { /* * All fields that change during normal runtime grouped to the * same cacheline */ struct hlist_node entry; unsigned long expires; void (...原创 2020-05-08 16:13:33 · 11347 阅读 · 5 评论 -
Linux时间子系统之时钟源层(Clock Source)
struct clocksource { u64 (*read)(struct clocksource *cs); u64 mask; u32 mult; u32 shift; u64 max_idle_ns; u32 maxadj;#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA struct arch_clocksource_data archda...原创 2020-04-26 17:58:55 · 12566 阅读 · 0 评论 -
Arm通用计时器简介
所有使用Arm处理器的系统中都会包含一个标准化的通用计时器(Generic Timer)框架。这个通用计时器系统提供了一个系统计数器(System Counter)和一组计时器(Timer)。其结构如下图:可以看到,系统计数器是全局唯一的,并且全局共享。而且这个系统计数器还是一直存在的,哪怕系统处于待机状态,所有内核都被关闭了,它仍然可以工作。每一个Arm核都配备一组专门为自己服务的计时器...原创 2020-04-16 18:03:59 · 12787 阅读 · 0 评论 -
在Ubuntu18.04下编译树莓派4B的Arm64内核
make modules是编译模块,很多驱动还有功能在选的时候选成M的都是modules,不过直接make,不加任何参数,就是make all,包含make modules。不用额外加此make,但是在安装的时候make install只是安装bzimage,Systemmap。没有把modules安装好,还要额外的make modules_install,把模块放到/lib/modules文件夹...原创 2020-04-07 17:02:54 · 3348 阅读 · 1 评论 -
Arm64下Linux内核Image头的格式
Linux对于Arm64架构,其编译出来的内核默认是不支持压缩的;而对于Arm32版本来说,默认支持内核解压的操作(代码位于arch/arm/boot/compressed目录下,可是arm64目录下没有对应的代码)。如果实在想压缩内核,也可以在bootloader里面解压好后放到内存中指定的位置。struct arm64_image_header { __le32 code0; __l...原创 2020-04-03 11:44:10 · 3508 阅读 · 0 评论