summaryrefslogtreecommitdiff
path: root/mbr/mbr.ha
blob: d0622d28cba9750d9ee220d1fd617ba14a631349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use io;

use sector;
use errors;

def mbr_lba: size = 0;

export type nombr = !void;

export type mbr = struct {
	@offset(0) bootstrap: [440]u8,
	@offset(440) udid: u32,
	@offset(444) reserved: u16,
	@offset(446) entries: [4]mbr_entry,
	@offset(510) magic: u16,
};

export type mbr_entry = struct {
	@offset(0) attributes: u8,
	@offset(4) part_type: u8,
	@offset(8) lba_begin: u32,
	@offset(12) lba_end: u32, 
};

export fn validate(self: *mbr) bool = {
	if (self.magic != 0xaa55) {
		return false;
	};

	return true;
};