interrupt

Possible to use bios interrupts in your code on linux?

流过昼夜 提交于 2019-12-10 17:12:26
问题 I write a simple program in assembly language in Linux (using nasm), and for educational purposes, I want to use BIOS interrupt instead linux system calls, is this possible ? 回答1: The short answer is, no it's not possible. The longer answer is that Linux has support for virtual8086 mode (the int vm86(unsigned long fn, struct vm86plus_struct *v86) call) which is capable of executing real mode code (including BIOS functions, if setup properly). However; the BIOS expects lots of different pieces

Can an x86 assembly interrupt service routine call another interrupt?

一个人想着一个人 提交于 2019-12-10 16:13:38
问题 Can I call interrupt from within interrupt service routine in freestanding x686 environment? So can one do the following: isr: pusha call doSomething int 21h popa iret If it's possible, then do these nested interrupts have any significant cave ins? 回答1: An interrupt call is just analogous to a regular call with flags pushed. And what iret does is it returns and pops the flags. So, yes, interrupts can be called recursively. Actually calling an interrupt in another interrupt handler happens all

What is the correct way of using C++ objects (and volatile) inside interrupt routines?

给你一囗甜甜゛ 提交于 2019-12-10 15:59:14
问题 I am currently working with Atmel AVR microcontrollers (gcc), but would like the answer to apply to the microcontroller world in general, i.e. usually single-threaded but with interrupts. I know how to use volatile in C code when accessing a variable that can be modified in an ISR. For example: uint8_t g_pushIndex = 0; volatile uint8_t g_popIndex = 0; uint8_t g_values[QUEUE_SIZE]; void waitForEmptyQueue() { bool isQueueEmpty = false; while (!isQueueEmpty) { // Disable interrupts to ensure

delphi timer ticks faster than timer service interrupt routine

落爺英雄遲暮 提交于 2019-12-10 15:51:29
问题 Hi I have been asked to maintain a Delphi 5 based program for someone, and the program is using a timer object to tick every 50 milli-seconds and upon each time-up it runs the block of single threaded code. I am just wondering, what would happen if the time taken to execute this block of code is longer than the timer tick interval, would this be bad? For example could it cause problems like access violation? How does Delphi handle this kind of situation by default? Thanks a lot. 回答1: The

Delay in running thread due to system.out.println statement [duplicate]

柔情痞子 提交于 2019-12-10 15:37:43
问题 This question already has an answer here : Loop doesn't see value changed by other thread without a print statement (1 answer) Closed 3 years ago . In the following code, if i use sysout statement inside for loop then the code executes and goes inside the loop after the condition met but if i do not use sysout statement inside loop then then infinite loop goes on without entering inside the if condition even if the if condition is satisfied.. can anyone please help me to find out the exact

Interrupt a sleeping thread

妖精的绣舞 提交于 2019-12-10 14:54:28
问题 Trying to interrupt a running thread, in this example, t1, which is executed by a thread in a thread pool. t2 is the one that sends the interrupt. I'm unable to stop the running t1, t1 does not get InterruptedException. What am I missing? Executor exec1 = Executors.newFixedThreadPool(1); // task to be interrupted Runnable runnable = new Runnable() { @Override public void run() { try { System.out.println("starting uninterruptible task 1"); Thread.sleep(4000); System.out.println("stopping

How do I properly hook Interrupt 28h in assembly for DOS, and restore it?

ぐ巨炮叔叔 提交于 2019-12-10 13:46:32
问题 I'm trying to set the handler of Interrupt 28h to my own routine, restore all the registers and flags involved, and restore the original Interrupt handler. I'm using NASM Assembler, under DOSBox and MS-DOS 6.22 in VirtualBox. I've thought about debugging, but doing so on a TSR program sounds impossible. I've tried pushing the Data Segment onto the Code Segment, and saving the original Data Segment for restoring later, but it seems to hang the machine even after restoring the Data Segment.

Is volatile needed when variable is only read during interrupt

六月ゝ 毕业季﹏ 提交于 2019-12-10 12:45:25
问题 The C standard states that the volatile keyword should be used in the definition of a variable when there's a chance that the variable's value could change outside the normal flow of execution of the program. If a global variable is changed (written) during normal execution flow and only read outside this normal flow (in an interrupt). Does this variable need to be volatile ? And why ? 回答1: If a global variable is changed (written) during normal execution flow and only read outside this

Why does my SWI instruction hang? (BeagleBone Black, ARM Cortex-A8 cpu)

混江龙づ霸主 提交于 2019-12-10 11:48:36
问题 I'm starting to write a toy OS for the BeagleBone Black, which uses an ARM Cortex-A8-based TI Sitara AM3359 SoC and the U-Boot bootloader. I've got a simple standalone hello world app writing to UART0 that I can load through U-Boot so far, and now I'm trying to move on to interrupt handlers, but I can't get SWI to do anything but hang the device. According to the AM335x TRM (starting on page 4099, if you're interested), the interrupt vector table is mapped in ROM at 0x20000. The ROM SWI

How are software interrupts triggered in windows when the IRQL drops?

假如想象 提交于 2019-12-10 10:54:35
问题 I know that for hardware interrupts, when KeLowerIrql is called by KeAcquireInterruptSpinLock, the HAL adjusts the interrupt mask in the LAPIC, which will allow queued interrupts (in the IRR probably) to be serviced automatically. But with software interrupts, for instance, ntdll.dll sysenter calls to the SSDT NtXxx system services, how are they 'postponed' and triggered when the IRQL goes to passive level Same goes for the DPC dispatcher software interrupt (if the DPC is for the current CPU