mirror of
https://github.com/tailix/loadwarka.git
synced 2025-03-03 16:14:24 -05:00
Add MBR structures
This commit is contained in:
parent
11613430f9
commit
55782bdef9
1 changed files with 29 additions and 0 deletions
29
src/main.c
29
src/main.c
|
@ -16,8 +16,37 @@
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MBR_SIZE 512
|
||||
#define MBR_ENTRIES 4
|
||||
#define MBR_MAGIC 0xAA55
|
||||
|
||||
struct MbrEntry {
|
||||
uint8_t drive_attributes;
|
||||
unsigned start_chs_address : 24;
|
||||
uint8_t partition_type;
|
||||
unsigned last_chs_address : 24;
|
||||
uint32_t start_lba;
|
||||
uint32_t sectors_count;
|
||||
}
|
||||
__attribute__((packed));
|
||||
|
||||
struct MbrInfo {
|
||||
uint32_t disk_id;
|
||||
uint16_t reserved;
|
||||
struct MbrEntry entries[MBR_ENTRIES];
|
||||
uint16_t magic;
|
||||
}
|
||||
__attribute__((packed));
|
||||
|
||||
struct Mbr {
|
||||
uint8_t bootstrap[MBR_SIZE - sizeof(struct MbrInfo)];
|
||||
struct MbrInfo info;
|
||||
}
|
||||
__attribute__((packed));
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Hello, World!\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue