当前位置:网站首页>中断及pendSV
中断及pendSV
2022-07-31 06:08:00 【南波儿万】
1. 概述
通过任务及任务切换一节读者已经了解了任务切换的详细过程,其实要实现任务切换的功能前面讲的还远远不够。因为,PSP的操作必须在特权模式下,而用户的程序是工作在线程模式下的。所以,用户要想实现任务的切换功能就必须想办法让CPU工作在特权模式下。要想深入了解嵌入是操作系统的实现原理我可能需要了解的更多。
下面的内容与平台相关性很强,但是其原理都是大同小异。这里讲的内容时基于ARM Cortex-M的处理器讲解的。
2. CPU的操作模式和特权级别
一般一款CPU都会有不同的操作模式和特权级别从而实现操作系统级别和用户级别的区分然后进一步实现操作权限的控制。我们都知道Linux系统各个用户的和root用有不同的操作权限,应用层和内核层也有对硬件操作的不同权限。Linux是如何实现权限控制的?不知道有没有读者提出过类似的问题?其实权限的控制不仅仅是软件层面的实现,在一定层面上硬件也需要支持。
我们以ARM Cortex-M系列的处理器为例,其支持两种处理器的操作模式和两种特权级别。
两种操作模式:
- handler mode:中断和异常执行的代码处于该模式
- thread mode:其他代码处于该模式
引入两个模式的本意,是用于区别普通应用程序的代码和异常服务例程的代码——包括中断服务例程的代码。
两种特权级别:
- 特权级
- 用户级
这可以提供一种存储器访问的保护机制,使得普通的用户程序代码不能意外地,甚至是恶意地执行涉及到要害的操作。处理器支持两种特权级,这也是一个基本的安全模型。
边栏推荐
- 知识、创新、回报。
- Difficulty comparison between high concurrency and multithreading (easy to confuse)
- Explain the example + detail the difference between @Resource and @Autowired annotations (the most complete in the entire network)
- 03-SDRAM:写操作(突发)
- 简单谈谈Feign
- 测试 思维导图
- Database Principles Homework 3 — JMU
- 2022.07.20_每日一题
- One of the small practical projects - food alliance ordering system
- 2022.07.24_每日一题
猜你喜欢
tidyverse笔记——dplyr包
LeetCode brush # 376 # Medium - swing sequence
那些破釜沉舟入局Web3.0的互联网精英都怎么样了?
Core Tower Electronics won the championship in the Wuhu Division of the 11th China Innovation and Entrepreneurship Competition
Run the NPM will pop up to ask "how are you going to open this file?"
Install and use uView
Zero-Shot Learning & Domain-aware Visual Bias Eliminating for Generalized Zero-Shot Learning
One of the small practical projects - food alliance ordering system
关于求反三角函数的三角函数值
2022.07.18_每日一题
随机推荐
Leetcode952. 按公因数计算最大组件大小
【解决】npm ERR A complete log of this run can be found in npm ERR
【Go语言入门】一文搞懂Go语言的最新依赖管理:go mod的使用
【编程题】【Scratch三级】2022.03 冬天下雪了
Zotero | Zotero translator plugin update | Solve the problem that Baidu academic literature cannot be obtained
【面试:并发篇38:多线程:线程池】ThreadPoolExecutor类的基本概念
【云原生】-Docker容器迁移Oracle到MySQL
Gradle remove dependency demo
360推送-360推送工具-360批量推送工具
Chapter 16: Constructing the Magic Square for Prime Numbers of Order n(5,7)
Install and use uView
批量翻译软件免费【2022最新版】
Install the gstreamer development dependency library to the project sysroot directory
In-depth analysis of z-index
R——避免使用 col=0
Explain the example + detail the difference between @Resource and @Autowired annotations (the most complete in the entire network)
Chapter 17: go back to find the entrance to the specified traverse, "ma bu" or horse stance just look greedy, no back to search traversal, "ma bu" or horse stance just look recursive search NXM board
Foreign trade website optimization - foreign trade website optimization tutorial - foreign trade website optimization software
Titanic 预测问题
SQLite数据库连接字符串