I'd like to make a simple x86 assembler. I'm wondering if there's any tutorials for making your own assembler. Or if there's a simple assembler that I could study.
Also, I wonder what tools are used in looking at and handling the binary/hex of programs.
...
CPU Switches from User mode to Kernel Mode : What exactly does it do? How does it makes this transition?
EDIT:
Even if it is architecture dependent please provide me with an answer. The architecture is up to you. Tell me for the architecture you know about.
I want to get an idea about what all things will be involved in it.
...
I have just started the Assembly language programming and in the first lecture our teacher told us about intel 8080 and intel 8085 and he said there was 64k memory with these processor.
Now i want to know that how we find this amount of memory with specific processor, for example i have a processor 1.8 Ghz , now how i can find out the a...
Suppose the accumulater register of the processor is of 16 bit , now we can call this processor as 16 bit processor, that is this processor supports 16 bit addressing.
now my question is how we can calculate the number of memory cells that can be addressed by 16 bit addressing?
according to my calculation 2 to the power 16 becomes 6505...
I am beginning some experimentation in writing a kernel and having fun doing it. I have the basic boot-loader done and the following directives:
[BITS 16]
[ORG 0x0000]
In the kernel tutorial, however, it starts with:
[ORG 0x0000]
[BITS 16]
I was wondering if the order in which these directives are given makes a difference? I am...
IAPX88 can deal with 1 mega byte memory(20 bit addressing), now my question is how we make a 20 bit address by using two 16 bit registers.please give an example.
...
What is the minimum set of steps required to use LODSB to load a relative address to a string in my code?
I have the following test program that I'm using PXE to boot. I boot it two ways: via pxelinux.0 and directly. If I boot it directly, my program prints both strings. If I boot via pxelinux.0, it only prints the first string.
Why? ...
Debugging some code in Visual Studio 2008 (C++), I noticed that the address in my function pointer variable is not the actual address of the function itself. This is an extern "C" function.
int main() {
void (*printaddr)(const char *) = &print; // debug shows printaddr == 0x013C1429
}
Address: 0x013C4F10
void print() {
...
}
Th...
I'm generating some opcodes dynamically in a JIT compiler and I'm looking for guidelines for opcode alignment.
1) I've read comments that briefly "recommend" alignment by adding nops after calls
2) I've also read about using nop for optimizing sequences for parallelism.
3) I've read that alignment of ops is good for "cache" performanc...
I've been reading up on memory models in an assembly book I picked up and I have a question or two. Let's say that the address bus has 32 lines, the data bus has 32 lines and the CPU is 32-bit (for simplicity). Now if the CPU makes a read request and sends the 32bit address, but only needs 8 bits, all 32 bits come back anyway? Also, t...
Hi,
I'm doing some ASM code in a C code with the asm function.
My environment is DVL with gcc version 3.
Hi need to make a JMP to a relative address like %eip+0x1f.
How can I do this ?
Thanks
...
I have the following code:
#include <boost/shared_ptr.hpp>
struct Foo { int a; };
static int A;
void
func_shared(const boost::shared_ptr<Foo> &foo) {
A = foo->a;
}
void
func_raw(Foo * const foo) {
A = foo->a;
}
I thought the compiler would create identical code, but for shared_ptr version an extra seemingly redundant instru...
Recently I've been using lot of Assembly language in *NIX operating systems. I was wondering about the windows domain.
Calling convention in linux:
mov $SYS_Call_NUM, %eax
mov $param1 , %ebx
mov $param2 , %ecx
int $0x80
Thats it. That is how we should make a system call in linux.
Reference of all system calls in linux:
Regarding...
I've been getting into some assembly lately and its fun as it challenges everything i have learned. I was wondering if i could ask a few questions
When running an executable, does the entire executable get loaded into memory?
From a bit of fiddling i've found that constants aren't really constants? Is it just a compiler thing?
const...
Hello,
I'm in an interesting problem.I forgot I'm using 64bit machine & OS and wrote a 32 bit assembly code. I don't know how to write 64 bit code.
This is the x86 32-bit assembly code for Gnu Assembler (AT&T syntax) on Linux.
//hello.S
#include <asm/unistd.h>
#include <syscall.h>
#define STDOUT 1
.data
hellostr:
.ascii "hello w...
I'm building a compiler/assembler/linker in Java for the x86-32 (IA32) processor targeting Windows.
High-level concepts (I do not have any "source code": there is no syntax nor lexical translation, and all languages are regular) are translated into opcodes, which then are wrapped and outputted to a file. The translation process has seve...
Hello All-
I'm working on a homework assignment in x86 and it isn't working as I expect (surprise surprise!). I'd like to be able to output values of variables in x86 functions to ensure that the values are what I expect them to be. Is there a simple way to do this, or is it very complex? For what it's worth, the x86 functions are being...
How does objdump manage to display source code? Is there a reference to the source file in the binary? I tried running strings on the binary and couldn't find any reference to the source file listed...
Thanks.
...
Which one is better/faster/preferred
1:
mov eax, 5
push eax
mov eax, [someAddress]
push eax
2:
push 5
push [someAddress]
...
Can anybody explain me what effect these two instructions cause in the assembly code generated by gcc for x86 machines:
push %ebp
movl %esp, %ebp
...