* Assembler part of libc now also exports "name@params_size" for every system function

because of stdcall convention. 
* Some fixes in calculating relocations procedure.

git-svn-id: svn://kolibrios.org@159 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Andrey Halyavin (halyavin) 2006-09-23 14:00:36 +00:00
parent 6127c7381d
commit 4d719e6bc5
28 changed files with 92 additions and 127 deletions

View File

@ -82,7 +82,7 @@ extern void stdcall _msys_sound_speaker_play(void* data);
extern void stdcall _msys_write_text(int x,int y,int color,char* text,int len);
extern void* stdcall _msys_start_thread(void (* func_ptr)(void),int stack_size,int* pid);
extern void stdcall _msys_window_redraw(int status);
extern void* stdcall malloc(int);
extern void stdcall free(void*);
extern void* stdcall realloc(void*,int);
extern void* malloc(int);
extern void free(void*);
extern void* realloc(void*,int);
#endif

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_set_background_size
_msys_set_background_size:
public_stdcall _msys_set_background_size,8
;arg1 - xsize
;arg2 - ysize
push ebx
@ -12,8 +12,7 @@ _msys_set_background_size:
int 0x40
pop ebx
ret 8
public _msys_write_background_mem
_msys_write_background_mem:
public_stdcall _msys_write_background_mem,8
;arg1 - pos
;arg2 - color
push ebx
@ -24,16 +23,14 @@ _msys_write_background_mem:
int 0x40
pop ebx
ret 8
public _msys_draw_background
_msys_draw_background:
public_stdcall _msys_draw_background,0
mov edx,ebx
mov eax,15
mov ebx,3
int 0x40
mov ebx,edx
ret
public _msys_set_background_draw_type
_msys_set_background_draw_type:
public_stdcall _msys_set_background_draw_type,4
;arg1 - type
mov edx,ebx
mov eax,15
@ -42,8 +39,7 @@ _msys_set_background_draw_type:
int 0x40
mov ebx,edx
ret 4
public _msys_background_blockmove
_msys_background_blockmove:
public_stdcall _msys_background_blockmove,12
;arg1 - source
;arg2 - position in dest
;arg3 - size

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_make_button
_msys_make_button:
public_stdcall _msys_make_button,24
;arg1 - x
;arg2 - y
;arg3 - xsize
@ -22,8 +22,7 @@ _msys_make_button:
pop esi ebx
ret 24
public _msys_get_button_id
_msys_get_button_id:
public_stdcall _msys_get_button_id,0
mov eax,17
int 0x40
test al,al

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_get_system_clock
_msys_get_system_clock:
public_stdcall _msys_get_system_clock,0
mov eax,3
int 0x40
ret

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_get_date
_msys_get_date:
public_stdcall _msys_get_date,0
mov eax,29
int 0x40
ret

View File

@ -1,8 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_debug_out
_msys_debug_out:
public_stdcall _msys_debug_out,4
;arg1 - char to out
push ebx
mov ecx,[esp+8]

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_delay
_msys_delay:
public_stdcall _msys_delay,4
;arg1 - time
mov edx,ebx
mov eax,5

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_dga_get_resolution
_msys_dga_get_resolution:
public_stdcall _msys_dga_get_resolution,16
;arg1 - *xres
;arg2 - *yres
;arg3 - *bpp

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_draw_bar
_msys_draw_bar:
public_stdcall _msys_draw_bar,20
;arg1 - x
;arg2 - y
;arg3 - xsize

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_putimage
_msys_putimage:
public_stdcall _msys_putimage,20
;arg1 - x
;arg2 - y
;arg3 - xsize

View File

@ -1,8 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_draw_window
_msys_draw_window:
public_stdcall _msys_draw_window,36
;arg1 - xcoord
;arg2 - ycoord
;arg3 - xsize

View File

@ -1,19 +1,17 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_wait_for_event_infinite
_msys_wait_for_event_infinite:
public_stdcall _msys_wait_for_event_infinite,0
mov eax,10
int 0x40
ret
public _msys_check_for_event
_msys_check_for_event:
public_stdcall _msys_check_for_event,0
mov eax,11
int 0x40
ret
public _msys_wait_for_event
_msys_wait_for_event:
public_stdcall _msys_wait_for_event,4
;arg1 - time
mov edx,ebx
mov eax,23
@ -22,8 +20,7 @@ _msys_wait_for_event:
mov ebx,edx
ret 4
public _msys_set_wanted_events
_msys_set_wanted_events:
public_stdcall _msys_set_wanted_events,4
;arg1 - flags
mov edx,ebx
mov eax,40

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_exit
_msys_exit:
public_stdcall _msys_exit,0
xor eax,eax
dec eax
int 0x40

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_read_file
_msys_read_file:
public_stdcall _msys_read_file,20
;arg1 - file name
;arg2 - file offset
;arg3 - size to read
@ -48,8 +48,7 @@ copy_file_name:
pop edi esi
ret
public _msys_write_file
_msys_write_file:
public_stdcall _msys_write_file,12
;arg1 - file name
;arg2 - size
;arg3 - data
@ -74,8 +73,7 @@ _msys_write_file:
pop ebp
ret 12
public _msys_run_program
_msys_run_program:
public_stdcall _msys_run_program,8
;arg1 - program name
;arg2 - parameters
push ebp

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_send_message
_msys_send_message:
public_stdcall _msys_send_message,12
;arg1 - pid
;arg2 - msg
;arg3 - size
@ -15,8 +15,7 @@ _msys_send_message:
pop esi ebx
ret 12
public _msys_define_receive_area
_msys_define_receive_area:
public_stdcall _msys_define_receive_area,8
;arg1 - area
;arg2 - size
push ebx

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_get_irq_owner
_msys_get_irq_owner:
public_stdcall _msys_get_irq_owner,4
;arg1 - irq
mov edx,ebx
mov eax,41
@ -10,8 +10,7 @@ _msys_get_irq_owner:
mov ebx,edx
ret 4
public _msys_get_data_read_by_irq
_msys_get_data_read_by_irq:
public_stdcall _msys_get_data_read_by_irq,12
;arg1 - irq
;arg2 - *size
;arg3 - data
@ -37,8 +36,7 @@ _msys_get_data_read_by_irq:
mov ebx,edx
ret
public _msys_send_data_to_device
_msys_send_data_to_device:
public_stdcall _msys_send_data_to_device,8
;arg1 - port
;arg2 - data
mov edx,ebx
@ -49,8 +47,7 @@ _msys_send_data_to_device:
mov ebx,edx
ret 8
public _msys_receive_data_from_device
_msys_receive_data_from_device:
public_stdcall _msys_receive_data_from_device,8
;arg1 - port
;arg2 - data
mov edx,ebx
@ -63,8 +60,7 @@ _msys_receive_data_from_device:
mov ebx,edx
ret 8
public _msys_program_irq
_msys_program_irq:
public_stdcall _msys_program_irq,8
;arg1 - intrtable
;arg2 - irq
mov edx,ebx
@ -75,8 +71,7 @@ _msys_program_irq:
mov ebx,edx
ret 8
public _msys_reserve_irq
_msys_reserve_irq:
public_stdcall _msys_reserve_irq,4
;arg1 - irq
mov edx,ebx
mov eax,45
@ -86,8 +81,7 @@ _msys_reserve_irq:
mov ebx,edx
ret 4
public _msys_free_irq
_msys_free_irq:
public_stdcall _msys_free_irq,4
;arg1 - irq
mov edx,ebx
mov eax,45
@ -98,8 +92,7 @@ _msys_free_irq:
mov ebx,edx
ret 4
public _msys_reserve_port_area
_msys_reserve_port_area:
public_stdcall _msys_reserve_port_area,8
;arg1 - start
;arg2 - end
push ebx
@ -111,8 +104,7 @@ _msys_reserve_port_area:
pop ebx
ret 8
public _msys_free_port_area
_msys_free_port_area:
public_stdcall _msys_free_port_area,8
;arg1 - start
;arg2 - end
push ebx

View File

@ -1,13 +1,12 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_get_key
_msys_get_key:
public_stdcall _msys_get_key,0
mov eax,2
int 0x40
ret
public _msys_set_keyboard_mode
_msys_set_keyboard_mode:
public_stdcall _msys_set_keyboard_mode,4
;arg1 - mode
mov edx,ebx
mov eax,66

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_line
_msys_line:
public_stdcall _msys_line,20
;arg1 - x1
;arg2 - y1
;arg3 - x2

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_midi_reset
_msys_midi_reset:
public_stdcall _msys_midi_reset,0
mov edx,ebx
mov eax,20
xor ebx,ebx
@ -10,8 +10,7 @@ _msys_midi_reset:
mov ebx,edx
ret
public _msys_midi_send
_msys_midi_send:
public_stdcall _msys_midi_send,4
;arg1 - data
mov edx,ebx
mov eax,20

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_get_pci_version
_msys_get_pci_version:
public_stdcall _msys_get_pci_version,0
mov edx,ebx
mov eax,62
xor ebx,ebx
@ -10,8 +10,7 @@ _msys_get_pci_version:
mov ebx,edx
ret
public _msys_get_last_pci_bus
_msys_get_last_pci_bus:
public_stdcall _msys_get_last_pci_bus,0
mov edx,ebx
mov eax,62
xor ebx,ebx
@ -21,8 +20,7 @@ _msys_get_last_pci_bus:
mov ebx,edx
ret
public _msys_get_pci_access_mechanism
_msys_get_pci_access_mechanism:
public_stdcall _msys_get_pci_access_mechanism,0
mov edx,ebx
mov eax,62
mov ebx,2
@ -31,8 +29,7 @@ _msys_get_pci_access_mechanism:
mov ebx,edx
ret
public _msys_pci_read_config_byte
_msys_pci_read_config_byte:
public_stdcall _msys_pci_read_config_byte,16
;arg1 - bus
;arg2 - dev
;arg3 - fn
@ -49,8 +46,7 @@ _msys_pci_read_config_byte:
mov ebx,edx
ret 16
public _msys_pci_read_config_word
_msys_pci_read_config_word:
public_stdcall _msys_pci_read_config_word,16
;arg1 - bus
;arg2 - dev
;arg3 - fn
@ -67,8 +63,7 @@ _msys_pci_read_config_word:
mov ebx,edx
ret 16
public _msys_pci_read_config_dword
_msys_pci_read_config_dword:
public_stdcall _msys_pci_read_config_dword,16
;arg1 - bus
;arg2 - dev
;arg3 - fn
@ -85,8 +80,7 @@ _msys_pci_read_config_dword:
mov ebx,edx
ret 16
public _msys_pci_write_config_byte
_msys_pci_write_config_byte:
public_stdcall _msys_pci_write_config_byte,20
;arg1 - bus
;arg2 - dev
;arg3 - fn
@ -105,8 +99,7 @@ _msys_pci_write_config_byte:
pop ebx
ret 20
public _msys_pci_write_config_word
_msys_pci_write_config_word:
public_stdcall _msys_pci_write_config_word,20
;arg1 - bus
;arg2 - dev
;arg3 - fn
@ -125,8 +118,7 @@ _msys_pci_write_config_word:
pop ebx
ret 20
public _msys_pci_write_config_dword
_msys_pci_write_config_dword:
public_stdcall _msys_pci_write_config_dword,20
;arg1 - bus
;arg2 - dev
;arg3 - fn

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_putpixel
_msys_putpixel:
public_stdcall _msys_putpixel,12
;arg1 - x
;arg2 - y
;arg3 - color

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_get_process_table
_msys_get_process_table:
public_stdcall _msys_get_process_table,8
;arg1 - pointer to information
;arg2 - pid
mov edx,ebx

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_get_screen_size
_msys_get_screen_size:
public_stdcall _msys_get_screen_size,8
;arg1 - x
;arg2 - y
mov eax,14

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_sound_load_block
_msys_sound_load_block:
public_stdcall _msys_sound_load_block,4
;arg1 - blockptr
mov edx,ebx
mov eax,55
@ -11,8 +11,7 @@ _msys_sound_load_block:
mov ebx,edx
ret 4
public _msys_sound_play_block
_msys_sound_play_block:
public_stdcall _msys_sound_play_block,0
mov edx,ebx
mov eax,55
xor ebx,ebx
@ -21,8 +20,7 @@ _msys_sound_play_block:
mov ebx,edx
ret
public _msys_sound_set_channels
_msys_sound_set_channels:
public_stdcall _msys_sound_set_channels,4
;arg1 - channels
push ebx
mov eax,55
@ -33,8 +31,7 @@ _msys_sound_set_channels:
pop ebx
ret 4
public _msys_sound_set_data_size
_msys_sound_set_data_size:
public_stdcall _msys_sound_set_data_size,4
;arg1 - data size
push ebx
mov eax,55
@ -46,8 +43,7 @@ _msys_sound_set_data_size:
pop ebx
ret 4
public _msys_sound_set_frequency
_msys_sound_set_frequency:
public_stdcall _msys_sound_set_frequency,4
;arg1 - frequency
push ebx
mov eax,55
@ -58,8 +54,7 @@ _msys_sound_set_frequency:
pop ebx
ret 4
public _msys_sound_speaker_play
_msys_sound_speaker_play:
public_stdcall _msys_sound_speaker_play,4
;arg1 - data
mov edx,ebx
mov eax,55

View File

@ -1,8 +1,8 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
extrn malloc
public _msys_start_thread
_msys_start_thread:
public_stdcall _msys_start_thread,12
;arg1 - proc
;arg2 - stacksize
;arg3 - pid

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_window_redraw
_msys_window_redraw:
public_stdcall _msys_window_redraw,4
;arg1 - status
mov edx,ebx
mov eax,12

View File

@ -1,7 +1,7 @@
format ELF
include "public_stdcall.inc"
section '.text' executable
public _msys_write_text
_msys_write_text:
public_stdcall _msys_write_text,20
;arg1 - x
;arg2 - y
;arg3 - color

View File

@ -96,11 +96,12 @@ void build_reloc(me_info* me)
Elf32_Sym* esym = ((Elf32_Sym *)symtab_section->data)+sym;
int sect=esym->st_shndx;
ss=findsection(me,sect);
if (ss==0) continue;
if (ss==0)
ss=me->bss_sections;
if (rel->r_offset>s->data_size)
continue;
if (type==R_386_PC32)
*(int*)(rel->r_offset+s->data)+=ss->sh_addr+esym->st_value-rel->r_offset-s->sh_addr;
*(int*)(rel->r_offset+s->data)=ss->sh_addr+esym->st_value-rel->r_offset-s->sh_addr-4;
else if (type==R_386_32)
*(int*)(rel->r_offset+s->data)+=ss->sh_addr+esym->st_value;
}