4.4 系统异常

工业4.0下的设备异常预测维护系统设计 设备异常预测维护系统面临的主要问题包括:如何准确地采集设备的运行数据;如何对大量的异构数据进行有效的处理和分析;如何建立准确的故障预测模型;如何实现系统与现有工业控制系统的集成等。此外,还需要考虑系统的可靠性、安全性和可扩展性,以适应不断变化的工业环境。 阅读详情

程序4-4 代码功能

 lidt IDT_POINTER(%rip)
 ...

setup_IDT:    // ignore_int(%rip) = 0x1111 2222 3333 4444
 #首先ignore_int中断服务程序的偏移地址(OFFSET)就可以使用lea指令取出ignore_int标号的基地址

 #这个基地址要被拆分成第0-15位和第48-63位,分别放在EAX和EDX寄存器中
 #然後在將EAX的值加載到中斷描述符的低位,將EDX的值加載到中斷描述符的高位。
 leaq ignore_int(%rip), %rdx     ;假如 ignore_int 函数 的地址为 %rdx = 0x2222 3333 4444 5555
 movq $(0x08 << 16), %rax       ; 段选择子  %rax = 0x0000 0000 0008 0000 = 0b 0000 0000 0000 1000   位数: 0-1 RPL 请求特权级  1-2   TI 指示目标段描述符所在描述符表类型   3-15 用于索引目标段描述符  2   #段选择符,我们要选用代码段的段选择符,所以我们使用0008h号GDT段选择符。
 movw %dx, %ax                 ;   段内偏移 15:00  %ax =  ignore_int 函数的低16位 %ax = 0x5555 %rax = 0x0000 0000 0008 5555
 movq $(0x8E00 << 32), %rcx    ;  %rcx = 0x0000 8E00 0000 0000 = 0b0000 0000 0000 0000 1000 1110 0000 0000  32-34 IST ( Interrupt Stack Table,中断枝表)是IA-32e模式为任务状态段引人的新型战指针,其功能与 RSP相同,只不过IST切换中断棋指针时不会考虑特权级切换。 35-39:0 40-43:Type 第40-43位为段描述符类型标志(TYPE),我们设置的是1110.即将此段描述符标记为“386中断门”。  44-44:0 45-46:DPL 描述符特权级  47-48:P 指定调用门描述符是否有效
 addq %rcx, %rax              ;   %rax = 0x0000 8E00 0008 5555  %rcx = 0x0000 8E00 0000 0000        
 movl %edx, %ecx              ;   %ecx = ignore_int 函数的低32位 0x4444 5555    %rcx = 0x0000 8E00 4444 5555
 shrl $16, %ecx               ;   %ecx =  0x0000 4444 %rcx = 0x0000 8E00 0000 4444 
 shlq $48, %rcx               ;   %rcx =  4444 0000 0000 0000
 addq %rcx, %rax              ;   %rax =  0x4444 8E00 0008 5555        
 shrq $32, %rdx              ;    %rdx = 0x0000 0000 2222 3333 
 leaq IDT_Table(%rip), %rdi ;
  mov $256, %rcx
 rp_sidt:
  movq %rax, (%rdi)
  movq %rdx, 8(%rdi)
  addq $0x10, %rdi
  dec %rcx
  jne rp_sidt

·模块setup_IDT负责往IDT(中断描述符表)填入中断描述符(单个表项占用16Byte),中断描述符的格式参考下图:

在这里插入图片描述

ignore_int:
/*#CLD指令即告訴程序si,di向內存地址增大的方向走。*/
 cld
 pushq %rax
 pushq %rbx
 pushq %rcx
 pushq %rdx
 pushq %rbp
 pushq %rdi
 pushq %rsi

 pushq %r8
 pushq %r9
 pushq %r10
 pushq %r11
 pushq %r12
 pushq %r13
 pushq %r14
 pushq %r15

 movq %es, %rax
 pushq %rax
 movq %ds, %rax
 pushq %rax

 movq $0x10, %rax
 movq %rax, %ds
 movq %rax, %es

 leaq int_msg(%rip), %rax
 pushq %rax
 movq %rax, %rdx
 movq $0x00000000, %rsi
 movq $0x00ff0000, %rdi
 movq $0, %rax
 callq color_printk
 addq $0x8, %rsp

Loop:
 jmp Loop

 popq %rax
 movq %rax, %ds
 popq %rax
 movq %rax, %es

 popq %r15
 popq %r14
 popq %r13
 popq %r12
 popq %r11
 popq %r10
 popq %r9
 popq %r8

 popq %rsi
 popq %rdi
 popq %rbp
 popq %rdx
 popq %rcx
 popq %rbx
 popq %rax
 iretq

int_msg:
 .asciz "Unknown interrupt or fault at RIP\n"

·目前,只写了一个中断处理程序ignore_int,功能是在发生中断时在屏幕显示黑底红字的错误信息"Unknown interrupt or fault at RIP\n",并随即进入死循环;

·根据描述符格式要求,现在利用ignore_int所在的内核数据段选择子0x08以及ignore_int的入口偏移地址,来创建中断描述符,并且往目前的IDT表的全部256个表项都填入这个相同的描述符(即目前无论发什么异常错误,都调用的是ignore_int)

设置TSS

TSS段主要用于任务切换(或特权级切换) 时,保存处理器的寄存器状态,以及切换至对应的 特权级栈空间,从而使得任务返回时能够还原执行现场。 下图是一个32位的任务状态段的内部结 构。 (16位的TSS段只用在Intel286处理中。 )

32位模式下的tss

TSS被分为两部分 : 动态区域和静态区域。 当任务在切换过程中挂起时, 处理器会将执行现场保 存在动态区域内,下图归纳了32位 TSS的动态区域。
在这里插入图片描述

64位模式下的tss

下图的TSS描述符位功能非常好理解, 而且功能也并无变化,但TSS的内部结构却发生革命性的 变化。 既然TSS不再需要保存和还原程序 (或任务)的执行现场环境,那么它只负责不同特权级间的栈切换工作 。
下图是IA-32e模式TSS的 内部结构 。
在这里插入图片描述

为 TSS 设置 IST

void set_tss64(unsigned long rsp0,unsigned long rsp1,unsigned long rsp2,unsigned long ist1,unsigned long ist2,unsigned long ist3,
unsigned long ist4,unsigned long ist5,unsigned long ist6,unsigned long ist7)
{
	*(unsigned long *)(TSS64_Table+1) = rsp0;
	*(unsigned long *)(TSS64_Table+3) = rsp1;
	*(unsigned long *)(TSS64_Table+5) = rsp2;

	*(unsigned long *)(TSS64_Table+9) = ist1;
	*(unsigned long *)(TSS64_Table+11) = ist2;
	*(unsigned long *)(TSS64_Table+13) = ist3;
	*(unsigned long *)(TSS64_Table+15) = ist4;
	*(unsigned long *)(TSS64_Table+17) = ist5;
	*(unsigned long *)(TSS64_Table+19) = ist6;
	*(unsigned long *)(TSS64_Table+21) = ist7;	
}
	set_tss64(_stack_start, _stack_start, _stack_start, 0xffff800000007c00, 0xffff800000007c00, 0xffff800000007c00, 0xffff800000007c00, 0xffff800000007c00, 0xffff800000007c00, 0xffff800000007c00);

IST和IDT的实际使用示例

/*

*/

#define _set_gate(gate_selector_addr,attr,ist,code_addr)	\
do								\
{	unsigned long __d0,__d1;				\
	__asm__ __volatile__	(	"movw	%%dx,	%%ax	\n\t"	\
					"andq	$0x7,	%%rcx	\n\t"	\
					"addq	%4,	%%rcx	\n\t"	\
					"shlq	$32,	%%rcx	\n\t"	\
					"addq	%%rcx,	%%rax	\n\t"	\
					"xorq	%%rcx,	%%rcx	\n\t"	\
					"movl	%%edx,	%%ecx	\n\t"	\
					"shrq	$16,	%%rcx	\n\t"	\
					"shlq	$48,	%%rcx	\n\t"	\
					"addq	%%rcx,	%%rax	\n\t"	\
					"movq	%%rax,	%0	\n\t"	\
					"shrq	$32,	%%rdx	\n\t"	\
					"movq	%%rdx,	%1	\n\t"	\
					:"=m"(*((unsigned long *)(gate_selector_addr)))	,					\
					 "=m"(*(1 + (unsigned long *)(gate_selector_addr))),"=&a"(__d0),"=&d"(__d1)		\
					:"i"(attr << 8),									\
					 "3"((unsigned long *)(code_addr)),"2"(0x8 << 16),"c"(ist)				\
					:"memory"		\
				);				\
}while(0)

void sys_vector_init()
{
	set_trap_gate(0,1,divide_error);
	set_trap_gate(1,1,debug);
	set_intr_gate(2,1,nmi);
	set_system_gate(3,1,int3);
	set_system_gate(4,1,overflow);
	set_system_gate(5,1,bounds);
	set_trap_gate(6,1,undefined_opcode);
	set_trap_gate(7,1,dev_not_available);
	set_trap_gate(8,1,double_fault);
	set_trap_gate(9,1,coprocessor_segment_overrun);
	set_trap_gate(10,1,invalid_TSS);
	set_trap_gate(11,1,segment_not_present);
	set_trap_gate(12,1,stack_segment_fault);
	set_trap_gate(13,1,general_protection);
	set_trap_gate(14,1,page_fault);
	//15 Intel reserved. Do not use.
	set_trap_gate(16,1,x87_FPU_error);
	set_trap_gate(17,1,alignment_check);
	set_trap_gate(18,1,machine_check);
	set_trap_gate(19,1,SIMD_exception);
	set_trap_gate(20,1,virtualization_exception);

	//set_system_gate(SYSTEM_CALL_VECTOR,7,system_call);

}

sys_vector_init 方法里面的所有异常的IST均设置为1,其代表IST1,值为0xffff800000007c00,在发生异常时,会系统会自动将rsp指针设置为 0xffff800000007c00 用于保存寄存器的值!

思考,为什么执行 i = 1/0 时,系统会找到序号为0的中断,而不产生其他中断序号?

异常事件和中断请求的 检测 都是在某一条指令执行过程中进行的,显然由硬件完成;

在 CPU 根据 CS 和 EIP 取下条指令之前,会根据检测的结果判断是否进入中断响应阶段;

异常和中断的响应也都是在某一条指令执行过程中或执行结束时进行的,显然也由硬件完成;

内存示意图

在这里插入图片描述

setup_IDT :格式化中断描述符

在这里插入图片描述

ignore_int :中断处理程序

在这里插入图片描述

setup_TSS64 :格式化TSS描述符,并填入GDT表

在这里插入图片描述

参考资料

TSS Descriptor

在这里插入图片描述

汇编指令 lea

在这里插入图片描述

【SpringBoot 4.x 第64节】夯爆了,全局异常处理高级实践:业务异常、系统异常与参数异常一次讲透(超详解)! 🏆 本文收录于 《滚雪球学 Spring Boot 4.x》 专栏。本专栏面向 有一定 Java 基础,但尚未系统学习 Spring Boot 的读者,采用“滚雪球式学习法”:先跑通、再理解、再重构、再上线,带你从第一个 Hello API 开始,逐步完成一个可部署、可监控、可扩展的后端项目。 阅读详情

相关推荐

【SpringBoot 4.x 第145节】Spring Boot 4.x 全局异常处理高级实践:业务异常、系统异常、参数异常一套打通(超详解)!

🏆 本文收录于 《滚雪球学 Spring Boot 4.x》 专栏。本专栏面向 有一定 Java 基础,但尚未系统学习 Spring Boot 的读者,采用“滚雪球式学习法”:先跑通、再理解、再重构、再上线,带你从第一个 Hello API 开始,逐步完成一个可部署、可监控、可扩展的后端项目。

**My Coding Family** 69

中断分析(五)

中断分析(五)    ——初始化中断描述符表的具体实现    中断描述符表的初始化:将中断描述符表的起始地址装入IDTR,并初始化表中的每一项。具体过程如下图所示:         一、中断描述符表的预初始化:用256个指向ignore_int中断门的入口地址填充中断描述符表。它

点滴积累 757

QKD(量子密钥分发)

量子密钥分发(Quantum Key Distribution,QKD)是一种基于量子力学原理的安全通信协议,它允许两个用户通过不安全的通信信道创建并共享一个安全的密钥。这个密钥随后可以用于加密和解密信息,确保通信的机密性。QKD的核心原理是量子不可克隆定理和量子测量的不确定性。

qq_40844444的博客 2896

关于cin.ignore()用法的一些浅见

C++小白经验总结

m0_57992813的博客 2244

智能座舱音频系统集成与调试:从芯片选型到音质优化实战

在智能座舱域控制器架构中,音频系统已从简单的功放加扬声器演进为SoC、数字音频总线、外部DSP与多通道功放协同的复杂子系统。TDM总线的时隙分配、PDM麦克风阵列的信号完整性,以及AEC回声消除算法如何与硬件协同,直接决定多音区体验和语音交互的可靠性。工程实践中,音频调试的关键在于先理顺供电、接地、时钟与数据路由,再针对功放削波、采样率失配、TDM slot错位等典型问题进行系统性排查。从芯片选型到系统级指标验收,只有将音频链路视为整车电子电气架构的一个协同整体,才能真正实现从“响”到“好听”的跨越。本文结

weixin_30162121的博客 364

ur3手眼标定+realsenseL515

知乎 csdn

AI_future的博客 978

AT&T 汇编入门 - 汇编使用printf

AT&amp;T 汇编入门 - 汇编使用printf 一般 C 语言的hello world 我们都是通过printf 打印的,而不是直接往stdout 写入字符串. 那我们现在就来试试如何在汇编中调用libc的printf 函数。 .section .data msg: .ascii "hello world!\n" .section .text .g...

chuck_huang的专栏 3001

做量化没有实时数据怎么行?我找到一个超级好用的Python库,速度还贼快!

今天咱们介绍了 pytdx 这个神奇的库,重点包括:✅ 安装 pytdx✅ 连接 TDX 服务器✅ 获取实时行情数据✅ 获取 K 线数据✅ 获取分笔成交数据总之,pytdx 是一个速度快、免费、易用的量化利器,适合 A 股量化交易的同学们使用。如果你还在为数据发愁,赶紧试试吧!🚀顺手再看就是对花姐最大的支持,期待你的关注。

奔跑的蜗牛 5723

Linux 0.11-重新设置idt和gdt-08

为什么原来已经设置过一遍了,这里又要重新设置一遍,你可千万别想有什么复杂的原因,就是因为原来设置的 gdt 是在 setup 程序中,之后这个地方要被缓冲区覆盖掉,所以这里重新设置在 head 程序中,这块内存区域之后就不会被其他程序用到并且覆盖了,就这么个事。中断描述符表 idt 里面存储着一个个中断描述符,每一个中断号就对应着一个中断描述符,而中断描述符里面存储着主要是中断程序的地址,这样一个中断号过来后,CPU 就会自动寻找相应的中断程序,然后去执行它。,然后第四项系统段描述符并没有用到,不用管。

m0_53157173的博客 1033

麒麟V10系统命令实战指南:从入门到精通

本文为麒麟V10操作系统用户提供了一份从入门到精通的命令行实战指南。内容涵盖文件管理、进程监控、网络诊断、文本处理及系统管理等核心场景,旨在帮助用户转变思维,掌握高效解决实际问题的系统命令技巧,从而提升在麒麟V10环境下的运维与工作效率。

sat99的博客 594

别再用默认参数了!手把手教你用2P2Z补偿网络优化Buck电源的动态性能

本文详细介绍了如何通过2P2Z补偿网络优化Buck电源的动态性能,解决默认参数下的负载阶跃响应问题。从频域分析到元件选型,再到实测验证,手把手教你提升相位裕度,显著降低超调量和稳定时间,适用于DCDC和开关电源设计。

weixin_33657398的博客 256

segment descriptor http://www.mouseos.com/arch/descriptor64.html

long mode 下的 segment descript 注意:     本文针对的是 long mode 下的 segment descriptor 情况,当然包括: 64-bit modecompatibility mode 对于 gate descriptor 来说,在 long mode 下是固定 16 bytes,但是对于 segmen

surpass1026的专栏 1029

Python白色飘雪(完整代码)

Python绘制白色飘雪动画的完整代码。

AIGC 3万+

Android4.2系统辅助功能打开时,加载WebView导致空指针异常解决记录

最近负责APP错误统计分析,修复线上一些BUG,有一个这样的问题,日志如下:java.lang.NullPointerException at android.webkit.AccessibilityInjector$TextToSpeechWrapper$1.onInit(AccessibilityInjector.java:753) at android.speech.tts.T

小嵩的博客 2581

时间序列预测 | Python实现ARIMAX和VARMAX时间序列数据预测

时间序列预测 | Python实现ARIMAX和VARMAX时间序列数据预测 目录时间序列预测 | Python实现ARIMAX和VARMAX时间序列数据预测基本介绍ARIMAXVARVARMAVARMAXSESHWES参考资料 基本介绍 本文介绍ARIMAX、VAR、VARMA和VARMAX基本概念及其Python程序设计。 ARIMAX 具有外源回归量的自回归整合移动平均值(ARIMAX)是 ARIMA 模型的扩展,其还包括外生变量的建模。 外生变量也称为协变量,可以被认为是并行输入序列,其在与

前程算法屋的博客 6688

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

异常处理

80x86处理器发布了大约20种不同的异常。内核必须为每种异常提供一个专门的异常处理程序。对于某些异常,CPU控制单元在开始执行异常处理程序前会产生一个硬件的错误码(hardware error code),并且压入内核态堆栈。下面列表给出了在80x86处理器中可以找到的异常的向量、名字、类型及其简单描述。更多信息可以在Intel的技术文挡中找到。0 - "Divide error

云(存储),松(耦合) 2561

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

构建64位操作系统-进程与线程

构建64位操作系统-进程

x13262608581的博客 496

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

【译】x86程序员手册35-9.8异常条件

译注:一些异常没有翻译,因为看书时主要为了理解linux代码,所以代码中没有主要使用的就没有仔细看。这部分内容后期再看时再进行翻译。 9.8 Exception Conditions异常条件 The following sections describe each of the possible exception conditions in detail. Each descr...

weixin_30716725的博客 632

《深入理解Linux内核》第四章中断和异常(一)

最近鼓足勇气拿起吃灰多年的linux红宝书《深入理解Linux内核》,希望可以提升和巩固Linux内核理论知识。在此记录自己对书本内容和源代码理解,望各位大虾批评指正。 一、中断描述符(4.2.3. Interrupt Descriptor Table) 目的:关联中断或者异常向量和对应中断或异常处理程序地址 大小:64bit(8个byte) 寄存器:idtr 格式: 其中40---43bit用来识别中断描述符类型。 二、硬件上对中断或者异常处理过程(4.2.4. Hardware Han

yxw0609131056的博客 687

构建64位操作系统-中断与异常

构建64位操作系统-中断与异常

x13262608581的博客 1423

实现64位操作系统的问题解决系列:(三)程序4-11 因为__switch_to符号未定义,编译失败

实现64位操作系统的问题解决系列:(三)程序4-11 因为__switch_to符号未定义,编译失败 ub16或者ub18上实践田宇大佬的64位操作系统的设计与实现,因为环境的原因,书中提供的代码并不能完全编译成功,前面我写了实现64位操作系统的问题解决系列:(一)和(二)基本编译到程序4-10都不会出问题,但是到程序4-11就会 因为__switch_to符号未定义,编译失败。 问题描述 经过实...

zhangji 1162

汇编 设置中断描述符表

操作的步骤如下:1、记录中断处理函数的段内偏移2、获取或指定段选择子3、对idt表赋值(本操作是对所有的中断都采用同一的函数(MyIntFunc)处理)注: _idt  中断描述符表的基址 idt_descr  中断描述符操作的参数图示如下:63.55.47.39.31.23.15.7.0|MyIntFunc[2] |MyIntFunc[3] |0x8e |0x00 |0x00 |0x08

eqxu的专栏 1535

C语言中的ignore

ignore函数 功能:函数用于输入流。它读入字符,直到已经读了num 个字符(默认为1)或是直到字符delim 被读入(默认为EOF). 其调用形式为cin.ignore(n,终止字符) 原型:istream &ignore( streamsize num=1, int delim=EOF ); 函数作用是跳过输入流中n个字符,或在遇到指定的终止字符时提前结束(此时跳过包

荪荪的博客 4765

64位操作系统——(二)kernel

64位操作系统——(二)kernel 作者:王赛宇 参考列表: 主要参考:《一个六十四位操作系统的设计与实现》——田雨 《Using as》 ——Dean Elsner & Jay Fenlason & friends nasm 用戶手册 处理器startup.s 常见汇编指令… 前情提要 在第一章节中,我们学习、研读了bootloader的代码,bootloader可以被分为两个过程: boot:计算机上电,自检完成后自动执行0x7c00处的boot程序,该程序被限制了大小5

qq_17853613的博客 3351

IA32和x64架构分段数据结构

翻译自《Intel® 64 and IA-32 Architectures Software Developer Manuals》 IA-32系统级寄存器和数据结构: 内存管理寄存器: 分段和分页: 逻辑地址到线性地址的翻译: 段选择子: 段描述符: 全局描述符和局部描述符

Firas的专栏 3999
上一篇: 4.5 初级内存管理单元
下一篇: 解决 wmware windows虚拟机无法使用U盘,提示“跟这台电脑连接的一个usb设备运行不正常 windows无法识别它”的问题!
滑板小王子
博客等级 码龄9年 19粉丝 25原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值