First of all, hello ... I would like to know what is the advantage to go to Ring0 mode ... what kind of thing can you do while in Ring0 mode ? I would also like to know what is the use of shr shl ( shif left, shift right ) And finally what does db means before a string like db ญญ'some thing' Thank you
Well, I've not so many time... I'll explain quickly what db is: db means that you define byte(s), it can be a string (many bytes) or just 1 byte or many bytes. For example: Name db "abcdf",0 is equal to Name db 61h, 62h, 63h, 64h, 65h, 0 You can define also 1 byte (to make a counter i.e): MyCount db 0 Then you can turn it to 0 to 255 (0FFh in hexadec) Hope you understand PS:there is also 'dd', 'w', ...
The shl/shr instructions are used to quickly multiply/divide by two (unsigned). Also in graphics/encryption/compression algorithms. To start with, it's just good to know what it does; and then in time you'll get a feel for where it's used. Just think of the bits lined up in a row (a parade, food line, etc.). One zero bit comes in from the left or right side, and a bit is lost out of the other side - not really lost - it gets put into the carry flag. It's important to compare these instructions to the other shift instructions to know the differences. For example, to do signed multiply/divide by two use sal/sar - the high bit is presevered with sar - there is no difference between shl and sal. I chickened out and took the other easy question. :D You should probable browse the message board and web on the ring0 question - there is much information.
You want me, Ring 0 is an access right to certain instructions in the processor, it is usually used for device drivers that must supply services to the operating system. Major source of info is in the platform specific device development kits from Microsoft. If you look around the net, you will find some info on device drivers and Iczelion has a set of tutorials on the win95 form of device drivers, VxD. DB literally means BYTE size data and it is used in assembler for things like string data which is usually a sequence of bytes. In the section of a 32 bit PE file called the .DATA section, you can use the notation,
to store string data for an application. SHR and SHL are literally bit shift instructions that will shift the bit positions in a piece of data by a specified amount right or left. Copy the data into a register and shift the bits in the data by the amount you need.
varname DB "This is a zero terminated string",0
Means shift the bits in the EAX register right by 2 bits. Bit shifts and rotations (ROL/ROR) are very useful instructions, you can divide and multiply by powers of 2 using these instructions and it is much faster than using the old integer MUL instructions. Regards, email@example.com
SHR eax, 2
shl ax, 1 shl ax, 1 shl ax, 1 shl ax, 1 and shl ax, 4 which one is faster? some book i read said that if you shl n time where n is less than 4, then you should use shl reg, 1 n time. instead of shl ax, n