summaryrefslogtreecommitdiff
path: root/com32/chain
Commit message (Collapse)AuthorAgeFilesLines
* chain.c: Fix misplaced #endif breaking non-DEBUG buildsH. Peter Anvin2012-03-261-1/+1
| | | | | | Fix misplaced #endif which made it impossible to build without DEBUG. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Use PRIu64 instead of %llu, where appropriateMichal Soltys2011-08-022-2/+3
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: once more rename option: stop -> breakMichal Soltys2011-05-103-11/+11
| | | | | | Seems to be most appropriate... Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: add support for ReactOS's freeldr.sysMichal Soltys2011-05-101-0/+15
| | | | | | | | Based on commit: ad4cf1470977f648ee1dd45e97939589ccb0393c (might need address adjustments) Signed-off-by: Michal Soltys <soltys@ziu.info>
* Merge branch 'master' into chaindevMichal Soltys2011-05-041-1/+2
| | | | | | | | | | Conflicts: com32/Makefile com32/modules/chain.c Note: add ReactOS' stuff introduced in old chain.c Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: change 'nochain' -> 'stop', update docsMichal Soltys2011-03-183-8/+8
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: minor adjustment to manglepe_fixchs()Michal Soltys2011-03-091-4/+2
| | | | | | It will not skip updates on EBRs with empty logical partition. Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: setup_handover() - use iter->lengthMichal Soltys2011-03-091-18/+13
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: modify lba2chs() towards using disk_chs typeMichal Soltys2011-03-094-16/+13
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: add generic length field to partition iteratorsMichal Soltys2011-03-082-0/+4
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: always report detected BPBMichal Soltys2011-03-083-22/+17
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: option rename: mbrchs -> fixchsMichal Soltys2011-03-083-7/+7
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: split manglepe_mbrchshide() into separate functionsMichal Soltys2011-03-083-35/+104
| | | | | | | | - split into 'fixchs' and 'hide' (cleaner, easier to read) - fix hide related conditions (they were too strong) - make sure we test for iterator status as well Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: minor help fixMichal Soltys2011-03-071-2/+2
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: minor fixes and cleanupsMichal Soltys2010-10-256-51/+64
| | | | | | | | | | | | | | | | | | | | - make sure opt.maps implies opt.sect, and simplify conditions throughout the files - move structure opt -> options.c - adjust #includes - omitted values in seg= and sect= are assumed 0 in all cases now - mangler_handover(): eax for gpt handover set only for iterated disks - rename parse_args() -> opt_parse_args() - rename mangler_common() -> mangler_init() - add opt_set_defs() - if mmapped sector would conflict with the file, turn off mmapping instead of bailing out - update temporary chain.txt to reflect changes + other fixups Signed-off-by: Michal Soltys <soltys@ziu.info>
* Merge branch 'master' into chaindevMichal Soltys2010-10-251-2/+19
| | | | | | | | | | Conflicts: com32/modules/chain.c Changes to DRMK imported into commented-out section of com32/chain/mangle.c Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain/chain.c: fix if-order during handover preparationMichal Soltys2010-10-211-34/+34
| | | | | | | When the handover area is being prepared, most primitive case should be checked first (not-iterated disk, including typeraw). Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: remove remains of SECTORMichal Soltys2010-10-142-6/+6
| | | | | | | All chain related code no longer depends on hardcoded sector size. Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain/partiter.c,h: updatesMichal Soltys2010-10-142-21/+50
| | | | | | | | | | | - lbacnt field in disklib's diskinfo allows for more strict sanity checks - hardcoded SECTOR is no longer used - we use diskinfo's bps value now - pi_begin() does additional sanity checks on header values, and allows using secondary gpt partition list, if crc of the primary one is invalid Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: move partition entries' mangling to mangle.creview02Michal Soltys2010-10-083-156/+113
| | | | | | | | | | | All functions related to partition entries' mangling has been moved to mangle.c, including appropriate renames: pentry_mangle() -> manglepe_mbrchshide() pem_setchs() -> mpe_setchs() pem_sethide() -> mpe_sethide() Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: allow service-only runsMichal Soltys2010-10-083-13/+31
| | | | | | | | | | | | | | This patch introduces small feature, allowing so called "service-only" runs - where the chain modules does everything as instructed, but otherwise doesn't perform actual chainloading. This is useful for 'mbrchs', '[un]hide[all]' and 'setbpb'+'save' options, making possible adjustments to partition/boot sector values on any disk/partition. See 'chain' option in doc/chain.txt for more details. Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: fix condition in pentry_mangle()Michal Soltys2010-10-081-4/+6
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: make raw handover use total sectors infoMichal Soltys2010-10-081-3/+6
| | | | | | | With disklib update providing total sectors info, make raw handover use it (instead of forcing arbitrary number). Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: Add unhide and unhideall optionsMichal Soltys2010-10-082-11/+14
| | | | | | | It could be useful to be able to simply unhide partitions. This short patch adds such functionality. Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: simplify pentry_mangle()Michal Soltys2010-10-081-34/+34
| | | | | | | | | | | pentry_mangle() has been simplified and made more readable, using non-selfkilling iterators, introduced recently. Further plan is to move 'mbrchs' into separate module (fixit.c32) providing such feature for all disks (along with some other features, including [un]hide[all]). Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: utility's lba2chs updateMichal Soltys2010-10-085-21/+31
| | | | | | | | | | | | | | | | | This patch adds 3 modes of operation to lba2chs: l2c_cnul - strict cylinder mode, using at most the value returned by 13h/48h or 13h/08h l2c_cadd - allow using 1 cylinder more. Only if cylinders are less than 1024 and total drive's lba size is not on a cylinder boundary. l2c_max - allow using any cylinder number. Modes have effect only if CHS geometry (cbios) is valid. chain.c uses l2c_cadd. Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain/mangle.c: remove useless commentMichal Soltys2010-09-281-1/+1
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain/partiter: make iterators not autofree after fin/errMichal Soltys2010-09-283-28/+57
| | | | | | | | | | | | | | This patch changes iterator behaviour to not free themselves automatically after finished iteration or error. This allows us to be able to always: - check their status through ->status field - access last valid data It will allow simplification of pentry_mangle() function in further commits. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain/options.c: cosmeticsMichal Soltys2010-09-281-4/+4
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain/chain.c: add "raw" handoverMichal Soltys2010-09-281-19/+27
| | | | | | | | | This adds a possibility to create an area resembling proper handover, when booting mbr of some media. If we have custom/special booting code always expecting handover, this would allow us to boot it from the 1st sector as well. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain/utility.c: Adjust lba2chsMichal Soltys2010-09-281-26/+29
| | | | | | | | This tiny patch adjusts how lba2chs() deals with unknown geometries. Instead of returning max values of "typical" geometries, it returns chs values calculated from them. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain module: bugfixing and cosmeticsMichal Soltys2010-09-287-36/+74
| | | | | | | | | | | | | Bugs: - one introduced ages ago - find_by_* functions should be tested vs. <0 for failure - one introduced by 579f15c7c456c - it accidentally blocked too much when testing for ',' in drive/partition option parsing - one introduced by d4d713c9ccfe0 - sone machines / VMs seem to set @40:75 just 1, regardless of amount of fixed disks available Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain module: setbpb changes, bss & bs options, bugfixesMichal Soltys2010-09-288-306/+381
| | | | | | | | | | | | | | | Generic function detecting BPB type (7 versions) have been added. set{hid,geo,drv} have been replaced by single setbpb option, using mentioned function to make more precise decisions what to update where. Full BSS and BS emulation has been added, also employing BPB detection. Some logic/flow changes in chain's main(). There was also a bug, in which backup sector was populated with wrong data. Appropriate documentation updates. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain module: make option 'save' truly separateMichal Soltys2010-09-284-41/+54
| | | | | | | | | | Previously, option 'save' has been executed as a part of bpb mangling. This was rather inflexible. Apart from that, all mangle functions test their respective opt.* options internally. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain, options: bugfixes, adjustments; big doc updateMichal Soltys2010-09-283-31/+40
| | | | | | | | | | | - seg='s offset values default to 0 if ommited - sect='s offset values default to 0x7c00 if ommited - FDOS's bootsector loaded at 0x1fe0 - drive / partition parsing: bugfix, so lables with ',' are recognized properly - big documentation update Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain: adjust 'mbrchs' calculations, adjust partitierMichal Soltys2010-09-283-32/+27
| | | | | | | | | | | It seems that chs values in extended partitions are expected to provide absolute positions. Previously these values were calculated directly from ebr lba values. Partiter now provides cebr_lba and ebr_lba that hold absolute values of current and next ebr. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain, partiter, options: bugfix, new optionsMichal Soltys2010-09-285-38/+158
| | | | | | | | | | | | | | | | - small bugfix in partiter.c - new options: hideall, mbrchs - new partiter feature - rawindex - counts all (inc. empty) partitions in all cases hideall is expansion of hide, that hides all partitions in a chain, not only primary ones mbrchs walks over all partitions and fixes chs values in mbr entries rawindex keeps count of all partitions, including holes in EBRs Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain, options: fixes, additionsMichal Soltys2010-09-283-23/+34
| | | | | | | | | - add 'bss=' option - update usage() - ommited offsets in 'file=' and 'sect=' default to 0x7c00 now - cosmetics Signed-off-by: Michal Soltys <soltys@ziu.info>
* partiter.c: add stepall modifier; bugfixes + comment changesMichal Soltys2010-09-283-37/+45
| | | | | | | | | | | | In certain situations (new features to be added later), it's useful to be able to step through all partitions in a partition list. This patch adds necessary functionality. Adjust chain.c to use new version of partiter. Also small bugfixes and comment changes. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: Split chain into smaller filesMichal Soltys2010-09-2812-788/+891
| | | | | | | | | | | | | new file: chain.h new file: common.h new file: mangle.c new file: mangle.h new file: options.c new file: options.h new file: utility.c new file: utility.h Signed-off-by: Michal Soltys <soltys@ziu.info>
* partiter.c: cosmetic changesMichal Soltys2010-09-281-42/+48
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: Improve setdrv option, remove setbpb4/Michal Soltys2010-09-281-36/+106
| | | | | | | Option 'setdrv' can autodetect offset now. setbpb4 is removed, as it's no longer necessary. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: change file/sect/hand area handling logic, add 'hptr' optionMichal Soltys2010-09-281-77/+91
| | | | | | | | | | | | | The logic behind file/sect/hand area handling is more flexible now. Furthermore, a user can explicitly control where ds:si/ds:bp should point during chainloading. Other misc. changes: - registry setup is more conservative - 'if' style Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: merge segs= and sect into single option, remove segfMichal Soltys2010-09-281-32/+39
| | | | | | | There's no need to have separate 'sect' and 'segs='. 'segf' alias of 'seg' can also be removed now. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: option renamesMichal Soltys2010-09-281-75/+73
| | | | | | | Renamed some of the options to better fit the whole scheme. Also adjusted usage(). Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: Always use console_ansi_raw(), not only with DEBUGMichal Soltys2010-09-281-4/+2
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: adjust what ds:si and ds:bp point to after chainloadingMichal Soltys2010-08-221-51/+66
| | | | | | | | | | Previously, chain module always set ds:si and ds:bp to handover area (unless otherwise blocked). This is not necessarily valid in case when both file and sector are being loaded - here file should receive pointer to it's [relocated] sector, and it's unlikely interested in mbr-like handover area at all. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: fixes, adjustmentsMichal Soltys2010-08-221-46/+145
| | | | | | | | | | - update usage() - add chs2lba() - update handover code to generate CHS values - make sure 'write' is never default - add wait_key() Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: add options, misc varaible renamesMichal Soltys2010-08-221-97/+220
| | | | | | | | | | | | This patch adds following options: - setgeo (bpb: set legacy geometry) - setdrv (bpb: set physical drive number) - read (read mbr / bs - previously always attempted) - write (write bs - for bpb mangling) - filebpb (also mangle 'kernel' file in memory) - msdos7 (dos7+ IP is set as required by io.sys) Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain.c: add 'smap' and 'hand' options, update handover codeMichal Soltys2010-08-221-81/+129
| | | | | | | | | | | '[no]hand' allows explicit control whenever to create handover data '[no]smap' allows loading bootsector without mapping it during actual chainloading (meant for upcoming BPB mangling options) Expanded handover code moved mostly to its own function Signed-off-by: Michal Soltys <soltys@ziu.info>