CS计算机代考程序代写 /*

/*
* acx_asm.S
*
* Created: Outline created by efb 2014, updated 2017
*
* Authors:
*
*/

#define __SFR_OFFSET 0
#include
#include “acx.h”

.extern pCanary

.section .text
.global x_yield
x_yield:

;————————————————————————
; Schedule next thread — must use caller save registers below here
; because we can reach this without saving regs
; if reached from x_new() function
;————————————————————————-
.global x_schedule
x_schedule:
// determine READY status of each thread

;————————————————
; Loop through all threads to test for READY
;————————————————

;———————————————————-
; SLEEP HERE: Here’s where we sleep (no threads are READY)
; but for now we’ll jump back to schedule loop again
;———————————————————-
; add sleep instructions here…(no need to implement)

rjmp x_schedule

;—————————————————
; Restore context of next READY thread
;—————————————————
restore:

ret

//———————————————————————————————-
// Function: bit2mask8
//
// Description: Returns a bit mask corresponding to thread ID parameter.
//
// Input params: uint8_t id — must by integer between 0 and 7
// Returns: mask – a bit mask having a single bit set corresponding to input ID
// (interpreted as bit number)
//———————————————————————————————–
.global bit2mask8
bit2mask8:

ret
//
// Put table of mask values in .text section and use LPM instruction to access…
//
.text
bitmask8_table:
.byte 0x01
.byte 0x02
.byte 0x04
.byte 0x08
.byte 0x10
.byte 0x20
.byte 0x40
.byte 0x80