Erwthshs:

Giorgos Keramidas keramida at freebsd.org
Sun Jan 27 18:39:01 EET 2002


On 2002-01-27 13:54:48, Thanos Agathaggelidis wrote:
> 
> Tora teleytaia exo mia aporia (h opoia profanos einai asteia gia
> tous pio pollous edw mesa):
> 
> Exoume to Linux,ta *BSDs, ta Windows, to OS/2, to Solarisx86. OLA trexoun 
> se arxitektoniki x86 ok? Otan kanoume compile ena programma tote ayto den 
> metatrepetai se assembly (h opoia den eksartatai ap'to OS alla apo thn CPU 
> swsta?) kai meta se machine code? Giati tote ena programma pou graftike se 
> Win/86 den paizei se Linux/86?

Giati to Lixux einai diaforetiko leitourgiko susthma, me diaforetikes
libraries, pou kalountai me diaforetiko tropo, kai epistrefoun
diaforetika apotelesmata, h akoma xeirotera exoun diaforetika
interfaces.

Paradeigma:

- Estw oti sta Windows gia na "anoijei ena arxeio" to programma kanei:

	.data
		.public	name
	name	.asciiz "koko.txt"

	.text
		.public	openfile
		.type	openfile, at function
	openfile:
		movl $1,%eax
		movl $name,%ebx
		intl $0x21

  kai meta apo auto to file-handle einai ston %eax kataxorhth,
  me errors pou mporei na parousiasthkan ston %ebx kataxorhth.

- Sto Linux omws gia na kanei tin idia douleia, na prepei na kaneis:

	.data
		.public	name
	name	.asciiz "koko.txt"

	.text
		.public	openfile
		.type	openfile, at function
	openfile:
		movl $15,%eax		/* diaforetiko syscall */
		pushl $name		/* perasma parametrou sto stack */
		jmp $_syscall		/* diaforetikos tropos klhshs */

Opws katalabaineis, mporei to idio instruction set (tou 386 sth
sugkekrimenh periptosh) na to xrhsimopoiei to ka8e leitourgiko systhma
opws tou katebei.  Den upoxreonei kaneis ta leitourgika susthmata na
akolou8hsoun ton One-True-Way(TM) ulopoihshs kathe pragmatos, afou den
uparxei One-True-Way(TM).

> Epishs
> i)  pia i diafora metaksy machine code kai assembly?

	machine code	= 0x90 0x90 0x90 0x2c
	assembly	= nop  nop  nop  ret

> ii) Giati otan kanoume compile ena programma ayto metatrepetai se
>    binary? (ayth kian einai xazh erwthsh, alla DEN KSERW :(( )

Kapws prepei na to 'treksei' h cpu sou swsta?
E loipon h cpu den jerei apo "assembly" ki alla tetoia omorfa.
Mono bytecode jerei na diabazei kai na to metafrazei se energeies
opws:

	- pare auto to byte kai balto ston kataxorhth eax

	- bale thn timh tou eax sth dieu8unsh mnhmhs pou 'deixnei'
	  auth th stigmh o ss:esp kai meiose ton esp kata 4.

> Any urls?
> 
> To kserw oti einai naive erwthsh alla toulax. egw exw kapoio keno
> gnwshs edw.

Xreiazesai kapoio biblio pou na exei ta basika pragmata gia
upologistes, pos douleuoun, kai ti dunatothtes exei to hardware tous
(anejarthta apo to ti leitourgiko susthma exeis).  Sinithos tha breis
tetoia stis biblio8hkes twn panepisthmiakwn tmhmatwn pou asxolountai
me 'computer science' kai alla tetoia omorfa :P

-- 
Giorgos Keramidas . . . . . . . . . keramida@{ceid.upatras.gr,freebsd.org}
FreeBSD Documentation Project . . . http://www.freebsd.org/docproj/
FreeBSD: The power to serve . . . . http://www.freebsd.org/



More information about the Linux-greek-users mailing list