Ignore:
Timestamp:
Jun 23, 2017, 1:31:23 PM (5 years ago)
Author:
max@…
Message:

Start implementing TLS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/hal_lapic.c

    r45 r46  
    3737vaddr_t lapic_va __in_kdata = 0;
    3838
    39 void lapic_write(uint32_t reg, uint32_t val)
     39void hal_lapic_write(uint32_t reg, uint32_t val)
    4040{
    4141        *((volatile uint32_t *)(lapic_va + reg)) = val;
    4242}
    4343
    44 uint32_t lapic_read(uint32_t reg)
     44uint32_t hal_lapic_read(uint32_t reg)
    4545{
    4646        return *((volatile uint32_t *)(lapic_va + reg));
    4747}
    4848
    49 void hal_init_lapic()
     49uint32_t hal_lapic_gid()
    5050{
    51         uint32_t id;
     51        return hal_lapic_read(LAPIC_ID) >> LAPIC_ID_SHIFT;
     52}
    5253
     54void hal_lapic_init()
     55{
    5356        lapic_va = hal_gpt_bootstrap_valloc(1); // XXX: should be shared
    5457
    5558        hal_gpt_enter(lapic_va, lapic_pa);
    5659
    57         lapic_write(LAPIC_TPR, 0);
    58         lapic_write(LAPIC_SVR, LAPIC_SVR_ENABLE|LAPIC_SPURIOUS_VECTOR);
    59 
    60         id = lapic_read(LAPIC_ID) >> LAPIC_ID_SHIFT;
    61 
    62         x86_printf("-> LAPIC id: %d\n", id);
     60        hal_lapic_write(LAPIC_TPR, 0);
     61        hal_lapic_write(LAPIC_SVR, LAPIC_SVR_ENABLE|LAPIC_SPURIOUS_VECTOR);
    6362}
    6463
Note: See TracChangeset for help on using the changeset viewer.