finish exec4.12-13
This commit is contained in:
parent
339f843bae
commit
7660d524f4
@ -13,4 +13,4 @@ define add-symbol-file-auto
|
||||
end
|
||||
|
||||
add-symbol-file-auto ./build/kernel.img
|
||||
add-symbol-file-auto ./user/build/ramdisk/yield_spin.bin
|
||||
add-symbol-file-auto ./user/build/ramdisk/yield_multi_aff.bin
|
||||
|
@ -409,7 +409,15 @@ int sys_set_affinity(u64 thread_cap, s32 aff)
|
||||
* Lab4
|
||||
* Finish the sys_set_affinity
|
||||
*/
|
||||
return -1;
|
||||
if (aff < -1 || aff >= PLAT_CPU_NUM) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (thread != NULL && thread->thread_ctx != NULL) {
|
||||
thread->thread_ctx->affinity = aff;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sys_get_affinity(u64 thread_cap)
|
||||
@ -430,5 +438,8 @@ int sys_get_affinity(u64 thread_cap)
|
||||
* Lab4
|
||||
* Finish the sys_get_affinity
|
||||
*/
|
||||
if (thread != NULL && thread->thread_ctx != NULL) {
|
||||
return thread->thread_ctx->affinity;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -72,11 +72,15 @@ int rr_sched_enqueue(struct thread *thread)
|
||||
if (dest_core == NO_AFF) {
|
||||
dest_core = smp_get_cpu_id();
|
||||
}
|
||||
if (dest_core < 0 || dest_core >= PLAT_CPU_NUM) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 入队尾
|
||||
list_append(&thread->ready_queue_node, &rr_ready_queue[dest_core]);
|
||||
thread->thread_ctx->state = TS_READY;
|
||||
thread->thread_ctx->cpuid = dest_core;
|
||||
thread->thread_ctx->sc->budget = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user