BrokenThorn Entertainment - View topic - something that we lost...
It is currently Thu Sep 09, 2010 4:41 am




Post new topic Reply to topic  [ 9 posts ] 
something that we lost... 
Author Message
User avatar

Joined: Sun Feb 15, 2009 8:49 pm
Posts: 26
Location: Kyiv, Ukraine
Post something that we lost...
Hi... I'm thinking of one project to added to my os (I mean FreeType) and got thought: isn't a time to write malloc, calloc, realloc, dealloc, fopen, fseek (after filesystem, which I already did) etc. functions (I mean standard C++ library like stdio) ?

_________________
Thinking of great - thinking of little, thinking of little - thinking of great.


Sun Aug 16, 2009 6:08 pm
Profile E-mail WWW
Moderator

Joined: Tue Oct 23, 2007 10:05 am
Posts: 311
Location: 127.0.0.1
Post Re: something that we lost...
Writing a heap memory management library can be very tricky to do correctly. There is nothing stopping you at this point writing the heap memory management functions.

I suggest you use libc as reference to help you avoid the pitfalls.

As for the rest (streams etc), there is more you need to be able to do first. You need a way to buffer parts of files in memory as a bare minimum. Also, some way to deal with stdin, stdout and stderr differently from normal files.

Also - on a picky point of information - stdio is a C library. In C++, it is technically referenced as cstdio to denote the fact it is a C library and not a C++ one :P

~Andrew

_________________
Image


Sun Aug 16, 2009 9:43 pm
Profile E-mail WWW

Joined: Fri Jul 24, 2009 5:35 pm
Posts: 34
Post Re: something that we lost...
James Molloy's "heap" tutorial is quite good: http://www.jamesmolloy.co.uk/tutorial_h ... 0Heap.html


Sun Aug 16, 2009 10:53 pm
Profile E-mail
Moderator

Joined: Tue Oct 23, 2007 10:05 am
Posts: 311
Location: 127.0.0.1
Post Re: something that we lost...
Wow - that looks like a fantastic tutorial.

I will read it when its not midnight

~Andrew

_________________
Image


Sun Aug 16, 2009 11:06 pm
Profile E-mail WWW
User avatar

Joined: Sun Feb 15, 2009 8:49 pm
Posts: 26
Location: Kyiv, Ukraine
Post Re: something that we lost...
Yeah, that tutorial is great but it is written with GCC so has some problem with going down to VC++ (I mean GAS style of inline assembly, that gives us possibility to use all registers, and eip too. But VC++ asm don't know such register... and so on...)

And trying to run it I've got error that even James couldn't explain. :-)

Thanks.

_________________
Thinking of great - thinking of little, thinking of little - thinking of great.


Thu Aug 20, 2009 11:34 am
Profile E-mail WWW
Moderator

Joined: Tue Oct 23, 2007 10:05 am
Posts: 311
Location: 127.0.0.1
Post Re: something that we lost...
There is no difference between GAS ans VC++ in terms of which registers you can access. They both allow full and complete access to the x86 instruction set.

The two main differences are that GAS uses AT&T syntax while VC++ uses Intel(ish) which is the same as NASM already used so far. The other is that GCC is far far better at optimizing around inserted asm.

~Andrew

_________________
Image


Fri Aug 21, 2009 7:15 am
Profile E-mail WWW
User avatar

Joined: Sun Feb 15, 2009 8:49 pm
Posts: 26
Location: Kyiv, Ukraine
Post Re: something that we lost...
try on.

ex:

mov eip, eax

You'll get error @ undefined symbol

Neon wrote exactly what I wrote before (I asked him).

:-)

_________________
Thinking of great - thinking of little, thinking of little - thinking of great.


Fri Aug 21, 2009 9:49 am
Profile E-mail WWW
Site Admin
User avatar

Joined: Sat Oct 20, 2007 7:58 pm
Posts: 359
Post Re: something that we lost...
Hello,

There is no standard instruction for accessing eip. If an assembler allows access, it is a nonstandard extension. (Of course, there are standard 'tricks' that can be used to write or read eip.)

_________________
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com


Fri Aug 21, 2009 1:15 pm
Profile E-mail WWW

Joined: Sat Nov 24, 2007 6:23 pm
Posts: 4
Location: In front of my computer, duh.
Post Re: something that we lost...
Mike wrote:
Hello,

There is no standard instruction for accessing eip. If an assembler allows access, it is a nonstandard extension. (Of course, there are standard 'tricks' that can be used to write or read eip.)

Such as "push eip; pop eax" or "call geteip; geteip: pop eax" etc.

_________________
Image
Image


Sat Aug 29, 2009 8:28 pm
Profile E-mail WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB © phpBB Group.
Original Design by Vjacheslav Trushkin for Free Forums/DivisionCore.
Theme and forum modified by BrokenThorn Entertainment, Co.