Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 72636
b: refs/heads/master
c: e6e1ace
h: refs/heads/master
v: v3
  • Loading branch information
H. Peter Anvin committed Oct 26, 2007
1 parent 0fdb4cd commit b240ea7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6b6815c6d5d1dc209701d1661a7a0e09a295db2f
refs/heads/master: e6e1ace9904b72478f0c5a5aa7bd174cb6f62561
4 changes: 2 additions & 2 deletions trunk/arch/x86/boot/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ static inline char *__get_heap(size_t s, size_t a, size_t n)
#define GET_HEAP(type, n) \
((type *)__get_heap(sizeof(type),__alignof__(type),(n)))

static inline int heap_free(void)
static inline bool heap_free(size_t n)
{
return heap_end-HEAP;
return (int)(heap_end-HEAP) >= (int)n;
}

/* copy.S */
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/boot/video-bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static int bios_probe(void)
video_bios.modes = GET_HEAP(struct mode_info, 0);

for (mode = 0x14; mode <= 0x7f; mode++) {
if (heap_free() < sizeof(struct mode_info))
if (!heap_free(sizeof(struct mode_info)))
break;

if (mode_defined(VIDEO_FIRST_BIOS+mode))
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/boot/video-vesa.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int vesa_probe(void)
while ((mode = rdfs16(mode_ptr)) != 0xffff) {
mode_ptr += 2;

if (heap_free() < sizeof(struct mode_info))
if (!heap_free(sizeof(struct mode_info)))
break; /* Heap full, can't save mode info */

if (mode & ~0x1ff)
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/boot/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static void save_screen(void)
saved.curx = boot_params.screen_info.orig_x;
saved.cury = boot_params.screen_info.orig_y;

if (heap_free() < saved.x*saved.y*sizeof(u16)+512)
if (!heap_free(saved.x*saved.y*sizeof(u16)+512))
return; /* Not enough heap to save the screen */

saved.data = GET_HEAP(u16, saved.x*saved.y);
Expand Down

0 comments on commit b240ea7

Please sign in to comment.