; entry.asm -- process entry for the C hello world. ; ; The C runtime's boot.obj is designed for a ROM system: _c_int00 sets SP (the ; *system* stack), calls main, calls exit (which is `for(;;)`) and ends in ; `reti`. None of that fits a process made by the VT1200's create_process: ; the spin never yields, and `reti` returns from an interrupt that never ; happened (it pops a garbage PC -> illegal opcode). ; ; So we enter here instead: set the C program stack (STK = A14, FP = A13), call ; main, and `rets` back to the create_process trampoline -- the same return the ; xhello payload uses. SP (the OS's interrupt stack) is left alone. ; ; _cstack is 4096 bytes; the compiler grows the program stack upward from STK. .text .globl _start .globl _main _start: setf 32, 0, 1 movi _cstack, a14 move a14, a13 calla _main rets .bss _cstack, 32768, 16 ; 32768 bits = 4096 bytes .end