diff options
author | Michael Brown | 2005-05-09 15:24:01 +0200 |
---|---|---|
committer | Michael Brown | 2005-05-09 15:24:01 +0200 |
commit | e75b7480d0c0ba905666b35e0b4218236a7affb3 (patch) | |
tree | c3a720a049d86c0af26d228377116a0d2a2da879 /src/include/buffer.h | |
parent | Add off_t and physaddr_t, and the copy_{to,from}_phys helper routines. (diff) | |
download | ipxe-e75b7480d0c0ba905666b35e0b4218236a7affb3.tar.gz ipxe-e75b7480d0c0ba905666b35e0b4218236a7affb3.tar.xz ipxe-e75b7480d0c0ba905666b35e0b4218236a7affb3.zip |
Modified to use physical addresses, and to not assume that we can directly
refer to data outside of our data or stack segments.
Diffstat (limited to 'src/include/buffer.h')
-rw-r--r-- | src/include/buffer.h | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/include/buffer.h b/src/include/buffer.h index 3c99bdef..7ed57fa2 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -1,16 +1,38 @@ #ifndef BUFFER_H #define BUFFER_H +#include "stdint.h" + +/* + * Free blocks in the buffer start with a "tail byte". If non-zero, + * this byte indicates that the free block is the tail of the buffer, + * i.e. occupies all the remaining space up to the end of the buffer. + * When the tail byte is non-zero, it indicates that the remainder of + * the descriptor (the struct buffer_free_block) follows the tail + * byte. + * + * This scheme is necessary because we may end up with a tail that is + * smaller than a struct buffer_free_block. + * + */ + struct buffer_free_block { - struct buffer_free_block *next; - struct buffer_free_block *prev; - void *end; -}; + char tail; + physaddr_t next_free; + physaddr_t end; +} __attribute__ (( packed )); struct buffer { - struct buffer_free_block free_blocks; - void *start; - void *end; + physaddr_t start; + physaddr_t end; + physaddr_t first_free; }; +/* Functions in buffer.c */ + +extern void init_buffer ( struct buffer *buffer, physaddr_t start, + size_t len ); +extern off_t fill_buffer ( struct buffer *buffer, void *data, + off_t offset, size_t len ); + #endif /* BUFFER_H */ |