flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Boot validation |
Author |
|
kake_zinger 13 Mar 2006, 11:50
Easy: add all bytes/dwords of the code together, compare sum to precalculated known good value. Or a weighted version of this where each byte value is multiplied with its instruction pointer/location in code before adding up. Better: calculate CRC-32. Just how much validation do you need?
|
|||
13 Mar 2006, 11:50 |
|
CodeX 13 Mar 2006, 12:31
Well, I already thought about using some kind of checksum. But this method has some disadvantage - when I change something in the second-stage loader (and this will happen often), then I need to change also the boot loader which is something very undesirable.
|
|||
13 Mar 2006, 12:31 |
|
vid 13 Mar 2006, 13:18
well, that's what is boot validation about, no? or just mark proper file/sector with some unusual byte sequence and test for it in boot code.
|
|||
13 Mar 2006, 13:18 |
|
CodeX 13 Mar 2006, 13:34
Actually, I'm thinking about more OOP-like approach to this problem. Boot sector will contain some fixed piece of code for validation, and all validation data will be contained in checked file. Maybe in some kind of header. When the file content changes - the header changes as well, but the method for validation stays the same.
|
|||
13 Mar 2006, 13:34 |
|
Dex4u 13 Mar 2006, 17:02
Some thing like this:
Code: use16 ORG 0x**** ; Set your org here jmp start ; jump to start db 'CODEX' ; ID ;----------------------------------------------------; ; Start of program. ; ;----------------------------------------------------; start: Now all you need to do is check for "CODE" . |
|||
13 Mar 2006, 17:02 |
|
CodeX 14 Mar 2006, 09:26
Yes, that will guarantee at some level that this is the file I need, but there's still no protection against file corruption (caused by transfer link distortions for example)
|
|||
14 Mar 2006, 09:26 |
|
Madis731 14 Mar 2006, 11:39
Maybe a hybrid with easy checksum + checking for "CODE". By easy I mean just a sum and this can be achieved with macros so you don't need to manually calculate it each time you change something. Its part of the assemblying.
PS. Welcome to the boards - glad to have more Estonians here |
|||
14 Mar 2006, 11:39 |
|
CodeX 14 Mar 2006, 12:46
I think I will use the same approach as PMInfoBlock structure in VBE 3.0 standart. The file will contain a header with some constant signature, welcome message, file length and checksum. The boot loader will read the first file sector and check for this header, then display the welcome message (containing among other things file version which is subject to change), then load the rest of the file, calculating it's checksum and comparing it with checksum from the file header.
This way I will have a constant boot loader and all information that changes will be placed in the file. So the structure will look something like this: Code: db 'CodeX' ; header signature db 39 ; header length db 'Second-stage loader v1.7', 0 ; welcome message dd 0xfadecafe ; file length dd 0xdeadbeef ; file checksum (or CRC-32) db 0xbc ; header checksum ;-------------------------------------- ; Start of program ;-------------------------------------- ... PS. To Madis731: Yes, that is really pleasant surpise |
|||
14 Mar 2006, 12:46 |
|
doubletoker 15 Mar 2006, 16:15
the boot loader I'm working on now, looks for a file on fat 12 which is marked read_only hidden system and inside a directory named kernels, I'm in the process of making it, if more then one file has the same attribs then it allows you to select which kernel, also trying the same idea on the boot directory to select which second stage os loader or program to run. the idea here is you can make a batch file that assembles the code, changes the attrib, writes it to the disk, and changes the attribs back, allowing no changing of the boot sec code, just an idea though. I guess my validation would be in a certian directory with the attribs set.
-pz |
|||
15 Mar 2006, 16:15 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.