Recursion in MIPS
I want implement a recursive program in assembly for MIPS, more specifically the well known Fibonacci function. There's the implementation in C: int fib(int n) { if(n<2) return 1; return fib(n-1)+fib(n-2); } ...
I want implement a recursive program in assembly for MIPS, more specifically the well known Fibonacci function. There's the implementation in C: int fib(int n) { if(n<2) return 1; return fib(n-1)+fib(n-2); } ...
I need to protect my program from disassembly. The first attempt would be by encrypting the program and decrypting its parts when needed. Perhaps encrypting again when decrypted code is executed. Please give me a clue, how create this type of defense. Obviously without assambler this task is difficult, but I haven't found many resource...
Yesterday, while I was pondering over Why can’t OS use entire 64-bits for addressing? I found another interesting thing. Lets take Intel Core 2 Duo Processor for example. From "4.2 Alphabetical Signals Reference" of Intel Core 2 Duo Processor E8000 and E7000 Series - Datasheet I came to know that it has 36 address lines & 64 data lines....
Alright so I have this line in my assembly MOV EAX, DWORD PTR DS:[ESI] where ESI is 00402050 (ascii, "123456789012") After this instruction: EAX = 34333231 What really happened here? How is this value calculated, and why? Where could I get some good reference on this kind of thing? ...
Well, a simple question here I am studying some assembly, and converting some assembly routines back to VB.NET Now, There is a specific line of code I am having trouble with, in assembly, assume the following: EBX = F0D04080 Then the following line gets executed SHR EBX, 4 Which gives me the following: EBX = 0F0D0408 Now, in V...
In the Intel documentiation manuals, I see references to 00+ multiple places, but no definition. What is this 00+ instruction/opcode? ...
Hi! I don't understand this piece of code :) mov ax, 07C0h ; Set up 4K of stack space above buffer add ax, 544 ; 8k buffer = 512 paragraphs + 32 paragraphs (loader) cli ; Disable interrupts while changing stack mov ss, ax mov sp, 4096 sti ; Restore interrupts mov ax, 07C0h - here BIOS loads our code. Bu...
I have designed a MIPS I simulator using Verilator which allows me to wrap verilog code into c++. I am attempting to run a c++ program on my processor but I've reached some problems. My goal is to: write a test program in c++ compile this program using a cross compiler g++ (mips-linux) take generated ELF file and disassemble it using...
Hi, I have a code that changes the function that would be called, to my new function, but I don't want to call only my new function, I also want to call the old one. This is an example, so you can understand what I'm saying: If I disassemble my .exe, I will look at this part: L00123456: mov eax, [L00654321] //doesn't matter ...
Hi, I'm writing an assembly macro to a C-program, and being quite new with this I have gotten stuck on something. I'm trying to write a macro for moving data from a general purpose register to a special purpose register. My problem is that the syntax I've found to move data from a GPR to an SPR takes a constant SPR value, while I want ...
Hey All, I'm using Slackware 12.2 on an x86 machine. I'm trying to debug/figure out things by dumping specific parts of memory. Unfortunately my knowledge on the Linux kernel is quite limited to what I need for programming/pentesting. So here's my question: Is there a way to access any point in memory? I tried doing this with a char p...
How important are section/segment directives? I've noticed that they are usually optional. Also, I've noticed that the output size changes when you do or do not include them. I'm using NASM, if that helps. ...
2^64 is still far from the "infinity" my ram/hard drive can handle... First I wonder how GMP works with memory/processor since it does some kind of shady optimisations... I was also wondering if there is a way of storing an integer (unsigned, it's easier) on an arbitrary number of bytes. For example, on 50 bytes, I would have a cap of ...
Hi, That might be a little bit an exotic problem, but I hope somebody can still help me out a bit ;). I would like to execute a standard C program, however, at some point during program execution I would like that a certain number of instructions, which are stored in a local scratch pad RAM, are executed. The scratchpad memory i...
I'm developing a text editor like VI with assembly and need to take control of console, exactly like Vi, for example changing the position of cursor and inserting and deleting of strings. I googled a lot but didn't find any good suggestion, the code is not my problem, I want to get the idea of how to do it, then i could code it myself I'...
can anybody give me good tutorial's site about inline assembler in c++? ...
[Edit: It seems this is an issue on gcc versions prior to 4.4, I got confused because of a gcc bugzilla entry reporting it for 4.5 (latest). Sorry, I should've tested with more recent versions. Still, the problem is somewhat valid as most people don't run gcc 4.4+.] Is it possible to tell the compiler the variable used in a switch fits ...
How do I use RIP Relative Addressing in a Linux assembly program for the AMD64 archtitecture? I am looking for a simple example (a Hello world program) that uses the AMD64 RIP relative adressing mode. For example the following 64-bit assembly program would work with normal (absolute addressing): .text .global _start _start: mo...
Hey, I'm pretty interested in OS writing, I was for a long time, but still just could not swallow it (I mostly go with "What can't you understand on first read you should not do at all" - and it applies well for everything else I do, like PHP, HTML, AS3.0, C++... a lot more) just now I KIND of got it. The problem is - really, ASM was not...
I want to write a bunch of optimizations for gcc using genetic algorithms. I need to measure execution time of an assembly functions for some stats and fit functions. The usual time measurement can't be used, 'cause it is influenced by the cache size. So I need a table where I can see something like this. command | operands | operands s...