Why the stack pointer is special in the register file? - cpu-architecture

I have a question about the register file.
As I know, the stack pointer is one of the special registers in the register file. Why it is determined specifically?
I mean compiler can define any register as a stack pointer and it can use it because it knows which is defined as the stack pointer during the compilation. So, no need for any special register for it.
Thank you.

Related

python3-pjsip(pjproject2.9 pjsua) custom sdp

I have a lab that I need to insert a custom body (SDP) in SIP message. I'm using python3-pjsip(pjproject2.9) to create simple SIP UA. However, python3-pjsip(pjproject2.9) does not support custom SDP. I found that someone raise a question about pjsua custom SDP on stack overflow and solved it. Unfortunately, I don't know how to modify the pjsua source with those tips. Would you tell me how to modify it in more detail or share the source you modified? .
Could I need to modify the C code?
I've never used PJSIP in Python, but I think you should look into on_call_sdp_created callback. There you should use pjmedia_sdp_media structure to add new SDP parameter to pjmedia_sdp_session provided by callback's argument. Functions pjmedia_sdp_attr_create and pjmedia_sdp_media_add_attr also should be helpful there.
Good luck!

How to know if "disableInitialLoad" was called on GPT?

I need to know if googletag.pubads().disableInitialLoad() was called, in which case I'll load an ad using a display and a refresh calls, otherwise I'll load it using just display. My assumption is that if I always call display plus refresh I will get 2 ad requests unless disableInitialLoad had been called.
Is it possible to know that?
There is an undocumented variable on pubads that internally saves the state of disableInitialLoad, because it is undocumented you have to use it under your own risk.
the variable is window.google_DisableInitialLoad
Hope it is still usefull to you.
There is a method in GPT for doing this which is: isInitialLoadDisabled()
And as Claudio wrote - it's good practice not to use undocumented variables.
Undocumented variables might not do exactly what you think they do - and their behaviour might change at any point (see avoiding common GPT implementation mistakes).

load module in system call implementation

I've seen some examples of adding system call to FreeBSD, as I understood , we should have a load module in the body of our implementation, and also this load is the same in every example which I've seen.
is the load module fix? if not, how can I implement it?
the following links are the examples of having the same load module:
1-the link which answers about the system call implementation
2- there is an example of system call here: /usr/share/examples/kld/syscall/module/syscall.c
Because of this I understand that if I want to add a system call using Kernel Loadable, a load handler module is the same in all of KLD.
"Basically, the load handler function is, as it states, a function
that handles the loading and unloading of a KLD. Hence, when a KLD is
kldloaded or kldunloaded, this handler is what, at a very simplistic
level, gets called."

correct method to create global variable in iphone sdk?

is there any best method to maintain global variable in iphone sdk? if i change it, it will affect in all controllers,views of that iphone application?
Globals are currently considered ugly, but they are a type of unprotected pre-allocated pre-initialized singleton, and all there was in computer programming best practices 50 years ago (1st edition of Knuth's books, etc.). The best method of maintaining globals includes using a lot of very clear comments so that you can consider something else when it's time to make the code more modular and reusable (potentially at some cost in code size).
To answer the OP's question, if you modify a global, then any controllers or views (and any C or Objective C code in the same thread that doesn't "cover" the globals name) that reads that global will get the newest value. But that new value won't be "pushed" immediately. Those views or controllers won't notice any new value until some method eventually is called that actually reads the global variables.
If you need a view or controller to respond faster, then you will need notifications or key-value observing rather than just modifying a global variable.
Globals are ugly. Better to use a singleton "Data Manager" class that contains all your data, and then use either notifications or key-value observing to update your ViewControllers about changes.

How to trace out all messages sent to a particular class or instance in Objective-C?

I would like to trace out all messages sent by the Objective-C runtime to a particular class, say UITableView (or a particular instance) so I can better understand the inner workings of some classes. Is there a way to do this?
Another use case is to trace out all delegate methods that are being called (say UITableViewDelegate methods) without having to declare them and put a trace method in each of them.
This may be a little heavy-handed, but try setting the NSObjCMessageLoggingEnabled environment variable to YES. That will show all the messages sent to every object, but you can easily filter it down to the messages sent to a particular class.
Some good tips here: http://www.dribin.org/dave/blog/archives/2006/04/22/tracing_objc/
Disclaimer: I'm not sure if the environment variable works for iPhone.