add ACSL annotation

This commit is contained in:
Yoichi Umezawa
2016-03-16 15:42:32 +09:00
parent 8dd9f5ef3f
commit 593cf98015
3 changed files with 54 additions and 2 deletions

View File

@ -1033,6 +1033,10 @@ static void __x86_wakeup(int apicid, unsigned long ip)
/** IHK Functions **/ /** IHK Functions **/
/*@
@ assigns \nothing;
@ ensures \interrupt_disabled == 0;
@*/
void cpu_halt(void) void cpu_halt(void)
{ {
asm volatile("hlt"); asm volatile("hlt");
@ -1335,6 +1339,10 @@ void arch_show_extended_context(void)
} }
#endif #endif
/*@
@ requires \valid(reg);
@ assigns \nothing;
@*/
void arch_show_interrupt_context(const void *reg) void arch_show_interrupt_context(const void *reg)
{ {
const struct x86_user_context *uctx = reg; const struct x86_user_context *uctx = reg;
@ -1423,8 +1431,8 @@ int ihk_mc_interrupt_cpu(int cpu, int vector)
} }
/*@ /*@
@ requires \valid(proc); @ requires \valid(thread);
@ ensures proc->fp_regs == NULL; @ ensures thread->fp_regs == NULL;
@*/ @*/
void void
release_fp_regs(struct thread *thread) release_fp_regs(struct thread *thread)
@ -1439,6 +1447,9 @@ release_fp_regs(struct thread *thread)
thread->fp_regs = NULL; thread->fp_regs = NULL;
} }
/*@
@ requires \valid(thread);
@*/
void void
save_fp_regs(struct thread *thread) save_fp_regs(struct thread *thread)
{ {
@ -1470,6 +1481,10 @@ save_fp_regs(struct thread *thread)
} }
} }
/*@
@ requires \valid(thread);
@ assigns thread->fp_regs;
@*/
void void
restore_fp_regs(struct thread *thread) restore_fp_regs(struct thread *thread)
{ {
@ -1518,18 +1533,27 @@ ihk_mc_user_context_t *lookup_user_context(struct thread *thread)
return uctx; return uctx;
} /* lookup_user_context() */ } /* lookup_user_context() */
/*@
@ assigns \nothing;
@*/
void init_tick(void) void init_tick(void)
{ {
dkprintf("init_tick():\n"); dkprintf("init_tick():\n");
return; return;
} }
/*@
@ assigns \nothing;
@*/
void init_delay(void) void init_delay(void)
{ {
dkprintf("init_delay():\n"); dkprintf("init_delay():\n");
return; return;
} }
/*@
@ assigns \nothing;
@*/
void sync_tick(void) void sync_tick(void)
{ {
dkprintf("sync_tick():\n"); dkprintf("sync_tick():\n");

View File

@ -271,6 +271,17 @@ void fill_note(void *note, struct thread *thread, void *regs)
* should be zero. * should be zero.
*/ */
/*@
@ requires \valid(thread);
@ requires \valid(regs);
@ requires \valid(coretable);
@ requires \valid(chunks);
@ behavior success:
@ ensures \result == 0;
@ assigns coretable;
@ behavior failure:
@ ensures \result == -1;
@*/
int gencore(struct thread *thread, void *regs, int gencore(struct thread *thread, void *regs,
struct coretable **coretable, int *chunks) struct coretable **coretable, int *chunks)
{ {
@ -510,6 +521,10 @@ int gencore(struct thread *thread, void *regs,
* \param coretable An array of core chunks. * \param coretable An array of core chunks.
*/ */
/*@
@ requires \valid(coretable);
@ assigns \nothing;
@*/
void freecore(struct coretable **coretable) void freecore(struct coretable **coretable)
{ {
struct coretable *ct = *coretable; struct coretable *ct = *coretable;

View File

@ -38,6 +38,11 @@ void init_processors_local(int max_id)
kprintf("locals = %p\n", locals); kprintf("locals = %p\n", locals);
} }
/*@
@ requires \valid(id);
@ ensures \result == locals + (LOCALS_SPAN * id);
@ assigns \nothing;
@*/
struct x86_cpu_local_variables *get_x86_cpu_local_variable(int id) struct x86_cpu_local_variables *get_x86_cpu_local_variable(int id)
{ {
return (struct x86_cpu_local_variables *) return (struct x86_cpu_local_variables *)
@ -98,6 +103,10 @@ void init_boot_processor_local(void)
} }
/** IHK **/ /** IHK **/
/*@
@ ensures \result == %gs;
@ assigns \nothing;
*/
int ihk_mc_get_processor_id(void) int ihk_mc_get_processor_id(void)
{ {
int id; int id;
@ -107,6 +116,10 @@ int ihk_mc_get_processor_id(void)
return id; return id;
} }
/*@
@ ensures \result == (locals + (LOCALS_SPAN * %gs))->apic_id;
@ assigns \nothing;
*/
int ihk_mc_get_hardware_processor_id(void) int ihk_mc_get_hardware_processor_id(void)
{ {
struct x86_cpu_local_variables *v = get_x86_this_cpu_local(); struct x86_cpu_local_variables *v = get_x86_this_cpu_local();