Fix very broken comparisons

This commit is contained in:
Kevin Lange 2015-06-02 21:29:28 -07:00
parent 4ad98421ba
commit 7f07d7403e
2 changed files with 9 additions and 9 deletions

View File

@ -139,10 +139,12 @@ void
set_frame(
uintptr_t frame_addr
) {
uint32_t frame = frame_addr / 0x1000;
uint32_t index = INDEX_FROM_BIT(frame);
uint32_t offset = OFFSET_FROM_BIT(frame);
frames[index] |= (0x1 << offset);
if (frame_addr < nframes * 4 * 0x400) {
uint32_t frame = frame_addr / 0x1000;
uint32_t index = INDEX_FROM_BIT(frame);
uint32_t offset = OFFSET_FROM_BIT(frame);
frames[index] |= (0x1 << offset);
}
}
void
@ -246,9 +248,7 @@ dma_frame(
page->rw = (is_writeable) ? 1 : 0;
page->user = (is_kernel) ? 0 : 1;
page->frame = address / 0x1000;
if (address < nframes * 4 * 0x400) {
set_frame(address);
}
set_frame(address);
}
void

View File

@ -39,8 +39,8 @@ static uint32_t write_ata(fs_node_t *node, uint32_t offset, uint32_t size, uint8
static void open_ata(fs_node_t *node, unsigned int flags);
static void close_ata(fs_node_t *node);
static size_t ata_max_offset(struct ata_device * dev) {
size_t sectors = dev->identity.sectors_48;
static uint64_t ata_max_offset(struct ata_device * dev) {
uint64_t sectors = dev->identity.sectors_48;
if (!sectors) {
/* Fall back to sectors_28 */
sectors = dev->identity.sectors_28;