OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:54 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 55 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Thu Jan 21, 2010 11:24 am 
Offline
Member
Member

Joined: Sun Mar 15, 2009 9:45 pm
Posts: 40
MessiahAndrw wrote:
quok wrote:
and the second winner will be announced after community voting has closed.


What exactly will the community be looking for? The goals are very strict and there's not much room for creative freedom if at all. So if two bootsectors complete all the goals - how am I suppose to judge the better of the two?


Maybe which one is better documented ?
Or employs nifty tricks to perform the same tasks ? (code faster or smaller)
Or simply loads faster the 'osload' ELF file ?


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Thu Jan 21, 2010 3:30 pm 
Offline
Member
Member

Joined: Sun Mar 15, 2009 9:45 pm
Posts: 40
@Quok

What about the constraints concerning the format of the resulting FAT image (with our boot loader installed via mformat),
is it supposed to be still mountable as a FAT disk ? Or is it just supposed to be booted by a machine ?

If yes, does it HAVE to be mountable by any system ?
I ask this question because Windows for instance seems to be very picky with the actual BPB content, and refuses to recognize some of my tests with
some special tricks (in custom fields not overwritten by mformat -k -B),
when linux seems to not care much apart from the main fields (geometry, etc.. all the fields that are overwritten by mformat -k -B)

What is the degree of compliance required regarding the BPB/FAT format and mountability ?

(eg: if your goal is just too first fill a valid FAT disk with your osloader, then to smash its boot sector with our entry and then only boot the resut in an emulator or a real machine; it's rather different than if you still want to mount the resulting disk, put more files on it, etc...)


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Thu Jan 21, 2010 6:33 pm 
Offline
Member
Member
User avatar

Joined: Wed Feb 07, 2007 1:45 pm
Posts: 1401
Location: Eugene, OR, US
Quok is out of town until Sat., but as to MessiahAndrw's question: it seems unlikely that anyone will be able to quite meet the full criteria for "winning". So the community vote is for the purpose of choosing a "winner", even if there is no winner. The community will not need to consider full compliance with all the rules -- the community will choose the "best" one, by any criteria it prefers. The community may think that a bootsector that is slightly bigger than 512b is still the best. Or one that has the niftiest code. Who knows how the mob decides in a democracy, anyway?

On your second question, you will need to wait for quok. I suspect that he would want for the bootsector/partition to mount under Windoze, too.


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Fri Jan 22, 2010 2:18 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
bewing wrote:
I suspect that he would want for the bootsector/partition to mount under Windoze, too.
... otherwise it wouldn't be a valid FAT image, no? :wink:

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Mon Jan 25, 2010 5:37 pm 
Offline
Member
Member

Joined: Sun Mar 15, 2009 9:45 pm
Posts: 40
@quok : one question regarding the OSLOADER ELF characteristics :
is it really supposed to be mapped at *ANY* address between 0-0x100000 ?
I mean for example, -Ttext=$text with :
text=0 (IVT)
text=0x7c00 (ourself)
etc...


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Mon Jan 25, 2010 5:55 pm 
Offline
Member
Member

Joined: Wed Oct 18, 2006 10:43 pm
Posts: 490
Location: Kansas City, KS, USA
a427 wrote:
@quok : one question regarding the OSLOADER ELF characteristics :
is it really supposed to be mapped at *ANY* address between 0-0x100000 ?
I mean for example, -Ttext=$text with :
text=0 (IVT)
text=0x7c00 (ourself)
etc...


The OSLOADER ELF file will not be linked at 0x0 or 0x7c00. I'll likely have a couple of binaries linked at different addresses between 0x40000 and 0x80000. A great test, actually, would be to load OpenBSD's bootloader (known as boot(8), and installed at /boot). Just rename it to OSLOADER and place it in the root directory of your FAT filesystem. It's a statically linked ELF file, linked to run at 0x40120, and it is less than 64K in size.


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Tue Jan 26, 2010 7:42 pm 
Offline
Member
Member

Joined: Tue Apr 28, 2009 4:58 pm
Posts: 87
MessiahAndrw wrote:
The goals are very strict and there's not much room for creative freedom if at all.
That was exactly my one of my valid points ... those who remember.
MessiahAndrw wrote:
So if two bootsectors complete all the goals - how am I suppose to judge the better of the two?
But only one bootsector will be posted ahead of the other. So one $50 winner.


I sincerely hope that I did not violate any rules while making this post.


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Wed Jan 27, 2010 10:12 am 
Offline
Member
Member

Joined: Wed Oct 18, 2006 10:43 pm
Posts: 490
Location: Kansas City, KS, USA
geppyfx wrote:
MessiahAndrw wrote:
The goals are very strict and there's not much room for creative freedom if at all.
That was exactly my one of my valid points ... those who remember.

Lots of contests strict goals and aren't necessarily about creative freedom. I suppose this is one of them. It's more about the challenge and having fun tackling that challenge, IMO.
geppyfx wrote:
MessiahAndrw wrote:
So if two bootsectors complete all the goals - how am I suppose to judge the better of the two?
But only one bootsector will be posted ahead of the other. So one $50 winner.

Yes, one $50 winner, but I think MessiahAndrw's quote was taken out of context here. Wasn't he asking how to judge the better of the two bootsectors during the community vote portion of the contest? That really comes down to personal preference. Personally I'd vote for whichever bootsector has what I feel to be the better code, better documentation, etc.


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Wed Jan 27, 2010 11:08 am 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 1225
quok wrote:
a427 wrote:
A great test, actually, would be to load OpenBSD's bootloader (known as boot(8), and installed at /boot).


Do you have a sample of that file or know where to find one?

_________________
Live PC 1: Image Live PC 2: Image

YouTube:
http://youtube.com/@AltComp126/streams
http://youtube.com/@proyectos/streams

http://master.dl.sourceforge.net/projec ... 7z?viasf=1


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Wed Jan 27, 2010 12:05 pm 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 9:29 pm
Posts: 2426
Location: Canada
~ wrote:
Do you have a sample of that file or know where to find one?

OpenBSD? :|

You can either take a copy from an existing installation, or grab baseXX.tgz from a mirror and extract it.

_________________
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Sat Jan 30, 2010 10:07 am 
Offline
Member
Member

Joined: Sun Mar 15, 2009 9:45 pm
Posts: 40
@quok

It's strange, now that I have something that boots 32 bit pmode ELF from FAT12, I did some experiments with the 'boot' file from openbsd,
and I wonder if this particular ELF file is not supposed to be specially bootstrapped in 16 bit real mode, plus with some special magic in registers :

Entry point address: 0x40120

boot: file format elf32-i386

Disassembly of section .text:

00040120 <.text>:
40120: 66 58 pop %ax
40122: 66 3d 0d d0 cmp $0xd00d,%ax
40126: 01 c0 add %eax,%eax
40128: 74 00 je 0x4012a
4012a: 66 5a pop %dx
4012c: fa cli
4012d: 66 0e pushw %cs
4012f: 66 1f popw %ds
40131: 67 66 0f 01 15 addr16 lgdtw (%di)
40136: 30 3f xor %bh,(%edi)
40138: 00 00 add %al,(%eax)
4013a: 0f 20 c0 mov %cr0,%eax
4013d: 66 83 c8 01 or $0x1,%ax
40141: 66 data16
40142: 0f 22 c0 mov %eax,%cr0
40145: 66 ea 4d 01 04 00 ljmpw $0x4,$0x14d
4014b: 08 00 or %al,(%eax)
4014d: b8 10 00 00 00 mov $0x10,%eax
40152: 8e d8 mov %eax,%ds

=> apparently, there are quite some extra 0x66 prefix to forge 16-bit assembly, plus we appear to load gdt and switch to protected mode...

So if one of your rules is to switch to protected mode within the loader (before bootstrapping OSLOADER), then it will prevent booting eg: the openbsd bootloader ?


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Sat Jan 30, 2010 11:09 am 
Offline
Member
Member

Joined: Wed Oct 18, 2006 10:43 pm
Posts: 490
Location: Kansas City, KS, USA
a427 wrote:
@quok

It's strange, now that I have something that boots 32 bit pmode ELF from FAT12, I did some experiments with the 'boot' file from openbsd,
and I wonder if this particular ELF file is not supposed to be specially bootstrapped in 16 bit real mode, plus with some special magic in registers :
<snip>
So if one of your rules is to switch to protected mode within the loader (before bootstrapping OSLOADER), then it will prevent booting eg: the openbsd bootloader ?

Ah, thanks for pointing that out, I completely forgot to mention that in your bootsector you shouldn't worry about switching to pmode. The OSLOADER, like the OpenBSD bootloader, is a 32-bit ELF file but it meant to be launched from 16 bit real mode. The first thing the osloader does (and OpenBSD's /boot) is jump to protected mode.

I'm sorry I failed to point this out earlier. Hopefully it'll make the contest a bit easier and more appealing for some people. :)


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Sat Jan 30, 2010 11:11 am 
Offline
Member
Member
User avatar

Joined: Fri Jun 13, 2008 3:21 pm
Posts: 1700
Location: Cambridge, United Kingdom
The 66h prefixes indicate clearly that it's 32-bit code. Of course it's loading it's own GDT; it doesn't want to rely on one which may potentially soon disappear


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Sat Jan 30, 2010 2:38 pm 
Offline
Member
Member

Joined: Sun Mar 15, 2009 9:45 pm
Posts: 40
Owen wrote:
The 66h prefixes indicate clearly that it's 32-bit code. Of course it's loading it's own GDT; it doesn't want to rely on one which may potentially soon disappear


Ok I see, in fact those prefixes are indeed necessary to execute 16 bit instructions in 32 bit-mode right ?
Thus I was wrong saying the 'boo' file must be started in 16-bit mode ? I'm confused here...

But then, as you can see in the disassembly above, how can we explain that the GDT loading happens on %di without setting it to a known value ?

40131: 67 66 0f 01 15 addr16 lgdtw (%di)

=> the openbsd 'boot' ELF file seems to expect some known values in registers (di=GDT, and we pop ax and compare it to 0xd00d ??)


Top
 Profile  
 
 Post subject: Re: The NEW 512 Byte Contest -- Quok Style
PostPosted: Sat Jan 30, 2010 2:42 pm 
Offline
Member
Member

Joined: Sun Mar 15, 2009 9:45 pm
Posts: 40
quok wrote:
Ah, thanks for pointing that out, I completely forgot to mention that in your bootsector you shouldn't worry about switching to pmode. The OSLOADER, like the OpenBSD bootloader, is a 32-bit ELF file but it meant to be launched from 16 bit real mode. The first thing the osloader does (and OpenBSD's /boot) is jump to protected mode.

I'm sorry I failed to point this out earlier. Hopefully it'll make the contest a bit easier and more appealing for some people. :)


My fault quok, in fact in your 'goals', you never explicitly mentioned booting in pmode, actually...

"Be able to load and execute a 32-bit ELF file of any size that is also linked above the first megabyte."

sorry..

But I still fail to understand how the 'boot' from opensbd is able to switch to pmode correctly without setting its %di before loading GDT at [di]....


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 55 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Alexey1994 and 29 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group