add reference links
This commit is contained in:
parent
2658cb74a9
commit
cadf502366
2 changed files with 5 additions and 0 deletions
|
|
@ -4,6 +4,9 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "chs.h"
|
#include "chs.h"
|
||||||
|
|
||||||
|
// https://wiki.osdev.org/MBR_(x86)
|
||||||
|
// https://en.wikipedia.org/wiki/Master_boot_record
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t attributes;
|
uint8_t attributes;
|
||||||
chs_encoded_t chs_first;
|
chs_encoded_t chs_first;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ void chs_decode(const chs_encoded_t* enc, chs_t* chs)
|
||||||
chs->cylinder = (((uint16_t)enc->b[1]) & 0xC0) << 2 | (uint16_t)enc->b[2];
|
chs->cylinder = (((uint16_t)enc->b[1]) & 0xC0) << 2 | (uint16_t)enc->b[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://wiki.osdev.org/LBA
|
||||||
|
|
||||||
uint32_t chs_to_lba(const chs_conf_t* conf, const chs_t* chs)
|
uint32_t chs_to_lba(const chs_conf_t* conf, const chs_t* chs)
|
||||||
{
|
{
|
||||||
return (chs->cylinder * conf->num_heads + chs->head) * conf->num_sectors + (chs->sector - 1);
|
return (chs->cylinder * conf->num_heads + chs->head) * conf->num_sectors + (chs->sector - 1);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue