diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-05-14 00:43:13 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-05-14 00:43:13 -0400 |
commit | 1bb3b5c25284cb98f40f245f5d621721c6959fe1 (patch) | |
tree | 87898414b768de1b56b43d256491121e01a97947 /src/farptr.h | |
parent | 022709521842e8f075c9cf5b070295a25f2b5636 (diff) | |
download | seabios-1bb3b5c25284cb98f40f245f5d621721c6959fe1.tar.gz |
Add full support for drives with more that 2<<32 sectors.
Use 64bit integers for sector and lba values.
Diffstat (limited to 'src/farptr.h')
-rw-r--r-- | src/farptr.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/farptr.h b/src/farptr.h index 56219d29..ef0aa423 100644 --- a/src/farptr.h +++ b/src/farptr.h @@ -28,6 +28,12 @@ extern u16 __segment_ES, __segment_CS, __segment_DS, __segment_SS; __asm__("movl %%" #SEG ":%1, %0" : "=ri"(__value) \ : "m"(var), "m"(__segment_ ## SEG)); \ __value; }) +#define READ64_SEG(SEG, var) ({ \ + union u64_u32_u __value; \ + union u64_u32_u *__r64_ptr = (union u64_u32_u *)&(var); \ + __value.hi = READ32_SEG(SEG, __r64_ptr->hi); \ + __value.lo = READ32_SEG(SEG, __r64_ptr->lo); \ + __value.val; }) #define WRITE8_SEG(SEG, var, value) \ __asm__("movb %b1, %%" #SEG ":%0" : "=m"(var) \ : "Q"(value), "m"(__segment_ ## SEG)) @@ -37,6 +43,13 @@ extern u16 __segment_ES, __segment_CS, __segment_DS, __segment_SS; #define WRITE32_SEG(SEG, var, value) \ __asm__("movl %1, %%" #SEG ":%0" : "=m"(var) \ : "r"(value), "m"(__segment_ ## SEG)) +#define WRITE64_SEG(SEG, var, value) do { \ + union u64_u32_u __value; \ + union u64_u32_u *__w64_ptr = (union u64_u32_u *)&(var); \ + __value.val = (value); \ + WRITE32_SEG(SEG, __w64_ptr->hi, __value.hi); \ + WRITE32_SEG(SEG, __w64_ptr->lo, __value.lo); \ + } while (0) // Low level macros for getting/setting a segment register. #define __SET_SEG(SEG, value) \ @@ -63,6 +76,9 @@ extern void __force_link_error__unknown_type(); else if (__builtin_types_compatible_p(typeof(__val), u32) \ || __builtin_types_compatible_p(typeof(__val), s32)) \ __val = READ32_SEG(seg, var); \ + else if (__builtin_types_compatible_p(typeof(__val), u64) \ + || __builtin_types_compatible_p(typeof(__val), s64)) \ + __val = READ64_SEG(seg, var); \ else \ __force_link_error__unknown_type(); \ __val; }) @@ -77,6 +93,9 @@ extern void __force_link_error__unknown_type(); else if (__builtin_types_compatible_p(typeof(var), u32) \ || __builtin_types_compatible_p(typeof(var), s32)) \ WRITE32_SEG(seg, var, (val)); \ + else if (__builtin_types_compatible_p(typeof(var), u64) \ + || __builtin_types_compatible_p(typeof(var), s64)) \ + WRITE64_SEG(seg, var, (val)); \ else \ __force_link_error__unknown_type(); \ } while (0) |