Changeset 94


Ignore:
Timestamp:
Jun 29, 2017, 1:27:43 PM (7 years ago)
Author:
max@…
Message:

remove lw_unc, add a few ops, and update a few things

Location:
trunk/hal/x86_64/core
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_cpu.S

    r91 r94  
    5656        ret
    5757
     58ASM_ENTRY(rdtsc)
     59        xorq    %rax,%rax
     60        rdtsc
     61        shlq    $32,%rdx
     62        orq     %rdx,%rax
     63        ret
     64
    5865ASM_ENTRY(in8)
    5966        movq    %rdi,%rdx
     
    8895        ret
    8996
     97/* -------------------------------------------------------------------------- */
     98
     99ASM_ENTRY(atomic_cas_32)
     100        movl    %esi,%eax
     101        lock
     102        cmpxchgl %edx,(%rdi)
     103        /* %eax now contains the old value */
     104        ret
     105
     106ASM_ENTRY(atomic_add_32)
     107        lock
     108        addl    %esi,(%rdi)
     109        ret
     110
  • trunk/hal/x86_64/core/hal_drivers.c

    r77 r94  
    2727void hal_drivers_txt_init(chdev_t *dev)
    2828{
    29         x86_panic((char *)__func__);
     29        soclib_tty_init(dev);
    3030}
    3131
  • trunk/hal/x86_64/core/hal_init.c

    r86 r94  
    178178
    179179        x86_printf("-> mytest = %z\n", mytest);
    180 
     180        void *hoho = &init_x86_64;
    181181        xptr_t myptr = XPTR(0, &mytest);
    182         hal_remote_sb(myptr, 1);
    183         x86_printf("-> mytest = %z\n", hal_remote_lb(myptr));
     182
     183        hal_remote_atomic_add(myptr, 3);
     184        x86_printf("-> mytest = %z\n", mytest);
     185
     186        hal_remote_spt(myptr, hoho);
     187        x86_printf("-> mytest = %Z\n", hal_remote_lpt(myptr));
     188
    184189
    185190        init_bootinfo(&btinfo);
  • trunk/hal/x86_64/core/hal_internal.h

    r91 r94  
    3535void sti();
    3636void cli();
     37uint64_t rdtsc();
    3738uint8_t in8(uint32_t port);
    3839void out8(uint32_t port, uint8_t val);
    3940uint64_t rdmsr(uint32_t);
    4041void wrmsr(uint32_t, uint64_t);
     42
     43uint32_t atomic_cas_32(volatile uint32_t *ptr, uint32_t exp, uint32_t new);
     44void atomic_add_32(volatile uint32_t *ptr, int32_t incr);
    4145
    4246/* hal_gpt.c */
     
    5559/* x86_printf.c */
    5660void x86_panic(char *msg);
     61void x86_putc(char c);
    5762void x86_printf(char *s, ...);
    5863
  • trunk/hal/x86_64/core/hal_remote.c

    r92 r94  
    7070}
    7171
    72 uint32_t hal_remote_lw_unc( xptr_t  xp )
    73 {
    74         x86_panic((char *)__func__);
    75         return 0;
    76 }
    77 
    7872bool_t hal_remote_atomic_cas( xptr_t    xp,
    7973                              uint32_t  old,
    8074                              uint32_t  new )
    8175{
    82         x86_panic((char *)__func__);
    83         return 0;
     76        return atomic_cas_32((volatile uint32_t *)xp, old, new);
    8477}
    8578
    8679uint32_t hal_remote_atomic_add( xptr_t   xp,
    87                                 uint32_t incr )
     80                                uint32_t incr ) // XXX define as signed
    8881{
    89         x86_panic((char *)__func__);
    90         return 0;
     82        atomic_add_32((volatile uint32_t *)xp, incr);
    9183}
    9284
  • trunk/hal/x86_64/core/hal_special.c

    r82 r94  
    7575uint32_t hal_time_stamp()
    7676{
    77         x86_panic((char *)__func__);
    78         return 0;
     77        return (uint32_t)rdtsc(); // XXX will be fixed soon
    7978}
    8079
    8180struct thread_s * hal_get_current_thread()
    8281{
    83         x86_panic((char *)__func__);
    8482        return curcpu()->ci_thr;
    8583}
  • trunk/hal/x86_64/core/x86_printf.c

    r90 r94  
    7474}
    7575
    76 static void x86_putc(char c)
     76void x86_putc(char c)
    7777{
    7878        if (c == '\n') {
Note: See TracChangeset for help on using the changeset viewer.