Add live update-friendly annotations.

Change-Id: I7d7d79893836a20799ca548a350f3288e92581f0
This commit is contained in:
Cristiano Giuffrida 2014-03-11 18:01:27 +01:00 committed by David van Moolenbroek
parent 5c8eb53d49
commit 50b7f13f9f
22 changed files with 74 additions and 40 deletions

View file

@ -100,8 +100,22 @@ void init_acpi(void)
static int sef_cb_init_fresh(int type, sef_init_info_t *info) static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{ {
int r;
init_acpi(); init_acpi();
/* Let SEF know about ACPI special cache word. */
r = sef_llvm_add_special_mem_region((void*)0xCACACACA, 1,
"%MMAP_CACHE_WORD");
if(r < 0) {
printf("acpi: sef_llvm_add_special_mem_region failed %d\n", r);
}
/* XXX To-do: acpi requires custom state transfer handlers for
* unions acpi_operand_object and acpi_generic_state (and nested unions)
* for generic state transfer to work correctly.
*/
return OK; return OK;
} }

View file

@ -3,7 +3,7 @@
#include "clean.h" #include "clean.h"
union fsdata_u { union ixfer_fsdata_u {
char b__data[1]; /* ordinary user data */ char b__data[1]; /* ordinary user data */
struct direct b__dir[1]; /* directory block */ struct direct b__dir[1]; /* directory block */
zone_t b__v2_ind[1]; /* V2 indirect block */ zone_t b__v2_ind[1]; /* V2 indirect block */
@ -12,10 +12,10 @@ union fsdata_u {
}; };
/* These defs make it possible to use to bp->b_data instead of bp->b.b__data */ /* These defs make it possible to use to bp->b_data instead of bp->b.b__data */
#define b_data(b) ((union fsdata_u *) b->data)->b__data #define b_data(b) ((union ixfer_fsdata_u *) b->data)->b__data
#define b_dir(b) ((union fsdata_u *) b->data)->b__dir #define b_dir(b) ((union ixfer_fsdata_u *) b->data)->b__dir
#define b_v2_ind(b) ((union fsdata_u *) b->data)->b__v2_ind #define b_v2_ind(b) ((union ixfer_fsdata_u *) b->data)->b__v2_ind
#define b_v2_ino(b) ((union fsdata_u *) b->data)->b__v2_ino #define b_v2_ino(b) ((union ixfer_fsdata_u *) b->data)->b__v2_ino
#define b_bitmap(b) ((union fsdata_u *) b->data)->b__bitmap #define b_bitmap(b) ((union ixfer_fsdata_u *) b->data)->b__bitmap
#endif #endif

View file

@ -68,7 +68,7 @@ init_hook(void)
*/ */
int main(void) int main(void)
{ {
struct inode_stat stat; static struct inode_stat stat;
int r; int r;
/* /*

View file

@ -2,9 +2,13 @@
#include "inc.h" #include "inc.h"
struct proc proc[NR_PROCS + NR_TASKS]; typedef struct proc ixfer_proc_t;
struct mproc mproc[NR_PROCS]; typedef struct fproc ixfer_fproc_t;
struct fproc fproc[NR_PROCS]; typedef struct mproc ixfer_mproc_t;
ixfer_proc_t proc[NR_PROCS + NR_TASKS];
ixfer_mproc_t mproc[NR_PROCS];
ixfer_fproc_t fproc[NR_PROCS];
static int nr_pid_entries; static int nr_pid_entries;

View file

@ -30,6 +30,12 @@
#endif #endif
#endif #endif
#ifndef _MINIX_MAGIC
#define __ALIGNED(X) __aligned(X)
#else
#define __ALIGNED(X)
#endif
#define EXTERN extern /* used in *.h files */ #define EXTERN extern /* used in *.h files */
#define TRUE 1 /* used for turning integers into Booleans */ #define TRUE 1 /* used for turning integers into Booleans */

View file

@ -2024,7 +2024,7 @@ typedef struct {
} mess_vmmcp_reply; } mess_vmmcp_reply;
_ASSERT_MSG_SIZE(mess_vmmcp_reply); _ASSERT_MSG_SIZE(mess_vmmcp_reply);
typedef struct { typedef struct noxfer_message {
endpoint_t m_source; /* who sent the message */ endpoint_t m_source; /* who sent the message */
int m_type; /* what kind of message is it */ int m_type; /* what kind of message is it */
union { union {
@ -2254,7 +2254,7 @@ typedef struct {
u8_t size[56]; /* message payload may have 56 bytes at most */ u8_t size[56]; /* message payload may have 56 bytes at most */
}; };
} message __aligned(16); } message __ALIGNED(16);
/* Ensure the complete union respects the IPC assumptions. */ /* Ensure the complete union respects the IPC assumptions. */
typedef int _ASSERT_message[/* CONSTCOND */sizeof(message) == 64 ? 1 : -1]; typedef int _ASSERT_message[/* CONSTCOND */sizeof(message) == 64 ? 1 : -1];

View file

@ -9,7 +9,7 @@
typedef struct { typedef struct {
int cp_flags; /* CPF_* below */ int cp_flags; /* CPF_* below */
union { union ixfer_cp_u{
struct { struct {
/* CPF_DIRECT */ /* CPF_DIRECT */
endpoint_t cp_who_to; /* grantee */ endpoint_t cp_who_to; /* grantee */

View file

@ -23,7 +23,7 @@
struct minix_timer; struct minix_timer;
typedef void (*tmr_func_t)(struct minix_timer *tp); typedef void (*tmr_func_t)(struct minix_timer *tp);
typedef union { int ta_int; long ta_long; void *ta_ptr; } tmr_arg_t; typedef union { int ta_int; long ta_long; void *ta_ptr; } ixfer_tmr_arg_t;
/* A minix_timer_t variable must be declare for each distinct timer to be used. /* A minix_timer_t variable must be declare for each distinct timer to be used.
* The timers watchdog function and expiration time are automatically set * The timers watchdog function and expiration time are automatically set
@ -34,7 +34,7 @@ typedef struct minix_timer
struct minix_timer *tmr_next; /* next in a timer chain */ struct minix_timer *tmr_next; /* next in a timer chain */
clock_t tmr_exp_time; /* expiration time */ clock_t tmr_exp_time; /* expiration time */
tmr_func_t tmr_func; /* function to call when expired */ tmr_func_t tmr_func; /* function to call when expired */
tmr_arg_t tmr_arg; /* random argument */ ixfer_tmr_arg_t tmr_arg; /* random argument */
} minix_timer_t; } minix_timer_t;
/* Used when the timer is not active. */ /* Used when the timer is not active. */

View file

@ -96,7 +96,7 @@ struct proc {
#define VMSTYPE_MAP 3 #define VMSTYPE_MAP 3
int type; /* suspended operation */ int type; /* suspended operation */
union { union ixfer_saved{
/* VMSTYPE_SYS_MESSAGE */ /* VMSTYPE_SYS_MESSAGE */
message reqmsg; /* suspended request message */ message reqmsg; /* suspended request message */
} saved; } saved;
@ -104,7 +104,7 @@ struct proc {
/* Parameters of request to VM */ /* Parameters of request to VM */
int req_type; int req_type;
endpoint_t target; endpoint_t target;
union { union ixfer_params{
struct { struct {
vir_bytes start, length; /* memory range */ vir_bytes start, length; /* memory range */
u8_t writeflag; /* nonzero for write access */ u8_t writeflag; /* nonzero for write access */

View file

@ -38,7 +38,7 @@ typedef struct arp46
ether_addr_t a46_dstaddr; ether_addr_t a46_dstaddr;
ether_addr_t a46_srcaddr; ether_addr_t a46_srcaddr;
ether_type_t a46_ethtype; ether_type_t a46_ethtype;
union union ixfer_arp46_u
{ {
struct struct
{ {

View file

@ -13,13 +13,12 @@ Copyright 1995 Philip Homburg
struct event; struct event;
typedef union ev_arg typedef struct ev_arg
{ {
int ev_int;
void *ev_ptr; void *ev_ptr;
} ev_arg_t; } ev_arg_t;
typedef void (*ev_func_t) ARGS(( struct event *ev, union ev_arg eva )); typedef void (*ev_func_t) ARGS(( struct event *ev, ev_arg_t eva ));
typedef struct event typedef struct event
{ {

View file

@ -80,6 +80,7 @@ void ip_init()
ip_port->ip_dl_type= icp->ic_devtype; ip_port->ip_dl_type= icp->ic_devtype;
ip_port->ip_mtu= IP_DEF_MTU; ip_port->ip_mtu= IP_DEF_MTU;
ip_port->ip_mtu_max= IP_MAX_PACKSIZE; ip_port->ip_mtu_max= IP_MAX_PACKSIZE;
memset(&ip_port->ip_dl, 0, sizeof(ip_port->ip_dl));
switch(ip_port->ip_dl_type) switch(ip_port->ip_dl_type)
{ {

View file

@ -29,7 +29,7 @@ typedef struct ip_port
{ {
int ip_flags, ip_dl_type; int ip_flags, ip_dl_type;
int ip_port; int ip_port;
union union sxfer_ip_dl_u
{ {
struct struct
{ {
@ -45,9 +45,11 @@ typedef struct ip_port
} dl_eth; } dl_eth;
struct struct
{ {
int dummy_int[3];
int ps_port; int ps_port;
acc_t *ps_send_head; acc_t *ps_send_head;
acc_t *ps_send_tail; acc_t *ps_send_tail;
void* dummy_ptr[3];
} dl_ps; } dl_ps;
} ip_dl; } ip_dl;
ipaddr_t ip_ipaddr; ipaddr_t ip_ipaddr;

View file

@ -109,7 +109,7 @@ static void check_dev(int type, int ifno)
char *defname; char *defname;
mode_t mode; mode_t mode;
u8_t minor_off; u8_t minor_off;
} devlist[] = { } devlist[5] = {
{ (char *) "/dev/eth", 0600, ETH_DEV_OFF }, { (char *) "/dev/eth", 0600, ETH_DEV_OFF },
{ (char *) "/dev/psip", 0600, PSIP_DEV_OFF }, { (char *) "/dev/psip", 0600, PSIP_DEV_OFF },
{ (char *) "/dev/ip", 0600, IP_DEV_OFF }, { (char *) "/dev/ip", 0600, IP_DEV_OFF },
@ -423,7 +423,9 @@ void *alloc(size_t size)
{ {
/* Allocate memory on the heap with sbrk(). */ /* Allocate memory on the heap with sbrk(). */
return malloc(size); void *addr = malloc(size);
memset(addr, 0, size);
return addr;
} }
/* /*

View file

@ -70,8 +70,8 @@ read_hook
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
struct fs_hooks hooks; static struct fs_hooks hooks;
struct inode_stat root_stat; static struct inode_stat root_stat;
/* fill in the hooks */ /* fill in the hooks */
memset(&hooks, 0, sizeof(hooks)); memset(&hooks, 0, sizeof(hooks));

View file

@ -18,9 +18,9 @@ struct data_store {
char key[DS_MAX_KEYLEN]; /* key to lookup information */ char key[DS_MAX_KEYLEN]; /* key to lookup information */
char owner[DS_MAX_KEYLEN]; char owner[DS_MAX_KEYLEN];
union { union dsi_u {
unsigned u32; unsigned u32;
struct { struct dsi_mem {
void *data; void *data;
size_t length; size_t length;
size_t reallen; size_t reallen;

View file

@ -3,7 +3,7 @@
#define LINES 22 #define LINES 22
static struct data_store ds_store[NR_DS_KEYS]; static struct data_store noxfer_ds_store[NR_DS_KEYS];
void data_store_dmp() void data_store_dmp()
{ {
@ -11,7 +11,7 @@ void data_store_dmp()
static int prev_i = 0; static int prev_i = 0;
int i, n = 0; int i, n = 0;
if (getsysinfo(DS_PROC_NR, SI_DATA_STORE, ds_store, sizeof(ds_store)) != OK) { if (getsysinfo(DS_PROC_NR, SI_DATA_STORE, noxfer_ds_store, sizeof(noxfer_ds_store)) != OK) {
printf("Error obtaining table from DS. Perhaps recompile IS?\n"); printf("Error obtaining table from DS. Perhaps recompile IS?\n");
return; return;
} }
@ -19,7 +19,7 @@ void data_store_dmp()
printf("Data store contents:\n"); printf("Data store contents:\n");
printf("-slot- -----------key----------- -----owner----- ---type--- ----value---\n"); printf("-slot- -----------key----------- -----owner----- ---type--- ----value---\n");
for(i = prev_i; i < NR_DS_KEYS && n < LINES; i++) { for(i = prev_i; i < NR_DS_KEYS && n < LINES; i++) {
p = &ds_store[i]; p = &noxfer_ds_store[i];
if(!(p->flags & DSF_IN_USE)) if(!(p->flags & DSF_IN_USE))
continue; continue;

View file

@ -52,6 +52,7 @@ struct rupdate {
}; };
/* Definition of an entry of the system process table. */ /* Definition of an entry of the system process table. */
typedef struct priv ixfer_priv_s;
struct rproc { struct rproc {
struct rprocpub *r_pub; /* pointer to the corresponding public entry */ struct rprocpub *r_pub; /* pointer to the corresponding public entry */
struct rproc *r_old_rp; /* pointer to the slot with the old version */ struct rproc *r_old_rp; /* pointer to the slot with the old version */
@ -83,7 +84,7 @@ struct rproc {
char *r_exec; /* Executable image */ char *r_exec; /* Executable image */
size_t r_exec_len; /* Length of image */ size_t r_exec_len; /* Length of image */
struct priv r_priv; /* Privilege structure to be passed to the ixfer_priv_s r_priv; /* Privilege structure to be passed to the
* kernel. * kernel.
*/ */
uid_t r_uid; uid_t r_uid;

View file

@ -5,6 +5,7 @@
#include <sys/select.h> #include <sys/select.h>
#include <minix/safecopies.h> #include <minix/safecopies.h>
#include <minix/sef.h>
/* This is the per-process information. A slot is reserved for each potential /* This is the per-process information. A slot is reserved for each potential
* process. Thus NR_PROCS must be the same as in the kernel. It is not * process. Thus NR_PROCS must be the same as in the kernel. It is not

View file

@ -32,12 +32,14 @@
#define FROM_PROC 0 #define FROM_PROC 0
#define TO_PROC 1 #define TO_PROC 1
typedef fd_set *ixfer_fd_set_ptr;
static struct selectentry { static struct selectentry {
struct fproc *requestor; /* slot is free iff this is NULL */ struct fproc *requestor; /* slot is free iff this is NULL */
endpoint_t req_endpt; endpoint_t req_endpt;
fd_set readfds, writefds, errorfds; fd_set readfds, writefds, errorfds;
fd_set ready_readfds, ready_writefds, ready_errorfds; fd_set ready_readfds, ready_writefds, ready_errorfds;
fd_set *vir_readfds, *vir_writefds, *vir_errorfds; ixfer_fd_set_ptr vir_readfds, vir_writefds, vir_errorfds;
struct filp *filps[OPEN_MAX]; struct filp *filps[OPEN_MAX];
int type[OPEN_MAX]; int type[OPEN_MAX];
int nfds, nreadyfds; int nfds, nreadyfds;

View file

@ -147,7 +147,7 @@ static u32_t findhole(int pages)
/* Find a space in the virtual address space of VM. */ /* Find a space in the virtual address space of VM. */
u32_t curv; u32_t curv;
int pde = 0, try_restart; int pde = 0, try_restart;
static u32_t lastv = 0; static void *lastv = 0;
pt_t *pt = &vmprocess->vm_pt; pt_t *pt = &vmprocess->vm_pt;
vir_bytes vmin, vmax; vir_bytes vmin, vmax;
u32_t holev = NO_MEM; u32_t holev = NO_MEM;
@ -163,7 +163,7 @@ static u32_t findhole(int pages)
assert((vmax % VM_PAGE_SIZE) == 0); assert((vmax % VM_PAGE_SIZE) == 0);
assert(pages > 0); assert(pages > 0);
curv = lastv; curv = (u32_t) lastv;
if(curv < vmin || curv >= vmax) if(curv < vmin || curv >= vmax)
curv = vmin; curv = vmin;
@ -198,7 +198,7 @@ static u32_t findhole(int pages)
/* if it's big enough, return it */ /* if it's big enough, return it */
if(holesize == pages) { if(holesize == pages) {
lastv = curv + VM_PAGE_SIZE; lastv = (void*) (curv + VM_PAGE_SIZE);
return holev; return holev;
} }
} }

View file

@ -116,11 +116,13 @@ struct sdh {
#define JUNK 0xdeadbeef #define JUNK 0xdeadbeef
#define NOJUNK 0xc0ffee #define NOJUNK 0xc0ffee
static struct slabheader {
struct slabdata { struct slabdata {
u8_t data[DATABYTES]; u8_t data[DATABYTES];
struct sdh sdh; struct sdh sdh;
} *list_head; };
static struct slabheader {
struct slabdata *list_head;
} slabs[SLABSIZES]; } slabs[SLABSIZES];
static int objstats(void *, int, struct slabheader **, struct slabdata static int objstats(void *, int, struct slabheader **, struct slabdata