9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 87206e17ba053ec960830b253ec69db52b4ad3fe
parent 62b384ed5e65b1e716234a4654e6770723fe25de
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue,  3 Aug 2021 23:58:59 +0200

os9: Avoid duplication of buffertab

Buffertab can be defined in different ways in the target,
so it has a centralized declaration and local definitions
in the target part.

Change-Id: I28ab1f734c59dde4b6a4e6bf0b47fef90ccbc8f4

Diffstat:
Minclude/os9/os9.h | 9+++++++++
Msrc/os9/alloc.c | 9---------
Msrc/os9/hosted/main.c | 1+
3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/os9/os9.h b/include/os9/os9.h @@ -26,6 +26,14 @@ #define QID(t, v, p) ((Qid) {.type = (t), .vers = (v), .path = (p)}) +#ifndef NR_BUFFERS +#define NR_BUFFERS 512 +#endif + +#ifndef HEAPSIZ +#define HEAPSIZ 4 +#endif + #define SEEK_SET 0 #define SEEK_CUR 1 #define SEEK_END 2 @@ -313,6 +321,7 @@ extern void sched(void); /* globals */ extern Chan *console; extern Mach mach; +extern char buffertab[NR_BUFFERS][PAGESIZE]; /* per cpu globals */ extern Proc *proc; diff --git a/src/os9/alloc.c b/src/os9/alloc.c @@ -3,20 +3,11 @@ #include <errno.h> #include <string.h> -#ifndef NR_BUFFERS -#define NR_BUFFERS 512 -#endif - -#ifndef HEAPSIZ -#define HEAPSIZ 4 -#endif - union bucket { long long ll; uintptr_t up; }; -char buffertab[NR_BUFFERS][PAGESIZE]; void freeb(void *bp) diff --git a/src/os9/hosted/main.c b/src/os9/hosted/main.c @@ -11,6 +11,7 @@ noreturn void longjmp(jmp_buf env, int val); Mach mach; +char buffertab[NR_BUFFERS][PAGESIZE]; int getch(void)