Skip to contentSkip to conversation

calculating byte

DISCUSSION ssams 6 participants 7 messages Jul 23, 2003 – Jul 25, 2003

lore
Share & tools
lore

ssams

author
#0 lore raw

hi all
if u have time, please answer my following question i try to learn more about assembly. in a time i'found some article that explain about exploit, and i get this following code. My question is.. how to calculate byte at each line..?
thnaks before
regard
ssams

            .....
            ..... 
            movl %esi,array-offset(%esi) # 3 bytes
            movb $0x0,nullbyteoffset(%esi)# 4 bytes
            movl $0x0,null-offset(%esi) # 7 bytes
            movl $0xb,%eax # 5 bytes
            movl %esi,%ebx # 2 bytes
            leal array-offset,(%esi),%ecx # 3 bytes
            leal null-offset(%esi),%edx # 3 bytes
            int $0x80 # 2 bytes
            ....
            ....

===========================================================================================
"TELKOMNet Instan Divre VI Kalimantan memberikan DISKON PROGRESSIVE kepada para pengguna TELKOMNet-Instan hingga 50% mulai bulan Juli hingga September 2003."
===========================================================================================

#1 lore raw

Hi ,

You can find this by looking at the
Machine Opcodes required for each instruction .

Bye

--- ssams <[email protected]> wrote: > hi all

Quoted 10 lines

if u have time, please answer my following question i try to learn more about assembly. in a time i'found some
article that explain about exploit, and i get this following code. My question is.. how to calculate byte at
each line..?
thnaks before
regard
ssams

Quoted 13 lines
            .....
            ..... 
            movl %esi,array-offset(%esi) # 3 bytes
            movb $0x0,nullbyteoffset(%esi)# 4 bytes
            movl $0x0,null-offset(%esi) # 7 bytes
            movl $0xb,%eax # 5 bytes
            movl %esi,%ebx # 2 bytes
            leal array-offset,(%esi),%ecx # 3 bytes
            leal null-offset(%esi),%edx # 3 bytes
            int $0x80 # 2 bytes
            ....
            ....

===========================================================================================

Quoted 5 lines

"TELKOMNet Instan Divre VI Kalimantan memberikan DISKON PROGRESSIVE kepada para pengguna TELKOMNet-Instan hingga 50% mulai bulan Juli hingga September 2003."

===========================================================================================

Quoted 5 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to [email protected] More majordomo info at

http://vger.kernel.org/majordomo-info.html

________________________________________________________________________
Send free SMS using the Yahoo! Messenger. Go to http://in.mobile.yahoo.com/new/pc/

#2 lore raw
In reply to ssams

ssams am Mittwoch, 23. Juli 2003 23:15:

Quoted 6 lines

hi all
if u have time, please answer my following question i try to learn more about assembly. in a time i'found some article that explain about exploit, and i get this following code. My question is.. how to calculate byte at each line..?

for a rough calculation, as a rule of thumb:

simple opcode 1 byte (very few such opcodes, e.g. push/pop)
opcode w. addressing modifier 2 bytes
mov immediate data + 4 bytes
signed byte displacement + 1 byte

'other' addressing size + 1 byte (16/32bit)
'other' data item size + 1 byte (word/dword)

'exotic operations praefix' + 1byte (e.g. "0F")

hp

Signature · 3 lines
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de
	FAQ(s) + DOCs at http://linuxassembly.org
  pse, reply to << lx -at- lxhp -dot- in-berlin -dot- de >>
#3 lore raw

switching to real mode?

Hi!

I know this question sounds a bit silly...
How would one switch to real mode in Linux, are there any caveats?

Wolfgang

#4 lore raw

Re: switching to real mode?

Wolfgang Huber am Freitag, 25. Juli 2003 14:38:

Quoted 3 lines

Hi!

I know this question sounds a bit silly...

indeed...

Quoted 1 line

How would one switch to real mode in Linux, are there any caveats?

none - if you can.

DA => FAQ(s) + DOCs at http://linuxassembly.org

hp.

#5 lore raw

Re: switching to real mode?

In reply to Wolfgang Huber
Quoted 7 lines · Wolfgang Huber

Hi!

I know this question sounds a bit silly...
How would one switch to real mode in Linux, are there any caveats?

Wolfgang

For what purpose you need it? From linux x86 users point of view: you just can't, or am i wrong? ;) Generally once you switch to protected mode you don't need real one and if you want to run some code written for real mode you just run it in vm86 mode rather than switching it back (as i remember dosemu does something like this). If you are interested in "hard" switch i suggest to read ie. intel's "software developers manual vol. 3, system programming", chapter 8 "processor management and initialization", point 8 "mode switching" (1999 version).

Correct me linux-assemblers if i'm wrong!

Signature · 1 line
Maciej Hrebien
#6 lore raw

Re: switching to real mode

Linux has support for V86 mode, which switches to something closely resembling Real Mode on IRET, and switches to pmode on an interrupt, so that 8086 code can be run on a pmode paged OS, and the V86 task can be paged, which allows numerous V86 tasks to think they have the low meg.

Otherwise, switching to Real Mode = Leaving Linux, or any other unix-alike. You could do that too, and alternate between Linux and Real Mode, maybe. Doing so would be a more twisted hack than Al Viro's namespaces.

Rick Hohensee