In a called function,I want to save the "program counter" , when program reached to a specified location ,& then return from the function .
In the next calling of this function , I want to restore "pc+1" to continue the process.
How can I do this?
5 5536 D_C 293
Contributor
Can you give an example of precisely what you want? It's not so clear to me. Besides, I'm not sure one can gain access to the program counter.
C++ files may also be relative. That is suppose you have a function that prints the memory location of an instruction, then returns. If you run the program a second time, you may not get the same value.
Banfa 9,065
Recognized Expert Moderator Expert
To get access to processor registers you normally need to drop into assembly code.
However the C/C++ standards do not define this, only some C/C++ compilers support it and all in propriatory ways.
For instance in MSVC I think (IIRC) that the sytanx is -
void fn(void
-
{
-
// Some C code here
-
-
asm
-
{
-
// we've dropped into assembler, assembly code here
-
}
-
-
// More C code here
-
}
-
However you'd better be really sure you know what you are doing it you are going to mess directly with the pc.
Thanks for your reply,
I use IAR 4.4 for arm.
In this program I have a timer interrupt. I have a specified routine to be done in this sub routine.But every part should be done in one time,then the program should wait until next interrupt service routine call to continue.
I tried function pointer arrays & also switch-case routines.But these routines are not practical for me as they are very time consuming.
If I can save PC, in the next interrupt call I can continue the routine very quickly.
Isn't so?
Banfa 9,065
Recognized Expert Moderator Expert
If I can save PC, in the next interrupt call I can continue the routine very quickly.
Isn't so?
For the ARM platform I would definately expect you to have a way to write assembler instructions but it may require an assembler file (i.e. write 2 functions 1 to read the pc 1 to write it). You will need to check your toolset documentation.
What you propose to do may work, on the other hand it may cause everything to fall over in a big heap.
D_C 293
Contributor
In assembly, yes, this is do-able. Anytime an interrupt is called, it automatically pushes the registers and PC onto the stack. In order to pop the same information off of the stack, you should have an assembly command that "Returns from interrupt".
From the limited assembly programming I have done, RETI was the return from interrupt command, that I don't think I ever needed.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Vikrant |
last post by:
Friends,
Due an application (old) install program problem, Under AIX I could
only create DB2 instance, I could also catalog it. Its complex
application and I am not expert in creating full database for this
application, but I have desired DB2 backup (by db2 backup db command).
Can I do redirected restore (SET TABLESPACE CONTAINERS ....) only
when instance is created & cataloged , I am under the impression that
redirected restore is...
|
by: Daniel Vallstrom |
last post by:
I'm having problems with inconsistent floating point behavior
resulting in e.g.
assert( x > 0.0 && putchar('\n') && x == 0.0 );
holding. (Actually, my problem is the dual one where I get
failed assertions for assertions that at first thought ought
to hold, but that's not important.)
At the end is a full program containing the above seemingly
|
by: Arne |
last post by:
A lot of Firefox users I know, says they have problems with validation
where the ampersand sign has to be written as & to be valid. I don't
have Firefox my self and don't wont to install it only because of this,
so I hope some of you gurus can enlighten me with this :)
In what circumstances can the "&" in the source code be involuntary
changed to "&" by a browser when or other software, when editing and
uploading the file to the web...
|
by: Irene |
last post by:
Hello all!
I'm creating a web site in ASP.NET (VB.NET). One of the requirements was to
allow users to create orders going through several steps. A must have is to
have an option to save the work in any phase (any step) and to be able to
continue later.
My idea was to create several pages as steps (no, wizard control is not
suitable for several reasons) and to allow users to save any step to the
database, that is, a ViewState of the...
|
by: Aenima1891 |
last post by:
write a program that replaces strings of blanks by the minimum number
of blanks to space to the next tab stop.
#include <stdio.h>
#define TABSIZE 8
int main()
{
int counter, c;
| |
by: Jonathan Pritchard |
last post by:
I know this is a simple problem, but I've just included this in the
title because it explains what my program tries to do.
The following does not work, it for someone reason does not want to
place the values on a new line.
=======================================================================
#include <stdio.h>
#include <conio.h>
int main(void)
|
by: fdu.xiaojf |
last post by:
Hi,
I have a program which will continue to run for several days. When it is
running, I can't do anything except waiting because it takes over most
of the CUP time.
Is it possible that the program can save all running data to a file when
I want it to stop, and can reload the data and continue to run from
where it stops when the computer is free ?
|
by: pkirk25 |
last post by:
I wonder if anyone has time to write a small example program based on
this data or to critique my own effort?
A file called Realm List.html contains the following data:
Bladefist-Horde
Nordrassil-Horde
Draenor-Alliance
Nordrassil-Alliance
Nordrassil-Neutral
Draenor-Horde
|
by: 1388-2/HB |
last post by:
I have a page with a significant number of dynamically created radio
buttons, checkboxes and textboxes.
When a user is presented with this form and subsequently fills a bunch of
stuff out, when they click submit I want to save their postback data (i.e.,
which checkboxes are checked, which radio buttons are pushed and what's
typed into the textboxes).
Then later I want another user to be able to view one of these forms and
elect to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |