I am new to MASM. So the questions may be quite basic.
When I am using the MASM assembler, there's an output file called "Link Map". Its content is composed of the starting offset and length of various segments, such as Data segment, Code segment and Stack segment. I am wondering that, where are these information describing? Are they ta...
Hi everyone:
I'm now performing a stack buffer overflow attack test on my own PC( Ubuntu 9.10, gcc-4.4.1 ) based on the article http://www.tenouk.com/Bufferoverflowc/Bufferoverflow4.html. Yet I haven't achieved the goal. Each time a segfault is thrown accompanied with some error informaiton.
I compile the source code, and wanna get fur...
If in exe (written in c++) file in .text section I'll add instruction like push eax; pop eax; I mean something what won't change anything. Will this program work properly or everything would get crashed ?
...
It seems that the following is a common method given in many tutorials on switching a processor from 16-bit to 32-bit:
mov eax, cr0 ; set bit 0 in CR0-go to pmode
or eax, 1
mov cr0, eax
Why wouldn't I simply do the following:
or cr0, 1
Is there something I'm missing? Possibly the only th...
I'm writing a MIPS assembly code that will ask the user for the file name and it will produce some statistics about the content of the file.
However, when I hard code the file name into a variable from the beginning it works just fine, but when I ask the user to input the file name it does not work.
after some debugging, I have discove...
In MIPS, is there a way to shift a binary number (0000) by filling its MSB with 1 (1000 and next time 1100 and next time 1110 so on...) each time?
...
If I have a value in an "f" register in MIPS, how do I truncate this down to X.YZ from X.YZDEF? Supposedly, you must convert from the float to two ints and display those... How is this done?
...
I'm doing some experimenting and would like to be able to see what is saved on the stack during a system call (the saved state of the user land process). According to http://lxr.linux.no/#linux+v2.6.30.1/arch/x86/kernel/entry_32.S it shows that the various values of registers are saved at those particular offsets to the stack pointer. He...
Hi folks, I'm trying to do something which I figure would be rather easy, though I'm beign proven terribly wrong. I'm probably doign something really dumb. Before I explain, here's my code:
.data
mynum:
.int 75
format:
.string "Value: %d\n"
.text
.globl main
main:
movl $0, %eax
# Add the number
addl $mynum,...
Hi,
I've come to learn that you cannot push a byte directly onto the Intel Pentium's stack, can anyone explain this to me please?
The reason that I've been given is because the esp register is word-addressable (or, that is the assumption in our model) and it must be an "even address". I would have assumed decrementing the value of some...
Suppose these two are essensially the same:
push 1
and
0x1231
Which says each assembly instruction maps to a machine code.
But is it necessary that each machine code can only map to one assembly code?
...
After the boot loader hands execution over to the kernel, what happens? I know assembler, so what are the first few instructions that a kernel must make? Or is there a C function that does this? What is the startup sequence before the kernel can execute an arbitrary binary?
...
How can I detect at compile time from an ASM source file if the target architecture is I386 or AMD64?
I am using masm(ml.exe)/masm64(ml64.exe) to assemble file32.asm and file64.asm. It would be nice to create a single file, file.asm, which should include either file32.asm, or file64.asm, depending on the architecture. Ideally, I would l...
What does the PCGPRLEN-1..28 means here?? Where does this 4 bit comes from?
...
This is perhaps more of a discussion question, but I thought stackoverflow could be the right place to ask it. I am studying the concept of instruction pipelining. I have been taught that a pipeline's instruction throughput is increased once the number of pipeline stages is increased, but in some cases, throughput might not change. Under...
Hello,
I want to generate fibonacci series using SBN in an OISC architecture. My initial approach is to implement it in assembly language first and then convert it to machine language. The first steps involve storing 0 and 1 in 2 registers and then subtract 1 from 0 and repeatedly subtract 1 in the consequent steps. Everytime it will ge...
I have an older C++ Windows program that I've been asked to get run in a kiosk style environment for a student project. From the main menu, hitting ESC will exit the program, which is undesirable. In ye olden days I would have trapped the keyboard interrupt or whatever and dug around to NOOP whatever JMP or CALL was getting referenced in...
When you pass parameters to a function on the cpu stack,
You put the parameters on then JSR puts the return address on the stack.
So that means in your function you must take the top item of the stack (the return address)
before you can take the others off)
eg is the following the correct way to go about it:
...
|Let’s do some additio...
I'm considering picking up some very rudimentary understanding of assembly. My current goal is simple: VERY BASIC understanding of GCC assembler output when compiling C/C++ with the -S switch for x86/x86-64.
Just enough to do simple things such as looking at a single function and verifying whether GCC optimizes away things I expect to d...
I've written an interpreter for my experimental language and know I want to move on and write a small compiler for it. It will probably take the source, go through the same steps as the interpreter (tokenizer, parser) and then translate the source to assembly.
Now my questions:
Can I expect that every command in my language can be 1:1...