blk->drive_lba_count = le32_to_cpu(*((uint32_t*)&buffer[120]));
/* done with our temporary memory */
- brelse((bufptr)buffer);
+ tmpfree(buffer);
/* Deselect the IDE, as we will re-select it in the partition scan and
it may not recursively stack de-selections */
return;
failout:
- brelse((bufptr)buffer);
+ tmpfree(buffer);
out:
ide_deselect();
return;
kputs("> ");
/* release temporary memory */
- brelse((bufptr)br);
+ tmpfree(br);
}
/* This returns a busy block not belonging to any device, with
* garbage contents. It is essentially a malloc for the kernel.
- * Free it with brelse()!
+ * Free it with tmpfree.
+ *
+ * API note: Nothing guarantees a connection between a bufcache entry
+ * and tmpbuf in future. Always free with tmpfree.
*/
void *tmpbuf(void)
{
return bp->bf_data;
}
-
+/* Allocate an empty _disk cache_ buffer */
void *zerobuf(void)
{
void *b;
extern bufptr bfind(uint16_t dev, blkno_t blk);
extern void bdrop(uint16_t dev);
extern bufptr freebuf(void);
+#define tmpfree brelse
extern void bufinit(void);
extern void bufdiscard(bufptr bp);
extern void bufdump (void);
extern void pagemap_add(uint8_t page); /* FIXME: may need a page type for big boxes */
extern void pagemap_free(ptptr p);
extern int pagemap_alloc(ptptr p);
-extern int pagemap_realloc(usize_t p);
+extern int pagemap_realloc(usize_t c, usize_t d, usize_t s);
extern usize_t pagemap_mem_used(void);
extern void map_init(void);
#ifndef platform_discard
goto nogood3; /* SN */
/* This must be the last test as it makes changes if it works */
- if (pagemap_realloc(top - MAPBASE))
+ /* FIXME: once we sort out chmem we can make stack and data
+ two elements. We never allocate 'code' as there is no split I/D */
+ if (pagemap_realloc(0, top - MAPBASE, 0))
goto nogood3;
/* From this point on we are commmited to the exec() completing */
ugets((void *) ugetw(nargv), udata.u_name, 8);
memcpy(udata.u_ptab->p_name, udata.u_name, 8);
- brelse(abuf);
- brelse(ebuf);
+ tmpfree(abuf);
+ tmpfree(ebuf);
i_deref(ino);
// Shove argc and the address of argv just below envp
goto nogood3;
/* This must be the last test as it makes changes if it works */
- if (pagemap_realloc(bin_size))
+ /* FIXME: need to update this to support split code/data and to fix
+ stack handling nicely */
+ if (pagemap_realloc(0, bin_size, 0))
goto nogood3;
/* From this point on we are commmited to the exec() completing */