Cčkový soubor struct.c:
Kód: Vybrat vše
#include <linux/sched.h>
#define offsetof(s, m) __builtin_offsetof (s, m)
typedef struct task_struct Ttask_struct;
int state_off = offsetof(Ttask_struct, state);
int mmu_pid_off = offsetof(Ttask_struct, mmu_pid);
int counter_off = offsetof(Ttask_struct, counter);
int priority_off = offsetof(Ttask_struct, priority);
int tstack_off = offsetof(Ttask_struct, tstack);
int timeout_off = offsetof(Ttask_struct, timeout);
Kód: Vybrat vše
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.6.0 #9615 (MINGW32)
;--------------------------------------------------------
.module struct
.optsdcc -mz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _timeout_off
.globl _tstack_off
.globl _priority_off
.globl _counter_off
.globl _mmu_pid_off
.globl _state_off
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _INITIALIZED
_state_off::
.ds 2
_mmu_pid_off::
.ds 2
_counter_off::
.ds 2
_priority_off::
.ds 2
_tstack_off::
.ds 2
_timeout_off::
.ds 2
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area _DABS (ABS)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _CODE
.area _CODE
.area _INITIALIZER
__xinit__state_off:
.dw #0x0000
__xinit__mmu_pid_off:
.dw #0x0001
__xinit__counter_off:
.dw #0x0002
__xinit__priority_off:
.dw #0x0003
__xinit__tstack_off:
.dw #0x0004
__xinit__timeout_off:
.dw #0x0048
.area _CABS (ABS)
Kód: Vybrat vše
state_off = 0x0000
mmu_pid_off = 0x0001
counter_off = 0x0002
priority_off = 0x0003
tstack_off = 0x0004
timeout_off = 0x0048
Díky Zmije za inspiraci.