User:Superleaf1995

From OSDev.wiki
Revision as of 20:02, 23 January 2022 by Superleaf1995 (talk | contribs)
Jump to navigation Jump to search

Hello I'm Superleaf1995, a C and Assembly coder that has build a lot of MS-DOS programs.

Userpages:

Send a happy face to COM1:

typedef int i;typedef void v;typedef char c;i z(){return inb(0x3F8+5)&32;}w(c a){while(!z()){}outb(0x3F8,a);}u(){w(':');w(')');}

390 Bits

/* follows MVS calling convention (used by gccmvs) */
void prepare_thread_task(struct thread* thread)
{
    /* R13 is used as a stack pointer, now we have to setup a few things up */
    thread->context.r15 = (unsigned int)thread->stack + stack_size;

    /* stack+76 should point to stack+180 (because this would be the next frame!) */
    *((uint32_t *)(&((uint8_t *)thread->stack)[76])) = (&((uint8_t *)thread->stack)[180]);
    *((uint32_t *)(&((uint8_t *)thread->stack)[8])) = (&((uint8_t *)thread->stack)[180]);

    /* Set backchain to 0 for stack unwinding */
    *((uint32_t *)(&((uint8_t *)thread->stack)[4])) = NULL;
    *((uint32_t *)(&((uint8_t *)thread->stack)[8])) = NULL;
    return;
}